Skip to content

Commit

Permalink
modify parameters for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
aoymt committed Sep 6, 2024
1 parent ab26e43 commit ab9432b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/py2dmat/algorithm/montecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class AlgorithmBase(py2dmat.algorithm.AlgorithmBase):
x: np.ndarray
xmin: np.ndarray
xmax: np.ndarray
#xunit: np.ndarray
xstep: np.ndarray

# discrete problem
Expand Down Expand Up @@ -123,11 +122,19 @@ def __init__(self, info: py2dmat.Info,
if self.iscontinuous:
self.xmin = self.domain.min_list
self.xmax = self.domain.max_list
#self.xunit = self.domain.unit_list
if "step_list" not in info_param:
raise ValueError("ERROR: algorithm.param.step_list not specified")
self.xstep = info_param.get("step_list")

if "step_list" in info_param:
self.xstep = info_param.get("step_list")

elif "unit_list" in info_param:
# for compatibility, unit_list can also be accepted for step size.
if self.mpirank == 0:
print("WARNING: unit_list is obsolete. use step_list instead")
self.xstep = info_param.get("unit_list")
else:
# neither step_list nor unit_list is specified, report error.
# default value not assumed.
raise ValueError("ERROR: algorithm.param.step_list not specified")
else:
self.node_coordinates = np.array(self.domain.grid)[:, 1:]
self.nnodes = self.node_coordinates.shape[0]
Expand Down

0 comments on commit ab9432b

Please sign in to comment.