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

Rename executables #131

Merged
merged 7 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 12 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ endif()

find_package(MPI REQUIRED)

add_executable(preciceMap src/preciceMap.cpp src/common.cpp src/mesh.cpp src/configreader.cpp src/modes.cpp src/utilities.cpp src/logger.cpp)
target_include_directories(preciceMap PRIVATE src thirdparty)
target_link_libraries(preciceMap
add_executable(precice-aste-run src/precice-aste-run.cpp src/common.cpp src/mesh.cpp src/configreader.cpp src/modes.cpp src/utilities.cpp src/logger.cpp)
target_include_directories(precice-aste-run PRIVATE src thirdparty)
target_link_libraries(precice-aste-run
precice::precice
Threads::Threads
MPI::MPI_CXX
Expand All @@ -61,15 +61,15 @@ target_link_libraries(preciceMap
)

if(ASTE_SET_MESH_BLOCK)
target_compile_definitions(preciceMap PRIVATE ASTE_SET_MESH_BLOCK)
target_compile_definitions(precice-aste-run PRIVATE ASTE_SET_MESH_BLOCK)
endif()

if(ASTE_NN_GRADIENT_MAPPING_AND_TETRA)
target_compile_definitions(preciceMap PRIVATE ASTE_NN_GRADIENT_MAPPING_AND_TETRA)
target_compile_definitions(precice-aste-run PRIVATE ASTE_NN_GRADIENT_MAPPING_AND_TETRA)
endif()

if(METIS_FOUND)
target_link_libraries(preciceMap metisAPI)
target_link_libraries(precice-aste-run metisAPI)
endif()


Expand All @@ -87,21 +87,21 @@ if (VTK_VERSION VERSION_LESS "8.90.0")
else ()
# vtk_module_autoinit is needed
vtk_module_autoinit(
TARGETS preciceMap testing
TARGETS precice-aste-run testing
MODULES ${VTK_LIBRARIES}
)
endif()

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/partition_mesh.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/join_mesh.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/vtk_calculator.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-partition DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-join DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-evaluate DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

include(GNUInstallDirs)
install(TARGETS preciceMap DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS precice-aste-run DESTINATION ${CMAKE_INSTALL_BINDIR})
if(METIS_FOUND)
install(TARGETS metisAPI DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/src/partition_mesh.py ${CMAKE_CURRENT_SOURCE_DIR}/src/join_mesh.py ${CMAKE_CURRENT_SOURCE_DIR}/src/vtk_calculator.py DESTINATION ${CMAKE_INSTALL_BINDIR})
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-partition ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-join ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-evaluate DESTINATION ${CMAKE_INSTALL_BINDIR})

enable_testing()

Expand Down
2 changes: 1 addition & 1 deletion src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ OptionMap getOptions(int argc, char *argv[])
"mesh", po::value<std::string>(),
"Mesh prefix (i.e. mesh name without the format extension such as '.vtk' or '.vtu'). "
"Example: solution.vtk has the prefix 'solution'. "
"preciceMap will look for timeseries as well as distributed meshes (e.g. from preCICE exports) "
"precice-aste-run will look for timeseries as well as distributed meshes (e.g. from preCICE exports) "
"automatically and load them if required.")(
"output", po::value<std::string>(),
"Output file name.")(
Expand Down
2 changes: 1 addition & 1 deletion src/vtk_calculator.py → src/precice-aste-evaluate
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self) -> None:

@staticmethod
def create_logger(level):
logger = logging.getLogger("---[ASTE-Calculator]")
logger = logging.getLogger("---[ASTE-Evaluate]")
logger.setLevel(getattr(logging, level))
ch = logging.StreamHandler()
ch.setLevel(getattr(logging, level))
Expand Down
2 changes: 1 addition & 1 deletion src/join_mesh.py → src/precice-aste-join
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def parse_args():

@staticmethod
def create_logger(args):
logger = logging.getLogger("---[ASTE-Joiner]")
logger = logging.getLogger("---[ASTE-Join]")
logger.setLevel(getattr(logging, args.logging))
ch = logging.StreamHandler()
ch.setLevel(getattr(logging, args.logging))
Expand Down
2 changes: 1 addition & 1 deletion src/partition_mesh.py → src/precice-aste-partition
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def parse_arguments():

@staticmethod
def create_logger(args):
logger = logging.getLogger("---[ASTE-Partitioner]")
logger = logging.getLogger("---[ASTE-Partition]")
logger.setLevel(getattr(logging, args.logging))
ch = logging.StreamHandler()
ch.setLevel(getattr(logging, args.logging))
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions tests/example/lci_2d/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
set -e -x

# Calculate franke function on fine mesh
vtk_calculator.py -m ./fine_mesh.vtk -f "franke2d(xy)" -d "Franke Function" -o "fine_mesh_lci.vtk"
precice-aste-evaluate -m ./fine_mesh.vtk -f "franke2d(xy)" -d "Franke Function" -o "fine_mesh_lci.vtk"

# Map from the finer mesh to coarser mesh
preciceMap -v -p A --mesh fine_mesh_lci --data "Franke Function" &
preciceMap -v -p B --mesh ./coarse_mesh --output map_nn --data "InterpolatedData"
precice-aste-run -v -p A --mesh fine_mesh_lci --data "Franke Function" &
precice-aste-run -v -p B --mesh ./coarse_mesh --output map_nn --data "InterpolatedData"

# Calculate statistics
vtk_calculator.py -m map_nn.vtk -f "franke2d(xy)" -d difference --diffdata "InterpolatedData" --diff
precice-aste-evaluate -m map_nn.vtk -f "franke2d(xy)" -d difference --diffdata "InterpolatedData" --diff
8 changes: 4 additions & 4 deletions tests/example/lci_3d/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
set -e -x

# Calculate franke function on fine mesh
vtk_calculator.py -m ./fine_mesh.vtk -f "franke3d" -d "Franke Function" -o "fine_mesh_lci.vtk"
precice-aste-evaluate -m ./fine_mesh.vtk -f "franke3d" -d "Franke Function" -o "fine_mesh_lci.vtk"

# Map from the finer mesh to coarser mesh
preciceMap -v -p A --mesh fine_mesh_lci --data "Franke Function" &
preciceMap -v -p B --mesh ./coarse_mesh --output map_nn --data "InterpolatedData"
precice-aste-run -v -p A --mesh fine_mesh_lci --data "Franke Function" &
precice-aste-run -v -p B --mesh ./coarse_mesh --output map_nn --data "InterpolatedData"

# Calculate statistics
vtk_calculator.py -m map_nn.vtk -f "franke3d" -d difference --diffdata "InterpolatedData" --diff
precice-aste-evaluate -m map_nn.vtk -f "franke3d" -d difference --diffdata "InterpolatedData" --diff
8 changes: 4 additions & 4 deletions tests/example/nn/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
set -e -x

# Calculate franke function on fine mesh
vtk_calculator.py -m ../fine_mesh.vtk -f "franke3d" -d "Franke Function" -o "fine_mesh_nn.vtk"
precice-aste-evaluate -m ../fine_mesh.vtk -f "franke3d" -d "Franke Function" -o "fine_mesh_nn.vtk"

# Map from the finer mesh to coarser mesh
preciceMap -v -p A --mesh fine_mesh_nn --data "Franke Function" &
preciceMap -v -p B --mesh ../coarse_mesh --output map_nn --data "InterpolatedData"
precice-aste-run -v -p A --mesh fine_mesh_nn --data "Franke Function" &
precice-aste-run -v -p B --mesh ../coarse_mesh --output map_nn --data "InterpolatedData"

# Calculate statistics
vtk_calculator.py -m map_nn.vtk -f "franke3d" -d difference --diffdata "InterpolatedData" --diff
precice-aste-evaluate -m map_nn.vtk -f "franke3d" -d difference --diffdata "InterpolatedData" --diff
2 changes: 1 addition & 1 deletion tests/example/nng_scalar/precice-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</log>

<solver-interface dimensions="3" experimental="true">
<data:scalar name="Data" gradient="on" />
<data:scalar name="Data" />

<mesh name="A-Mesh">
<use-data name="Data" />
Expand Down
8 changes: 4 additions & 4 deletions tests/example/nng_scalar/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
set -e -x

# Calculate distance from origin on fine mesh
vtk_calculator.py -m ../fine_mesh.vtk -f "sqrt(x^2+y^2+z^2)" -d "Distance" -o "fine_mesh_nng.vtk" --gradient
precice-aste-evaluate -m ../fine_mesh.vtk -f "sqrt(x^2+y^2+z^2)" -d "Distance" -o "fine_mesh_nng.vtk" --gradient

# Map from the finer mesh to coarser mesh
preciceMap -v -p A --mesh fine_mesh_nng --data "Distance" &
preciceMap -v -p B --mesh ../coarse_mesh --output map_nng --data "InterpolatedData"
precice-aste-run -v -p A --mesh fine_mesh_nng --data "Distance" &
precice-aste-run -v -p B --mesh ../coarse_mesh --output map_nng --data "InterpolatedData"

# Calculate statistics
vtk_calculator.py -m map_nng.vtk -f "sqrt(x^2+y^2+z^2)" -d difference --diffdata "InterpolatedData" --diff
precice-aste-evaluate -m map_nng.vtk -f "sqrt(x^2+y^2+z^2)" -d difference --diffdata "InterpolatedData" --diff
2 changes: 1 addition & 1 deletion tests/example/nng_vector/precice-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</log>

<solver-interface dimensions="3" experimental="true">
<data:vector name="Data" gradient="on" />
<data:vector name="Data" />

<mesh name="A-Mesh">
<use-data name="Data" />
Expand Down
8 changes: 4 additions & 4 deletions tests/example/nng_vector/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
set -e -x

# Calculate distance from origin on fine mesh
vtk_calculator.py -m ../fine_mesh.vtk -f "sin(x)*iHat+cos(y)*jHat+z^2*kHat" -d "MyFunction" -o "fine_mesh_nng.vtk" --gradient
precice-aste-evaluate -m ../fine_mesh.vtk -f "sin(x)*iHat+cos(y)*jHat+z^2*kHat" -d "MyFunction" -o "fine_mesh_nng.vtk" --gradient

# Map from the finer mesh to coarser mesh
preciceMap -v -p A --mesh fine_mesh_nng --data "MyFunction" --vector &
preciceMap -v -p B --mesh ../coarse_mesh --output map_nng --data "InterpolatedData" --vector
precice-aste-run -v -p A --mesh fine_mesh_nng --data "MyFunction" --vector &
precice-aste-run -v -p B --mesh ../coarse_mesh --output map_nng --data "InterpolatedData" --vector

# Calculate statistics
vtk_calculator.py -m map_nng.vtk -f "sin(x)*iHat+cos(y)*jHat+z^2*kHat" -d difference --diffdata "InterpolatedData" --diff
precice-aste-evaluate -m map_nng.vtk -f "sin(x)*iHat+cos(y)*jHat+z^2*kHat" -d difference --diffdata "InterpolatedData" --diff
31 changes: 29 additions & 2 deletions tests/example/run-all.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
#!/bin/sh
#!/bin/bash
set -e -u

# Print the problmatic case and increase error count
detect_error(){
echo "Error while running case ${array[1]}"
err_count=$((err_count + 1))
}

echo "- Running all examples cases..."
test_cases=$(find . -maxdepth 2 -mindepth 2 -name run.sh)
number_of_cases=$(echo "$test_cases" | wc -w)
echo "- There are $number_of_cases case(s) found..."

# Initial directory and error count
run_all_dir=$(pwd)
err_count=0

# Run all cases
for testcase in $test_cases; do
array=($(echo "$testcase" | tr "/" "\n"))
cd "${array[1]}"
echo "- Running test case ${array[1]}..."
./run.sh || detect_error
cd "$run_all_dir"
done

find . -maxdepth 2 -mindepth 2 -name run.sh -execdir sh -c './run.sh' \;
if [ $err_count -eq 0 ]; then
echo "All tests passed"
else
echo "$err_count out of $number_of_cases failed"
exit 1
fi
10 changes: 5 additions & 5 deletions tools/mapping-tester/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def createRunScript(outdir, path, case):
)

# Generate runner script
acmd = '/usr/bin/time -f %M -a -o memory-A.log preciceMap -v -p A --data "{}" --mesh {} || kill 0 &'.format(
acmd = '/usr/bin/time -f %M -a -o memory-A.log precice-aste-run -v -p A --data "{}" --mesh {} || kill 0 &'.format(
case["function"], ameshLocation
)
if aranks > 1:
Expand All @@ -156,7 +156,7 @@ def createRunScript(outdir, path, case):
os.path.join(outdir, "meshes", bmesh, str(branks), bmesh), path
)
mapped_data_name = case["function"] + "(mapped)"
bcmd = '/usr/bin/time -f %M -a -o memory-B.log preciceMap -v -p B --data "{}" --mesh {} --output mapped || kill 0 &'.format(
bcmd = '/usr/bin/time -f %M -a -o memory-B.log precice-aste-run -v -p B --data "{}" --mesh {} --output mapped || kill 0 &'.format(
mapped_data_name, bmeshLocation
)
if branks > 1:
Expand Down Expand Up @@ -213,7 +213,7 @@ def createRunScript(outdir, path, case):
]
if branks == 1:
joincmd = "[ ! -f mapped.vtu ] || mv --update mapped.vtu mapped.vtk"
diffcmd = 'vtk_calculator.py --data error --diffdata "{1}" --diff --stats --mesh mapped.vtk --function "{0}" | tee diff.log'.format(
diffcmd = 'precice-aste-evaluate --data error --diffdata "{1}" --diff --stats --mesh mapped.vtk --function "{0}" | tee diff.log'.format(
case["function"], mapped_data_name
)
post_content += [joincmd, diffcmd]
Expand All @@ -222,10 +222,10 @@ def createRunScript(outdir, path, case):
os.path.normpath(bmeshLocation)
)
tmprecoveryFile = recoveryFileLocation + "/{}_recovery.json".format(bmesh)
joincmd = "join_mesh.py --mesh mapped -r {} -o result.vtk".format(
joincmd = "precice-aste-join --mesh mapped -r {} -o result.vtk".format(
tmprecoveryFile
)
diffcmd = 'vtk_calculator.py --data error --diffdata "{1}" --diff --stats --mesh result.vtk --function "{0}" | tee diff.log'.format(
diffcmd = 'precice-aste-evaluate --data error --diffdata "{1}" --diff --stats --mesh result.vtk --function "{0}" | tee diff.log'.format(
case["function"], mapped_data_name
)
post_content += [joincmd, diffcmd]
Expand Down
52 changes: 0 additions & 52 deletions tools/mapping-tester/plotstats.py

This file was deleted.

4 changes: 2 additions & 2 deletions tools/mapping-tester/preparemeshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def prepareMainMesh(meshdir, name, file, function, force=False):
[pathName, tmpfilename] = os.path.split(os.path.normpath(mainMesh))
subprocess.run(
[
"vtk_calculator.py",
"precice-aste-evaluate",
"--mesh",
os.path.expandvars(file),
"--function",
Expand Down Expand Up @@ -87,7 +87,7 @@ def preparePartMesh(meshdir, name, p, force=False):
[pathName, tmpfilename] = os.path.split(os.path.normpath(partMesh))
subprocess.run(
[
"partition_mesh.py",
"precice-aste-partition",
"--mesh",
mainMesh,
"--algorithm",
Expand Down