Skip to content

Commit

Permalink
Fixed to reflect FLUKA-CERN
Browse files Browse the repository at this point in the history
  • Loading branch information
makeclean committed Nov 2, 2020
1 parent f02333f commit 62c61b0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions cmake/FindFluka.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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
)
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}")

Expand Down
40 changes: 20 additions & 20 deletions src/fluka/app/mainFluDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "DagMC.hpp"
#include "dagmcmetadata.hpp"
#include "moab/ProgOptions.hpp"

#include <cstring>
#include <fstream>
Expand Down Expand Up @@ -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<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
// we assume that its a FLUKA run
if (dagmc_file.empty()) {
flukarun = true;
} else if (argc > 2) {
std::cout << "run as main_fludag <facet_file> 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);
Expand All @@ -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
Expand All @@ -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";
Expand Down

0 comments on commit 62c61b0

Please sign in to comment.