Skip to content
Snippets Groups Projects
Commit 5b635453 authored by Timo Koch's avatar Timo Koch
Browse files

[test][python] Add a test for the grid geometry Python bindings

parent 15d6277e
No related branches found
No related tags found
1 merge request!1985Feature/python bindings
......@@ -10,3 +10,8 @@ add_subdirectory(multidomain)
add_subdirectory(nonlinear)
add_subdirectory(porousmediumflow)
add_subdirectory(discretization)
# if Python bindings are enabled, include Python binding tests
if(DUNE_ENABLE_PYTHONBINDINGS)
add_subdirectory(python)
endif()
dune_python_add_test(NAME test_py_gridgeometry
COMMAND ${PYTHON_EXECUTABLE} test_py_gridgeometry.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
LABELS python unit)
#!/usr/bin/env python3
from dune.grid import structuredGrid
from dumux.discretization import GridGeometry
gridView = structuredGrid([0,0],[1,1],[5,5])
gridGeometry = GridGeometry(gridView, discMethod="cctpfa")
gridGeometry.update()
print("The total number of scvs is {}".format(gridGeometry.numScv()))
print("The total number of scvfs is {}".format(gridGeometry.numScvf()))
for e in gridView.elements:
fvGeometry = gridGeometry.localView()
fvGeometry.bind(e)
for scv in fvGeometry.scvs():
print("scv dofIndex: {}".format(scv.dofIndex()))
print("scv center: {}".format(scv.center()))
print("scv volume: {}".format(scv.volume()))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment