From 2bf5f3180d857fd7de47f016927bbab5e8bba6bc Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:29:02 +0600 Subject: [PATCH 01/32] find geant4 manual mode --- cmake/FindGeant4.cmake | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/cmake/FindGeant4.cmake b/cmake/FindGeant4.cmake index b62365fbea..36c47b9ba8 100644 --- a/cmake/FindGeant4.cmake +++ b/cmake/FindGeant4.cmake @@ -1,25 +1,31 @@ # Find Geant4 cmake config file set(Geant4_SEARCH_DIRS) -# Is this line necessary? -set(PACKAGE_FIND_VERSION ${Geant4_FIND_VERSION}) +set(Geant4_FIND_VERSION ${Geant4_FIND_VERSION}) file(GLOB Geant4_SEARCH_DIRS "${GEANT4_DIR}/lib*/Geant4-*") string(REPLACE "\n" ";" Geant4_SEARCH_DIRS ${Geant4_SEARCH_DIRS}) -find_path(Geant4_CMAKE_CONFIG_VERSION - NAMES Geant4ConfigVersion.cmake - PATHS ${Geant4_SEARCH_DIRS} - NO_DEFAULT_PATH - ) +# Extract the version number from the first directory in Geant4_SEARCH_DIRS +if(Geant4_SEARCH_DIRS) + # Extract the version number from the directory name + list(GET Geant4_SEARCH_DIRS 0 Geant4_LIB_DIR) + file(RELATIVE_PATH Geant4_VERSION ${GEANT4_DIR} ${Geant4_LIB_DIR}) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" Geant4_VERSION ${Geant4_VERSION}) -if (Geant4_CMAKE_CONFIG_VERSION) - set(Geant4_CMAKE_CONFIG_VERSION ${Geant4_CMAKE_CONFIG_VERSION}/Geant4ConfigVersion.cmake) - include(${Geant4_CMAKE_CONFIG_VERSION}) - set(Geant4_VERSION ${PACKAGE_VERSION}) - set(Geant4_VERSION_COMPATIBLE ${PACKAGE_VERSION_COMPATIBLE}) - set(Geant4_VERSION_EXACT ${PACKAGE_VERSION_EXACT}) -else () - message(FATAL_ERROR "Could not find Geant4") -endif () + if(Geant4_VERSION) + message("Found Geant4 version ${Geant4_VERSION}") + + # Compare the versions + if(Geant4_FIND_VERSION VERSION_GREATER Geant4_VERSION) + set(Geant4_VERSION_COMPATIBLE false) + else() + set(Geant4_VERSION_COMPATIBLE true) + endif() + else() + message(FATAL_ERROR "Failed to extract Geant4 version from directory name") + endif() +else() + message(FATAL_ERROR "No Geant4 installation found") +endif() find_path(Geant4_CMAKE_CONFIG NAMES Geant4Config.cmake @@ -58,8 +64,8 @@ include(${Geant4_USE_FILE}) set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS_SAVE}) message(STATUS "Geant4 version: ${Geant4_VERSION}") -message(STATUS "Geant4 version required: ${PACKAGE_FIND_VERSION}") -message(STATUS "Geant4 version compatible: ${PACKAGE_VERSION_COMPATIBLE}") +message(STATUS "Geant4 version required: ${Geant4_FIND_VERSION}") +message(STATUS "Geant4 version compatible: ${Geant4_VERSION_COMPATIBLE}") message(STATUS "Geant4 version exact: ${PACKAGE_VERSION_EXACT}") message(STATUS "Geant4_INCLUDE_DIRS: ${Geant4_INCLUDE_DIRS}") message(STATUS "Geant4_LIBRARIES_SHARED: ${Geant4_LIBRARIES_SHARED}") From 2b1fc2369c8bb48ef1864c13094aa2e94bc9a99c Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:33:04 +0600 Subject: [PATCH 02/32] remove moab condition --- src/dagmc/DagMC.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index c4e0494e41..c086c44027 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -811,15 +811,6 @@ ErrorCode DagMC::point_in_volume_slow(EntityHandle volume, const double xyz[3], return rval; } -#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 -// find a which volume contains the current point -ErrorCode DagMC::find_volume(const double xyz[3], EntityHandle& volume, - const double* uvw) { - ErrorCode rval = ray_tracer->find_volume(xyz, volume, uvw); - return rval; -} -#endif - // detemine distance to nearest surface ErrorCode DagMC::closest_to_location(EntityHandle volume, const double coords[3], double& result, @@ -870,11 +861,11 @@ ErrorCode DagMC::next_vol(EntityHandle surface, EntityHandle old_volume, /* SECTION III: Indexing & Cross-referencing */ -EntityHandle DagMC::entity_by_id(int dimension, int id) const { +EntityHandle DagMC::entity_by_id(int dimension, int id) { return GTT->entity_by_id(dimension, id); } -int DagMC::id_by_index(int dimension, int index) const { +int DagMC::id_by_index(int dimension, int index) { EntityHandle h = entity_by_index(dimension, index); if (!h) return 0; @@ -883,7 +874,7 @@ int DagMC::id_by_index(int dimension, int index) const { return result; } -int DagMC::get_entity_id(EntityHandle this_ent) const { +int DagMC::get_entity_id(EntityHandle this_ent) { return GTT->global_id(this_ent); } From 0c4a183dc184cee3625ff23dc85c225234b0ac49 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:34:02 +0600 Subject: [PATCH 03/32] remove moab version condition --- src/dagmc/DagMC.hpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/dagmc/DagMC.hpp b/src/dagmc/DagMC.hpp index c4f28f2bcd..5ecce3c584 100644 --- a/src/dagmc/DagMC.hpp +++ b/src/dagmc/DagMC.hpp @@ -225,10 +225,6 @@ class DagMC { ErrorCode point_in_volume_slow(const EntityHandle volume, const double xyz[3], int& result); -#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 - ErrorCode find_volume(const double xyz[3], EntityHandle& volume, - const double* uvw = NULL); -#endif ErrorCode test_volume_boundary(const EntityHandle volume, const EntityHandle surface, @@ -263,16 +259,16 @@ class DagMC { */ /** map from dimension & global ID to EntityHandle */ - EntityHandle entity_by_id(int dimension, int id) const; + EntityHandle entity_by_id(int dimension, int id); /** map from dimension & base-1 ordinal index to EntityHandle */ - EntityHandle entity_by_index(int dimension, int index) const; + EntityHandle entity_by_index(int dimension, int index); /** map from dimension & base-1 ordinal index to global ID */ - int id_by_index(int dimension, int index) const; + int id_by_index(int dimension, int index); /** PPHW: Missing dim & global ID ==> base-1 ordinal index */ /** map from EntityHandle to base-1 ordinal index */ - int index_by_handle(EntityHandle handle) const; + int index_by_handle(EntityHandle handle); /** map from EntityHandle to global ID */ - int get_entity_id(EntityHandle this_ent) const; + int get_entity_id(EntityHandle this_ent); /**\brief get number of geometric sets corresponding to geometry of specified *dimension @@ -282,7 +278,7 @@ class DagMC { *the dimensionality of the entities in question \return integer number of *entities of that dimension */ - unsigned int num_entities(int dimension) const; + unsigned int num_entities(int dimension); private: /** get all group sets on the model */ @@ -564,18 +560,18 @@ class DagMC { }; // end DagMC -inline EntityHandle DagMC::entity_by_index(int dimension, int index) const { +inline EntityHandle DagMC::entity_by_index(int dimension, int index) { assert(2 <= dimension && 3 >= dimension && (unsigned)index < entHandles[dimension].size()); return entHandles[dimension][index]; } -inline int DagMC::index_by_handle(EntityHandle handle) const { +inline int DagMC::index_by_handle(EntityHandle handle) { assert(handle - setOffset < entIndices.size()); return entIndices[handle - setOffset]; } -inline unsigned int DagMC::num_entities(int dimension) const { +inline unsigned int DagMC::num_entities(int dimension) { assert(vertex_handle_idx <= dimension && groups_handle_idx >= dimension); return entHandles[dimension].size() - 1; } From 8a6af96580333896e992f7483c42b83f862d3722 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:36:12 +0600 Subject: [PATCH 04/32] rearrange logger, then require_density --- src/dagmc/dagmcmetadata.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dagmc/dagmcmetadata.cpp b/src/dagmc/dagmcmetadata.cpp index b2753cf2f8..3392901011 100644 --- a/src/dagmc/dagmcmetadata.cpp +++ b/src/dagmc/dagmcmetadata.cpp @@ -12,8 +12,8 @@ dagmcMetaData::dagmcMetaData(moab::DagMC* dag_ptr, bool verbosity, bool require_density_present) : DAG(dag_ptr), - require_density(require_density_present), - logger(verbosity) { + logger(verbosity), + require_density(require_density_present) { // these are the keywords that dagmc will understand // from groups if you need to process more // they should be added here From c1629505c15765b49e6a89051ee552359a5c67a5 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:37:32 +0600 Subject: [PATCH 05/32] remove moab conditions --- src/dagmc/tests/dagmc_simple_test.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/dagmc/tests/dagmc_simple_test.cpp b/src/dagmc/tests/dagmc_simple_test.cpp index ee1525a524..9d46f47fb9 100644 --- a/src/dagmc/tests/dagmc_simple_test.cpp +++ b/src/dagmc/tests/dagmc_simple_test.cpp @@ -156,19 +156,6 @@ TEST_F(DagmcSimpleTest, dagmc_point_in) { EXPECT_EQ(expect_result, result); } -#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 -TEST_F(DagmcSimpleTest, dagmc_find_volume) { - int vol_idx = 1; - int vol_dim = 3; - double xyz[3] = {0.0, 0.0, 0.0}; - EntityHandle vol_h; - EntityHandle expected_vol_h = DAG->entity_by_index(vol_dim, vol_idx); - ErrorCode rval = DAG->find_volume(xyz, vol_h); - EXPECT_EQ(rval, MB_SUCCESS); - EXPECT_EQ(expected_vol_h, vol_h); -} -#endif - TEST_F(DagmcSimpleTest, dagmc_test_obb_retreval_rayfire) { // make new dagmc std::cout << "test_obb_retreval and ray_fire" << std::endl; From 47cd28bc5a09ed0e3e4b973c3cfb33df2baa0766 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:38:46 +0600 Subject: [PATCH 06/32] new condition Geant4_VERSION GREATER_EQUAL 11.0 --- src/geant4/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/geant4/CMakeLists.txt b/src/geant4/CMakeLists.txt index d203d00ced..7599946d9b 100644 --- a/src/geant4/CMakeLists.txt +++ b/src/geant4/CMakeLists.txt @@ -2,7 +2,11 @@ message("") find_package(Geant4 10.4.2 REQUIRED) -if ( Geant4_VERSION GREATER_EQUAL 10.6 ) +if ( Geant4_VERSION GREATER_EQUAL 11.0 ) + message(STATUS "Configuring DAGMC for Geant4 version >= 11.0") + add_compile_definitions(GEANT4_GT_10_6=1) + add_compile_definitions(GEANT4_GT_11=1) + elseif( Geant4_VERSION GREATER_EQUAL 10.6 ) message(STATUS "Configuring DAGMC for Geant4 version >= 10.6") add_compile_definitions(GEANT4_GT_10_6=1) endif() From 71a17633ae35fc039cdd617a0e24a0d4520dc8e7 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:40:32 +0600 Subject: [PATCH 07/32] removed itaps and added PyNE's dagmc by @gonuke --- src/geant4/generate_geant4 | 83 +++++++++----------------------------- 1 file changed, 18 insertions(+), 65 deletions(-) diff --git a/src/geant4/generate_geant4 b/src/geant4/generate_geant4 index 524b312394..182c29c55b 100755 --- a/src/geant4/generate_geant4 +++ b/src/geant4/generate_geant4 @@ -2,11 +2,13 @@ from optparse import OptionParser import os,errno -from itaps import iMesh,iBase +import sys # for material handling -from pyne.material import Material,MaterialLibrary +from pyne.material import Material +from pyne.material_library import MaterialLibrary from pyne.nucname import name, znum, anum, id, alara from pyne.data import atomic_mass +from pyne import dagmc # for coloring the volumes import colorsys @@ -70,7 +72,7 @@ def parse_arguments(): try: fh = open(options.dag_file, "r") except IOError: - print "Error: can\'t find DAG file" + print("Error: can't find DAG file") else: fh.close() if not options.directory: @@ -90,69 +92,17 @@ dag_filename : h5m filename Returns --------- -dag_volnames : dictionary of volume names - +dag_vol_names : list of volume names +dag_materials : dictionary of material assignments """ def _get_dag_info(dag_filename): - dag_vol_names = [] # list of dag volume names (Cubit id) - dag_materials = {} # list of material assignments from group - - # create imesh instance - dag_geom = iMesh.Mesh() - # load the file - dag_geom.load(dag_filename) - - # get all entities - ents = dag_geom.getEntities() - - # create a mesh set - mesh_set = dag_geom.getEntSets() - # list of volume ent handles - - mat_list = [] - # get all geom_dimension ents - geom_list = [] - - cat_list = [] - - vol_tag = dag_geom.getTagHandle('GEOM_DIMENSION') - name_tag = dag_geom.getTagHandle('GLOBAL_ID') + dag_materials = dagmc.cell_material_assignments(dag_filename) - mat_tag = dag_geom.getTagHandle('NAME') + dag_vol_names = [dag_materials.keys()] - cat_tag = dag_geom.getTagHandle('CATEGORY') - - # get the list we need - for i in mesh_set: - tags = dag_geom.getAllTags(i) - for tag in tags: - if tag == vol_tag: - geom_list.append(i) - if tag == mat_tag: - mat_list.append(i) - if tag == cat_tag: - cat_list.append(i) - - # for the 3d entities - for entity in geom_list: - if vol_tag[entity] == 3: - dag_vol_names.append(str(name_tag[entity])) - - - # loop over all the volumes - for entity in geom_list: - # loop over the material sets - for meshset in mat_list: - # if volume in set - if meshset.contains(entity): - mat_name = mat_tag[meshset] - volume_name = name_tag[entity] - dag_materials[volume_name]="".join( chr( val ) for val in mat_name ) - - - return dag_vol_names,dag_materials + return dag_vol_names, dag_materials """ Function to pull out the pyne materials from the h5m file @@ -179,8 +129,8 @@ def _get_material_info(dag_file): mat_lib.from_hdf5(dag_file) materials = mat_lib.keys() except: - print "!! There are no materials in the h5m file !!" - print " Assuming all volumes contain vacuum " + print("There are no materials in the h5m file!!") + print("Assuming all volumes contain vacuum") materials = {} nuclides = set() @@ -534,7 +484,7 @@ dag_volume_names : list or dictionary of volume names def _setup_dagspecific_headers(dag_volume_names, tallies_needed): if not dag_volume_names: - print "dag volume names not assigned", sys.exc_info()[0] + print("dag volume names not assigned", sys.exc_info()[0]) raise headers = {} @@ -1680,7 +1630,7 @@ def _write_files(path, dictionary_files): try: fh = open(path+'/'+key, "w") except IOError: - print "Error: "+file+" file exists" + print("Error: "+key+" file exists") else: for line in dictionary_files[key]: fh.write(line) @@ -1707,9 +1657,12 @@ def _create_directory_structure(directory): _mkdir_p(directory+'/src') return +# Fix: Don't know what it does +""" def _dagmc_volume_material(dagmc_h5m, index): return material_name + """ """ Function from http://stackoverflow.com/questions @@ -1724,7 +1677,7 @@ def _mkdir_p(path): try: os.makedirs(path) except OSError: - print "Error: can\'t create directory, "+path + print("Error: can't create directory, "+path) raise From 627be18de999a55c5099df798ed4a8bc53313844 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:40:58 +0600 Subject: [PATCH 08/32] GEANT4_GT_11 --- src/geant4/app/include/ExN01Analysis.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/geant4/app/include/ExN01Analysis.hh b/src/geant4/app/include/ExN01Analysis.hh index 15618704ce..530d274df5 100644 --- a/src/geant4/app/include/ExN01Analysis.hh +++ b/src/geant4/app/include/ExN01Analysis.hh @@ -7,6 +7,10 @@ #ifndef ExN01Analysis_h #define ExN01Analysis_h 1 +#ifdef GEANT4_GT_11 +#include "G4AnalysisManager.hh" +#else #include "g4root.hh" +#endif #endif From 0e17740cbc0b12b5b5fb5305793bde19671c4ddd Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:41:12 +0600 Subject: [PATCH 09/32] GEANT4_GT_11 --- src/geant4/app/src/ExN01DetectorConstruction.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/geant4/app/src/ExN01DetectorConstruction.cc b/src/geant4/app/src/ExN01DetectorConstruction.cc index 23b6e91dc1..bf9236bee0 100644 --- a/src/geant4/app/src/ExN01DetectorConstruction.cc +++ b/src/geant4/app/src/ExN01DetectorConstruction.cc @@ -51,8 +51,11 @@ G4VPhysicalVolume* ExN01DetectorConstruction::Construct() { // load the material from the UW^2 library std::map material_lib; material_lib = load_uwuw_materials(workflow_data); - +#ifdef GEANT4_GT_11 + G4VisAttributes* invis = new G4VisAttributes(G4VisAttributes::GetInvisible()); +#else G4VisAttributes* invis = new G4VisAttributes(G4VisAttributes::Invisible); +#endif //------------------------------------------------------ volumes // -- World Volume in which we place other volumes From 55292f7601b2813f28ad8057c8290afc71691e49 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:41:51 +0600 Subject: [PATCH 10/32] GEANT4_GT_10_6 uill use MeshScoreMap --- src/geant4/app/src/ExN01UserScoreWriter.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/geant4/app/src/ExN01UserScoreWriter.cc b/src/geant4/app/src/ExN01UserScoreWriter.cc index 4fe0f8e9bc..b18f0ec94c 100644 --- a/src/geant4/app/src/ExN01UserScoreWriter.cc +++ b/src/geant4/app/src/ExN01UserScoreWriter.cc @@ -30,7 +30,11 @@ void ExN01UserScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName, G4cout << "Dumping mesh " << fScoringMesh->GetWorldName() << " to file" << G4endl; - // retrieve the map +// retrieve the map +#ifdef GEANT4_GT_10_6 + using MeshScoreMap = G4VScoringMesh::MeshScoreMap; +#endif + MeshScoreMap scMap = fScoringMesh->GetScoreMap(); // get the number of bins From a1d03629e9519c8085864f1421c9420ac4031bcb Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:45:21 +0600 Subject: [PATCH 11/32] geant4 v11 support --- doc/CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/CHANGELOG.rst b/doc/CHANGELOG.rst index 46b49d1fe5..00ca380195 100644 --- a/doc/CHANGELOG.rst +++ b/doc/CHANGELOG.rst @@ -29,7 +29,7 @@ Next version * Adding const identifier to cross-reference methods (#906) **Fixed:** - * Patch to compile with Geant4 10.6 (#803) + * Patch to compile with Geant4 10.6 (#803 #860) * Patched cmake-search paths for double-down and MOAB (#878) * Patch to compile with gcc-13 (#882) * Tweak conda environment for Windows build to avoid conflicting gtest headers (#888) From 0f5239dca9656e5f292c728cdfb2fe38d3ade010 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 18 Sep 2023 23:55:26 +0600 Subject: [PATCH 12/32] Patch to compile with Geant4 11.x --- doc/CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/CHANGELOG.rst b/doc/CHANGELOG.rst index 00ca380195..62c86101d9 100644 --- a/doc/CHANGELOG.rst +++ b/doc/CHANGELOG.rst @@ -29,7 +29,7 @@ Next version * Adding const identifier to cross-reference methods (#906) **Fixed:** - * Patch to compile with Geant4 10.6 (#803 #860) + * Patch to compile with Geant4 11.x (#803 #907) * Patched cmake-search paths for double-down and MOAB (#878) * Patch to compile with gcc-13 (#882) * Tweak conda environment for Windows build to avoid conflicting gtest headers (#888) From f7c4acff5393c86bde2c357d8bfe0003ec9e2aa5 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Tue, 19 Sep 2023 08:16:06 +0600 Subject: [PATCH 13/32] Geant4ConfigVersion --- cmake/FindGeant4.cmake | 44 ++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/cmake/FindGeant4.cmake b/cmake/FindGeant4.cmake index 36c47b9ba8..098f28573c 100644 --- a/cmake/FindGeant4.cmake +++ b/cmake/FindGeant4.cmake @@ -1,37 +1,31 @@ # Find Geant4 cmake config file set(Geant4_SEARCH_DIRS) -set(Geant4_FIND_VERSION ${Geant4_FIND_VERSION}) + file(GLOB Geant4_SEARCH_DIRS "${GEANT4_DIR}/lib*/Geant4-*") string(REPLACE "\n" ";" Geant4_SEARCH_DIRS ${Geant4_SEARCH_DIRS}) -# Extract the version number from the first directory in Geant4_SEARCH_DIRS -if(Geant4_SEARCH_DIRS) - # Extract the version number from the directory name - list(GET Geant4_SEARCH_DIRS 0 Geant4_LIB_DIR) - file(RELATIVE_PATH Geant4_VERSION ${GEANT4_DIR} ${Geant4_LIB_DIR}) - string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" Geant4_VERSION ${Geant4_VERSION}) - - if(Geant4_VERSION) - message("Found Geant4 version ${Geant4_VERSION}") - - # Compare the versions - if(Geant4_FIND_VERSION VERSION_GREATER Geant4_VERSION) - set(Geant4_VERSION_COMPATIBLE false) - else() - set(Geant4_VERSION_COMPATIBLE true) - endif() - else() - message(FATAL_ERROR "Failed to extract Geant4 version from directory name") - endif() -else() - message(FATAL_ERROR "No Geant4 installation found") -endif() - find_path(Geant4_CMAKE_CONFIG NAMES Geant4Config.cmake PATHS ${Geant4_SEARCH_DIRS} NO_DEFAULT_PATH ) + +find_path(Geant4_CMAKE_CONFIG_VERSION + NAMES Geant4ConfigVersion.cmake + PATHS ${Geant4_CMAKE_CONFIG} + NO_DEFAULT_PATH + ) + +if (Geant4_CMAKE_CONFIG_VERSION) + set(Geant4_CMAKE_CONFIG_VERSION ${Geant4_CMAKE_CONFIG_VERSION}/Geant4ConfigVersion.cmake) + include(${Geant4_CMAKE_CONFIG_VERSION}) + set(Geant4_VERSION ${PACKAGE_VERSION}) + set(Geant4_VERSION_COMPATIBLE ${PACKAGE_VERSION_COMPATIBLE}) + set(Geant4_VERSION_EXACT ${PACKAGE_VERSION_EXACT}) +else () + message(FATAL_ERROR "Could not find Geant4") +endif () + if (Geant4_CMAKE_CONFIG) set(Geant4_CMAKE_CONFIG ${Geant4_CMAKE_CONFIG}/Geant4Config.cmake) message(STATUS "Geant4_CMAKE_CONFIG: ${Geant4_CMAKE_CONFIG}") @@ -65,7 +59,7 @@ set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS_SAVE}) message(STATUS "Geant4 version: ${Geant4_VERSION}") message(STATUS "Geant4 version required: ${Geant4_FIND_VERSION}") -message(STATUS "Geant4 version compatible: ${Geant4_VERSION_COMPATIBLE}") +message(STATUS "Geant4 version compatible: ${PACKAGE_VERSION_COMPATIBLE}") message(STATUS "Geant4 version exact: ${PACKAGE_VERSION_EXACT}") message(STATUS "Geant4_INCLUDE_DIRS: ${Geant4_INCLUDE_DIRS}") message(STATUS "Geant4_LIBRARIES_SHARED: ${Geant4_LIBRARIES_SHARED}") From 4c0302e5e9e168d2a1a28c55eea45ee0ef1e0d26 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 2 Oct 2023 19:04:18 +0600 Subject: [PATCH 14/32] find a volume in a DAGMC instance if moab >5.2 --- src/dagmc/DagMC.cpp | 9 +++++++++ src/dagmc/tests/dagmc_simple_test.cpp | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index c086c44027..8f92ca8672 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -811,6 +811,15 @@ ErrorCode DagMC::point_in_volume_slow(EntityHandle volume, const double xyz[3], return rval; } +#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 +// find a which volume contains the current point +ErrorCode DagMC::find_volume(const double xyz[3], EntityHandle& volume, + const double* uvw) { + ErrorCode rval = ray_tracer->find_volume(xyz, volume, uvw); + return rval; +} +#endif + // detemine distance to nearest surface ErrorCode DagMC::closest_to_location(EntityHandle volume, const double coords[3], double& result, diff --git a/src/dagmc/tests/dagmc_simple_test.cpp b/src/dagmc/tests/dagmc_simple_test.cpp index 9d46f47fb9..ee1525a524 100644 --- a/src/dagmc/tests/dagmc_simple_test.cpp +++ b/src/dagmc/tests/dagmc_simple_test.cpp @@ -156,6 +156,19 @@ TEST_F(DagmcSimpleTest, dagmc_point_in) { EXPECT_EQ(expect_result, result); } +#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 +TEST_F(DagmcSimpleTest, dagmc_find_volume) { + int vol_idx = 1; + int vol_dim = 3; + double xyz[3] = {0.0, 0.0, 0.0}; + EntityHandle vol_h; + EntityHandle expected_vol_h = DAG->entity_by_index(vol_dim, vol_idx); + ErrorCode rval = DAG->find_volume(xyz, vol_h); + EXPECT_EQ(rval, MB_SUCCESS); + EXPECT_EQ(expected_vol_h, vol_h); +} +#endif + TEST_F(DagmcSimpleTest, dagmc_test_obb_retreval_rayfire) { // make new dagmc std::cout << "test_obb_retreval and ray_fire" << std::endl; From 5737e4563beccae7f099a37323ab1a36ce25066d Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 2 Oct 2023 21:00:44 +0600 Subject: [PATCH 15/32] geant4 11.1.2 added --- .github/workflows/docker_publish.yml | 59 +++++++--------------------- 1 file changed, 15 insertions(+), 44 deletions(-) diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml index c8d84031f4..a7687c2f69 100644 --- a/.github/workflows/docker_publish.yml +++ b/.github/workflows/docker_publish.yml @@ -5,8 +5,8 @@ on: workflow_dispatch: push: paths: - - 'CI/Dockerfile' - - '.github/workflows/docker_publish.yml' + - "CI/Dockerfile" + - ".github/workflows/docker_publish.yml" jobs: build-dependency-and-test-img: @@ -14,26 +14,12 @@ jobs: strategy: matrix: - ubuntu_versions : [ - 20.04, - 22.04, - ] - compiler : [ - gcc, - clang, - ] - hdf5_versions : [ - 1.10.4, - ] - moab_versions : [ - 5.3.0, - ] - double_down : [ - OFF, - ] - geant_version : [ - 10.7.4, - ] + ubuntu_versions: [20.04, 22.04] + compiler: [gcc, clang] + hdf5_versions: [1.10.4] + moab_versions: [5.3.0, 5.4.0] + double_down: [OFF] + geant_version: [10.7.4, 11.1.2] name: Installing Dependencies, Building DAGMC and running tests steps: @@ -68,36 +54,21 @@ jobs: dockerfile: CI/Dockerfile build-args: double_down=${{ matrix.double_down}}, geant4_version=${{ matrix.geant_version }}, COMPILER=${{ matrix.compiler }}, UBUNTU_VERSION=${{ matrix.ubuntu_versions }}, HDF5_VERSION=${{ matrix.hdf5_versions }}, MOAB_BRANCH=${{ matrix.moab_versions }} - push_stable_ci_img: needs: [build-dependency-and-test-img] runs-on: ubuntu-latest strategy: matrix: - ubuntu_versions : [ - 20.04, - 22.04, - ] - compiler : [ - gcc, - clang, - ] - hdf5_versions : [ - 1.10.4, - ] - moab_versions : [ - 5.3.0, - ] - double_down : [ - OFF, - ] - geant_version : [ - 10.7.4, - ] + ubuntu_versions: [20.04, 22.04] + compiler: [gcc, clang] + hdf5_versions: [1.10.4] + moab_versions: [5.3.0, 5.4.0] + double_down: [OFF] + geant_version: [10.7.4, 11.1.2] name: Pushing final images - steps: + steps: - name: Log in to the Container registry if: ${{ github.repository_owner == 'svalinn' }} uses: docker/login-action@v2 From 968f6f763d9d5c2c4b2f9aab012a3c8eafde5a16 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Mon, 2 Oct 2023 22:26:18 +0600 Subject: [PATCH 16/32] geant4_version=11.1.2 --- CI/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/Dockerfile b/CI/Dockerfile index 5eba2cfe5d..434d43a767 100644 --- a/CI/Dockerfile +++ b/CI/Dockerfile @@ -5,7 +5,7 @@ # Global ARGS set before the first build stage are accessable by all build stages ARG EMBREE_BRANCH='v3.6.1' -ARG geant4_version=10.7.4 +ARG geant4_version=11.1.2 ARG UBUNTU_VERSION=20.04 ARG MOAB_BRANCH=5.3.0 ARG double_down=OFF From 6d8c89df680b6c2cdb3a09ff5c5c5c1af622a740 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Thu, 19 Oct 2023 19:45:03 +0600 Subject: [PATCH 17/32] follow dagmc format --- .github/workflows/docker_publish.yml | 60 +++++++++++++++++++++------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml index a7687c2f69..65d59ec798 100644 --- a/.github/workflows/docker_publish.yml +++ b/.github/workflows/docker_publish.yml @@ -5,8 +5,8 @@ on: workflow_dispatch: push: paths: - - "CI/Dockerfile" - - ".github/workflows/docker_publish.yml" + - 'CI/Dockerfile' + - '.github/workflows/docker_publish.yml' jobs: build-dependency-and-test-img: @@ -14,12 +14,26 @@ jobs: strategy: matrix: - ubuntu_versions: [20.04, 22.04] - compiler: [gcc, clang] - hdf5_versions: [1.10.4] - moab_versions: [5.3.0, 5.4.0] - double_down: [OFF] - geant_version: [10.7.4, 11.1.2] + ubuntu_versions : [ + 20.04, + 22.04, + ] + compiler : [ + gcc, + clang, + ] + hdf5_versions : [ + 1.10.4, + ] + moab_versions : [ + 5.3.0, + ] + double_down : [ + OFF, + ] + geant_version : [ + 10.7.4, + ] name: Installing Dependencies, Building DAGMC and running tests steps: @@ -54,21 +68,37 @@ jobs: dockerfile: CI/Dockerfile build-args: double_down=${{ matrix.double_down}}, geant4_version=${{ matrix.geant_version }}, COMPILER=${{ matrix.compiler }}, UBUNTU_VERSION=${{ matrix.ubuntu_versions }}, HDF5_VERSION=${{ matrix.hdf5_versions }}, MOAB_BRANCH=${{ matrix.moab_versions }} + push_stable_ci_img: needs: [build-dependency-and-test-img] runs-on: ubuntu-latest strategy: matrix: - ubuntu_versions: [20.04, 22.04] - compiler: [gcc, clang] - hdf5_versions: [1.10.4] - moab_versions: [5.3.0, 5.4.0] - double_down: [OFF] - geant_version: [10.7.4, 11.1.2] + ubuntu_versions : [ + 20.04, + 22.04, + ] + compiler : [ + gcc, + clang, + ] + hdf5_versions : [ + 1.10.4, + ] + moab_versions : [ + 5.3.0, + ] + double_down : [ + OFF, + ] + geant_version : [ + 10.7.4, + 11.1.2 + ] name: Pushing final images - steps: + steps: - name: Log in to the Container registry if: ${{ github.repository_owner == 'svalinn' }} uses: docker/login-action@v2 From 8f583c6907b787f7fca58efabb46fdd9aed235c0 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Thu, 19 Oct 2023 20:57:02 +0600 Subject: [PATCH 18/32] add const --- src/dagmc/DagMC.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dagmc/DagMC.cpp b/src/dagmc/DagMC.cpp index 8f92ca8672..c4e0494e41 100644 --- a/src/dagmc/DagMC.cpp +++ b/src/dagmc/DagMC.cpp @@ -870,11 +870,11 @@ ErrorCode DagMC::next_vol(EntityHandle surface, EntityHandle old_volume, /* SECTION III: Indexing & Cross-referencing */ -EntityHandle DagMC::entity_by_id(int dimension, int id) { +EntityHandle DagMC::entity_by_id(int dimension, int id) const { return GTT->entity_by_id(dimension, id); } -int DagMC::id_by_index(int dimension, int index) { +int DagMC::id_by_index(int dimension, int index) const { EntityHandle h = entity_by_index(dimension, index); if (!h) return 0; @@ -883,7 +883,7 @@ int DagMC::id_by_index(int dimension, int index) { return result; } -int DagMC::get_entity_id(EntityHandle this_ent) { +int DagMC::get_entity_id(EntityHandle this_ent) const { return GTT->global_id(this_ent); } From 8ce9f3b3099a6909ce3d651c52746026b8c44d7f Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Thu, 19 Oct 2023 22:45:39 +0600 Subject: [PATCH 19/32] add const --- src/dagmc/DagMC.hpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/dagmc/DagMC.hpp b/src/dagmc/DagMC.hpp index 5ecce3c584..c4f28f2bcd 100644 --- a/src/dagmc/DagMC.hpp +++ b/src/dagmc/DagMC.hpp @@ -225,6 +225,10 @@ class DagMC { ErrorCode point_in_volume_slow(const EntityHandle volume, const double xyz[3], int& result); +#if MOAB_VERSION_MAJOR == 5 && MOAB_VERSION_MINOR > 2 + ErrorCode find_volume(const double xyz[3], EntityHandle& volume, + const double* uvw = NULL); +#endif ErrorCode test_volume_boundary(const EntityHandle volume, const EntityHandle surface, @@ -259,16 +263,16 @@ class DagMC { */ /** map from dimension & global ID to EntityHandle */ - EntityHandle entity_by_id(int dimension, int id); + EntityHandle entity_by_id(int dimension, int id) const; /** map from dimension & base-1 ordinal index to EntityHandle */ - EntityHandle entity_by_index(int dimension, int index); + EntityHandle entity_by_index(int dimension, int index) const; /** map from dimension & base-1 ordinal index to global ID */ - int id_by_index(int dimension, int index); + int id_by_index(int dimension, int index) const; /** PPHW: Missing dim & global ID ==> base-1 ordinal index */ /** map from EntityHandle to base-1 ordinal index */ - int index_by_handle(EntityHandle handle); + int index_by_handle(EntityHandle handle) const; /** map from EntityHandle to global ID */ - int get_entity_id(EntityHandle this_ent); + int get_entity_id(EntityHandle this_ent) const; /**\brief get number of geometric sets corresponding to geometry of specified *dimension @@ -278,7 +282,7 @@ class DagMC { *the dimensionality of the entities in question \return integer number of *entities of that dimension */ - unsigned int num_entities(int dimension); + unsigned int num_entities(int dimension) const; private: /** get all group sets on the model */ @@ -560,18 +564,18 @@ class DagMC { }; // end DagMC -inline EntityHandle DagMC::entity_by_index(int dimension, int index) { +inline EntityHandle DagMC::entity_by_index(int dimension, int index) const { assert(2 <= dimension && 3 >= dimension && (unsigned)index < entHandles[dimension].size()); return entHandles[dimension][index]; } -inline int DagMC::index_by_handle(EntityHandle handle) { +inline int DagMC::index_by_handle(EntityHandle handle) const { assert(handle - setOffset < entIndices.size()); return entIndices[handle - setOffset]; } -inline unsigned int DagMC::num_entities(int dimension) { +inline unsigned int DagMC::num_entities(int dimension) const { assert(vertex_handle_idx <= dimension && groups_handle_idx >= dimension); return entHandles[dimension].size() - 1; } From 61f28e5c88a4efb4d9f0b835cad38192c611cc18 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Thu, 19 Oct 2023 22:53:33 +0600 Subject: [PATCH 20/32] soft reset --- src/dagmc/dagmcmetadata.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dagmc/dagmcmetadata.cpp b/src/dagmc/dagmcmetadata.cpp index 3392901011..b2753cf2f8 100644 --- a/src/dagmc/dagmcmetadata.cpp +++ b/src/dagmc/dagmcmetadata.cpp @@ -12,8 +12,8 @@ dagmcMetaData::dagmcMetaData(moab::DagMC* dag_ptr, bool verbosity, bool require_density_present) : DAG(dag_ptr), - logger(verbosity), - require_density(require_density_present) { + require_density(require_density_present), + logger(verbosity) { // these are the keywords that dagmc will understand // from groups if you need to process more // they should be added here From 0769e844b37cfacbe951aed6c8ed02b9850cf5ea Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Thu, 19 Oct 2023 23:10:13 +0600 Subject: [PATCH 21/32] geant4 11.1.2 --- .github/workflows/docker_publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml index 65d59ec798..902a9703f9 100644 --- a/.github/workflows/docker_publish.yml +++ b/.github/workflows/docker_publish.yml @@ -33,6 +33,7 @@ jobs: ] geant_version : [ 10.7.4, + 11.1.2 ] name: Installing Dependencies, Building DAGMC and running tests From b4b5a7dc5b34137fbd7b36798a29884cd5fffa31 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Fri, 20 Oct 2023 09:42:23 +0600 Subject: [PATCH 22/32] sefault geant4 11.1.2 --- .github/actions/upstream-test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/upstream-test/action.yml b/.github/actions/upstream-test/action.yml index 0cb8182274..68064d160b 100644 --- a/.github/actions/upstream-test/action.yml +++ b/.github/actions/upstream-test/action.yml @@ -8,7 +8,7 @@ inputs: geant_version: description: Version of Geant4 required: false - default: 10.7.4 + default: 11.1.2 ubuntu_version: description: Underlying OS version required: false From fc1507cf0d361def4b9193d002f5dbaeb73f121f Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Fri, 20 Oct 2023 09:42:39 +0600 Subject: [PATCH 23/32] new stage geant4 --- .github/workflows/docker_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml index 902a9703f9..70d12dd5a4 100644 --- a/.github/workflows/docker_publish.yml +++ b/.github/workflows/docker_publish.yml @@ -61,7 +61,7 @@ jobs: uses: firehed/multistage-docker-build-action@v1 with: repository: ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ matrix.ubuntu_versions }}-${{ matrix.compiler}}-geant4_${{ matrix.geant_version }}-hdf5_${{ matrix.hdf5_versions}}-moab_${{ matrix.moab_versions }} - stages: base, external_deps, hdf5, moab, dagmc + stages: base, external_deps, hdf5, moab, geant4, dagmc server-stage: dagmc_test quiet: false parallel: true From 510445f116cbbf12a257518ab238720619de96c2 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Fri, 20 Oct 2023 09:42:56 +0600 Subject: [PATCH 24/32] add 11.1.2 geant4 --- .github/workflows/linux_build_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linux_build_test.yml b/.github/workflows/linux_build_test.yml index e17b2b36c7..1902f36817 100644 --- a/.github/workflows/linux_build_test.yml +++ b/.github/workflows/linux_build_test.yml @@ -55,6 +55,7 @@ jobs: ] geant_version : [ 10.7.4, + 11.1.2 ] container: From 928b9f07f6d58c020682c702725a62636fcc2dca Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Fri, 20 Oct 2023 09:43:09 +0600 Subject: [PATCH 25/32] geant4 11.1.2 --- .github/workflows/linux_upstream_test_geant4.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux_upstream_test_geant4.yml b/.github/workflows/linux_upstream_test_geant4.yml index d5871a4907..3e09d0161a 100644 --- a/.github/workflows/linux_upstream_test_geant4.yml +++ b/.github/workflows/linux_upstream_test_geant4.yml @@ -27,5 +27,5 @@ jobs: uses: ./.github/actions/upstream-test with: token: ${{ secrets.GITHUB_TOKEN }} - geant_version: 11.1.1 + geant_version: 11.1.2 From ee0b75b3f23303a9af48a19d1eff2e200519010b Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Fri, 20 Oct 2023 09:46:20 +0600 Subject: [PATCH 26/32] soft reset --- .github/workflows/docker_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml index 70d12dd5a4..902a9703f9 100644 --- a/.github/workflows/docker_publish.yml +++ b/.github/workflows/docker_publish.yml @@ -61,7 +61,7 @@ jobs: uses: firehed/multistage-docker-build-action@v1 with: repository: ghcr.io/${{ github.repository_owner }}/dagmc-ci-ubuntu-${{ matrix.ubuntu_versions }}-${{ matrix.compiler}}-geant4_${{ matrix.geant_version }}-hdf5_${{ matrix.hdf5_versions}}-moab_${{ matrix.moab_versions }} - stages: base, external_deps, hdf5, moab, geant4, dagmc + stages: base, external_deps, hdf5, moab, dagmc server-stage: dagmc_test quiet: false parallel: true From c0fc92ca6d8c01f5d1f31f4c48ee1ca233512677 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Thu, 30 Nov 2023 20:30:05 +0600 Subject: [PATCH 27/32] Update cmake/FindGeant4.cmake Co-authored-by: Paul Wilson --- cmake/FindGeant4.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindGeant4.cmake b/cmake/FindGeant4.cmake index 098f28573c..c8a0fda751 100644 --- a/cmake/FindGeant4.cmake +++ b/cmake/FindGeant4.cmake @@ -1,7 +1,7 @@ # Find Geant4 cmake config file set(Geant4_SEARCH_DIRS) -file(GLOB Geant4_SEARCH_DIRS "${GEANT4_DIR}/lib*/Geant4-*") +file(GLOB Geant4_SEARCH_DIRS "${GEANT4_DIR}/lib*/Geant4*") string(REPLACE "\n" ";" Geant4_SEARCH_DIRS ${Geant4_SEARCH_DIRS}) find_path(Geant4_CMAKE_CONFIG From fa54fff6c90505281c444df719080ab3b364b73f Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Fri, 1 Dec 2023 00:07:26 +0600 Subject: [PATCH 28/32] find path for geant4 11+ --- cmake/FindGeant4.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/FindGeant4.cmake b/cmake/FindGeant4.cmake index c8a0fda751..f22f19b60b 100644 --- a/cmake/FindGeant4.cmake +++ b/cmake/FindGeant4.cmake @@ -3,6 +3,7 @@ set(Geant4_SEARCH_DIRS) file(GLOB Geant4_SEARCH_DIRS "${GEANT4_DIR}/lib*/Geant4*") string(REPLACE "\n" ";" Geant4_SEARCH_DIRS ${Geant4_SEARCH_DIRS}) +list(APPEND Geant4_SEARCH_DIRS "${GEANT4_DIR}/lib/cmake/Geant4") find_path(Geant4_CMAKE_CONFIG NAMES Geant4Config.cmake From 6b761f1d9b8992cc3f527ede578dd5ca44fd56df Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Thu, 30 Nov 2023 17:24:16 -0600 Subject: [PATCH 29/32] remove build test until we have a working docker container --- .github/workflows/linux_build_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/linux_build_test.yml b/.github/workflows/linux_build_test.yml index 0e866db731..5e8bbc30d0 100644 --- a/.github/workflows/linux_build_test.yml +++ b/.github/workflows/linux_build_test.yml @@ -55,7 +55,6 @@ jobs: ] geant_version : [ 10.7.4, - 11.1.2 ] container: From 4ec7aa6d6c92621db3b34189d7740e8db937c56c Mon Sep 17 00:00:00 2001 From: Paul Wilson Date: Fri, 1 Dec 2023 09:07:53 -0600 Subject: [PATCH 30/32] remove explicit gcc install in mac_build_test.yml --- .github/workflows/mac_build_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mac_build_test.yml b/.github/workflows/mac_build_test.yml index 59678ce08e..a959052f76 100644 --- a/.github/workflows/mac_build_test.yml +++ b/.github/workflows/mac_build_test.yml @@ -47,7 +47,7 @@ jobs: - name: Initial setup shell: bash -l {0} run: | - brew install eigen gcc@6 hdf5 + brew install eigen hdf5 - name: Environment Variables shell: bash -l {0} From 1f137ffffaa2f8a78f7e182d12705929f32e9dee Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Wed, 6 Dec 2023 20:45:00 -0600 Subject: [PATCH 31/32] address review comments --- src/geant4/app/src/ExN01UserScoreWriter.cc | 6 +---- src/geant4/generate_geant4 | 27 ++++++++-------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/geant4/app/src/ExN01UserScoreWriter.cc b/src/geant4/app/src/ExN01UserScoreWriter.cc index b18f0ec94c..b2dfb6018c 100644 --- a/src/geant4/app/src/ExN01UserScoreWriter.cc +++ b/src/geant4/app/src/ExN01UserScoreWriter.cc @@ -30,11 +30,7 @@ void ExN01UserScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName, G4cout << "Dumping mesh " << fScoringMesh->GetWorldName() << " to file" << G4endl; -// retrieve the map -#ifdef GEANT4_GT_10_6 - using MeshScoreMap = G4VScoringMesh::MeshScoreMap; -#endif - + x// retrieve the map MeshScoreMap scMap = fScoringMesh->GetScoreMap(); // get the number of bins diff --git a/src/geant4/generate_geant4 b/src/geant4/generate_geant4 index 182c29c55b..af7b3c64af 100755 --- a/src/geant4/generate_geant4 +++ b/src/geant4/generate_geant4 @@ -71,10 +71,9 @@ def parse_arguments(): if options.dag_file: try: fh = open(options.dag_file, "r") - except IOError: - print("Error: can't find DAG file") - else: fh.close() + except IOError: + print("Error: can't find DAG file: '{} ".format(options.dag_file)) if not options.directory: options.directory = os.getcwd() else: @@ -100,7 +99,7 @@ def _get_dag_info(dag_filename): dag_materials = dagmc.cell_material_assignments(dag_filename) - dag_vol_names = [dag_materials.keys()] + dag_vol_names = list(dag_materials.keys()) return dag_vol_names, dag_materials @@ -129,8 +128,8 @@ def _get_material_info(dag_file): mat_lib.from_hdf5(dag_file) materials = mat_lib.keys() except: - print("There are no materials in the h5m file!!") - print("Assuming all volumes contain vacuum") + print("There are no materials in the h5m file.\n" + "Assuming all volumes contain vacuum") materials = {} nuclides = set() @@ -484,7 +483,7 @@ dag_volume_names : list or dictionary of volume names def _setup_dagspecific_headers(dag_volume_names, tallies_needed): if not dag_volume_names: - print("dag volume names not assigned", sys.exc_info()[0]) + print("DAGMC volume names are not assigned", sys.exc_info()[0]) raise headers = {} @@ -1629,12 +1628,11 @@ def _write_files(path, dictionary_files): for key in dictionary_files: try: fh = open(path+'/'+key, "w") - except IOError: - print("Error: "+key+" file exists") - else: for line in dictionary_files[key]: fh.write(line) fh.close + except IOError: + print("Error: '{}' file exists".format(key)) """ @@ -1657,13 +1655,6 @@ def _create_directory_structure(directory): _mkdir_p(directory+'/src') return -# Fix: Don't know what it does -""" -def _dagmc_volume_material(dagmc_h5m, index): - - return material_name - """ - """ Function from http://stackoverflow.com/questions /600268/mkdir-p-functionality-in-python, to create @@ -1677,7 +1668,7 @@ def _mkdir_p(path): try: os.makedirs(path) except OSError: - print("Error: can't create directory, "+path) + print("Error: can't create directory '{}' ".format(path)) raise From b1e00914e54971f89f88343eef4c124e823807cd Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Wed, 6 Dec 2023 20:47:02 -0600 Subject: [PATCH 32/32] random typo --- src/geant4/app/src/ExN01UserScoreWriter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geant4/app/src/ExN01UserScoreWriter.cc b/src/geant4/app/src/ExN01UserScoreWriter.cc index b2dfb6018c..4fe0f8e9bc 100644 --- a/src/geant4/app/src/ExN01UserScoreWriter.cc +++ b/src/geant4/app/src/ExN01UserScoreWriter.cc @@ -30,7 +30,7 @@ void ExN01UserScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName, G4cout << "Dumping mesh " << fScoringMesh->GetWorldName() << " to file" << G4endl; - x// retrieve the map + // retrieve the map MeshScoreMap scMap = fScoringMesh->GetScoreMap(); // get the number of bins