-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refactor-py-module' into 'master'
Python wheels for module and ogs binaries See merge request ogs/ogs!4263
- Loading branch information
Showing
37 changed files
with
550 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(ogs.simulator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Create OpenGeoSys python module | ||
# https://pybind11.readthedocs.io/en/stable/compiling.html#building-with-cmake | ||
pybind11_add_module( | ||
simulator MODULE ogs_python_module.cpp | ||
../../CLI/CommandLineArgumentParser.cpp | ||
) | ||
|
||
# lld linker strips out PyInit_OpenGeoSys symbol. Use standard linker. | ||
get_target_property(_link_options simulator LINK_OPTIONS) | ||
if(_link_options) | ||
list(REMOVE_ITEM _link_options -fuse-ld=lld) | ||
set_target_properties(simulator PROPERTIES LINK_OPTIONS "${_link_options}") | ||
endif() | ||
|
||
target_link_libraries( | ||
simulator PRIVATE ApplicationsLib BaseLib CMakeInfoLib GitInfoLib tclap | ||
) | ||
target_include_directories(simulator PRIVATE ../../CLI) | ||
|
||
# Install into root dir (in Python module, enables 'import ogs.simulator') | ||
install(TARGETS simulator LIBRARY DESTINATION .) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
80 changes: 80 additions & 0 deletions
80
Applications/Python/ogs/_internal/provide_ogs_cli_tools_via_wheel.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import os | ||
import platform | ||
import subprocess | ||
import sys | ||
|
||
binaries_list = [ | ||
"addDataToRaster", | ||
"AddElementQuality", | ||
"AddFaultToVoxelGrid", | ||
"AddLayer", | ||
"appendLinesAlongPolyline", | ||
"AssignRasterDataToMesh", | ||
"checkMesh", | ||
"ComputeNodeAreasFromSurfaceMesh", | ||
"computeSurfaceNodeIDsInPolygonalRegion", | ||
"constructMeshesFromGeometry", | ||
"convertGEO", | ||
"convertToLinearMesh", | ||
"convertVtkDataArrayToVtkDataArray", | ||
"CreateBoundaryConditionsAlongPolylines", | ||
"createIntermediateRasters", | ||
"createLayeredMeshFromRasters", | ||
"createMeshElemPropertiesFromASCRaster", | ||
"createNeumannBc", | ||
"createQuadraticMesh", | ||
"createRaster", | ||
"editMaterialID", | ||
"ExtractBoundary", | ||
"ExtractMaterials", | ||
"ExtractSurface", | ||
"generateGeometry", | ||
"generateMatPropsFromMatID", | ||
"generateStructuredMesh", | ||
"geometryToGmshGeo", | ||
"GMSH2OGS", | ||
"GocadSGridReader", | ||
"GocadTSurfaceReader", | ||
"identifySubdomains", | ||
"IntegrateBoreholesIntoMesh", | ||
"Layers2Grid", | ||
"MapGeometryToMeshSurface", | ||
"Mesh2Raster", | ||
"MoveGeometry", | ||
"MoveMesh", | ||
"moveMeshNodes", | ||
"mpmetis", | ||
"NodeReordering", | ||
"ogs", | ||
"OGS2VTK", | ||
"partmesh", | ||
"PVD2XDMF", | ||
"queryMesh", | ||
"Raster2Mesh", | ||
"RemoveGhostData", | ||
"removeMeshElements", | ||
"ResetPropertiesInPolygonalRegion", | ||
"reviseMesh", | ||
"scaleProperty", | ||
"swapNodeCoordinateAxes", | ||
"TecPlotTools", | ||
"tetgen", | ||
"TIN2VTK", | ||
"VTK2OGS", | ||
"VTK2TIN", | ||
"vtkdiff", | ||
"Vtu2Grid", | ||
] | ||
|
||
if "PEP517_BUILD_BACKEND" not in os.environ: | ||
OGS_BIN_DIR = os.path.join(os.path.join(os.path.dirname(__file__), "..", "bin")) | ||
|
||
if platform.system() == "Windows": | ||
os.add_dll_directory(OGS_BIN_DIR) | ||
|
||
def _program(name, args): | ||
return subprocess.run([os.path.join(OGS_BIN_DIR, name)] + args).returncode | ||
|
||
FUNC_TEMPLATE = """def {0}(): raise SystemExit(_program("{0}", sys.argv[1:]))""" | ||
for f in binaries_list: | ||
exec(FUNC_TEMPLATE.format(f)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.