Flow123d  release_2.2.0-914-gf1a3a4f
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | Friends | List of all members
Mesh Class Reference

#include <mesh.h>

Collaboration diagram for Mesh:
Collaboration graph
[legend]

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)
 
 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 ()
 
 Mesh (Input::Record in_record, MPI_Comm com=MPI_COMM_WORLD)
 
void reinit (Input::Record in_record)
 
 ~Mesh ()
 Destructor. More...
 
unsigned int n_nodes () const
 
unsigned int n_elements () const
 
unsigned int n_boundaries () const
 
unsigned int n_edges () const
 
unsigned int n_corners ()
 
const RegionDBregion_db () const
 
void reserve_node_size (unsigned int n_nodes)
 Reserve size of node vector. More...
 
void reserve_element_size (unsigned int n_elements)
 Reserve size of element vector. More...
 
Partitioningget_part ()
 
Distributionget_el_ds () const
 
IdxIntget_row_4_el () const
 
IdxIntget_el_4_loc () const
 
MPI_Comm get_comm () const
 
MixedMeshIntersectionsmixed_intersections ()
 
unsigned int n_sides ()
 
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 setup_topology ()
 
void elements_id_maps (vector< IdxInt > &bulk_elements_id, vector< IdxInt > &boundary_elements_id) const
 
ElementAccessor< 3 > element_accessor (unsigned int idx, bool boundary=false)
 
void read_regions_from_input (Input::Array region_list)
 
vector< vector< unsigned int > > const & node_elements ()
 
void check_and_finish ()
 
void compute_element_boxes ()
 Precompute element bounding boxes if it is not done yet. More...
 
const BoundingBoxget_mesh_boungin_box ()
 Return the mesh bounding box. Is set after call compute_element_boxes(). 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_observe_radius () const
 Maximal distance of observe point from Mesh relative to its size. 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

NodeVector node_vector
 Vector of nodes of the mesh. More...
 
ElementVector element
 Vector of elements of the mesh. More...
 
vector< Boundaryboundary_
 
ElementVector bc_elements
 
std::vector< Edgeedges
 Vector of MH edges, this should not be part of the geometrical mesh. More...
 
std::shared_ptr< MixedMeshIntersectionsintersections
 
vector< vector< unsigned int > > master_elements
 
vector< Neighbourvb_neighbours_
 
int n_insides
 
int n_exsides
 
int n_sides_
 
int n_lines
 
int n_triangles
 
int n_tetrahedras
 
vector< vector< vector< unsigned int > > > side_nodes
 
unsigned int n_all_input_elements_
 Number of elements read from input. More...
 

Static Public Attributes

static const unsigned int undef_idx =-1
 

Protected Member Functions

void make_neighbours_and_edges ()
 
void make_edge_permutations ()
 
void create_node_element_lists ()
 
bool find_lower_dim_element (ElementVector &elements, 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 modify_element_ids (const RegionDB::MapElementIDToRegionID &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...
 
RegionDB region_db_
 
std::shared_ptr< Partitioningpart_
 
std::vector< BoundingBoxelement_box_
 Auxiliary vector of mesh elements bounding boxes. More...
 
BoundingBox mesh_box_
 Bounding box of whole mesh. More...
 
std::shared_ptr< BIHTreebih_tree_
 
Input::Record in_record_
 
MPI_Comm comm_
 
vector< vector< unsigned int > > node_elements_
 

Private Attributes

IdxIntrow_4_el
 Index set assigning to global element index the local index used in parallel vectors. More...
 
IdxIntel_4_loc
 Index set assigning to local element index its global index. More...
 
Distributionel_ds
 Parallel distribution of elements. More...
 

Friends

class RegionSetBase
 
class Element
 
class BIHTree
 

Detailed Description

Definition at line 99 of file mesh.h.

Member Typedef Documentation

Types of search algorithm for finding intersection candidates.

Member Enumeration Documentation

anonymous enum

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

Enumerator
x_coord 
y_coord 
z_coord 

Definition at line 131 of file mesh.h.

Types of search algorithm for finding intersection candidates.

Enumerator
BIHsearch 
BIHonly 
BBsearch 

Definition at line 114 of file mesh.h.

Constructor & Destructor Documentation

Mesh::Mesh ( )

Empty constructor.

Use only for unit tests!!!

Definition at line 94 of file mesh.cc.

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 102 of file mesh.cc.

Mesh::~Mesh ( )

Destructor.

Definition at line 173 of file mesh.cc.

Member Function Documentation

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 773 of file mesh.cc.

Here is the caller graph for this function:

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

Add new node of given id and coordinates to mesh.

Definition at line 767 of file mesh.cc.

Here is the caller graph for this function:

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 762 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::check_and_finish ( )

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

Definition at line 716 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::compute_element_boxes ( )

Precompute element bounding boxes if it is not done yet.

Definition at line 731 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::count_element_types ( )
protected

Definition at line 227 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::count_side_types ( )
protected

Definition at line 282 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::create_node_element_lists ( )
protected

Create element lists for nodes in Mesh::nodes_elements.

Definition at line 295 of file mesh.cc.

Here is the caller graph for this function:

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"   
)
ElementAccessor< 3 > Mesh::element_accessor ( unsigned int  idx,
bool  boundary = false 
)

Definition at line 668 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::element_to_neigh_vb ( )
protected

Definition at line 619 of file mesh.cc.

Here is the caller graph for this function:

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

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

Definition at line 674 of file mesh.cc.

Here is the caller graph for this function:

bool Mesh::find_lower_dim_element ( ElementVector elements,
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 336 of file mesh.cc.

Here is the caller graph for this function:

const BIHTree & Mesh::get_bih_tree ( )

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

Definition at line 752 of file mesh.cc.

Here is the caller graph for this function:

MPI_Comm Mesh::get_comm ( ) const
inline

Returns MPI communicator of the mesh.

Definition at line 201 of file mesh.h.

Here is the caller graph for this function:

IdxInt* Mesh::get_el_4_loc ( ) const
inline

Definition at line 195 of file mesh.h.

Here is the caller graph for this function:

Distribution* Mesh::get_el_ds ( ) const
inline

Definition at line 189 of file mesh.h.

Here is the caller graph for this function:

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 60 of file mesh.cc.

Here is the caller graph for this function:

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

Definition at line 71 of file mesh.cc.

Here is the caller graph for this function:

Mesh::IntersectionSearch Mesh::get_intersection_search ( )

Getter for input type selection for intersection search algorithm.

Definition at line 122 of file mesh.cc.

Here is the caller graph for this function:

const BoundingBox& Mesh::get_mesh_boungin_box ( )
inline

Return the mesh bounding box. Is set after call compute_element_boxes().

Definition at line 320 of file mesh.h.

Partitioning * Mesh::get_part ( )

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

Definition at line 218 of file mesh.cc.

Here is the caller graph for this function:

IdxInt* Mesh::get_row_4_el ( ) const
inline

Definition at line 192 of file mesh.h.

Here is the caller graph for this function:

double Mesh::global_observe_radius ( ) const

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

Definition at line 758 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::init_from_input ( )

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

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 308 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::make_edge_permutations ( )
protected

On edges sharing sides of many elements it may happen that each side has its nodes ordered in a different way. This method finds the permutation for each side so as to obtain the ordering of side 0.

Definition at line 548 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::make_neighbours_and_edges ( )
protected

This replaces read_neighbours() in order to avoid using NGH preprocessor.

TODO:

  • Avoid maps:

    4) replace EdgeVector by std::vector<Edge> (need not to know the size)

    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 bc_elements first, there should be no Neigh, but check it set Edge and boundary there

Definition at line 373 of file mesh.cc.

Here is the caller graph for this function:

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 216 of file mesh.h.

FilePath Mesh::mesh_file ( )
inline

Return FilePath object representing "mesh_file" input key.

Definition at line 345 of file mesh.h.

MixedMeshIntersections & Mesh::mixed_intersections ( )

Definition at line 651 of file mesh.cc.

Here is the caller graph for this function:

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 244 of file mesh.cc.

Here is the caller graph for this function:

unsigned int Mesh::n_boundaries ( ) const
inline

Definition at line 160 of file mesh.h.

unsigned int Mesh::n_corners ( )

Definition at line 208 of file mesh.cc.

unsigned int Mesh::n_edges ( ) const
inline

Definition at line 164 of file mesh.h.

Here is the caller graph for this function:

unsigned int Mesh::n_elements ( ) const
inline

Definition at line 156 of file mesh.h.

unsigned int Mesh::n_nodes ( ) const
inline

Definition at line 152 of file mesh.h.

Here is the caller graph for this function:

unsigned int Mesh::n_sides ( )

Definition at line 199 of file mesh.cc.

Here is the caller graph for this function:

unsigned int Mesh::n_vb_neighbours ( ) const
inline

Definition at line 208 of file mesh.h.

Here is the caller graph for this function:

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

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

Definition at line 814 of file mesh.cc.

Here is the caller graph for this function:

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

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

Definition at line 706 of file mesh.cc.

Here is the caller graph for this function:

const RegionDB& Mesh::region_db ( ) const
inline

Definition at line 170 of file mesh.h.

void Mesh::reinit ( Input::Record  in_record)

Common part of both previous constructors and way how to reinitialize a mesh from the given input record.

Definition at line 128 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::reserve_element_size ( unsigned int  n_elements)
inline

Reserve size of element vector.

Definition at line 180 of file mesh.h.

Here is the caller graph for this function:

void Mesh::reserve_node_size ( unsigned int  n_nodes)
inline

Reserve size of node vector.

Definition at line 175 of file mesh.h.

Here is the caller graph for this function:

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 356 of file mesh.cc.

Here is the caller graph for this function:

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 254 of file mesh.cc.

Here is the caller graph for this function:

Mesh::TYPEDEF_ERR_INFO ( EI_ElemLast  ,
int   
)
Mesh::TYPEDEF_ERR_INFO ( EI_ElemNew  ,
int   
)
Mesh::TYPEDEF_ERR_INFO ( EI_RegLast  ,
std::string   
)
Mesh::TYPEDEF_ERR_INFO ( EI_RegNew  ,
std::string   
)

Friends And Related Function Documentation

friend class BIHTree
friend

Definition at line 456 of file mesh.h.

friend class Element
friend

Definition at line 455 of file mesh.h.

friend class RegionSetBase
friend

Definition at line 454 of file mesh.h.

Member Data Documentation

ElementVector Mesh::bc_elements

vector of boundary elements - should replace 'boundary' TODO: put both bulk and bc elements (on zero level) to the same vector or make better map id->element for field inputs that use element IDs the avoid usage of ElementVector etc.

Definition at line 268 of file mesh.h.

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

BIH Tree for intersection and observe points lookup.

Definition at line 437 of file mesh.h.

vector<Boundary> Mesh::boundary_

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 264 of file mesh.h.

MPI_Comm Mesh::comm_
protected

MPI communicator used for partitioning and ...

Definition at line 448 of file mesh.h.

std::vector<Edge> Mesh::edges

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

Definition at line 271 of file mesh.h.

IdxInt* Mesh::el_4_loc
private

Index set assigning to local element index its global index.

Definition at line 465 of file mesh.h.

Distribution* Mesh::el_ds
private

Parallel distribution of elements.

Definition at line 467 of file mesh.h.

intersections array for every intersection in which El is master Mesh::element

Vector of elements of the mesh.

For every element El we have vector of indices into This is necessary for true mortar.

Definition at line 260 of file mesh.h.

std::vector<BoundingBox> Mesh::element_box_
protected

Auxiliary vector of mesh elements bounding boxes.

Definition at line 429 of file mesh.h.

Input::Record Mesh::in_record_
protected

Accessor to the input record for the mesh.

Definition at line 443 of file mesh.h.

std::shared_ptr<MixedMeshIntersections> Mesh::intersections

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

Definition at line 279 of file mesh.h.

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

Definition at line 285 of file mesh.h.

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 416 of file mesh.h.

BoundingBox Mesh::mesh_box_
protected

Bounding box of whole mesh.

Definition at line 432 of file mesh.h.

unsigned int Mesh::n_all_input_elements_

Number of elements read from input.

Definition at line 356 of file mesh.h.

unsigned int Mesh::n_bb_neigh
protected

Definition at line 413 of file mesh.h.

int Mesh::n_exsides

Definition at line 293 of file mesh.h.

int Mesh::n_insides

Definition at line 292 of file mesh.h.

int Mesh::n_lines

Definition at line 296 of file mesh.h.

int Mesh::n_sides_

Definition at line 294 of file mesh.h.

int Mesh::n_tetrahedras

Definition at line 298 of file mesh.h.

int Mesh::n_triangles

Definition at line 297 of file mesh.h.

unsigned int Mesh::n_vb_neigh
protected

Definition at line 413 of file mesh.h.

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

Definition at line 451 of file mesh.h.

NodeVector Mesh::node_vector

Vector of nodes of the mesh.

Definition at line 258 of file mesh.h.

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

Mesh partitioning. Created in setup_topology.

Definition at line 426 of file mesh.h.

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 422 of file mesh.h.

IdxInt* Mesh::row_4_el
private

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

Definition at line 463 of file mesh.h.

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

Definition at line 309 of file mesh.h.

const unsigned int Mesh::undef_idx =-1
static

Definition at line 125 of file mesh.h.

vector<Neighbour> Mesh::vb_neighbours_

Vector of compatible neighbourings.

Definition at line 290 of file mesh.h.


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