-
Notifications
You must be signed in to change notification settings - Fork 65
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 update #924
Geant4 v11 update #924
Conversation
Co-authored-by: Paul Wilson <paul.wilson@wisc.edu>
Mac testing will fail until we merge #922 |
I think, there is no need to install gcc manually. GitHub workflow already comes with built-in dev tools. |
I'm trying to skip gcc in #922 right now |
Thanks @ahnaf-tahmid-chowdhury - I've moved that change into this PR since it was such a small change. Looking for a review here from @pshriwise @shimwell @makeclean @helen-brooks ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ahnaf-tahmid-chowdhury and @gonuke for the update to a newer Geant4 version.
Mostly line comments on the Python script here.
src/geant4/generate_geant4
Outdated
@@ -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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("Error: can't find DAG file") | |
print("Error: can't find DAG file: '{}' ".format(options.dag_file)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the extra else
block at the end:
try:
fh = open(options.dag_file, 'r')
fh.close()
except IOError:
print("Error: can't find DAG file: '{}'".format(options.dag_file))
src/geant4/generate_geant4
Outdated
print("There are no materials in the h5m file!!") | ||
print("Assuming all volumes contain vacuum") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
src/geant4/generate_geant4
Outdated
@@ -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]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("dag volume names not assigned", sys.exc_info()[0]) | |
print("DAGMC volume names are not assigned", sys.exc_info()[0]) |
src/geant4/generate_geant4
Outdated
@@ -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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("Error: "+key+" file exists") | |
print("Error: {} file exists".format(key)) |
src/geant4/generate_geant4
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("Error: can't create directory, "+path) | |
print("Error: can't create directory '{}' ".format(path)) |
src/geant4/generate_geant4
Outdated
|
||
mat_tag = dag_geom.getTagHandle('NAME') | ||
dag_vol_names = [dag_materials.keys()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dag_vol_names = [dag_materials.keys()] | |
dag_vol_names = list(dag_materials.keys()) |
src/geant4/generate_geant4
Outdated
@@ -1707,9 +1657,12 @@ def _create_directory_structure(directory): | |||
_mkdir_p(directory+'/src') | |||
return | |||
|
|||
# Fix: Don't know what it does | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to remove this function?
@@ -30,7 +30,11 @@ void ExN01UserScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName, | |||
G4cout << "Dumping mesh " << fScoringMesh->GetWorldName() << " to file" | |||
<< G4endl; | |||
|
|||
// retrieve the map | |||
// retrieve the map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are also just above. We should only need this once. Might be a change inherited from the original PR.
Thanks for the review @pshriwise - I think I addressed everything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gonuke!
Note: These changes were first proposed in #907 by @ahnaf-tahmid-chowdhury. In order for the docker build process to test smoothly, a new PR is being issued with all those changes, attributed to him, but without updating the standard
linux_build_test.yml
workflow. That workflow will require the new docker images to exist first.Description
Introduce changes to support building against Geant4 v11.x
Motivation and Context
Some code API changes for Geant4 require some changes.
Changes
Supports build of newer versions of Geant4
Expected behavior
Since these changes should be backward compatible with v10 of Geant4, all tests should pass including testing on both new and old versions of Geant4