Skip to content

Commit

Permalink
Add API for runtime remeshing.
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonis committed Nov 4, 2024
1 parent dc7e520 commit 3c5bc4d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cyprecice/Participant.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ cdef extern from "precice/Participant.hpp" namespace "precice":

void setMeshTetrahedra (const string& meshName, vector[int] vertices)

# remeshing

void resetMesh (const string& meshName)

# data access

void writeData (const string& meshName, const string& dataName, vector[int] vertices, vector[double] values)
Expand Down
36 changes: 36 additions & 0 deletions cyprecice/cyprecice.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,42 @@ cdef class Participant:

self.thisptr.setMeshTetrahedra (convert(mesh_name), cpp_vertices)

# remeshing


def reset_mesh (self, mesh_name):
"""
Resets a mesh and allows setting it using set_mesh functions again.
Parameters
----------
mesh_name : str
Name of the mesh to reset.
Notes
-----
This function is still experimental.
Please refer to the documentation on how to enable and use it.
Previous calls:
advance() been called
Examples
--------
Set mesh vertices for a 2D problem with 5 mesh vertices.
>>> positions = np.array([[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]])
>>> mesh_name = "MeshOne"
>>> vertex_ids = participant.set_mesh_vertices(mesh_name, positions)
>>> # later in the coupling loop
>>> if remeshing_required():
>>> participant.reset_mesh(mesh_name)
>>> positions = np.array([[1, 1], [3, 3], [5, 5]])
>>> vertex_ids = participant.set_mesh_vertices(mesh_name, positions)
"""

self.thisptr.resetMesh (convert(mesh_name))

# data access

def write_data (self, mesh_name, data_name, vertex_ids, values):
Expand Down

0 comments on commit 3c5bc4d

Please sign in to comment.