Commit cebe18b6 authored by Dion Haefner's avatar Dion Haefner

python 3 compliance

parent 5f2ad8f3
......@@ -6,6 +6,9 @@ def read_parameter_file(in_path):
data_dict = {}
with h5py.File(in_path, 'r') as f:
attrs = dict(f["parameters"].attrs)
for k,v in attrs.items():
if isinstance(v,bytes):
attrs[k] = v.decode("utf-8")
group = attrs["parameterization"]
for key in f["parameters/{}".format(group)].keys():
data_dict[key] = np.array(f["parameters/{}/{}".format(group,key)])
......@@ -28,7 +31,7 @@ def write_parameter_file(group,data_dict,out_path,attrs=None,overwrite=False):
:param overwrite: If true, overwrite an existing file without asking
"""
print(group)
if os.path.isfile(out_path) and not overwrite:
ow = raw_input("The output file {} already exists. Overwrite? [y/N] ".format(out_path))
if not ow.lower() in ["y","yes"]:
......
......@@ -23,12 +23,12 @@ def test_dorie(iniinfo,inifile,executable):
except ImportError:
raise ValueError("Unknown test command " + test_command)
command.append(test_command)
if "_test_command_options" in iniinfo:
command.append(iniinfo["_test_command_options"])
if not "_test_target" in iniinfo:
command.append(inifile)
elif iniinfo["_test_target"] != "None":
command.append(iniinfo["_test_target"])
if "_test_command_options" in iniinfo and iniinfo["_test_command_options"] != "None":
command.append(iniinfo["_test_command_options"])
# Run DORiE and measure total execution time
start = time.clock()
......
......@@ -180,7 +180,7 @@ class VTKFile:
if variables is None:
variables = list(data.keys())
cell_centers = self.grid.cellCenters()
cell_centers = self.grid.cellCenters()
x, y = cell_centers[...,0], cell_centers[...,1]
(xt, yt), c = self.grid.triangulation()
......
message(STATUS "Handling system tests")
configure_file(CTestCustom.cmake ${CMAKE_BINARY_DIR} @ONLY)
function(dorie_add_system_test target metaini)
configure_file(${metaini}.in ${CMAKE_CURRENT_LIST_DIR}/${metaini})
dune_add_system_test(TARGET ${target} INIFILE ${metaini} SCRIPT test_dorie.py)
......@@ -10,21 +12,22 @@ function(dorie_add_system_test_dependency test1 test2)
endfunction()
# dorie run
#dorie_add_system_test(dorie ode.mini)
#dorie_add_system_test(dorie ode_higherorder.mini)
#dorie_add_system_test(dorie muphi.mini)
#dorie_add_system_test_dependency(dorie_muphi dorie-pfg_muphi_pfg)
#dorie_add_system_test(dorie reference_2d.mini)
#dorie_add_system_test(dorie reference_3d.mini)
dorie_add_system_test(dorie ode.mini)
dorie_add_system_test(dorie ode_higherorder.mini)
dorie_add_system_test(dorie muphi.mini)
dorie_add_system_test_dependency(dorie_muphi dorie-pfg_muphi_pfg)
dorie_add_system_test(dorie reference_2d.mini)
dorie_add_system_test(dorie reference_3d.mini)
# dorie pfg
#dorie_add_system_test(dorie-pfg parfield.mini)
#dorie_add_system_test(dorie-pfg parfield_muphi.mini)
dorie_add_system_test(dorie-pfg parfield.mini)
dorie_add_system_test(dorie-pfg parfield_parallel.mini)
dorie_add_system_test(dorie-pfg parfield_muphi.mini)
dorie_add_system_test(dorie-pfg correlation.mini)
# dorie plot
#dorie_add_system_test(dorie plot.mini)
#dorie_add_system_test_dependency(dorie_plot dorie_reference_2d_0000)
dorie_add_system_test(dorie plot.mini)
dorie_add_system_test_dependency(dorie_plot dorie_reference_2d_0000)
# dorie create
#dorie_add_system_test(dorie create.mini)
dorie_add_system_test(dorie create.mini)
if (NOT @HDF5_IS_PARALLEL@)
list(APPEND CTEST_CUSTOM_TESTS_IGNORE
"dorie-pfg_pfg_parallel"
)
endif (NOT @HDF5_IS_PARALLEL@)
include ${CMAKE_BINARY_DIR}/doc/default_files/parfield.ini
__name = pfg_parallel
_test_command = pfg
_test_command_options = --parallel
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_data_path = {_asset_path}/parfield-data
_evaluation = reference
[_reference]
path = {_asset_path}/references/parfield
[general]
generator = fft
outputFile = fft_parallel.h5
parameterization = vanGenuchten
overwrite = true
[generator.fft]
N = 50 50
newField = true
newEV = true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment