Mesh

class Mesh

Base class for meshes.

Subclassed by godzilla::UnstructuredMesh

Public Functions

mpi::Communicator get_comm() const

Get the MPI comm this object works on.

DM get_dm() const

Get the underlying DM object.

Returns:

Underlying PETSc DM

Int get_dimension() const

Get the mesh spatial dimension.

Returns:

Mesh spatial dimension

void set_dimension(Int dim)

Set the topological dimension of the mesh.

Parameters:

dim – The topological dimension

bool has_label(const std::string &name) const

Check if mesh has label with a name.

Parameters:

name – The name of the label

Returns:

true if label exists, otherwise false

Label get_label(const std::string &name) const

Get label associated with a name.

Parameters:

name – Label name

Returns:

Label associated with the name

void create_label(const std::string &name) const

Create label.

Parameters:

name – Label name

void remove_label(const std::string &name)

Remove label with given name.

Parameters:

name – The label name

DM get_coordinate_dm() const

Gets the DM that prescribes coordinate layout and scatters between global and local coordinates.

Returns:

coordinate DM

Vector get_coordinates() const

Get a global vector with the coordinates associated with this mesh.

Returns:

Global coordinate vector

Vector get_coordinates_local() const

Get a local vector with the coordinates associated with this mesh.

Returns:

Coordinate vector

Section get_coordinate_section() const

Retrieve the layout of coordinate values over the mesh.

Returns:

Local section from the coordinate DM

void set_coordinate_dim(Int dim)

Set the dimension of the embedding space for coordinate values.

Parameters:

dim – The embedding dimension

void set_coordinates_local(const Vector &c)

Sets a local vector, including ghost points, that holds the coordinates.

Parameters:

c – coordinate vector

void set_up()

Sets up the data structures inside the DM object.

void set_label_value(const char *name, Int point, Int value)

Add a point to a Label with given value.

Parameters:
  • name – The label name

  • point – The mesh point

  • value – The label value for this point

void clear_label_value(const char *name, Int point, Int value)

Remove a point from a Label with given value.

Parameters:
  • name – The label name

  • point – The mesh point

  • value – The label value for this point

void view(PetscViewer viewer = PETSC_VIEWER_STDOUT_WORLD)

View the underlying DM.

Parameters:

viewer – Viewer

std::vector<int> get_neighbors() const

Gets an array containing the MPI ranks of all the process’ neighbors.

Returns:

Array of all neighboring ranks