Skip to content

Commit

Permalink
this seems to work
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Mar 24, 2024
1 parent 7dd8e15 commit 63dfc98
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
2 changes: 2 additions & 0 deletions Exec/Make.auto_source
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ AUTO_BUILD_SOURCES += $(CASTRO_AUTO_SOURCE_DIR)/castro_params.H

CPP_PARAMETERS := $(TOP)/Source/driver/_cpp_parameters

$(CASTRO_AUTO_SOURCE_DIR)/runtime_params.cpp: $(CASTRO_AUTO_SOURCE_DIR)/castro_params.H

$(CASTRO_AUTO_SOURCE_DIR)/castro_params.H: $(CPP_PARAMETERS)
@if [ ! -d $(CASTRO_AUTO_SOURCE_DIR) ]; then mkdir -p $(CASTRO_AUTO_SOURCE_DIR); fi
PYTHONPATH=$(MICROPHYSICS_HOME)/util/build_scripts $(TOP)/Source/driver/parse_castro_params.py -o $(CASTRO_AUTO_SOURCE_DIR) $(CPP_PARAMETERS)
Expand Down
1 change: 0 additions & 1 deletion Source/diffusion/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ CEXE_sources += diffusion_util.cpp

CEXE_sources += Castro_diffusion.cpp
CEXE_sources += Diffusion.cpp
CEXE_sources += diffusion_params.cpp
CEXE_headers += Diffusion.H
2 changes: 1 addition & 1 deletion Source/driver/Make.package
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# these are the files that should be needed for any Castro build

CEXE_sources += Castro.cpp
CEXE_sources += castro_params.cpp
CEXE_sources += runtime_params.cpp
CEXE_sources += Castro_advance.cpp
CEXE_sources += Castro_advance_ctu.cpp
ifeq ($(USE_TRUE_SDC), TRUE)
Expand Down
29 changes: 19 additions & 10 deletions Source/driver/parse_castro_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,25 @@ def write_headers_and_source(params, out_directory, struct_name):

jo.close()

# write the C++ source file that actually defines the parameters
try:
pf = open(f"{out_directory}/{nm}_params.cpp", "w", encoding="UTF-8")
except OSError:
sys.exit(f"unable to open {nm}_params.cpp")
# write a single C++ source file that actually defines the parameters
# (one file for all namespaces)
try:
pf = open(f"{out_directory}/runtime_params.cpp", "w", encoding="UTF-8")
except OSError:
sys.exit(f"unable to open runtime_params.cpp")

pf.write("#include <AMReX_REAL.H>\n")
pf.write("#include <AMReX_Gpu.H>\n")
pf.write("#include <castro_limits.H>\n\n")

pf.write("#include <AMReX_REAL.H>\n")
pf.write("#include <AMReX_Gpu.H>\n")
pf.write("#include <castro_limits.H>\n\n")
pf.write(f"#include <{nm}_params.H>\n\n")
for nm in namespaces:
pf.write(f"#include <{nm}_params.H>\n")
pf.write("\n")

for nm in namespaces:
params_nm = [q for q in params if q.namespace == nm]
# sort by repr since None may be present
ifdefs = sorted({q.ifdef for q in params_nm}, key=repr)

pf.write(f"namespace {nm} {{\n")

Expand All @@ -236,7 +245,7 @@ def write_headers_and_source(params, out_directory, struct_name):
pf.write("#endif\n")
pf.write("}\n\n")

pf.close()
pf.close()

# now write a single file that contains all of the parameter structs
try:
Expand Down
1 change: 0 additions & 1 deletion Source/gravity/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# this is included if USE_GRAV = TRUE

CEXE_sources += Gravity.cpp
CEXE_sources += gravity_params.cpp
CEXE_headers += Gravity.H
CEXE_headers += Gravity_util.H
CEXE_headers += Castro_gravity.H
Expand Down
2 changes: 0 additions & 2 deletions Source/radiation/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ CEXE_sources += HypreExtMultiABec.cpp
CEXE_sources += HypreMultiABec.cpp
CEXE_sources += HypreABec.cpp
CEXE_sources += Radiation.cpp
CEXE_sources += radiation_params.cpp
CEXE_sources += radsolve_params.cpp
CEXE_sources += RadSolve.cpp
CEXE_sources += RadBndry.cpp
CEXE_sources += RadMultiGroup.cpp
Expand Down

0 comments on commit 63dfc98

Please sign in to comment.