DOLFIN
DOLFIN C++ interface
|
#include <Mesh.h>
Public Member Functions | |
Mesh () | |
Create empty mesh. | |
Mesh (MPI_Comm comm) | |
Create empty mesh. | |
Mesh (const Mesh &mesh) | |
Mesh (std::string filename) | |
Mesh (MPI_Comm comm, std::string filename) | |
Mesh (MPI_Comm comm, LocalMeshData &local_mesh_data) | |
~Mesh () | |
Destructor. | |
const Mesh & | operator= (const Mesh &mesh) |
std::size_t | num_vertices () const |
std::size_t | num_edges () const |
std::size_t | num_faces () const |
std::size_t | num_facets () const |
std::size_t | num_cells () const |
std::size_t | num_entities (std::size_t d) const |
std::vector< double > & | coordinates () |
const std::vector< double > & | coordinates () const |
const std::vector< unsigned int > & | cells () const |
std::size_t | num_entities_global (std::size_t dim) const |
MeshTopology & | topology () |
const MeshTopology & | topology () const |
MeshGeometry & | geometry () |
const MeshGeometry & | geometry () const |
MeshDomains & | domains () |
const MeshDomains & | domains () const |
std::shared_ptr< BoundingBoxTree > | bounding_box_tree () const |
MeshData & | data () |
const MeshData & | data () const |
CellType & | type () |
const CellType & | type () const |
Get mesh cell type (const version). | |
std::size_t | init (std::size_t dim) const |
void | init (std::size_t d0, std::size_t d1) const |
void | init () const |
Compute all entities and connectivity. | |
void | init_global (std::size_t dim) const |
Compute global indices for entity dimension dim. | |
void | clean () |
void | order () |
bool | ordered () const |
Mesh | renumber_by_color () const |
void | scale (double factor) |
void | translate (const Point &point) |
void | rotate (double angle, std::size_t axis=2) |
void | rotate (double angle, std::size_t axis, const Point &point) |
void | smooth (std::size_t num_iterations=1) |
void | smooth_boundary (std::size_t num_iterations=1, bool harmonic_smoothing=true) |
void | snap_boundary (const SubDomain &sub_domain, bool harmonic_smoothing=true) |
const std::vector< std::size_t > & | color (std::string coloring_type) const |
const std::vector< std::size_t > & | color (std::vector< std::size_t > coloring_type) const |
double | hmin () const |
double | hmax () const |
double | rmin () const |
double | rmax () const |
std::size_t | hash () const |
std::string | str (bool verbose) const |
const std::vector< int > & | cell_orientations () const |
void | init_cell_orientations (const Expression &global_normal) |
MPI_Comm | mpi_comm () const |
std::string | ghost_mode () const |
![]() | |
Variable () | |
Create unnamed variable. | |
Variable (const std::string name, const std::string label) | |
Create variable with given name and label. | |
Variable (const Variable &variable) | |
Copy constructor. | |
virtual | ~Variable () |
Destructor. | |
const Variable & | operator= (const Variable &variable) |
Assignment operator. | |
void | rename (const std::string name, const std::string label) |
Rename variable. | |
std::string | name () const |
Return name. | |
std::string | label () const |
Return label (description) | |
std::size_t | id () const |
![]() | |
Hierarchical (Mesh &self) | |
Constructor. | |
virtual | ~Hierarchical () |
Destructor. | |
std::size_t | depth () const |
bool | has_parent () const |
bool | has_child () const |
Mesh & | parent () |
const Mesh & | parent () const |
Return parent in hierarchy (const version). | |
std::shared_ptr< Mesh > | parent_shared_ptr () |
std::shared_ptr< const Mesh > | parent_shared_ptr () const |
Return shared pointer to parent (const version). | |
Mesh & | child () |
const Mesh & | child () const |
Return child in hierarchy (const version). | |
std::shared_ptr< Mesh > | child_shared_ptr () |
std::shared_ptr< const Mesh > | child_shared_ptr () const |
Return shared pointer to child (const version). | |
Mesh & | root_node () |
const Mesh & | root_node () const |
Return root node object in hierarchy (const version). | |
std::shared_ptr< Mesh > | root_node_shared_ptr () |
std::shared_ptr< const Mesh > | root_node_shared_ptr () const |
Return shared pointer to root node object in hierarchy (const version). | |
Mesh & | leaf_node () |
const Mesh & | leaf_node () const |
Return leaf node object in hierarchy (const version). | |
std::shared_ptr< Mesh > | leaf_node_shared_ptr () |
std::shared_ptr< const Mesh > | leaf_node_shared_ptr () const |
Return shared pointer to leaf node object in hierarchy (const version). | |
void | set_parent (std::shared_ptr< Mesh > parent) |
Set parent. | |
void | clear_child () |
Clear child. | |
void | set_child (std::shared_ptr< Mesh > child) |
Set child. | |
const Hierarchical & | operator= (const Hierarchical &hierarchical) |
Assignment operator. | |
void | _debug () const |
Function useful for debugging the hierarchy. | |
Friends | |
class | MeshEditor |
class | TopologyComputation |
class | MeshPartitioning |
Mesh | create_mesh (Function &coordinates) |
Additional Inherited Members | |
![]() | |
Parameters | parameters |
Parameters. | |
A Mesh consists of a set of connected and numbered mesh entities.
Both the representation and the interface are dimension-independent, but a concrete interface is also provided for standard named mesh entities:
Entity | Dimension | Codimension |
---|---|---|
Vertex | 0 | |
Edge | 1 | |
Face | 2 | |
Facet | 1 | |
Cell | 0 |
When working with mesh iterators, all entities and connectivity are precomputed automatically the first time an iterator is created over any given topological dimension or connectivity.
Note that for efficiency, only entities of dimension zero (vertices) and entities of the maximal dimension (cells) exist when creating a Mesh. Other entities must be explicitly created by calling init(). For example, all edges in a mesh may be created by a call to mesh.init(1). Similarly, connectivities such as all edges connected to a given vertex must also be explicitly created (in this case by a call to mesh.init(0, 1)).
|
explicit |
Create mesh from data file.
filename | (std::string) Name of file to load. |
Mesh::Mesh | ( | MPI_Comm | comm, |
std::string | filename | ||
) |
Create mesh from data file.
comm | (MPI_Comm) The MPI communicator |
filename | (std::string) Name of file to load. |
Mesh::Mesh | ( | MPI_Comm | comm, |
LocalMeshData & | local_mesh_data | ||
) |
Create a distributed mesh from local (per process) data.
comm | (MPI_Comm) MPI communicator for the mesh. |
local_mesh_data | (LocalMeshData) Data from which to build the mesh. |
std::shared_ptr< BoundingBoxTree > Mesh::bounding_box_tree | ( | ) | const |
Get bounding box tree for mesh. The bounding box tree is initialized and built upon the first call to this function. The bounding box tree can be used to compute collisions between the mesh and other objects. It is the responsibility of the caller to use (and possibly rebuild) the tree. It is stored as a (mutable) member of the mesh to enable sharing of the bounding box tree data structure.
const std::vector< int > & Mesh::cell_orientations | ( | ) | const |
Return cell_orientations (const version)
Map from cell index to orientation of cell. Is empty if cell orientations have not been computed.
|
inline |
Get cell connectivity.
void Mesh::clean | ( | ) |
Clean out all auxiliary topology data. This clears all topological data, except the connectivity between cells and vertices.
const std::vector< std::size_t > & Mesh::color | ( | std::string | coloring_type | ) | const |
Color the cells of the mesh such that no two neighboring cells share the same color. A colored mesh keeps a MeshFunction<std::size_t> named "cell colors" as mesh data which holds the colors of the mesh.
coloring_type | (std::string) Coloring type, specifying what relation makes two cells neighbors, can be one of "vertex", "edge" or "facet". |
const std::vector< std::size_t > & Mesh::color | ( | std::vector< std::size_t > | coloring_type | ) | const |
Color the cells of the mesh such that no two neighboring cells share the same color. A colored mesh keeps a MeshFunction<std::size_t> named "cell colors" as mesh data which holds the colors of the mesh.
coloring_type | (std::vector<std::size_t>&) Coloring type given as list of topological dimensions, specifying what relation makes two mesh entities neighbors. |
|
inline |
Get vertex coordinates.
|
inline |
Return coordinates of all vertices (const version).
MeshData & Mesh::data | ( | ) |
Get mesh data.
const MeshData & Mesh::data | ( | ) | const |
Get mesh data (const version).
|
inline |
Get mesh (sub)domains.
|
inline |
Get mesh (sub)domains (const).
|
inline |
Get mesh geometry.
|
inline |
Get mesh geometry (const version).
std::string Mesh::ghost_mode | ( | ) | const |
Ghost mode used for partitioning. Possible values are same as parameters["ghost_mode"]
. WARNING: the interface may change in future without deprecation; the method is now intended for internal library use.
std::size_t Mesh::hash | ( | ) | const |
Compute hash of mesh, currently based on the has of the mesh geometry and mesh topology.
double Mesh::hmax | ( | ) | const |
Compute maximum cell size in mesh, measured greatest distance between any two vertices of a cell.
double Mesh::hmin | ( | ) | const |
Compute minimum cell size in mesh, measured greatest distance between any two vertices of a cell.
std::size_t Mesh::init | ( | std::size_t | dim | ) | const |
Compute entities of given topological dimension.
dim | (std::size_t) Topological dimension. |
void Mesh::init | ( | std::size_t | d0, |
std::size_t | d1 | ||
) | const |
Compute connectivity between given pair of dimensions.
d0 | (std::size_t) Topological dimension. |
d1 | (std::size_t) Topological dimension. |
void Mesh::init_cell_orientations | ( | const Expression & | global_normal | ) |
Compute and initialize cell_orientations relative to a given global outward direction/normal/orientation. Only defined if mesh is orientable.
global_normal | (Expression) A global normal direction to the mesh |
|
inline |
Get number of cells in mesh.
|
inline |
Get number of edges in mesh.
|
inline |
Get number of entities of given topological dimension.
d | (std::size_t) Topological dimension. |
|
inline |
Get global number of entities of given topological dimension.
dim | (std::size_t) Topological dimension. |
|
inline |
Get number of faces in mesh.
|
inline |
Get number of facets in mesh.
|
inline |
Get number of vertices in mesh.
void Mesh::order | ( | ) |
Order all mesh entities.
See also: UFC documentation (put link here!)
bool Mesh::ordered | ( | ) | const |
Check if mesh is ordered according to the UFC numbering convention.
dolfin::Mesh Mesh::renumber_by_color | ( | ) | const |
Renumber mesh entities by coloring. This function is currently restricted to renumbering by cell coloring. The cells (cell-vertex connectivity) and the coordinates of the mesh are renumbered to improve the locality within each color. It is assumed that the mesh has already been colored and that only cell-vertex connectivity exists as part of the mesh.
double Mesh::rmax | ( | ) | const |
Compute maximum cell inradius.
double Mesh::rmin | ( | ) | const |
Compute minimum cell inradius.
void Mesh::rotate | ( | double | angle, |
std::size_t | axis = 2 |
||
) |
Rotate mesh around a coordinate axis through center of mass of all mesh vertices
angle | (double) The number of degrees (0-360) of rotation. |
axis | (std::size_t) The coordinate axis around which to rotate the mesh. |
void Mesh::rotate | ( | double | angle, |
std::size_t | axis, | ||
const Point & | point | ||
) |
Rotate mesh around a coordinate axis through a given point
angle | (double) The number of degrees (0-360) of rotation. |
axis | (std::size_t) The coordinate axis around which to rotate the mesh. |
point | (Point) The point around which to rotate the mesh. |
void Mesh::scale | ( | double | factor | ) |
Scale mesh coordinates with given factor.
Arguments factor (double) The factor defining the scaling.
void Mesh::smooth | ( | std::size_t | num_iterations = 1 | ) |
Smooth internal vertices of mesh by local averaging.
num_iterations | (std::size_t) Number of iterations to perform smoothing, default value is 1. |
void Mesh::smooth_boundary | ( | std::size_t | num_iterations = 1 , |
bool | harmonic_smoothing = true |
||
) |
Smooth boundary vertices of mesh by local averaging.
num_iterations | (std::size_t) Number of iterations to perform smoothing, default value is 1. |
harmonic_smoothing | (bool) Flag to turn on harmonics smoothing, default value is true. |
void Mesh::snap_boundary | ( | const SubDomain & | sub_domain, |
bool | harmonic_smoothing = true |
||
) |
|
virtual |
Informal string representation.
verbose | (bool) Flag to turn on additional output. |
Reimplemented from dolfin::Variable.
|
inline |
Get mesh topology.
|
inline |
Get mesh topology (const version).
void Mesh::translate | ( | const Point & | point | ) |
Translate mesh according to a given vector.
point | (Point) The vector defining the translation. |
|
inline |
Get mesh cell type.
Creates mesh from coordinate function
Topology is given by underlying mesh of the function space and geometry is given by function values. Hence resulting mesh geometry has a degree of the function space degree. Geometry of function mesh is ignored.
Mesh connectivities d-0, d-1, ..., d-r are built on function mesh (where d is topological dimension of the mesh and r is maximal dimension of entity associated with any coordinate node). Consider clearing unneeded connectivities when finished.