diff --git a/src/fluka/app/mainFluDAG.cpp b/src/fluka/app/mainFluDAG.cpp index a011244088..fd0f5bfa34 100644 --- a/src/fluka/app/mainFluDAG.cpp +++ b/src/fluka/app/mainFluDAG.cpp @@ -13,6 +13,7 @@ #include "dagmcmetadata.hpp" #include "moab/ProgOptions.hpp" +#include #include #include #include // for timing the routine @@ -116,8 +117,30 @@ int main(int argc, char* argv[]) { fludag_write_ididx(vol_id); } else { // call fluka run - // flugg mode is flag = 1 - const int flag = 1; + + // check for the input file argument + // get it from the command line + 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); + } 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)); + if (chcmpt_.chinpf[0] == 0) { + // flabrt("FLUKAM","FLUDAG NO INPUT SPECIFIED"); + return 1; + } + std::cout << chcmpt_.chinpf << std::endl; + } + const int flag = 2; + std::cout << "running fluka" << std::endl; flukam(flag); } diff --git a/src/fluka/fluka_funcs.h b/src/fluka/fluka_funcs.h index 50492a2df6..b52a4e6a00 100644 --- a/src/fluka/fluka_funcs.h +++ b/src/fluka/fluka_funcs.h @@ -132,6 +132,24 @@ extern "C" { } mulbou_; } +// 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_; +} + // struct to hold particle state struct particle_state { moab::DagMC::RayHistory history;