Skip to content

Commit

Permalink
Merge pull request #21 from ahnaf-tahmid-chowdhury/makeclean-fluka-cern
Browse files Browse the repository at this point in the history
Update changelog file and run clang-format
  • Loading branch information
makeclean authored Jul 12, 2024
2 parents 89923cf + 7c751aa commit 7213763
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 31 deletions.
1 change: 1 addition & 0 deletions doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Next version
* Allow Double Down v1.1.0 Installation in Dockerfile (#929 #944 #949)
* Inline documentation improvements (#945)
* Streamline dependencies of docker CI images (#951 #952)
* Fixed to reflect FLUKA-CERN (#677)

v3.2.3
====================
Expand Down
42 changes: 24 additions & 18 deletions src/fluka/app/mainFluDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
*/
//----------------------------------------------------//
#include <time.h> // for timing the routine
#include <fstream>

#include <cstdlib>
#include <cstring>
#include <fstream>

//---------------------------------------------------------------------------//
#include "fluka_funcs.h"
#include "DagMC.hpp"
#include "dagmcmetadata.hpp"
#include "fluka_funcs.h"
#include "moab/ProgOptions.hpp"

#define flukam flukam_
Expand Down Expand Up @@ -43,10 +44,12 @@ int main(int argc, char* argv[]) {
std::string infile = "dagmc.h5m";
std::string dagmc_file = "";

// form the inputs and determine if this is a true calculation or a preprocess run
// form the inputs and determine if this is a true calculation or a preprocess
// run
ProgOptions po("mainfludag: a DAGMC enabled version of FLUKA-CERN");
po.addOpt<std::string>("dagmc", "Path to h5m DAGMC file to proccess", &dagmc_file);
po.addOptionalArgs<std::string>(0,"","");
po.addOpt<std::string>("dagmc", "Path to h5m DAGMC file to proccess",
&dagmc_file);
po.addOptionalArgs<std::string>(0, "", "");
po.parseCommandLine(argc, argv);

// if no string has been provided, dagmc command not applied
Expand All @@ -68,20 +71,23 @@ int main(int argc, char* argv[]) {
}

// get the current time
time(&time_before); /* get current time; same as: timer = time(NULL) */
time(&time_before); /* get current time; same as: timer = time(NULL) */

// DAG call to load the file
error = DAG->load_file(infile.c_str()); // load the dag file takeing the faceting from h5m
error = DAG->load_file(
infile.c_str()); // load the dag file takeing the faceting from h5m
if (error != moab::MB_SUCCESS) {
std::cerr << "DAGMC failed to read input file: " << infile << std::endl;
exit(EXIT_FAILURE);
}

time(&time_after);

double seconds = difftime(time_after, time_before); //get the time in seconds to load file
time_before = time_after; // reset time to now for the next call
std::cout << "Time to load the h5m file = " << seconds << " seconds" << std::endl;
double seconds = difftime(
time_after, time_before); // get the time in seconds to load file
time_before = time_after; // reset time to now for the next call
std::cout << "Time to load the h5m file = " << seconds << " seconds"
<< std::endl;

// DAG call to initialize geometry
// if more than 1 argument provided
Expand Down Expand Up @@ -118,25 +124,25 @@ int main(int argc, char* argv[]) {
fludag_write_ididx(vol_id);
} else {
// call fluka run

// check for the input file argument
// get it from the command line
if(argc >= 1) {
if (argc >= 1) {
// convert to std::string
std::string chinpf_s(argv[1]);
char chinpf[256] = "";
memset(chinpf,' ',256);
std::copy(chinpf_s.begin(),chinpf_s.end(),chinpf);
strcpy(chcmpt_.chinpf,chinpf);
memset(chinpf, ' ', 256);
std::copy(chinpf_s.begin(), chinpf_s.end(), chinpf);
strcpy(chcmpt_.chinpf, chinpf);
} else {
// get it from the environment
std::cout << "from env" << std::endl;
char* env = std::getenv("INPF");
std::cout << env << std::endl;
strncpy(env,chcmpt_.chinpf,sizeof(env));
strncpy(env, chcmpt_.chinpf, sizeof(env));
if (chcmpt_.chinpf[0] == 0) {
// flabrt("FLUKAM","FLUDAG NO INPUT SPECIFIED");
return 1;
// flabrt("FLUKAM","FLUDAG NO INPUT SPECIFIED");
return 1;
}
}
const int flag = 2;
Expand Down
26 changes: 13 additions & 13 deletions src/fluka/fluka_funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,19 @@ extern struct {
// the CHCMPT struct for
// setting the input name
extern "C" {
extern struct {
char comptr[50];
char inpfil[200];
char pwddir[200];
char hlfdir[200];
char homdir[200];
char hostnm[200];
char usrflk[200];
char grpflk[200];
char inpnam[200];
char chinpf[256];
char hfpath[200];
} chcmpt_;
extern struct {
char comptr[50];
char inpfil[200];
char pwddir[200];
char hlfdir[200];
char homdir[200];
char hostnm[200];
char usrflk[200];
char grpflk[200];
char inpnam[200];
char chinpf[256];
char hfpath[200];
} chcmpt_;
}

// struct to hold particle state
Expand Down

0 comments on commit 7213763

Please sign in to comment.