Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geant4 v11 fix #907

Merged
merged 29 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2bf5f31
find geant4 manual mode
ahnaf-tahmid-chowdhury Sep 18, 2023
2b1fc23
remove moab condition
ahnaf-tahmid-chowdhury Sep 18, 2023
0c4a183
remove moab version condition
ahnaf-tahmid-chowdhury Sep 18, 2023
8a6af96
rearrange logger, then require_density
ahnaf-tahmid-chowdhury Sep 18, 2023
c162950
remove moab conditions
ahnaf-tahmid-chowdhury Sep 18, 2023
47cd28b
new condition Geant4_VERSION GREATER_EQUAL 11.0
ahnaf-tahmid-chowdhury Sep 18, 2023
71a1763
removed itaps and added PyNE's dagmc by @gonuke
ahnaf-tahmid-chowdhury Sep 18, 2023
627be18
GEANT4_GT_11
ahnaf-tahmid-chowdhury Sep 18, 2023
0e17740
GEANT4_GT_11
ahnaf-tahmid-chowdhury Sep 18, 2023
55292f7
GEANT4_GT_10_6 uill use MeshScoreMap
ahnaf-tahmid-chowdhury Sep 18, 2023
a1d0362
geant4 v11 support
ahnaf-tahmid-chowdhury Sep 18, 2023
0f5239d
Patch to compile with Geant4 11.x
ahnaf-tahmid-chowdhury Sep 18, 2023
f7c4acf
Geant4ConfigVersion
ahnaf-tahmid-chowdhury Sep 19, 2023
4c0302e
find a volume in a DAGMC instance if moab >5.2
ahnaf-tahmid-chowdhury Oct 2, 2023
5737e45
geant4 11.1.2 added
ahnaf-tahmid-chowdhury Oct 2, 2023
968f6f7
geant4_version=11.1.2
ahnaf-tahmid-chowdhury Oct 2, 2023
6d8c89d
follow dagmc format
ahnaf-tahmid-chowdhury Oct 19, 2023
8f583c6
add const
ahnaf-tahmid-chowdhury Oct 19, 2023
8ce9f3b
add const
ahnaf-tahmid-chowdhury Oct 19, 2023
61f28e5
soft reset
ahnaf-tahmid-chowdhury Oct 19, 2023
0769e84
geant4 11.1.2
ahnaf-tahmid-chowdhury Oct 19, 2023
b4b5a7d
sefault geant4 11.1.2
ahnaf-tahmid-chowdhury Oct 20, 2023
fc1507c
new stage geant4
ahnaf-tahmid-chowdhury Oct 20, 2023
510445f
add 11.1.2 geant4
ahnaf-tahmid-chowdhury Oct 20, 2023
928b9f0
geant4 11.1.2
ahnaf-tahmid-chowdhury Oct 20, 2023
ee0b75b
soft reset
ahnaf-tahmid-chowdhury Oct 20, 2023
42b98d3
Merge branch 'svalinn:develop' into fix-geant4-build
ahnaf-tahmid-chowdhury Oct 22, 2023
c0fc92c
Update cmake/FindGeant4.cmake
ahnaf-tahmid-chowdhury Nov 30, 2023
fa54fff
find path for geant4 11+
ahnaf-tahmid-chowdhury Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 15 additions & 44 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,21 @@ on:
workflow_dispatch:
push:
paths:
- 'CI/Dockerfile'
- '.github/workflows/docker_publish.yml'
- "CI/Dockerfile"
- ".github/workflows/docker_publish.yml"
ahnaf-tahmid-chowdhury marked this conversation as resolved.
Show resolved Hide resolved

jobs:
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]
ahnaf-tahmid-chowdhury marked this conversation as resolved.
Show resolved Hide resolved

name: Installing Dependencies, Building DAGMC and running tests
steps:
Expand Down Expand Up @@ -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]
ahnaf-tahmid-chowdhury marked this conversation as resolved.
Show resolved Hide resolved

name: Pushing final images
steps:
steps:
- name: Log in to the Container registry
if: ${{ github.repository_owner == 'svalinn' }}
uses: docker/login-action@v2
Expand Down
2 changes: 1 addition & 1 deletion CI/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we need/want to update the default yet - I'll think about it as I review the rest of the PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will be testing with both

ARG UBUNTU_VERSION=20.04
ARG MOAB_BRANCH=5.3.0
ARG double_down=OFF
Expand Down
18 changes: 9 additions & 9 deletions cmake/FindGeant4.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Find Geant4 cmake config file
set(Geant4_SEARCH_DIRS)
# Is this line necessary?
set(PACKAGE_FIND_VERSION ${Geant4_FIND_VERSION})

file(GLOB Geant4_SEARCH_DIRS "${GEANT4_DIR}/lib*/Geant4-*")
ahnaf-tahmid-chowdhury marked this conversation as resolved.
Show resolved Hide resolved
string(REPLACE "\n" ";" Geant4_SEARCH_DIRS ${Geant4_SEARCH_DIRS})

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_SEARCH_DIRS}
PATHS ${Geant4_CMAKE_CONFIG}
NO_DEFAULT_PATH
)

Expand All @@ -21,11 +26,6 @@ else ()
message(FATAL_ERROR "Could not find Geant4")
endif ()

find_path(Geant4_CMAKE_CONFIG
NAMES Geant4Config.cmake
PATHS ${Geant4_SEARCH_DIRS}
NO_DEFAULT_PATH
)
if (Geant4_CMAKE_CONFIG)
set(Geant4_CMAKE_CONFIG ${Geant4_CMAKE_CONFIG}/Geant4Config.cmake)
message(STATUS "Geant4_CMAKE_CONFIG: ${Geant4_CMAKE_CONFIG}")
Expand Down Expand Up @@ -58,7 +58,7 @@ 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 required: ${Geant4_FIND_VERSION}")
message(STATUS "Geant4 version compatible: ${PACKAGE_VERSION_COMPATIBLE}")
message(STATUS "Geant4 version exact: ${PACKAGE_VERSION_EXACT}")
message(STATUS "Geant4_INCLUDE_DIRS: ${Geant4_INCLUDE_DIRS}")
Expand Down
2 changes: 1 addition & 1 deletion doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 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)
Expand Down
6 changes: 3 additions & 3 deletions src/dagmc/DagMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) const {
EntityHandle DagMC::entity_by_id(int dimension, int id) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a regression from another PR that added the const - please remove this change

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibid

EntityHandle h = entity_by_index(dimension, index);
if (!h) return 0;

Expand All @@ -883,7 +883,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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibid

return GTT->global_id(this_ent);
}

Expand Down
22 changes: 9 additions & 13 deletions src/dagmc/DagMC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a regression and removes code that was intentionally added by a subsequent PR.


ErrorCode test_volume_boundary(const EntityHandle volume,
const EntityHandle surface,
Expand Down Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should retain the const


/**\brief get number of geometric sets corresponding to geometry of specified
*dimension
Expand All @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibid


private:
/** get all group sets on the model */
Expand Down Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibid

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibid

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibid

assert(vertex_handle_idx <= dimension && groups_handle_idx >= dimension);
return entHandles[dimension].size() - 1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/dagmc/dagmcmetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an important change from another PR

// these are the keywords that dagmc will understand
// from groups if you need to process more
// they should be added here
Expand Down
6 changes: 5 additions & 1 deletion src/geant4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions src/geant4/app/include/ExN01Analysis.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#ifndef ExN01Analysis_h
#define ExN01Analysis_h 1

#ifdef GEANT4_GT_11
#include "G4AnalysisManager.hh"
#else
#include "g4root.hh"
#endif

#endif
5 changes: 4 additions & 1 deletion src/geant4/app/src/ExN01DetectorConstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ G4VPhysicalVolume* ExN01DetectorConstruction::Construct() {
// load the material from the UW^2 library
std::map<std::string, G4Material*> 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
Expand Down
6 changes: 5 additions & 1 deletion src/geant4/app/src/ExN01UserScoreWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Comment on lines +33 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't this already in an earlier PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I recall, this should be required for >10.6 and It may need to be available in earlier PR.

MeshScoreMap scMap = fScoringMesh->GetScoreMap();

// get the number of bins
Expand Down
Loading