diff --git a/cmake/FindFluka.cmake b/cmake/FindFluka.cmake index 2b28f5a60f..532530ec25 100644 --- a/cmake/FindFluka.cmake +++ b/cmake/FindFluka.cmake @@ -1,6 +1,6 @@ find_path(FLUKA_LIBRARIES - NAMES libflukahp.a - HINTS ${FLUKA_DIR} + NAMES libfluka.a + HINTS ${FLUKA_DIR} ${FLUKA_DIR}/lib PATHS ENV FLUKA_DIR NO_DEFAULT_PATH ) @@ -8,7 +8,7 @@ if (FLUKA_LIBRARIES) get_filename_component(FLUKA_LIBRARIES ${FLUKA_LIBRARIES} ABSOLUTE) endif () -set(FLUKA_LIBRARIES ${FLUKA_LIBRARIES}/libflukahp.a gfortran) +set(FLUKA_LIBRARIES ${FLUKA_LIBRARIES}/libfluka.a gfortran) message(STATUS "FLUKA_LIBRARIES: ${FLUKA_LIBRARIES}") diff --git a/doc/CHANGELOG.rst b/doc/CHANGELOG.rst index dec48de598..092576e447 100644 --- a/doc/CHANGELOG.rst +++ b/doc/CHANGELOG.rst @@ -10,7 +10,6 @@ Next version **Changed:** * Update hdf5 to v1.14.3 from v1.10.4 (#931 #933) - * Ensure implicit complement handle is placed at the back of DAGMC volume indices (#935) * Update MOAB to 5.5.1 from 5.3.0 (#939 #940) * Update README regarding OpenMC (#938) * Simplify Housekeeping Process for DAGMC (#943) @@ -19,6 +18,11 @@ Next version * Streamline dependencies of docker CI images (#951 #952) * Update github actions to newer versions as necessary (#958) +**Fixed:** + + * Ensure implicit complement handle is placed at the back of DAGMC volume indices (#935) + * Fixed to reflect FLUKA-CERN (#677) + v3.2.3 ==================== diff --git a/doc/install/fludag.rst b/doc/install/fludag.rst index 4fcced0bfd..d5d8cd1b64 100644 --- a/doc/install/fludag.rst +++ b/doc/install/fludag.rst @@ -10,13 +10,15 @@ Install FLUKA ~~~~~~~~~~~~~ FluDAG uses FLUKA_ from CERN/INFN. In order to download FLUKA you need to become -a registered user, which you can do at the `FLUKA registration -`_ page. +a registered user, which you can do at the `FLUKA-INFN registration +`_ page for FLUKA-INFN and `FLUKA-CERN registration page `_. Save your user ID and password for future FLUKA updates. We recommend an x64 -worfklow and thus you should download the 64-bit executable. The name of the -downloaded tarball is of the form ``fluka20xx.xx-linux-gfor64bitAA.tar.gz``. -Refer to the `installation instructions `_ when building FLUKA. +worfklow and thus you should download the 64-bit executable. For FLUKA-INFN, the +name of the downloaded tarball is of the form ``fluka20xx.xx-linux-gfor64bitAA.tar.gz``. +Refer to the `installation instructions `_ when building FLUKA. + +For FLUKA-CERN, x64 is the only option and refer to `installation instructions `_ Take care to follow the FLUKA site instructions when setting the ``$FLUPRO`` and ``$FLUFOR`` environment variables. @@ -24,7 +26,8 @@ Take care to follow the FLUKA site instructions when setting the ``$FLUPRO`` and .. include:: configure_dag-code_header.txt The following CMake command will build FluDAG. Note that ``$FLUPRO`` should have -previously been defined as part of the FLUKA install. +previously been defined as part of the FLUKA install. FLUPRO can also be set explictly +to the base path of FLUKA, for example ``/home/user/fluka-cern/fluka4.01`` :: $ cmake ../src -DMOAB_DIR=$HOME/dagmc_bld/MOAB \ @@ -60,5 +63,7 @@ like this: .. include:: test_dagmc.txt .. _FLUKA: http://www.fluka.org/fluka.php -.. _FLUKA_register: https://www.fluka.org/fluka.php?id=secured_intro -.. _FLUKA_install: http://www.fluka.org/fluka.php?id=ins_run +.. _FLUKA_infn_register: https://www.fluka.org/fluka.php?id=secured_intro +.. _FLUKA_cern_register: https://fluka.cern/home +.. _FLUKA_infn_install: http://www.fluka.org/fluka.php?id=ins_run +.. _FLUKA_cern_install: https://fluka.cern/documentation/installation diff --git a/doc/usersguide/codes/fludag.rst b/doc/usersguide/codes/fludag.rst index a74b8ce445..f6c82dd82e 100644 --- a/doc/usersguide/codes/fludag.rst +++ b/doc/usersguide/codes/fludag.rst @@ -146,7 +146,7 @@ material assignment data from the CAD geometry we must first subsequently-defined geometry file, the user must produce the ``mat.inp`` file. :: - $ /path/to/fludag/executable/mainfludag geom.h5m + $ /path/to/fludag/executable/mainfludag --dagmc geom.h5m This will load the named .h5m file and produce the material assignment information. This information should then be pasted into the FLUKA input file, @@ -165,5 +165,5 @@ geometry file to a fixed file called ``dagmc.h5m``. The problem can then be run with :: - $ $FLUPRO/flutil/rfluka -e \ + $ rfluka -e \ ++{standard fluka options}++ diff --git a/doc/usersguide/uw2.rst b/doc/usersguide/uw2.rst index a3bfea101d..b9df8d5e14 100644 --- a/doc/usersguide/uw2.rst +++ b/doc/usersguide/uw2.rst @@ -147,7 +147,7 @@ run the ``mainfludag`` executable to produce the ``mat.inp`` file which contains all the detailed material assignments and compound descriptions. :: - $ mainfludag geom.h5m + $ mainfludag --dagmc geom.h5m The user should then paste the contents of ``mat.inp`` into the main FLUKA input deck. Now the user must make a symbolic link to the geometry file named diff --git a/news/PR-0677.rst b/news/PR-0677.rst new file mode 100644 index 0000000000..35e43ba339 --- /dev/null +++ b/news/PR-0677.rst @@ -0,0 +1,16 @@ +**Added:** +Fixes to allow compilation against FLUKA-CERN + +**Changed:** + +- Fixes to allow compilation against FLUKA-CERN + +**Deprecated:** None + +**Removed:** None + +**Fixed:** + +Now allows compilation against FLUKA-CERN + +**Security:** None diff --git a/src/fluka/app/mainFluDAG.cpp b/src/fluka/app/mainFluDAG.cpp index f65d2c55f1..0cc99798ce 100644 --- a/src/fluka/app/mainFluDAG.cpp +++ b/src/fluka/app/mainFluDAG.cpp @@ -6,15 +6,18 @@ * \brief Functions called by fluka * \note Unittested */ -//--------------------------ß-------------------------// +//----------------------------------------------------// #include // for timing the routine +#include #include #include +//---------------------------------------------------------------------------// #include "DagMC.hpp" #include "dagmcmetadata.hpp" #include "fluka_funcs.h" +#include "moab/ProgOptions.hpp" #define flukam flukam_ @@ -39,37 +42,40 @@ int main(int argc, char* argv[]) { // Default h5m filename is for fluka runs std::string infile = "dagmc.h5m"; - - if (argc == 1) { // then its a fluka run - // fluka creates a run dir one lvl higher - infile = "../" + infile; + std::string dagmc_file = ""; + + // 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("dagmc", "Path to h5m DAGMC file to proccess", + &dagmc_file); + po.addOptionalArgs(0, "", ""); + po.parseCommandLine(argc, argv); + + // if no string has been provided, dagmc command not applied + // we assume that its a FLUKA run + if (dagmc_file.empty()) { flukarun = true; - } else if (argc > 2) { - std::cout << "run as main_fludag to produce" - << " material assignments" << std::endl; - std::cout << "too many arguments provided" << std::endl; - exit(1); - } else { // its a pre process run - infile = argv[1]; // must be the 2nd argument + // fluka creates a run dir one lvl higher than cwd + infile = "../" + infile; + } else { + // dagmc command has been set do the its a process run + infile = dagmc_file; } + // test to see if the file exists std::ifstream h5mfile(infile.c_str()); // filestream for mesh geom if (!h5mfile.good()) { std::cout << "h5m file does not exist" << std::endl; exit(1); } - int max_pbl = 1; - // get the current time time(&time_before); /* get current time; same as: timer = time(NULL) */ // DAG call to load the file - std::cout << "Loading the faceted geometry file " << infile << "..." - << std::endl; 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); @@ -79,9 +85,7 @@ int main(int argc, char* argv[]) { 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 - + time_before = time_after; // reset time to now for the next call std::cout << "Time to load the h5m file = " << seconds << " seconds" << std::endl; @@ -92,11 +96,12 @@ int main(int argc, char* argv[]) { error = DAG->init_OBBTree(); } else { // otherwise this is a preprocess run - // no need to build the tree + // no need to build the tree - its faster error = DAG->setup_impl_compl(); error = DAG->setup_indices(); } + // check if (error != moab::MB_SUCCESS) { std::cerr << "DAGMC failed to initialize geometry and create OBB tree" << std::endl; @@ -104,9 +109,9 @@ int main(int argc, char* argv[]) { } time(&time_after); - seconds = difftime(time_after, time_before); std::cout << "Time to initialise the geometry" << seconds << std::endl; + // if fluka preprocess run then create mat file to paste into input deck if (!flukarun) { std::string lcad = "mat.inp"; @@ -119,8 +124,29 @@ 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; + } + } + 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 ab69043e0a..d43c713f63 100644 --- a/src/fluka/fluka_funcs.h +++ b/src/fluka/fluka_funcs.h @@ -133,6 +133,24 @@ extern struct { } 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;