Flow123d
3.9.0-094ba6f5a
|
#include <mesh.h>
Classes | |
struct | ElementTmpData |
Public Types | |
enum | IntersectionSearch { BIHsearch = 1, BIHonly = 2, BBsearch = 3 } |
Types of search algorithm for finding intersection candidates. More... | |
enum | { x_coord =0, y_coord =1, z_coord =2 } |
typedef enum Mesh::IntersectionSearch | IntersectionSearch |
Types of search algorithm for finding intersection candidates. More... | |
Public Member Functions | |
TYPEDEF_ERR_INFO (EI_ElemLast, int) | |
TYPEDEF_ERR_INFO (EI_ElemNew, int) | |
TYPEDEF_ERR_INFO (EI_RegLast, std::string) | |
TYPEDEF_ERR_INFO (EI_RegNew, std::string) | |
TYPEDEF_ERR_INFO (EI_Region, std::string) | |
TYPEDEF_ERR_INFO (EI_RegIdx, unsigned int) | |
TYPEDEF_ERR_INFO (EI_Dim, unsigned int) | |
TYPEDEF_ERR_INFO (EI_DimOther, unsigned int) | |
TYPEDEF_ERR_INFO (EI_Quality, double) | |
DECLARE_EXCEPTION (ExcDuplicateBoundary,<< "Duplicate boundary elements! \n"<< "Element id: "<< EI_ElemLast::val<< " on region name: "<< EI_RegLast::val<< "\n"<< "Element id: "<< EI_ElemNew::val<< " on region name: "<< EI_RegNew::val<< "\n") | |
DECLARE_EXCEPTION (ExcElmWrongOrder,<< "Element IDs in non-increasing order, ID: "<< EI_ElemId::val<< "\n") | |
DECLARE_EXCEPTION (ExcRegionElmDiffDim,<< "User defined region "<< EI_Region::qval<< " (id "<< EI_RegIdx::val<< ") by 'From_Elements' cannot have elements of different dimensions.\n"<< "Thrown due to: dim "<< EI_Dim::val<< " neq dim "<< EI_DimOther::val<< " (ele id "<< EI_ElemId::val<< ").\n"<< "Split elements by dim, create separate regions and then possibly use Union.\n") | |
DECLARE_EXCEPTION (ExcBadElement,<< "Extremely bad quality element ID="<< EI_ElemId::val<< ",("<< EI_Quality::val<< "<4*epsilon).\n") | |
DECLARE_EXCEPTION (ExcBdrElemMatchRegular,<< "Boundary element (id: "<< EI_ElemId::val<< ") match a regular element (id: "<< EI_ElemIdOther::val<< ") of lower dimension.\n") | |
Mesh () | |
Mesh (Input::Record in_record, MPI_Comm com=MPI_COMM_WORLD) | |
Mesh (Mesh &other) | |
~Mesh () override | |
Destructor. More... | |
unsigned int | n_boundaries () const |
Boundary | boundary (uint edge_idx) const override |
unsigned int | n_corners () |
Partitioning * | get_part () override |
const LongIdx * | get_local_part () override |
Distribution * | get_node_ds () const |
LongIdx * | get_node_4_loc () const |
unsigned int | n_local_nodes () const |
MPI_Comm | get_comm () const |
MixedMeshIntersections & | mixed_intersections () |
unsigned int | n_sides () const |
void | read_gmsh_from_stream (istream &in) |
void | init_from_input () |
void | setup_topology () |
void | elements_id_maps (vector< LongIdx > &bulk_elements_id, vector< LongIdx > &boundary_elements_id) const |
std::shared_ptr< EquivalentMeshMap > | check_compatible_mesh (Mesh &input_mesh) override |
void | read_regions_from_input (Input::Array region_list) |
void | check_and_finish () |
std::vector< BoundingBox > | get_element_boxes () |
Compute bounding boxes of elements contained in mesh. More... | |
const BIHTree & | get_bih_tree () |
Getter for BIH. Creates and compute BIH at first call. More... | |
void | add_node (unsigned int node_id, arma::vec3 coords) |
Add new node of given id and coordinates to mesh. More... | |
void | add_element (unsigned int elm_id, unsigned int dim, unsigned int region_id, unsigned int partition_id, std::vector< unsigned int > node_ids) |
Add new element of given id to mesh. More... | |
void | add_physical_name (unsigned int dim, unsigned int id, std::string name) |
Add new node of given id and coordinates to mesh. More... | |
FilePath | mesh_file () |
Return FilePath object representing "mesh_file" input key. More... | |
IntersectionSearch | get_intersection_search () |
Getter for input type selection for intersection search algorithm. More... | |
double | global_snap_radius () const |
Maximal distance of observe point from Mesh relative to its size. More... | |
int | node_index (int node_id) const |
For node of given node_id returns index in element_vec_ or (-1) if node doesn't exist. More... | |
BCMesh * | bc_mesh () const override |
Implement MeshBase::bc_mesh(), getter of boundary mesh. More... | |
Public Member Functions inherited from MeshBase | |
TYPEDEF_ERR_INFO (EI_ElemId, int) | |
TYPEDEF_ERR_INFO (EI_ElemIdOther, int) | |
DECLARE_EXCEPTION (ExcTooMatchingIds,<< "Mesh: Duplicate dim-join lower dim elements: "<< EI_ElemId::val<< ", "<< EI_ElemIdOther::val<< ".\n") | |
MeshBase () | |
virtual | ~MeshBase () |
unsigned int | n_elements () const |
unsigned int | n_edges () const |
unsigned int | n_vb_neighbours () const |
Distribution * | get_el_ds () const |
LongIdx * | get_el_4_loc () const |
LongIdx * | get_row_4_el () const |
const Element & | element (unsigned idx) const |
Edge | edge (uint edge_idx) const |
Return edge with given index. More... | |
const Neighbour & | vb_neighbour (unsigned int nb) const |
Return neighbour with given index. More... | |
int | find_elem_id (unsigned int pos) const |
Return element id (in GMSH file) of element of given position in element vector. More... | |
unsigned int | max_edge_sides (unsigned int dim) const |
const DuplicateNodes * | duplicate_nodes () const |
const vector< vector< unsigned int > > & | node_elements () |
int | find_node_id (unsigned int pos) const |
Return node id (in GMSH file) of node of given position in node vector. More... | |
void | check_element_size (unsigned int elem_idx) const |
Check if given index is in element_vec_. More... | |
const std::vector< unsigned int > & | get_side_nodes (unsigned int dim, unsigned int side) const |
unsigned int | n_nodes () const |
const RegionDB & | region_db () const |
NodeAccessor< 3 > | node (unsigned int idx) const |
Create and return NodeAccessor to node of given idx. More... | |
ElementAccessor< 3 > | element_accessor (unsigned int idx) const |
Create and return ElementAccessor to element of given idx. More... | |
Range< ElementAccessor< 3 > > | elements_range () const |
Returns range of mesh elements. More... | |
Range< NodeAccessor< 3 > > | node_range () const |
Returns range of nodes. More... | |
Range< Edge > | edge_range () const |
Return range of edges. More... | |
void | intersect_element_lists (vector< unsigned int > const &nodes_list, vector< unsigned int > &intersection_element_list) |
int | elem_index (int elem_id) const |
For element of given elem_id returns index in element_vec_ or (-1) if element doesn't exist. More... | |
void | init_element_vector (unsigned int size) |
Initialize element_vec_, set size and reset counters of boundary and bulk elements. More... | |
void | init_node_vector (unsigned int size) |
Initialize node_vec_, set size. More... | |
const std::vector< unsigned int > & | node_permutations () const |
Return permutation vector of nodes. More... | |
const std::vector< unsigned int > & | element_permutations () const |
Return permutation vector of elements. More... | |
Static Public Member Functions | |
static const Input::Type::Selection & | get_input_intersection_variant () |
The definition of input record for selection of variant of file format. More... | |
static const Input::Type::Record & | get_input_type () |
Public Attributes | |
vector< BoundaryData > | boundary_ |
std::shared_ptr< MixedMeshIntersections > | intersections |
vector< vector< unsigned int > > | master_elements |
int | n_insides |
int | n_exsides |
int | n_sides_ |
Public Attributes inherited from MeshBase | |
vector< vector< unsigned int > > | node_elements_ |
For each node the vector contains a list of elements that use this node. More... | |
vector< vector< vector< unsigned int > > > | side_nodes |
Protected Member Functions | |
void | init () |
void | make_neighbours_and_edges () |
void | element_to_neigh_vb () |
void | count_element_types () |
void | count_side_types () |
void | check_mesh_on_read () |
void | modify_element_ids (const RegionDB::MapElementIDToRegionID &map) |
void | init_element (Element *ele, unsigned int elm_id, unsigned int dim, RegionIdx region_idx, unsigned int partition_id, std::vector< unsigned int > node_ids) |
Initialize element. More... | |
void | output_internal_ngh_data () |
Output of neighboring data into raw output. More... | |
void | optimize () |
void | sort_permuted_nodes_elements (std::vector< int > new_node_ids, std::vector< int > new_elem_ids) |
Sort elements and nodes by order stored in permutation vectors. More... | |
unsigned int | check_compatible_elements (MeshBase *source_mesh, MeshBase *target_mesh, const std::vector< unsigned int > &node_ids, std::vector< LongIdx > &map) |
Protected Member Functions inherited from MeshBase | |
void | canonical_faces () |
void | create_node_element_lists () |
Element * | add_element_to_vector (int id, bool is_boundary=false) |
Adds element to mesh data structures (element_vec_, element_ids_), returns pointer to this element. More... | |
bool | find_lower_dim_element (vector< unsigned int > &element_list, unsigned int dim, unsigned int &element_idx) |
bool | same_sides (const SideIter &si, vector< unsigned int > &side_nodes) |
Protected Attributes | |
unsigned int | n_bb_neigh |
unsigned int | n_vb_neigh |
bool | optimize_memory_locality |
std::shared_ptr< Partitioning > | part_ |
std::shared_ptr< BIHTree > | bih_tree_ |
Input::Record | in_record_ |
MPI_Comm | comm_ |
Protected Attributes inherited from MeshBase | |
vector< Element > | element_vec_ |
BidirectionalMap< int > | element_ids_ |
Maps element ids to indexes into vector element_vec_. More... | |
std::vector< EdgeData > | edges |
Vector of MH edges, this should not be part of the geometrical mesh. More... | |
vector< Neighbour > | vb_neighbours_ |
Vector of compatible neighbourings. More... | |
unsigned int | max_edge_sides_ [3] |
Maximal number of sides per one edge in the actual mesh (set in make_neighbours_and_edges()). More... | |
shared_ptr< Armor::Array< double > > | nodes_ |
shared_ptr< BidirectionalMap< int > > | node_ids_ |
Maps node ids to indexes into vector node_vec_. More... | |
std::vector< unsigned int > | node_permutation_ |
Vector of node permutations of optimized mesh (see class MeshOptimizer) More... | |
std::vector< unsigned int > | elem_permutation_ |
Vector of element permutations of optimized mesh (see class MeshOptimizer) More... | |
std::array< std::array< uint, 4 >, 64 > | element_nodes_original_ |
LongIdx * | row_4_el |
Index set assigning to global element index the local index used in parallel vectors. More... | |
LongIdx * | el_4_loc |
Index set assigning to local element index its global index. More... | |
Distribution * | el_ds |
Parallel distribution of elements. More... | |
DuplicateNodes * | duplicate_nodes_ |
std::shared_ptr< RegionDB > | region_db_ |
Private Member Functions | |
void | distribute_nodes () |
Fill array node_4_loc_ and create object node_ds_ according to element distribution. More... | |
Private Attributes | |
LongIdx * | node_4_loc_ |
Index set assigning to local node index its global index. More... | |
Distribution * | node_ds_ |
Parallel distribution of nodes. Depends on elements distribution. More... | |
unsigned int | n_local_nodes_ |
Hold number of local nodes (own + ghost), value is equal with size of node_4_loc array. More... | |
BCMesh * | bc_mesh_ |
Boundary mesh, object is created only if it's necessary. More... | |
Friends | |
class | Edge |
class | Side |
class | RegionSetBase |
class | Element |
class | BIHTree |
class | Boundary |
class | BCMesh |
template<int spacedim> | |
class | ElementAccessor |
template<int spacedim> | |
class | NodeAccessor |
Additional Inherited Members | |
Static Public Attributes inherited from MeshBase | |
static const unsigned int | undef_idx =-1 |
typedef enum Mesh::IntersectionSearch Mesh::IntersectionSearch |
Types of search algorithm for finding intersection candidates.
anonymous enum |
Labels for coordinate indexes in arma::vec3 representing vectors and points.
Enumerator | |
---|---|
x_coord | |
y_coord | |
z_coord |
Mesh::Mesh | ( | ) |
Mesh::Mesh | ( | Input::Record | in_record, |
MPI_Comm | com = MPI_COMM_WORLD |
||
) |
void Mesh::add_element | ( | unsigned int | elm_id, |
unsigned int | dim, | ||
unsigned int | region_id, | ||
unsigned int | partition_id, | ||
std::vector< unsigned int > | node_ids | ||
) |
void Mesh::add_node | ( | unsigned int | node_id, |
arma::vec3 | coords | ||
) |
void Mesh::add_physical_name | ( | unsigned int | dim, |
unsigned int | id, | ||
std::string | name | ||
) |
|
inlineoverridevirtual |
Implement MeshBase::bc_mesh(), getter of boundary mesh.
Implements MeshBase.
Definition at line 566 of file mesh.h.
void Mesh::check_and_finish | ( | ) |
|
protected |
Looks for the same (compatible) elements between the source_mesh
and target_mesh
. Auxiliary function for check_compatible_mesh(). Uses the nodal mapping node_ids
. Fills the element mapping map
. Returns the number of compatible elements.
Definition at line 984 of file mesh.cc.
|
overridevirtual |
|
protected |
|
protected |
|
protected |
Mesh::DECLARE_EXCEPTION | ( | ExcBadElement | , |
<< "Extremely bad quality element | ID = "<< EI_ElemId::val<< " , |
||
("<< EI_Quality::val<< "< 4 *epsilon).\n" | |||
) |
Mesh::DECLARE_EXCEPTION | ( | ExcBdrElemMatchRegular | , |
<< "Boundary element (id: "<< EI_ElemId::val<< ") match a regular element (id: "<< EI_ElemIdOther::val<< ") of lower dimension.\n" | |||
) |
Mesh::DECLARE_EXCEPTION | ( | ExcDuplicateBoundary | , |
<< "Duplicate boundary elements! \n"<< "Element id: "<< EI_ElemLast::val<< " on region name: "<< EI_RegLast::val<< "\n"<< "Element id: "<< EI_ElemNew::val<< " on region name: "<< EI_RegNew::val<< "\n" | |||
) |
Mesh::DECLARE_EXCEPTION | ( | ExcElmWrongOrder | , |
<< "Element IDs in non-increasing | order, | ||
ID:"<< EI_ElemId::val<< "\n" | |||
) |
Mesh::DECLARE_EXCEPTION | ( | ExcRegionElmDiffDim | , |
<< "User defined region "<< EI_Region::qval<< " (id "<< EI_RegIdx::val<< ") by 'From_Elements' cannot have elements of different dimensions.\n"<< "Thrown due to: dim "<< EI_Dim::val<< " neq dim "<< EI_DimOther::val<< " (ele id "<< EI_ElemId::val<< ").\n"<< "Split elements by | dim, | ||
create separate regions and then possibly use Union.\n" | |||
) |
|
private |
|
protected |
const BIHTree & Mesh::get_bih_tree | ( | ) |
|
inline |
std::vector< BoundingBox > Mesh::get_element_boxes | ( | ) |
|
static |
|
static |
Mesh::IntersectionSearch Mesh::get_intersection_search | ( | ) |
|
overridevirtual |
|
inline |
|
inline |
|
overridevirtual |
Returns pointer to partitioning object. Partitioning is created during setup_topology.
Implements MeshBase.
Definition at line 334 of file mesh.cc.
double Mesh::global_snap_radius | ( | ) | const |
|
protected |
Part of the constructor whichdoes not depedn on input record. Initializes node-side numbering according to RefElement.
Definition at line 281 of file mesh.cc.
|
protected |
void Mesh::init_from_input | ( | ) |
Reads input record, creates regions, read the mesh, setup topology. creates region sets.
|
protected |
This replaces read_neighbours() in order to avoid using NGH preprocessor.
TODO:
Avoid maps:
5) need not to have temporary array for Edges, only postpone setting pointers in elements and set them after edges are found; we can temporary save Edge index instead of pointer in Neigbours and elements
6) Try replace Edge * by indexes in Neigbours and elements (anyway we have mesh pointer in elements so it is accessible also from Neigbours)
TODO:
Definition at line 623 of file mesh.cc.
|
inline |
MixedMeshIntersections & Mesh::mixed_intersections | ( | ) |
|
protected |
Possibly modify region id of elements sets by user in "regions" part of input file.
TODO: This method needs check in issue 'Review mesh setting'. Changes have been done during generalized region key and may be causing problems during the further development.
Definition at line 345 of file mesh.cc.
|
inline |
unsigned int Mesh::n_sides | ( | ) | const |
|
inline |
|
protected |
Apply functionality of MeshOptimizer to sort nodes and elements.
Use Hilbert curve, need call sort_permuted_nodes_elements method.
Definition at line 482 of file mesh.cc.
|
protected |
void Mesh::read_gmsh_from_stream | ( | istream & | in | ) |
Reads mesh from stream.
Method is especially used in unit tests.
void Mesh::read_regions_from_input | ( | Input::Array | region_list | ) |
Reads elements and their affiliation to regions and region sets defined by user in input file Format of input record is defined in method RegionSetBase::get_input_type()
region_list | Array input AbstractRecords which define regions, region sets and elements |
Definition at line 1028 of file mesh.cc.
void Mesh::setup_topology | ( | ) |
|
protected |
Mesh::TYPEDEF_ERR_INFO | ( | EI_Dim | , |
unsigned int | |||
) |
Mesh::TYPEDEF_ERR_INFO | ( | EI_DimOther | , |
unsigned int | |||
) |
Mesh::TYPEDEF_ERR_INFO | ( | EI_ElemLast | , |
int | |||
) |
Mesh::TYPEDEF_ERR_INFO | ( | EI_ElemNew | , |
int | |||
) |
Mesh::TYPEDEF_ERR_INFO | ( | EI_Quality | , |
double | |||
) |
Mesh::TYPEDEF_ERR_INFO | ( | EI_RegIdx | , |
unsigned int | |||
) |
Mesh::TYPEDEF_ERR_INFO | ( | EI_Region | , |
std::string | |||
) |
Mesh::TYPEDEF_ERR_INFO | ( | EI_RegLast | , |
std::string | |||
) |
Mesh::TYPEDEF_ERR_INFO | ( | EI_RegNew | , |
std::string | |||
) |
|
friend |
|
friend |
|
friend |
|
private |
|
protected |
|
mutable |
|
protected |
|
protected |
std::shared_ptr<MixedMeshIntersections> Mesh::intersections |
|
private |
|
private |
|
private |
|
protected |
|
protected |