GetFEM++
5.3
|
Describe a mesh (collection of convexes (elements) and points). More...
#include <getfem_mesh.h>
Inherits bgeot::basic_mesh, getfem::context_dependencies, dal::static_stored_object, and enable_shared_from_this< mesh >.
Inherited by getfem::global_mesh_for_mesh_level_set, getfem::mesh_cache_for_Bank_basic_refine_convex, getfem::mesh_cache_for_Bank_build_green_simplexes, and getfem::torus_mesh.
Public Member Functions | |
mesh (const std::string name="") | |
Constructor. | |
void | update_from_context () const |
this function has to be defined and should update the object when the context is modified. More... | |
ref_mesh_face_pt_ct | points_of_face_of_convex (size_type ic, short_type f) const |
Return a (pseudo)container of points of face of a given convex. | |
ref_convex | convex (size_type ic) const |
return a bgeot::convex object for the convex number ic. | |
size_type | nb_points () const |
Give the number of geometrical nodes in the mesh. | |
const dal::bit_vector & | points_index () const |
Return the points index. | |
void | sup_point (size_type i) |
Delete the point of index i from the mesh if it is not linked to a convex. | |
void | swap_points (size_type i, size_type j) |
Swap the indexes of points of index i and j in the whole structure. | |
size_type | search_point (const base_node &pt, const scalar_type radius=0) const |
Search a point given its coordinates. More... | |
gmm::uint64_type | convex_version_number (size_type ic) const |
return the version number of the convex ic. | |
template<class ITER > | |
size_type | add_convex (bgeot::pgeometric_trans pgt, ITER ipts) |
Add a convex to the mesh. More... | |
template<class ITER > | |
size_type | add_convex_by_points (bgeot::pgeometric_trans pgt, ITER ipts, const scalar_type tol=scalar_type(0)) |
Add a convex to the mesh, given a geometric transformation and a list of point coordinates. More... | |
template<class ITER > | |
size_type | add_simplex (dim_type di, ITER ipts) |
Add a simplex to the mesh, given its dimension and point numbers. | |
template<class ITER > | |
size_type | add_simplex_by_points (dim_type dim, ITER ipts) |
Add a simplex to the mesh, given its dimension and point coordinates. More... | |
size_type | add_segment (size_type a, size_type b) |
Add a segment to the mesh, given the point id of its vertices. More... | |
size_type | add_segment_by_points (const base_node &pt1, const base_node &pt2) |
Add a segment to the mesh, given the coordinates of its vertices. More... | |
size_type | add_triangle (size_type a, size_type b, size_type c) |
Add a triangle to the mesh, given the point id of its vertices. More... | |
size_type | add_triangle_by_points (const base_node &p1, const base_node &p2, const base_node &p3) |
Add a triangle to the mesh, given the coordinates of its vertices. More... | |
size_type | add_tetrahedron (size_type a, size_type b, size_type c, size_type d) |
Add a tetrahedron to the mesh, given the point id of its vertices. More... | |
size_type | add_tetrahedron_by_points (const base_node &p1, const base_node &p2, const base_node &p3, const base_node &p4) |
Add a tetrahedron to the mesh, given the coordinates of its vertices. More... | |
size_type | add_pyramid (size_type a, size_type b, size_type c, size_type d, size_type e) |
Add a pyramid to the mesh, given the point id of its vertices. More... | |
template<class ITER > | |
size_type | add_parallelepiped (dim_type di, const ITER &ipts) |
Add a parallelepiped to the mesh. More... | |
template<class ITER > | |
size_type | add_parallelepiped_by_points (dim_type di, const ITER &ps) |
Add a parallelepiped to the mesh. More... | |
template<class ITER > | |
size_type | add_prism (dim_type di, const ITER &ipts) |
Add a prism to the mesh. More... | |
template<class ITER > | |
size_type | add_prism_by_points (dim_type di, const ITER &ps) |
Add a prism to the mesh. More... | |
void | sup_convex (size_type ic, bool sup_points=false) |
Delete the convex of index ic from the mesh. | |
void | swap_convex (size_type i, size_type j) |
Swap the indexes of the convex of indexes i and j in the whole structure. | |
base_small_vector | normal_of_face_of_convex (size_type ic, short_type f, const base_node &pt) const |
Return the normal of the given convex face, evaluated at the point pt. More... | |
base_matrix | local_basis_of_face_of_convex (size_type ic, short_type f, const base_node &pt) const |
Return a local basis for the convex face. More... | |
base_matrix | local_basis_of_face_of_convex (size_type ic, short_type f, size_type n) const |
Return a local basis for the convex face. More... | |
scalar_type | convex_quality_estimate (size_type ic) const |
Return an estimate of the convex quality (0 <= Q <= 1). More... | |
scalar_type | convex_area_estimate (size_type ic, size_type degree=2) const |
Return an estimate of the convex area. More... | |
virtual scalar_type | convex_radius_estimate (size_type ic) const |
Return an estimate of the convex largest dimension. More... | |
scalar_type | minimal_convex_radius_estimate () const |
Return an estimate of the convex smallest dimension. More... | |
scalar_type | maximal_convex_radius_estimate () const |
Return an estimate of the convex largest dimension. More... | |
void | translation (const base_small_vector &) |
Apply the given translation to each mesh node. More... | |
void | transformation (const base_matrix &) |
apply the given matrix transformation to each mesh node. More... | |
void | bounding_box (base_node &Pmin, base_node &Pmax) const |
Return the bounding box [Pmin - Pmax] of the mesh. More... | |
const mesh_region | region (size_type id) const |
Return the region of index 'id'. More... | |
bool | has_region (size_type s) const |
Return true if the region of index 's' exists in the mesh. | |
void | sup_region (size_type b) |
Remove the region of index b. More... | |
void | sup_convex_from_regions (size_type cv) |
Remove all references to a convex from all regions stored in the mesh. More... | |
void | optimize_structure (bool with_renumbering=true) |
Pack the mesh : renumber convexes and nodes such that there is no holes in their numbering. More... | |
const std::vector< size_type > & | cuthill_mckee_ordering () const |
Return the list of convex IDs for a Cuthill-McKee ordering. | |
void | clear () |
Erase the mesh. | |
void | write_to_file (const std::string &name) const |
Write the mesh to a file. More... | |
void | write_to_file (std::ostream &ost) const |
Write the mesh to a text stream. More... | |
void | read_from_file (const std::string &name) |
Load the mesh from a file. More... | |
void | read_from_file (std::istream &ist) |
Load the mesh from a text stream. More... | |
void | copy_from (const mesh &m) |
Clone a mesh. | |
void | Bank_refine (dal::bit_vector) |
Use the Bank strategy to refine some convexes. More... | |
Public Member Functions inherited from getfem::context_dependencies | |
bool | context_check () const |
return true if update_from_context was called | |
Describe a mesh (collection of convexes (elements) and points).
Note that mesh object have no copy constructor, use mesh::copy_from instead. This class inherits from bgeot::mesh<base_node> and bgeot::mesh_structure. Compared to bgeot::mesh, It provides some additional methods for convenience (add_simplex_by_points etc...), and it is able to send "messages" to objects that depend on it (for example getfem::mesh_fem) when something in the mesh has been modified. For example, when a convex is removed from the mesh, the mesh_fem that uses this mesh automagically removes any finite element on the convex, and renumbers the dof.
Points and convex numbering:
The numbering of points and convexes is not dynamical, which means that when a point or a convex has been removed from the mesh, there might be holes in the numbering. To loop over the set of valid points in the mesh, one should use
instead of
(same thing for the convexes, always use convex_index()).
Definition at line 95 of file getfem_mesh.h.
|
inlinevirtual |
this function has to be defined and should update the object when the context is modified.
Implements getfem::context_dependencies.
Definition at line 172 of file getfem_mesh.h.
|
inline |
Search a point given its coordinates.
pt | the point that is searched. |
Definition at line 209 of file getfem_mesh.h.
|
inline |
Add a convex to the mesh.
This methods assume that the convex nodes have already been added to the mesh.
pgt | the geometric transformation of the convex. |
ipts | an iterator to a set of point index. |
Definition at line 226 of file getfem_mesh.h.
size_type getfem::mesh::add_segment | ( | size_type | a, |
size_type | b | ||
) |
Add a segment to the mesh, given the point id of its vertices.
Definition at line 283 of file getfem_mesh.cc.
|
inline |
Add a segment to the mesh, given the coordinates of its vertices.
Definition at line 262 of file getfem_mesh.h.
size_type getfem::mesh::add_triangle | ( | size_type | a, |
size_type | b, | ||
size_type | c | ||
) |
Add a triangle to the mesh, given the point id of its vertices.
Definition at line 288 of file getfem_mesh.cc.
size_type getfem::mesh::add_triangle_by_points | ( | const base_node & | p1, |
const base_node & | p2, | ||
const base_node & | p3 | ||
) |
Add a triangle to the mesh, given the coordinates of its vertices.
Definition at line 295 of file getfem_mesh.cc.
size_type getfem::mesh::add_tetrahedron | ( | size_type | a, |
size_type | b, | ||
size_type | c, | ||
size_type | d | ||
) |
Add a tetrahedron to the mesh, given the point id of its vertices.
Definition at line 298 of file getfem_mesh.cc.
size_type getfem::mesh::add_tetrahedron_by_points | ( | const base_node & | p1, |
const base_node & | p2, | ||
const base_node & | p3, | ||
const base_node & | p4 | ||
) |
Add a tetrahedron to the mesh, given the coordinates of its vertices.
Definition at line 311 of file getfem_mesh.cc.
size_type getfem::mesh::add_pyramid | ( | size_type | a, |
size_type | b, | ||
size_type | c, | ||
size_type | d, | ||
size_type | e | ||
) |
Add a pyramid to the mesh, given the point id of its vertices.
Definition at line 304 of file getfem_mesh.cc.
base_small_vector getfem::mesh::normal_of_face_of_convex | ( | size_type | ic, |
short_type | f, | ||
const base_node & | pt | ||
) | const |
Return the normal of the given convex face, evaluated at the point pt.
ic | the convex number. |
f | the face number. |
pt | the point at which the normal is taken, in the reference convex. This point should of course be on the correspounding face of the reference convex, except if the geometric transformation is linear: in that case, the normal constant. |
Definition at line 343 of file getfem_mesh.cc.
base_matrix getfem::mesh::local_basis_of_face_of_convex | ( | size_type | ic, |
short_type | f, | ||
const base_node & | pt | ||
) | const |
Return a local basis for the convex face.
ic | the convex number. |
f | the face number. |
pt | the point coordinates. |
Definition at line 380 of file getfem_mesh.cc.
base_matrix getfem::mesh::local_basis_of_face_of_convex | ( | size_type | ic, |
short_type | f, | ||
size_type | n | ||
) | const |
Return a local basis for the convex face.
ic | the convex number. |
f | the face number. |
n | local point index in the reference convex, at which the basis will be evaluated – should be faster than the function above since it uses a bgeot::geotrans_precomp . |
Definition at line 389 of file getfem_mesh.cc.
scalar_type getfem::mesh::convex_quality_estimate | ( | size_type | ic | ) | const |
Return an estimate of the convex quality (0 <= Q <= 1).
Definition at line 409 of file getfem_mesh.cc.
scalar_type getfem::mesh::convex_area_estimate | ( | size_type | ic, |
size_type | degree = 2 |
||
) | const |
Return an estimate of the convex area.
ic | the convex number |
degree | the degree of the approximation integration method used to compute the area. |
Definition at line 401 of file getfem_mesh.cc.
|
virtual |
Return an estimate of the convex largest dimension.
Reimplemented in getfem::torus_mesh.
Definition at line 420 of file getfem_mesh.cc.
scalar_type getfem::mesh::minimal_convex_radius_estimate | ( | ) | const |
Return an estimate of the convex smallest dimension.
Definition at line 426 of file getfem_mesh.cc.
scalar_type getfem::mesh::maximal_convex_radius_estimate | ( | ) | const |
Return an estimate of the convex largest dimension.
Definition at line 435 of file getfem_mesh.cc.
void getfem::mesh::translation | ( | const base_small_vector & | V | ) |
Apply the given translation to each mesh node.
Definition at line 252 of file getfem_mesh.cc.
void getfem::mesh::transformation | ( | const base_matrix & | M | ) |
apply the given matrix transformation to each mesh node.
Definition at line 255 of file getfem_mesh.cc.
void getfem::mesh::bounding_box | ( | base_node & | Pmin, |
base_node & | Pmax | ||
) | const |
Return the bounding box [Pmin - Pmax] of the mesh.
Definition at line 261 of file getfem_mesh.cc.
|
inline |
Return the region of index 'id'.
Regions stored in mesh are updated when the mesh is modified (i.e. when a convex is removed from the mesh, it is also removed from all regions of the mesh.
Definition at line 414 of file getfem_mesh.h.
|
inline |
Remove the region of index b.
Definition at line 440 of file getfem_mesh.h.
void getfem::mesh::sup_convex_from_regions | ( | size_type | cv | ) |
Remove all references to a convex from all regions stored in the mesh.
cv | the convex number. |
Definition at line 42 of file getfem_mesh.cc.
void getfem::mesh::optimize_structure | ( | bool | with_renumbering = true | ) |
Pack the mesh : renumber convexes and nodes such that there is no holes in their numbering.
Do NOT do the Cuthill-McKee.
Definition at line 223 of file getfem_mesh.cc.
void getfem::mesh::write_to_file | ( | const std::string & | name | ) | const |
Write the mesh to a file.
The format is getfem-specific.
name | the file name. |
Definition at line 667 of file getfem_mesh.cc.
void getfem::mesh::write_to_file | ( | std::ostream & | ost | ) | const |
Write the mesh to a text stream.
ost | the stream. |
Definition at line 643 of file getfem_mesh.cc.
void getfem::mesh::read_from_file | ( | const std::string & | name | ) |
Load the mesh from a file.
name | the file name. |
Definition at line 613 of file getfem_mesh.cc.
void getfem::mesh::read_from_file | ( | std::istream & | ist | ) |
Load the mesh from a text stream.
ist | the text stream. |
Definition at line 469 of file getfem_mesh.cc.
void getfem::mesh::Bank_refine | ( | dal::bit_vector | b | ) |
Use the Bank strategy to refine some convexes.
Definition at line 1259 of file getfem_mesh.cc.