From 62c61b02f41640b744286c89e8143f674fe21b65 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Fri, 15 May 2020 15:14:02 +0100 Subject: [PATCH] Fixed to reflect FLUKA-CERN --- cmake/FindFluka.cmake | 6 +++--- src/fluka/app/mainFluDAG.cpp | 40 ++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 23 deletions(-) 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/src/fluka/app/mainFluDAG.cpp b/src/fluka/app/mainFluDAG.cpp index 61ab95c05d..a011244088 100644 --- a/src/fluka/app/mainFluDAG.cpp +++ b/src/fluka/app/mainFluDAG.cpp @@ -11,6 +11,7 @@ #include "DagMC.hpp" #include "dagmcmetadata.hpp" +#include "moab/ProgOptions.hpp" #include #include @@ -39,37 +40,37 @@ int main(int argc, char* argv[]) { // Default h5m filename is for fluka runs std::string infile = "dagmc.h5m"; + std::string dagmc_file = ""; - if (argc == 1) { // then its a fluka run - // fluka creates a run dir one lvl higher - infile = "../" + infile; + // 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); @@ -78,9 +79,7 @@ int main(int argc, char* argv[]) { 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; // DAG call to initialize geometry @@ -90,20 +89,21 @@ 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; exit(EXIT_FAILURE); } 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";