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 2 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.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-join.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-evaluate.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to keep the .py extension or can we omit it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can omit them. Probably the best way is to keep them in the source folder but install them without extension.

Those scripts are executed by /usr/bin/env python3 as long as python3 is installed, I should be safe.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the best way is to keep them in the source folder but install them without extension.

Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The developers can easily recognize the files from the extension. Removing the extension from the source file just makes it harder to understand I don't see any benefit. On the other hand, it does not matter whether it is a script file or binary executable for the user. Removing extension makes it closer to the "usual" executable experience.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not want have differences between the source code version and the build tree version. Let's go without the extension.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ready to merge.


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.py ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-join.py ${CMAKE_CURRENT_SOURCE_DIR}/src/precice-aste-evaluate.py 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.py
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.py
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.py
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.py -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.py -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.py -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.py -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.py -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.py -m map_nn.vtk -f "franke3d" -d difference --diffdata "InterpolatedData" --diff
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.py -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.py -m map_nng.vtk -f "sqrt(x^2+y^2+z^2)" -d difference --diffdata "InterpolatedData" --diff
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.py -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.py -m map_nng.vtk -f "sin(x)*iHat+cos(y)*jHat+z^2*kHat" -d difference --diffdata "InterpolatedData" --diff
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.py --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.py --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.py --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
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.py",
"--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.py",
"--mesh",
mainMesh,
"--algorithm",
Expand Down