Flow123d  JS_before_hm-1801-ga009cfea3
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Mesh Class Reference

#include <mesh.h>

Inheritance diagram for Mesh:
Inheritance graph
[legend]
Collaboration diagram for Mesh:
Collaboration graph
[legend]

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_ElemId, int)
 
 TYPEDEF_ERR_INFO (EI_ElemIdOther, int)
 
 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 (ExcTooMatchingIds,<< "Mesh: Duplicate dim-join lower dim elements: "<< EI_ElemId::val<< ", "<< EI_ElemIdOther::val<< ".\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)
 
virtual ~Mesh ()
 Destructor. More...
 
virtual unsigned int n_nodes () const
 
unsigned int n_boundaries () const
 
unsigned int n_edges () const
 
Edge edge (uint edge_idx) const
 
Boundary boundary (uint edge_idx) const
 
unsigned int n_corners ()
 
const RegionDBregion_db () const
 
virtual Partitioningget_part ()
 
virtual const LongIdxget_local_part ()
 
Distributionget_el_ds () const
 
LongIdxget_row_4_el () const
 
LongIdxget_el_4_loc () const
 
Distributionget_node_ds () const
 
LongIdxget_node_4_loc () const
 
unsigned int n_local_nodes () const
 
MPI_Comm get_comm () const
 
MixedMeshIntersectionsmixed_intersections ()
 
unsigned int n_sides () const
 
unsigned int n_vb_neighbours () const
 
unsigned int max_edge_sides (unsigned int dim) const
 
void read_gmsh_from_stream (istream &in)
 
void init_from_input ()
 
void canonical_faces ()
 
void setup_topology ()
 
void elements_id_maps (vector< LongIdx > &bulk_elements_id, vector< LongIdx > &boundary_elements_id) const
 
virtual std::shared_ptr< EquivalentMeshMapcheck_compatible_mesh (Mesh &input_mesh)
 
virtual ElementAccessor< 3 > element_accessor (unsigned int idx) const
 Create and return ElementAccessor to element of given idx. More...
 
NodeAccessor< 3 > node (unsigned int idx) const
 Create and return NodeAccessor to node of given idx. More...
 
void read_regions_from_input (Input::Array region_list)
 
const vector< vector< unsigned int > > & node_elements ()
 
void check_and_finish ()
 
std::vector< BoundingBoxget_element_boxes ()
 Compute bounding boxes of elements contained in mesh. More...
 
const BIHTreeget_bih_tree ()
 Getter for BIH. Creates and compute BIH at first call. More...
 
void intersect_element_lists (vector< unsigned int > const &nodes_list, vector< unsigned int > &intersection_element_list)
 
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...
 
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...
 
virtual Range< ElementAccessor< 3 > > elements_range () const
 Returns range of bulk elements. More...
 
Range< NodeAccessor< 3 > > node_range () const
 Returns range of nodes. More...
 
Range< Edgeedge_range () const
 Returns range of edges. More...
 
virtual unsigned int n_elements () const
 Returns count of boundary or bulk elements. More...
 
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...
 
int find_elem_id (unsigned int pos) const
 Return element id (in GMSH file) of element of given position in element vector. More...
 
const std::vector< unsigned int > & element_permutations () const
 Return permutation vector of elements. 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...
 
int find_node_id (unsigned int pos) const
 Return node id (in GMSH file) of node of given position in node vector. More...
 
const std::vector< unsigned int > & node_permutations () const
 Return permutation vector of nodes. More...
 
void check_element_size (unsigned int elem_idx) const
 Check if given index is in element_vec_. More...
 
unsigned int create_boundary_elements ()
 Create boundary elements from data of temporary structure, this method MUST be call after read mesh from file, return number of read boundary elements. More...
 
BCMeshget_bc_mesh ()
 Create boundary mesh if doesn't exist and return it. More...
 

Static Public Member Functions

static const Input::Type::Selectionget_input_intersection_variant ()
 The definition of input record for selection of variant of file format. More...
 
static const Input::Type::Recordget_input_type ()
 

Public Attributes

vector< BoundaryDataboundary_
 
std::shared_ptr< MixedMeshIntersectionsintersections
 
vector< vector< unsigned int > > master_elements
 
DuplicateNodestree
 
vector< Neighbourvb_neighbours_
 
int n_insides
 
int n_exsides
 
int n_sides_
 
vector< vector< vector< unsigned int > > > side_nodes
 
vector< vector< unsigned int > > node_elements_
 For each node the vector contains a list of elements that use this node. More...
 

Protected Member Functions

void init ()
 
void make_neighbours_and_edges ()
 
void create_node_element_lists ()
 
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)
 
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)
 
Elementadd_element_to_vector (int id)
 Adds element to mesh data structures (element_vec_, element_ids_), returns pointer to this element. More...
 
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 (Mesh *source_mesh, Mesh *target_mesh, const std::vector< unsigned int > &node_ids, std::vector< LongIdx > &map)
 

Protected Attributes

unsigned int n_bb_neigh
 
unsigned int n_vb_neigh
 
unsigned int max_edge_sides_ [3]
 Maximal number of sides per one edge in the actual mesh (set in make_neighbours_and_edges()). More...
 
bool optimize_memory_locality
 
RegionDB region_db_
 
std::shared_ptr< Partitioningpart_
 
std::shared_ptr< BIHTreebih_tree_
 
Input::Record in_record_
 
MPI_Comm comm_
 
vector< Elementelement_vec_
 
vector< ElementTmpDatabc_element_tmp_
 Hold data of boundary elements during reading mesh (allow to preserve correct order during reading of mix bulk-boundary element) More...
 
unsigned int bulk_size_
 Count of bulk elements. More...
 
unsigned int boundary_loaded_size_
 Count of boundary elements loaded from mesh file. More...
 
BidirectionalMap< int > element_ids_
 Maps element ids to indexes into vector element_vec_. More...
 
Armor::Array< double > nodes_
 
BidirectionalMap< int > node_ids_
 Maps node ids to indexes into vector node_vec_. More...
 
std::vector< EdgeDataedges
 Vector of MH edges, this should not be part of the geometrical mesh. 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...
 

Private Member Functions

void distribute_nodes ()
 Fill array node_4_loc_ and create object node_ds_ according to element distribution. More...
 

Private Attributes

LongIdxrow_4_el
 Index set assigning to global element index the local index used in parallel vectors. More...
 
LongIdxel_4_loc
 Index set assigning to local element index its global index. More...
 
Distributionel_ds
 Parallel distribution of elements. More...
 
LongIdxnode_4_loc_
 Index set assigning to local node index its global index. More...
 
Distributionnode_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...
 
BCMeshbc_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
 

Detailed Description

Definition at line 98 of file mesh.h.

Member Typedef Documentation

◆ IntersectionSearch

Types of search algorithm for finding intersection candidates.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Labels for coordinate indexes in arma::vec3 representing vectors and points.

Enumerator
x_coord 
y_coord 
z_coord 

Definition at line 151 of file mesh.h.

◆ IntersectionSearch

Types of search algorithm for finding intersection candidates.

Enumerator
BIHsearch 
BIHonly 
BBsearch 

Definition at line 135 of file mesh.h.

Constructor & Destructor Documentation

◆ Mesh() [1/3]

Mesh::Mesh ( )

Empty constructor.

Use only for unit tests!!!

Definition at line 102 of file mesh.cc.

◆ Mesh() [2/3]

Mesh::Mesh ( Input::Record  in_record,
MPI_Comm  com = MPI_COMM_WORLD 
)

Constructor from an input record. Do not process input record. That is done in init_from_input.

Definition at line 118 of file mesh.cc.

◆ Mesh() [3/3]

Mesh::Mesh ( Mesh other)

Definition at line 137 of file mesh.cc.

◆ ~Mesh()

Mesh::~Mesh ( )
virtual

Destructor.

Definition at line 213 of file mesh.cc.

Member Function Documentation

◆ add_element()

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 
)

Add new element of given id to mesh.

Definition at line 1045 of file mesh.cc.

Here is the caller graph for this function:

◆ add_element_to_vector()

Element * Mesh::add_element_to_vector ( int  id)
protected

Adds element to mesh data structures (element_vec_, element_ids_), returns pointer to this element.

Definition at line 1122 of file mesh.cc.

Here is the caller graph for this function:

◆ add_node()

void Mesh::add_node ( unsigned int  node_id,
arma::vec3  coords 
)

Add new node of given id and coordinates to mesh.

Definition at line 1037 of file mesh.cc.

Here is the caller graph for this function:

◆ add_physical_name()

void Mesh::add_physical_name ( unsigned int  dim,
unsigned int  id,
std::string  name 
)

Add new node of given id and coordinates to mesh.

Definition at line 1032 of file mesh.cc.

Here is the caller graph for this function:

◆ boundary()

Boundary Mesh::boundary ( uint  edge_idx) const

Definition at line 268 of file mesh.cc.

Here is the caller graph for this function:

◆ canonical_faces()

void Mesh::canonical_faces ( )

Permute nodes of individual elements so that all elements have same edge orientations and aligned sides have same order of their nodes Canonical edge orientation in elements and faces is from nodes of lower local index to higher local index.

Algorithm detals:

  1. Orient all edges from lowe global node id to higher node id, fictional step. (substantial is orientation of yet non-oriented edges of a node in direction out of the node. Can be proven (!?) that this prevents edge cycles of the length 3 (faces with cyclic edges).
  2. Having all faces non-cyclic there exists a permutation of any element to the reference element. Pass through the elements. Sort nodes by global ID.

Definition at line 390 of file mesh.cc.

Here is the caller graph for this function:

◆ check_and_finish()

void Mesh::check_and_finish ( )

Check usage of regions, set regions to elements defined by user, close RegionDB

Definition at line 989 of file mesh.cc.

Here is the caller graph for this function:

◆ check_compatible_elements()

unsigned int Mesh::check_compatible_elements ( Mesh source_mesh,
Mesh target_mesh,
const std::vector< unsigned int > &  node_ids,
std::vector< LongIdx > &  map 
)
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 935 of file mesh.cc.

Here is the caller graph for this function:

◆ check_compatible_mesh()

std::shared_ptr< EquivalentMeshMap > Mesh::check_compatible_mesh ( Mesh input_mesh)
virtual

Reimplemented in BCMesh.

Definition at line 870 of file mesh.cc.

Here is the caller graph for this function:

◆ check_element_size()

void Mesh::check_element_size ( unsigned int  elem_idx) const
inline

Check if given index is in element_vec_.

Definition at line 1148 of file mesh.cc.

Here is the caller graph for this function:

◆ check_mesh_on_read()

void Mesh::check_mesh_on_read ( )
protected

Check the element quality and remove unused nodes.

Definition at line 310 of file mesh.cc.

Here is the caller graph for this function:

◆ count_element_types()

void Mesh::count_element_types ( )
protected

◆ count_side_types()

void Mesh::count_side_types ( )
protected

Definition at line 472 of file mesh.cc.

Here is the caller graph for this function:

◆ create_boundary_elements()

unsigned int Mesh::create_boundary_elements ( )

Create boundary elements from data of temporary structure, this method MUST be call after read mesh from file, return number of read boundary elements.

Definition at line 1251 of file mesh.cc.

Here is the caller graph for this function:

◆ create_node_element_lists()

void Mesh::create_node_element_lists ( )
protected

Create element lists for nodes in Mesh::nodes_elements.

Definition at line 486 of file mesh.cc.

Here is the caller graph for this function:

◆ DECLARE_EXCEPTION() [1/6]

Mesh::DECLARE_EXCEPTION ( ExcBadElement  ,
<< "Extremely bad quality element  ID = "<< EI_ElemId::val<< ",
("<< EI_Quality::val<< "< 4 *epsilon).\n"   
)

◆ DECLARE_EXCEPTION() [2/6]

Mesh::DECLARE_EXCEPTION ( ExcBdrElemMatchRegular  ,
<< "Boundary element (id: "<< EI_ElemId::val<< ") match a regular element (id: "<< EI_ElemIdOther::val<< ") of lower dimension.\n"   
)

◆ DECLARE_EXCEPTION() [3/6]

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"   
)

◆ DECLARE_EXCEPTION() [4/6]

Mesh::DECLARE_EXCEPTION ( ExcElmWrongOrder  ,
<< "Element IDs in non-increasing  order,
ID:"<< EI_ElemId::val<< "\n"   
)

◆ DECLARE_EXCEPTION() [5/6]

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"   
)

◆ DECLARE_EXCEPTION() [6/6]

Mesh::DECLARE_EXCEPTION ( ExcTooMatchingIds  ,
<< "Mesh: Duplicate dim-join lower dim elements: "<< EI_ElemId::val<< "  ,
"<< EI_ElemIdOther::val<< ".\n"   
)

◆ distribute_nodes()

void Mesh::distribute_nodes ( )
private

Fill array node_4_loc_ and create object node_ds_ according to element distribution.

Definition at line 1271 of file mesh.cc.

Here is the caller graph for this function:

◆ edge()

Edge Mesh::edge ( uint  edge_idx) const

Definition at line 262 of file mesh.cc.

Here is the caller graph for this function:

◆ edge_range()

Range< Edge > Mesh::edge_range ( ) const

Returns range of edges.

Definition at line 1142 of file mesh.cc.

Here is the caller graph for this function:

◆ elem_index()

int Mesh::elem_index ( int  elem_id) const
inline

For element of given elem_id returns index in element_vec_ or (-1) if element doesn't exist.

Definition at line 406 of file mesh.h.

Here is the caller graph for this function:

◆ element_accessor()

ElementAccessor< 3 > Mesh::element_accessor ( unsigned int  idx) const
virtual

Create and return ElementAccessor to element of given idx.

Reimplemented in BCMesh.

Definition at line 817 of file mesh.cc.

◆ element_permutations()

const std::vector<unsigned int>& Mesh::element_permutations ( ) const
inline

Return permutation vector of elements.

Definition at line 418 of file mesh.h.

◆ element_to_neigh_vb()

void Mesh::element_to_neigh_vb ( )
protected

Definition at line 767 of file mesh.cc.

Here is the caller graph for this function:

◆ elements_id_maps()

void Mesh::elements_id_maps ( vector< LongIdx > &  bulk_elements_id,
vector< LongIdx > &  boundary_elements_id 
) const

Returns vector of ID numbers of elements, either bulk or bc elemnts.

Definition at line 829 of file mesh.cc.

Here is the caller graph for this function:

◆ elements_range()

Range< ElementAccessor< 3 > > Mesh::elements_range ( ) const
virtual

Returns range of bulk elements.

Reimplemented in BCMesh.

Definition at line 1130 of file mesh.cc.

◆ find_elem_id()

int Mesh::find_elem_id ( unsigned int  pos) const
inline

Return element id (in GMSH file) of element of given position in element vector.

Definition at line 412 of file mesh.h.

Here is the caller graph for this function:

◆ find_lower_dim_element()

bool Mesh::find_lower_dim_element ( vector< unsigned int > &  element_list,
unsigned int  dim,
unsigned int &  element_idx 
)
protected

Remove elements with dimension not equal to dim from element_list. Index of the first element of dimension dim-1, is returned in element_idx. If no such element is found the method returns false, if one such element is found the method returns true, if more elements are found we report an user input error.

Definition at line 531 of file mesh.cc.

Here is the caller graph for this function:

◆ find_node_id()

int Mesh::find_node_id ( unsigned int  pos) const
inline

Return node id (in GMSH file) of node of given position in node vector.

Definition at line 430 of file mesh.h.

Here is the caller graph for this function:

◆ get_bc_mesh()

BCMesh * Mesh::get_bc_mesh ( )

Create boundary mesh if doesn't exist and return it.

Definition at line 1265 of file mesh.cc.

Here is the caller graph for this function:

◆ get_bih_tree()

const BIHTree & Mesh::get_bih_tree ( )

Getter for BIH. Creates and compute BIH at first call.

Definition at line 1019 of file mesh.cc.

Here is the caller graph for this function:

◆ get_comm()

MPI_Comm Mesh::get_comm ( ) const
inline

Returns MPI communicator of the mesh.

Definition at line 219 of file mesh.h.

Here is the caller graph for this function:

◆ get_el_4_loc()

LongIdx* Mesh::get_el_4_loc ( ) const
inline

Definition at line 204 of file mesh.h.

Here is the caller graph for this function:

◆ get_el_ds()

Distribution* Mesh::get_el_ds ( ) const
inline

Definition at line 198 of file mesh.h.

Here is the caller graph for this function:

◆ get_element_boxes()

std::vector< BoundingBox > Mesh::get_element_boxes ( )

Compute bounding boxes of elements contained in mesh.

Definition at line 1004 of file mesh.cc.

Here is the caller graph for this function:

◆ get_input_intersection_variant()

const Input::Type::Selection & Mesh::get_input_intersection_variant ( )
static

The definition of input record for selection of variant of file format.

Definition at line 65 of file mesh.cc.

Here is the caller graph for this function:

◆ get_input_type()

const IT::Record & Mesh::get_input_type ( )
static

Definition at line 76 of file mesh.cc.

Here is the caller graph for this function:

◆ get_intersection_search()

Mesh::IntersectionSearch Mesh::get_intersection_search ( )

Getter for input type selection for intersection search algorithm.

Definition at line 156 of file mesh.cc.

Here is the caller graph for this function:

◆ get_local_part()

const LongIdx * Mesh::get_local_part ( )
virtual

Reimplemented in BCMesh.

Definition at line 278 of file mesh.cc.

Here is the caller graph for this function:

◆ get_node_4_loc()

LongIdx* Mesh::get_node_4_loc ( ) const
inline

Definition at line 210 of file mesh.h.

Here is the caller graph for this function:

◆ get_node_ds()

Distribution* Mesh::get_node_ds ( ) const
inline

Definition at line 207 of file mesh.h.

Here is the caller graph for this function:

◆ get_part()

Partitioning * Mesh::get_part ( )
virtual

Returns pointer to partitioning object. Partitioning is created during setup_topology.

Reimplemented in BCMesh.

Definition at line 274 of file mesh.cc.

Here is the caller graph for this function:

◆ get_row_4_el()

LongIdx* Mesh::get_row_4_el ( ) const
inline

Definition at line 201 of file mesh.h.

Here is the caller graph for this function:

◆ global_snap_radius()

double Mesh::global_snap_radius ( ) const

Maximal distance of observe point from Mesh relative to its size.

Definition at line 1028 of file mesh.cc.

Here is the caller graph for this function:

◆ init()

void Mesh::init ( )
protected

Part of the constructor whichdoes not depedn on input record. Initializes node-side numbering according to RefElement.

Definition at line 162 of file mesh.cc.

Here is the caller graph for this function:

◆ init_element()

void Mesh::init_element ( Element ele,
unsigned int  elm_id,
unsigned int  dim,
RegionIdx  region_idx,
unsigned int  partition_id,
std::vector< unsigned int >  node_ids 
)
protected

Initialize element.

Definition at line 1068 of file mesh.cc.

Here is the caller graph for this function:

◆ init_element_vector()

void Mesh::init_element_vector ( unsigned int  size)

Initialize element_vec_, set size and reset counters of boundary and bulk elements.

Definition at line 1099 of file mesh.cc.

Here is the caller graph for this function:

◆ init_from_input()

void Mesh::init_from_input ( )

Reads input record, creates regions, read the mesh, setup topology. creates region sets.

◆ init_node_vector()

void Mesh::init_node_vector ( unsigned int  size)

Initialize node_vec_, set size.

Definition at line 1113 of file mesh.cc.

Here is the caller graph for this function:

◆ intersect_element_lists()

void Mesh::intersect_element_lists ( vector< unsigned int > const &  nodes_list,
vector< unsigned int > &  intersection_element_list 
)

Find intersection of element lists given by Mesh::node_elements_ for elements givne by nodes_list parameter. The result is placed into vector intersection_element_list. If the node_list is empty, and empty intersection is returned.

Definition at line 499 of file mesh.cc.

Here is the caller graph for this function:

◆ make_neighbours_and_edges()

void Mesh::make_neighbours_and_edges ( )
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:

  • use std::is_any for setting is_neigbour
  • possibly make appropriate constructors for Edge and Neighbour
  • check side!=-1 when searching neigbouring element
  • process boundary elements first, there should be no Neigh, but check it set Edge and boundary there

Definition at line 570 of file mesh.cc.

Here is the caller graph for this function:

◆ max_edge_sides()

unsigned int Mesh::max_edge_sides ( unsigned int  dim) const
inline

Returns maximal number of sides of one edge, which connects elements of dimension dim.

Parameters
dimDimension of elements sharing the edge.

Definition at line 232 of file mesh.h.

◆ mesh_file()

FilePath Mesh::mesh_file ( )
inline

Return FilePath object representing "mesh_file" input key.

Definition at line 370 of file mesh.h.

◆ mixed_intersections()

MixedMeshIntersections & Mesh::mixed_intersections ( )

Definition at line 800 of file mesh.cc.

Here is the caller graph for this function:

◆ modify_element_ids()

void Mesh::modify_element_ids ( const RegionDB::MapElementIDToRegionID map)
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 285 of file mesh.cc.

Here is the caller graph for this function:

◆ n_boundaries()

unsigned int Mesh::n_boundaries ( ) const
inline

Definition at line 174 of file mesh.h.

◆ n_corners()

unsigned int Mesh::n_corners ( )

Definition at line 252 of file mesh.cc.

◆ n_edges()

unsigned int Mesh::n_edges ( ) const
inline

Definition at line 178 of file mesh.h.

Here is the caller graph for this function:

◆ n_elements()

virtual unsigned int Mesh::n_elements ( ) const
inlinevirtual

Returns count of boundary or bulk elements.

Reimplemented in BCMesh.

Definition at line 398 of file mesh.h.

◆ n_local_nodes()

unsigned int Mesh::n_local_nodes ( ) const
inline

Definition at line 213 of file mesh.h.

Here is the caller graph for this function:

◆ n_nodes()

virtual unsigned int Mesh::n_nodes ( ) const
inlinevirtual

Reimplemented in BCMesh.

Definition at line 170 of file mesh.h.

Here is the caller graph for this function:

◆ n_sides()

unsigned int Mesh::n_sides ( ) const

Definition at line 238 of file mesh.cc.

Here is the caller graph for this function:

◆ n_vb_neighbours()

unsigned int Mesh::n_vb_neighbours ( ) const

Definition at line 247 of file mesh.cc.

Here is the caller graph for this function:

◆ node()

NodeAccessor< 3 > Mesh::node ( unsigned int  idx) const

Create and return NodeAccessor to node of given idx.

Definition at line 823 of file mesh.cc.

Here is the caller graph for this function:

◆ node_elements()

const vector< vector< unsigned int > > & Mesh::node_elements ( )

Returns nodes_elements vector, if doesn't exist creates its.

Definition at line 1091 of file mesh.cc.

Here is the caller graph for this function:

◆ node_index()

int Mesh::node_index ( int  node_id) const
inline

For node of given node_id returns index in element_vec_ or (-1) if node doesn't exist.

Definition at line 424 of file mesh.h.

Here is the caller graph for this function:

◆ node_permutations()

const std::vector<unsigned int>& Mesh::node_permutations ( ) const
inline

Return permutation vector of nodes.

Definition at line 436 of file mesh.h.

◆ node_range()

Range< NodeAccessor< 3 > > Mesh::node_range ( ) const

Returns range of nodes.

Definition at line 1136 of file mesh.cc.

Here is the caller graph for this function:

◆ optimize()

void Mesh::optimize ( )
protected

Apply functionality of MeshOptimizer to sort nodes and elements.

Use Hilbert curve, need call sort_permuted_nodes_elements method.

Definition at line 435 of file mesh.cc.

Here is the caller graph for this function:

◆ output_internal_ngh_data()

void Mesh::output_internal_ngh_data ( )
protected

Output of neighboring data into raw output.

Definition at line 1156 of file mesh.cc.

Here is the caller graph for this function:

◆ read_gmsh_from_stream()

void Mesh::read_gmsh_from_stream ( istream &  in)

Reads mesh from stream.

Method is especially used in unit tests.

◆ read_regions_from_input()

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()

Parameters
region_listArray input AbstractRecords which define regions, region sets and elements

Definition at line 979 of file mesh.cc.

Here is the caller graph for this function:

◆ region_db()

const RegionDB& Mesh::region_db ( ) const
inline

Definition at line 187 of file mesh.h.

◆ same_sides()

bool Mesh::same_sides ( const SideIter si,
vector< unsigned int > &  side_nodes 
)
protected

Returns true if side si has same nodes as in the list side_nodes.

Definition at line 553 of file mesh.cc.

Here is the caller graph for this function:

◆ setup_topology()

void Mesh::setup_topology ( )

Initialize all mesh structures from raw information about nodes and elements (including boundary elements). Namely: create remaining boundary elements and Boundary objects, find edges and compatible neighborings.

Definition at line 399 of file mesh.cc.

Here is the caller graph for this function:

◆ sort_permuted_nodes_elements()

void Mesh::sort_permuted_nodes_elements ( std::vector< int >  new_node_ids,
std::vector< int >  new_elem_ids 
)
protected

Sort elements and nodes by order stored in permutation vectors.

Definition at line 445 of file mesh.cc.

Here is the caller graph for this function:

◆ TYPEDEF_ERR_INFO() [1/11]

Mesh::TYPEDEF_ERR_INFO ( EI_Dim  ,
unsigned int   
)

◆ TYPEDEF_ERR_INFO() [2/11]

Mesh::TYPEDEF_ERR_INFO ( EI_DimOther  ,
unsigned int   
)

◆ TYPEDEF_ERR_INFO() [3/11]

Mesh::TYPEDEF_ERR_INFO ( EI_ElemId  ,
int   
)

◆ TYPEDEF_ERR_INFO() [4/11]

Mesh::TYPEDEF_ERR_INFO ( EI_ElemIdOther  ,
int   
)

◆ TYPEDEF_ERR_INFO() [5/11]

Mesh::TYPEDEF_ERR_INFO ( EI_ElemLast  ,
int   
)

◆ TYPEDEF_ERR_INFO() [6/11]

Mesh::TYPEDEF_ERR_INFO ( EI_ElemNew  ,
int   
)

◆ TYPEDEF_ERR_INFO() [7/11]

Mesh::TYPEDEF_ERR_INFO ( EI_Quality  ,
double   
)

◆ TYPEDEF_ERR_INFO() [8/11]

Mesh::TYPEDEF_ERR_INFO ( EI_RegIdx  ,
unsigned int   
)

◆ TYPEDEF_ERR_INFO() [9/11]

Mesh::TYPEDEF_ERR_INFO ( EI_Region  ,
std::string   
)

◆ TYPEDEF_ERR_INFO() [10/11]

Mesh::TYPEDEF_ERR_INFO ( EI_RegLast  ,
std::string   
)

◆ TYPEDEF_ERR_INFO() [11/11]

Mesh::TYPEDEF_ERR_INFO ( EI_RegNew  ,
std::string   
)

Friends And Related Function Documentation

◆ BCMesh

friend class BCMesh
friend

Definition at line 636 of file mesh.h.

◆ BIHTree

friend class BIHTree
friend

Definition at line 634 of file mesh.h.

◆ Boundary

friend class Boundary
friend

Definition at line 635 of file mesh.h.

◆ Edge

friend class Edge
friend

Definition at line 630 of file mesh.h.

◆ Element

friend class Element
friend

Definition at line 633 of file mesh.h.

◆ ElementAccessor

template<int spacedim>
friend class ElementAccessor
friend

Definition at line 637 of file mesh.h.

◆ NodeAccessor

template<int spacedim>
friend class NodeAccessor
friend

Definition at line 638 of file mesh.h.

◆ RegionSetBase

friend class RegionSetBase
friend

Definition at line 632 of file mesh.h.

◆ Side

friend class Side
friend

Definition at line 631 of file mesh.h.

Member Data Documentation

◆ bc_element_tmp_

vector<ElementTmpData> Mesh::bc_element_tmp_
protected

Hold data of boundary elements during reading mesh (allow to preserve correct order during reading of mix bulk-boundary element)

Definition at line 601 of file mesh.h.

◆ bc_mesh_

BCMesh* Mesh::bc_mesh_
private

Boundary mesh, object is created only if it's necessary.

Definition at line 660 of file mesh.h.

◆ bih_tree_

std::shared_ptr<BIHTree> Mesh::bih_tree_
protected

BIH Tree for intersection and observe points lookup.

Definition at line 580 of file mesh.h.

◆ boundary_

vector<BoundaryData> Mesh::boundary_
mutable

Vector of boundary sides where is prescribed boundary condition. TODO: apply all boundary conditions in the main assembling cycle over elements and remove this Vector.

Definition at line 301 of file mesh.h.

◆ boundary_loaded_size_

unsigned int Mesh::boundary_loaded_size_
protected

Count of boundary elements loaded from mesh file.

Definition at line 607 of file mesh.h.

◆ bulk_size_

unsigned int Mesh::bulk_size_
protected

Count of bulk elements.

Definition at line 604 of file mesh.h.

◆ comm_

MPI_Comm Mesh::comm_
protected

MPI communicator used for partitioning and ...

Definition at line 591 of file mesh.h.

◆ edges

std::vector<EdgeData> Mesh::edges
protected

Vector of MH edges, this should not be part of the geometrical mesh.

Definition at line 621 of file mesh.h.

◆ el_4_loc

LongIdx* Mesh::el_4_loc
private

Index set assigning to local element index its global index.

Definition at line 650 of file mesh.h.

◆ el_ds

Distribution* Mesh::el_ds
private

Parallel distribution of elements.

Definition at line 652 of file mesh.h.

◆ elem_permutation_

std::vector<unsigned int> Mesh::elem_permutation_
protected

Vector of element permutations of optimized mesh (see class MeshOptimizer)

Definition at line 627 of file mesh.h.

◆ element_ids_

BidirectionalMap<int> Mesh::element_ids_
protected

Maps element ids to indexes into vector element_vec_.

Definition at line 610 of file mesh.h.

◆ element_vec_

vector<Element> Mesh::element_vec_
protected

Vector of elements of the mesh.

Store all elements of the mesh in order bulk elements - boundary elements

Definition at line 598 of file mesh.h.

◆ in_record_

Input::Record Mesh::in_record_
protected

Accessor to the input record for the mesh.

Definition at line 586 of file mesh.h.

◆ intersections

std::shared_ptr<MixedMeshIntersections> Mesh::intersections

Vector of individual intersections of two elements. This is enough for local mortar.

Definition at line 309 of file mesh.h.

◆ master_elements

vector<vector<unsigned int> > Mesh::master_elements

Definition at line 315 of file mesh.h.

◆ max_edge_sides_

unsigned int Mesh::max_edge_sides_[3]
protected

Maximal number of sides per one edge in the actual mesh (set in make_neighbours_and_edges()).

Definition at line 535 of file mesh.h.

◆ n_bb_neigh

unsigned int Mesh::n_bb_neigh
protected

Definition at line 532 of file mesh.h.

◆ n_exsides

int Mesh::n_exsides

Definition at line 325 of file mesh.h.

◆ n_insides

int Mesh::n_insides

Definition at line 324 of file mesh.h.

◆ n_local_nodes_

unsigned int Mesh::n_local_nodes_
private

Hold number of local nodes (own + ghost), value is equal with size of node_4_loc array.

Definition at line 658 of file mesh.h.

◆ n_sides_

int Mesh::n_sides_
mutable

Definition at line 326 of file mesh.h.

◆ n_vb_neigh

unsigned int Mesh::n_vb_neigh
protected

Definition at line 532 of file mesh.h.

◆ node_4_loc_

LongIdx* Mesh::node_4_loc_
private

Index set assigning to local node index its global index.

Definition at line 654 of file mesh.h.

◆ node_ds_

Distribution* Mesh::node_ds_
private

Parallel distribution of nodes. Depends on elements distribution.

Definition at line 656 of file mesh.h.

◆ node_elements_

vector<vector<unsigned int> > Mesh::node_elements_

For each node the vector contains a list of elements that use this node.

Definition at line 403 of file mesh.h.

◆ node_ids_

BidirectionalMap<int> Mesh::node_ids_
protected

Maps node ids to indexes into vector node_vec_.

Definition at line 618 of file mesh.h.

◆ node_permutation_

std::vector<unsigned int> Mesh::node_permutation_
protected

Vector of node permutations of optimized mesh (see class MeshOptimizer)

Definition at line 624 of file mesh.h.

◆ nodes_

Armor::Array<double> Mesh::nodes_
protected

Vector of nodes of the mesh.

Definition at line 615 of file mesh.h.

◆ optimize_memory_locality

bool Mesh::optimize_memory_locality
protected

Flag for optimization perfomed at the beginning of setup_topology. Default true, can be set to flase by the optimize_mesh key of the input recoed.

Definition at line 565 of file mesh.h.

◆ part_

std::shared_ptr<Partitioning> Mesh::part_
protected

Mesh partitioning. Created in setup_topology.

Definition at line 575 of file mesh.h.

◆ region_db_

RegionDB Mesh::region_db_
protected

Database of regions (both bulk and boundary) of the mesh. Regions are logical parts of the domain that allows setting of different data and boundary conditions on them.

Definition at line 571 of file mesh.h.

◆ row_4_el

LongIdx* Mesh::row_4_el
private

Index set assigning to global element index the local index used in parallel vectors.

Definition at line 648 of file mesh.h.

◆ side_nodes

vector< vector< vector<unsigned int> > > Mesh::side_nodes

Definition at line 339 of file mesh.h.

◆ tree

DuplicateNodes* Mesh::tree

Definition at line 317 of file mesh.h.

◆ vb_neighbours_

vector<Neighbour> Mesh::vb_neighbours_

Vector of compatible neighbourings.

Definition at line 322 of file mesh.h.


The documentation for this class was generated from the following files: