Flow123d  jenkins-Flow123d-windows-release-multijob-285
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Mesh Class Reference

#include <mesh.h>

Collaboration diagram for Mesh:
Collaboration graph
[legend]

Public Types

enum  { x_coord =0, y_coord =1, z_coord =2 }
 

Public Member Functions

 Mesh (const std::string &input_str="{mesh_file=\"\"}", MPI_Comm com=MPI_COMM_WORLD)
 
 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
 
Partitioningget_part ()
 
MPI_Comm get_comm () const
 
void make_intersec_elements ()
 
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 ()
 
vector< int > const & elements_id_maps (bool boundary_domain) const
 
ElementAccessor< 3 > element_accessor (unsigned int idx, bool boundary=false)
 

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...
 
vector< Intersectionintersections
 
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
 

Static Public Attributes

static const unsigned int undef_idx =-1
 
static Input::Type::Record input_type
 

Protected Member Functions

void make_neighbours_and_edges ()
 
void make_edge_permutations ()
 
void create_node_element_lists ()
 
void intersect_element_lists (vector< unsigned int > const &nodes_list, vector< unsigned int > &intersection_element_list)
 
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 setup_topology ()
 
void element_to_neigh_vb ()
 
void count_element_types ()
 
void count_side_types ()
 

Protected Attributes

unsigned int n_bb_neigh
 
unsigned int n_vb_neigh
 
vector< int > bulk_elements_id_
 
vector< int > boundary_elements_id_
 
unsigned int n_all_input_elements_
 Number of elements read from input. More...
 
vector< vector< unsigned int > > node_elements
 
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_
 
boost::shared_ptr< Partitioningpart_
 
Input::Record in_record_
 
MPI_Comm comm_
 

Friends

class GmshMeshReader
 

Detailed Description

Definition at line 109 of file mesh.h.

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

Constructor & Destructor Documentation

Mesh::Mesh ( const std::string &  input_str = "{mesh_file=\"\"}",
MPI_Comm  com = MPI_COMM_WORLD 
)

Constructor with input record given by string. Aimed for testing purpose. Do not process input record. That is done in init_from_input.

Definition at line 85 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 97 of file mesh.cc.

Mesh::~Mesh ( )

Destructor.

Definition at line 151 of file mesh.cc.

Member Function Documentation

void Mesh::count_element_types ( )
protected

Definition at line 200 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::count_side_types ( )
protected

Definition at line 272 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 285 of file mesh.cc.

Here is the caller graph for this function:

ElementAccessor< 3 > Mesh::element_accessor ( unsigned int  idx,
bool  boundary = false 
)

Definition at line 670 of file mesh.cc.

Here is the caller graph for this function:

void Mesh::element_to_neigh_vb ( )
protected

Definition at line 596 of file mesh.cc.

Here is the caller graph for this function:

vector< int > const & Mesh::elements_id_maps ( bool  boundary_domain) const

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

Definition at line 676 of file mesh.cc.

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

Here is the caller graph for this function:

Partitioning * Mesh::get_part ( )

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

Definition at line 191 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.

Definition at line 227 of file mesh.cc.

Here is the caller graph for this function:

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

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

Here is the caller graph for this function:

void Mesh::make_intersec_elements ( )

Definition at line 631 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 363 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 182 of file mesh.h.

Here is the caller graph for this function:

unsigned int Mesh::n_boundaries ( ) const
inline

Definition at line 145 of file mesh.h.

unsigned int Mesh::n_corners ( )

Definition at line 181 of file mesh.cc.

Here is the caller graph for this function:

unsigned int Mesh::n_edges ( ) const
inline

Definition at line 149 of file mesh.h.

Here is the caller graph for this function:

unsigned int Mesh::n_elements ( ) const
inline

Definition at line 141 of file mesh.h.

unsigned int Mesh::n_nodes ( ) const
inline

Definition at line 137 of file mesh.h.

Here is the caller graph for this function:

unsigned int Mesh::n_sides ( )

Definition at line 172 of file mesh.cc.

Here is the caller graph for this function:

unsigned int Mesh::n_vb_neighbours ( ) const
inline

Definition at line 174 of file mesh.h.

void Mesh::read_gmsh_from_stream ( istream &  in)

Definition at line 216 of file mesh.cc.

const RegionDB& Mesh::region_db ( ) const
inline

Definition at line 155 of file mesh.h.

Here is the caller graph for this function:

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

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

Here is the caller graph for this function:

void Mesh::setup_topology ( )
protected

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

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class GmshMeshReader
friend

Definition at line 351 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 213 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 209 of file mesh.h.

vector<int> Mesh::boundary_elements_id_
mutableprotected

Definition at line 322 of file mesh.h.

vector<int> Mesh::bulk_elements_id_
mutableprotected

Vector of both bulk and boundary IDs. Bulk elements come first, then boundary elements, but only the portion that appears in input mesh file and has ID assigned.

TODO: Rather should be part of GMSH reader, but in such case we need store pointer to it in the mesh (good idea, but need more general interface for readers)

Definition at line 322 of file mesh.h.

MPI_Comm Mesh::comm_
protected

MPI communicator used for partitioning and ...

Definition at line 349 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 216 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 205 of file mesh.h.

Input::Record Mesh::in_record_
protected

Accessor to the input record for the mesh.

Definition at line 344 of file mesh.h.

IT::Record Mesh::input_type
static
Initial value:
= IT::Record("Mesh","Record with mesh related data." )
"Input file with mesh description.")
"List of additional region definitions not contained in the mesh.")
"List of region set definitions. There are three region sets implicitly defined:\n"
"ALL (all regions of the mesh), BOUNDARY (all boundary regions), and BULK (all bulk regions)")
.declare_key("partitioning", Partitioning::input_type, IT::Default("any_neighboring"), "Parameters of mesh partitioning algorithms.\n" )
.close()

Definition at line 112 of file mesh.h.

vector<Intersection> Mesh::intersections

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

Definition at line 224 of file mesh.h.

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

Definition at line 230 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 330 of file mesh.h.

unsigned int Mesh::n_all_input_elements_
protected

Number of elements read from input.

Definition at line 324 of file mesh.h.

unsigned int Mesh::n_bb_neigh
protected

Definition at line 316 of file mesh.h.

int Mesh::n_exsides

Definition at line 238 of file mesh.h.

int Mesh::n_insides

Definition at line 237 of file mesh.h.

int Mesh::n_lines

Definition at line 241 of file mesh.h.

int Mesh::n_sides_

Definition at line 239 of file mesh.h.

int Mesh::n_tetrahedras

Definition at line 243 of file mesh.h.

int Mesh::n_triangles

Definition at line 242 of file mesh.h.

unsigned int Mesh::n_vb_neigh
protected

Definition at line 316 of file mesh.h.

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

Definition at line 327 of file mesh.h.

NodeVector Mesh::node_vector

Vector of nodes of the mesh.

Definition at line 203 of file mesh.h.

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

Mesh partitioning. Created in setup_topology.

Definition at line 340 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 336 of file mesh.h.

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

Definition at line 254 of file mesh.h.

const unsigned int Mesh::undef_idx =-1
static

Definition at line 111 of file mesh.h.

vector<Neighbour> Mesh::vb_neighbours_

Vector of compatible neighbourings.

Definition at line 235 of file mesh.h.


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