Flow123d  release_3.0.0-968-gc87a28e79
mesh.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file mesh.h
15  * @brief
16  */
17 
18 #ifndef MAKE_MESH_H
19 #define MAKE_MESH_H
20 
21 #include <mpi.h> // for MPI_Comm, MPI_COMM_WORLD
22 
23 //#include <boost/range.hpp>
24 #include <memory> // for shared_ptr
25 #include <string> // for string
26 #include <vector> // for vector, vector<>::iterator
27 #include "input/accessors.hh" // for Record, Array (ptr only)
28 #include "input/accessors_impl.hh" // for Record::val
29 #include "input/storage.hh" // for ExcStorageTypeMismatch
30 #include "input/type_record.hh" // for Record (ptr only), Recor...
31 #include "mesh/long_idx.hh" // for LongIdx
32 #include "mesh/boundaries.h" // for Boundary
33 #include "mesh/edges.h" // for Edge
34 #include "mesh/region.hh" // for RegionDB, RegionDB::MapE...
35 #include "mesh/nodes.hh"
36 #include "mesh/bounding_box.hh" // for BoundingBox
37 #include "mesh/range_wrapper.hh"
40 #include "system/exceptions.hh" // for operator<<, ExcStream, EI
41 #include "system/file_path.hh" // for FilePath
42 #include "system/sys_vector.hh" // for FullIterator, VectorId<>...
43 
44 class BIHTree;
45 class Distribution;
46 class Partitioning;
48 class Neighbour;
49 class SideIter;
50 class BCMesh;
51 class DuplicateNodes;
52 template <class Object> class Range;
53 template <int spacedim> class ElementAccessor;
54 template <int spacedim> class NodeAccessor;
55 
56 
57 #define ELM 0
58 #define BC 1
59 #define NODE 2
60 
61 /**
62  * This parameter limits volume of elements from below.
63  */
64 #define MESH_CRITICAL_VOLUME 1.0E-12
65 
68 
70 public:
72 };
73 
74 
75 
76 //=============================================================================
77 // STRUCTURE OF THE MESH
78 //=============================================================================
79 
80 class Mesh {
81 public:
82  TYPEDEF_ERR_INFO( EI_ElemLast, int);
83  TYPEDEF_ERR_INFO( EI_ElemNew, int);
84  TYPEDEF_ERR_INFO( EI_RegLast, std::string);
85  TYPEDEF_ERR_INFO( EI_RegNew, std::string);
86  DECLARE_EXCEPTION(ExcDuplicateBoundary,
87  << "Duplicate boundary elements! \n"
88  << "Element id: " << EI_ElemLast::val << " on region name: " << EI_RegLast::val << "\n"
89  << "Element id: " << EI_ElemNew::val << " on region name: " << EI_RegNew::val << "\n");
90 
91 
92  /**
93  * \brief Types of search algorithm for finding intersection candidates.
94  */
95  typedef enum IntersectionSearch {
96  BIHsearch = 1,
97  BIHonly = 2,
100 
101  /**
102  * \brief The definition of input record for selection of variant of file format
103  */
105 
106  static const unsigned int undef_idx=-1;
107  static const Input::Type::Record & get_input_type();
108 
109 
110 
111  /** Labels for coordinate indexes in arma::vec3 representing vectors and points.*/
112  enum {x_coord=0, y_coord=1, z_coord=2};
113 
114  /**
115  * Empty constructor.
116  *
117  * Use only for unit tests!!!
118  */
119  Mesh();
120  /**
121  * Constructor from an input record.
122  * Do not process input record. That is done in init_from_input.
123  */
124  Mesh(Input::Record in_record, MPI_Comm com = MPI_COMM_WORLD);
125  /**
126  * Common part of both previous constructors and way how to reinitialize a mesh from the given input record.
127  */
128  void reinit(Input::Record in_record);
129 
130  /// Destructor.
131  virtual ~Mesh();
132 
133  virtual inline unsigned int n_nodes() const {
134  return node_vec_.size();
135  }
136 
137  inline unsigned int n_boundaries() const {
138  return boundary_.size();
139  }
140 
141  inline unsigned int n_edges() const {
142  return edges.size();
143  }
144 
145  unsigned int n_corners();
146 
147  inline const RegionDB &region_db() const {
148  return region_db_;
149  }
150 
151 // /// Reserve size of node vector
152 // inline void reserve_node_size(unsigned int n_nodes) {
153 // node_vector.reserve(n_nodes);
154 // }
155 //
156 // /// Reserve size of element vector
157 // inline void reserve_element_size(unsigned int n_elements) {
158 // element.reserve(n_elements);
159 // }
160 
161  /**
162  * Returns pointer to partitioning object. Partitioning is created during setup_topology.
163  */
164  virtual Partitioning *get_part();
165 
166  virtual const LongIdx *get_local_part();
167 
169  { return el_ds; }
170 
172  { return row_4_el; }
173 
175  { return el_4_loc; }
176 
178  { return node_ds_; }
179 
181  { return node_4_loc_; }
182 
183  unsigned int n_local_nodes() const
184  { return n_local_nodes_; }
185 
186  /**
187  * Returns MPI communicator of the mesh.
188  */
189  inline MPI_Comm get_comm() const { return comm_; }
190 
191 
193 
194  unsigned int n_sides() const;
195 
196  unsigned int n_vb_neighbours() const;
197 
198  /**
199  * Returns maximal number of sides of one edge, which connects elements of dimension @p dim.
200  * @param dim Dimension of elements sharing the edge.
201  */
202  unsigned int max_edge_sides(unsigned int dim) const { return max_edge_sides_[dim-1]; }
203 
204  /**
205  * Reads mesh from stream.
206  *
207  * Method is especially used in unit tests.
208  */
209  void read_gmsh_from_stream(istream &in);
210  /**
211  * Reads input record, creates regions, read the mesh, setup topology. creates region sets.
212  */
213  void init_from_input();
214 
215 
216  /**
217  * Initialize all mesh structures from raw information about nodes and elements (including boundary elements).
218  * Namely: create remaining boundary elements and Boundary objects, find edges and compatible neighborings.
219  */
220  void setup_topology();
221 
222  /**
223  * Returns vector of ID numbers of elements, either bulk or bc elemnts.
224  */
225  void elements_id_maps( vector<LongIdx> & bulk_elements_id, vector<LongIdx> & boundary_elements_id) const;
226 
227  /*
228  * Check if nodes and elements are compatible with \p mesh.
229  */
230  virtual bool check_compatible_mesh( Mesh & mesh, vector<LongIdx> & bulk_elements_id, vector<LongIdx> & boundary_elements_id );
231 
232  /// Create and return ElementAccessor to element of given idx
233  virtual ElementAccessor<3> element_accessor(unsigned int idx) const;
234 
235  /// Create and return NodeAccessor to node of given idx
236  NodeAccessor<3> node_accessor(unsigned int idx) const;
237 
238  /**
239  * Reads elements and their affiliation to regions and region sets defined by user in input file
240  * Format of input record is defined in method RegionSetBase::get_input_type()
241  *
242  * @param region_list Array input AbstractRecords which define regions, region sets and elements
243  */
244  void read_regions_from_input(Input::Array region_list);
245 
246  /**
247  * Returns nodes_elements vector, if doesn't exist creates its.
248  */
250 
251 // /// Vector of nodes of the mesh.
252 // NodeVector node_vector;
253 // /// Vector of elements of the mesh.
254 // ElementVector element;
255 
256  /// Vector of boundary sides where is prescribed boundary condition.
257  /// TODO: apply all boundary conditions in the main assembling cycle over elements and remove this Vector.
259 
260  /// Vector of MH edges, this should not be part of the geometrical mesh
262 
263  //flow::VectorId<int> bcd_group_id; // gives a index of group for an id
264 
265  /**
266  * Vector of individual intersections of two elements.
267  * This is enough for local mortar.
268  */
269  std::shared_ptr<MixedMeshIntersections> intersections;
270 
271  /**
272  * For every element El we have vector of indices into @var intersections array for every intersection in which El is master element.
273  * This is necessary for true mortar.
274  */
276 
278 
279  /**
280  * Vector of compatible neighbourings.
281  */
283 
284  int n_insides; // # of internal sides
285  int n_exsides; // # of external sides
286  mutable int n_sides_; // total number of sides (should be easy to count when we have separated dimensions
287 
288  int n_lines; // Number of line elements
289  int n_triangles; // Number of triangle elements
290  int n_tetrahedras; // Number of tetrahedra elements
291 
292  // Temporary solution for numbering of nodes on sides.
293  // The data are defined in RefElement<dim>::side_nodes,
294  // Mesh::side_nodes can be removed as soon as Element
295  // is templated by dimension.
296  //
297  // for every side dimension D = 0 .. 2
298  // for every element side 0 .. D+1
299  // for every side node 0 .. D
300  // index into element node array
302 
303  /**
304  * Check usage of regions, set regions to elements defined by user, close RegionDB
305  */
306  void check_and_finish();
307 
308  /// Compute bounding boxes of elements contained in mesh.
310 
311  /// Getter for BIH. Creates and compute BIH at first call.
312  const BIHTree &get_bih_tree();\
313 
314  /**
315  * Find intersection of element lists given by Mesh::node_elements_ for elements givne by @p nodes_list parameter.
316  * The result is placed into vector @p intersection_element_list. If the @p node_list is empty, and empty intersection is
317  * returned.
318  */
319  void intersect_element_lists(vector<unsigned int> const &nodes_list, vector<unsigned int> &intersection_element_list);
320 
321  /// Add new node of given id and coordinates to mesh
322  void add_node(unsigned int node_id, arma::vec3 coords);
323 
324  /// Add new element of given id to mesh
325  void add_element(unsigned int elm_id, unsigned int dim, unsigned int region_id, unsigned int partition_id,
326  std::vector<unsigned int> node_ids);
327 
328  /// Add new node of given id and coordinates to mesh
329  void add_physical_name(unsigned int dim, unsigned int id, std::string name);
330 
331  /// Return FilePath object representing "mesh_file" input key
332  inline FilePath mesh_file() {
333  return in_record_.val<FilePath>("mesh_file");
334  }
335 
336  /// Getter for input type selection for intersection search algorithm.
338 
339  /// Maximal distance of observe point from Mesh relative to its size
340  double global_snap_radius() const;
341 
342  /// Initialize element_vec_, set size and reset counters of boundary and bulk elements.
343  void init_element_vector(unsigned int size);
344 
345  /// Initialize node_vec_, set size
346  void init_node_vector(unsigned int size);
347 
348  /// Returns range of bulk elements
349  virtual Range<ElementAccessor<3>> elements_range() const;
350 
351  /// Returns range of nodes
353 
354  /// Returns count of boundary or bulk elements
355  virtual unsigned int n_elements(bool boundary=false) const {
356  if (boundary) return element_ids_.size()-bulk_size_;
357  else return bulk_size_;
358  }
359 
360  /// For each node the vector contains a list of elements that use this node
362 
363  /// For element of given elem_id returns index in element_vec_ or (-1) if element doesn't exist.
364  inline int elem_index(int elem_id) const
365  {
366  return element_ids_.get_position(elem_id);
367  }
368 
369  /// Return element id (in GMSH file) of element of given position in element vector.
370  inline int find_elem_id(unsigned int pos) const
371  {
372  return element_ids_[pos];
373  }
374 
375  /// For node of given node_id returns index in element_vec_ or (-1) if node doesn't exist.
376  inline int node_index(int node_id) const
377  {
378  return node_ids_.get_position(node_id);
379  }
380 
381  /// Return node id (in GMSH file) of node of given position in node vector.
382  inline int find_node_id(unsigned int pos) const
383  {
384  return node_ids_[pos];
385  }
386 
387  /// Check if given index is in element_vec_
388  void check_element_size(unsigned int elem_idx) const;
389 
390  /// Create boundary elements from data of temporary structure, this method MUST be call after read mesh from
392 
393  /// Permute nodes of 3D elements of given elm_idx
394  void permute_tetrahedron(unsigned int elm_idx, std::vector<unsigned int> permutation_vec);
395 
396  /// Permute nodes of 2D elements of given elm_idx
397  void permute_triangle(unsigned int elm_idx, std::vector<unsigned int> permutation_vec);
398 
399  /// Create boundary mesh if doesn't exist and return it.
400  BCMesh *get_bc_mesh();
401 
402 protected:
403 
404  /**
405  * Allow store boundary element data to temporary structure.
406  *
407  * We need this structure to preserve correct order of boundary elements.
408  */
409  struct ElementTmpData {
410  /// Constructor
411  ElementTmpData(unsigned int e_id, unsigned int dm, RegionIdx reg_idx, unsigned int part_id, std::vector<unsigned int> nodes)
412  : elm_id(e_id), dim(dm), region_idx(reg_idx), partition_id(part_id), node_ids(nodes) {}
413 
414  unsigned int elm_id;
415  unsigned int dim;
417  unsigned int partition_id;
419  };
420 
421  /**
422  * This replaces read_neighbours() in order to avoid using NGH preprocessor.
423  *
424  * TODO:
425  * - Avoid maps:
426  *
427  * 5) need not to have temporary array for Edges, only postpone setting pointers in elements and set them
428  * after edges are found; we can temporary save Edge index instead of pointer in Neigbours and elements
429  *
430  * 6) Try replace Edge * by indexes in Neigbours and elements (anyway we have mesh pointer in elements so it is accessible also from Neigbours)
431  *
432  */
434 
435  /**
436  * On edges sharing sides of many elements it may happen that each side has its nodes ordered in a different way.
437  * This method finds the permutation for each side so as to obtain the ordering of side 0.
438  */
439  void make_edge_permutations();
440  /**
441  * Create element lists for nodes in Mesh::nodes_elements.
442  */
444  /**
445  * Remove elements with dimension not equal to @p dim from @p element_list. Index of the first element of dimension @p dim-1,
446  * is returned in @p element_idx. If no such element is found the method returns false, if one such element is found the method returns true,
447  * if more elements are found we report an user input error.
448  */
449  bool find_lower_dim_element(vector<unsigned int> &element_list, unsigned int dim, unsigned int &element_idx);
450 
451  /**
452  * Returns true if side @p si has same nodes as in the list @p side_nodes.
453  */
455 
456 
457  void element_to_neigh_vb();
458 
459  void count_element_types();
460  void count_side_types();
461 
462  /**
463  * Check the element quality and remove unused nodes.
464  */
465  void check_mesh_on_read();
466 
467  /**
468  * Possibly modify region id of elements sets by user in "regions" part of input file.
469  *
470  * TODO: This method needs check in issue 'Review mesh setting'.
471  * Changes have been done during generalized region key and may be causing problems
472  * during the further development.
473  */
475 
476  /// Adds element to mesh data structures (element_vec_, element_ids_), returns pointer to this element.
477  Element * add_element_to_vector(int id, bool boundary=false);
478 
479  /// Initialize element
480  void init_element(Element *ele, unsigned int elm_id, unsigned int dim, RegionIdx region_idx, unsigned int partition_id,
481  std::vector<unsigned int> node_ids);
482 
483  unsigned int n_bb_neigh, n_vb_neigh;
484 
485  /// Maximal number of sides per one edge in the actual mesh (set in make_neighbours_and_edges()).
486  unsigned int max_edge_sides_[3];
487 
488  /// Output of neighboring data into raw output.
490 
491  /**
492  * Database of regions (both bulk and boundary) of the mesh. Regions are logical parts of the
493  * domain that allows setting of different data and boundary conditions on them.
494  */
496  /**
497  * Mesh partitioning. Created in setup_topology.
498  */
499  std::shared_ptr<Partitioning> part_;
500 
501  /**
502  * BIH Tree for intersection and observe points lookup.
503  */
504  std::shared_ptr<BIHTree> bih_tree_;
505 
506 
507  /**
508  * Accessor to the input record for the mesh.
509  */
511 
512  /**
513  * MPI communicator used for partitioning and ...
514  */
516 
517  /**
518  * Vector of elements of the mesh.
519  *
520  * Store all elements of the mesh in order bulk elements - boundary elements
521  */
523 
524  /// Hold data of boundary elements during reading mesh (allow to preserve correct order during reading of mix bulk-boundary element)
526 
527  /// Count of bulk elements
528  unsigned int bulk_size_;
529 
530  /// Count of boundary elements loaded from mesh file
531  unsigned int boundary_loaded_size_;
532 
533  /// Maps element ids to indexes into vector element_vec_
535 
536  /**
537  * Vector of nodes of the mesh.
538  */
540 
541  /// Maps node ids to indexes into vector node_vec_
543 
544 
545 
546 
547  friend class RegionSetBase;
548  friend class Element;
549  friend class BIHTree;
550  friend class Boundary;
551  friend class BCMesh;
552  template <int spacedim> friend class ElementAccessor;
553  template <int spacedim> friend class NodeAccessor;
554 
555 
556 
557 private:
558 
559  /// Fill array node_4_loc_ and create object node_ds_ according to element distribution.
560  void distribute_nodes();
561 
562  /// Index set assigning to global element index the local index used in parallel vectors.
564  /// Index set assigning to local element index its global index.
566  /// Parallel distribution of elements.
568  /// Index set assigning to local node index its global index.
570  /// Parallel distribution of nodes. Depends on elements distribution.
572  /// Hold number of local nodes (own + ghost), value is equal with size of node_4_loc array.
573  unsigned int n_local_nodes_;
574  /// Boundary mesh, object is created only if it's necessary
576 
578 };
579 
580 #endif
581 //-----------------------------------------------------------------------------
582 // vim: set cindent:
Mesh::ElementTmpData::partition_id
unsigned int partition_id
Definition: mesh.h:417
Mesh::get_el_ds
Distribution * get_el_ds() const
Definition: mesh.h:168
Mesh::y_coord
@ y_coord
Definition: mesh.h:112
Mesh::n_tetrahedras
int n_tetrahedras
Definition: mesh.h:290
Mesh::permute_triangle
void permute_triangle(unsigned int elm_idx, std::vector< unsigned int > permutation_vec)
Permute nodes of 2D elements of given elm_idx.
Definition: mesh.cc:1252
Boundary
Definition: boundaries.h:48
BidirectionalMap< int >
general_iterator.hh
Template Iter serves as general template for internal iterators.
Mesh::permute_tetrahedron
void permute_tetrahedron(unsigned int elm_idx, std::vector< unsigned int > permutation_vec)
Permute nodes of 3D elements of given elm_idx.
Definition: mesh.cc:1235
Mesh::boundary_
vector< Boundary > boundary_
Definition: mesh.h:258
Mesh::get_input_intersection_variant
static const Input::Type::Selection & get_input_intersection_variant()
The definition of input record for selection of variant of file format.
Definition: mesh.cc:65
BoundarySegment
Definition: mesh.h:69
Mesh::get_element_boxes
std::vector< BoundingBox > get_element_boxes()
Compute bounding boxes of elements contained in mesh.
Definition: mesh.cc:992
Mesh::node_4_loc_
LongIdx * node_4_loc_
Index set assigning to local node index its global index.
Definition: mesh.h:569
Mesh::in_record_
Input::Record in_record_
Definition: mesh.h:510
Mesh::ElementTmpData::elm_id
unsigned int elm_id
Definition: mesh.h:414
Mesh::init_element_vector
void init_element_vector(unsigned int size)
Initialize element_vec_, set size and reset counters of boundary and bulk elements.
Definition: mesh.cc:1082
Mesh::undef_idx
static const unsigned int undef_idx
Definition: mesh.h:106
Mesh::create_boundary_elements
void create_boundary_elements()
Create boundary elements from data of temporary structure, this method MUST be call after read mesh f...
Definition: mesh.cc:1218
Mesh::ElementTmpData::region_idx
RegionIdx region_idx
Definition: mesh.h:416
Mesh::ElementTmpData::ElementTmpData
ElementTmpData(unsigned int e_id, unsigned int dm, RegionIdx reg_idx, unsigned int part_id, std::vector< unsigned int > nodes)
Constructor.
Definition: mesh.h:411
Mesh::n_exsides
int n_exsides
Definition: mesh.h:285
Mesh::init_element
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.
Definition: mesh.cc:1055
Iter
General iterator template. Provides iterator over objects in some container.
Definition: general_iterator.hh:30
LongIdx
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
Definition: long_idx.hh:22
Mesh::elements_range
virtual Range< ElementAccessor< 3 > > elements_range() const
Returns range of bulk elements.
Definition: mesh.cc:1116
Mesh::n_sides
unsigned int n_sides() const
Definition: mesh.cc:227
Mesh::reinit
void reinit(Input::Record in_record)
Definition: mesh.cc:157
file_path.hh
MixedMeshIntersections
Main class for computation of intersection of meshes of combined dimensions.
Definition: mixed_mesh_intersections.hh:64
Input::Record::val
const Ret val(const string &key) const
Definition: accessors_impl.hh:31
Mesh::boundary_loaded_size_
unsigned int boundary_loaded_size_
Count of boundary elements loaded from mesh file.
Definition: mesh.h:531
Mesh::tree
DuplicateNodes * tree
Definition: mesh.h:277
Mesh::element_vec_
vector< Element > element_vec_
Definition: mesh.h:522
FilePath
Dedicated class for storing path to input and output files.
Definition: file_path.hh:54
Mesh::get_input_type
static const Input::Type::Record & get_input_type()
Definition: mesh.cc:76
BIHTree
Class for O(log N) lookup for intersections with a set of bounding boxes.
Definition: bih_tree.hh:38
Mesh::max_edge_sides_
unsigned int max_edge_sides_[3]
Maximal number of sides per one edge in the actual mesh (set in make_neighbours_and_edges()).
Definition: mesh.h:486
std::vector< LongIdx >
Mesh::n_edges
unsigned int n_edges() const
Definition: mesh.h:141
Mesh::count_side_types
void count_side_types()
Definition: mesh.cc:400
ElementAccessor
Definition: fe_value_handler.hh:29
Mesh::TYPEDEF_ERR_INFO
TYPEDEF_ERR_INFO(EI_ElemLast, int)
Partitioning
Class for the mesh partitioning. This should provide:
Definition: partitioning.hh:52
Mesh::make_edge_permutations
void make_edge_permutations()
Definition: mesh.cc:679
arma::vec3
Definition: doxy_dummy_defs.hh:17
Mesh::get_row_4_el
LongIdx * get_row_4_el() const
Definition: mesh.h:171
nodes.hh
Nodes of a mesh.
Mesh::node_range
Range< NodeAccessor< 3 > > node_range() const
Returns range of nodes.
Definition: mesh.cc:1122
ElementIter
Iter< ElementAccessor< 3 > > ElementIter
Definition: mesh.h:66
Mesh::n_local_nodes_
unsigned int n_local_nodes_
Hold number of local nodes (own + ghost), value is equal with size of node_4_loc array.
Definition: mesh.h:573
Neighbour
Definition: neighbours.h:119
Mesh::read_regions_from_input
void read_regions_from_input(Input::Array region_list)
Definition: mesh.cc:967
Mesh::z_coord
@ z_coord
Definition: mesh.h:112
Mesh::get_intersection_search
IntersectionSearch get_intersection_search()
Getter for input type selection for intersection search algorithm.
Definition: mesh.cc:151
storage.hh
Mesh::n_vb_neighbours
unsigned int n_vb_neighbours() const
Definition: mesh.cc:236
exceptions.hh
type_record.hh
Mesh::get_node_ds
Distribution * get_node_ds() const
Definition: mesh.h:177
Element
Definition: elements.h:42
Mesh::el_ds
Distribution * el_ds
Parallel distribution of elements.
Definition: mesh.h:567
Mesh::intersect_element_lists
void intersect_element_lists(vector< unsigned int > const &nodes_list, vector< unsigned int > &intersection_element_list)
Definition: mesh.cc:427
Mesh::n_sides_
int n_sides_
Definition: mesh.h:286
BidirectionalMap::get_position
int get_position(T val) const
Return position of item of given value.
Definition: bidirectional_map.hh:103
RegionSetBase
Definition: region_set.hh:35
Mesh::init_from_input
void init_from_input()
Mesh::output_internal_ngh_data
void output_internal_ngh_data()
Output of neighboring data into raw output.
Definition: mesh.cc:1136
Mesh::DECLARE_EXCEPTION
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::ElementTmpData::node_ids
std::vector< unsigned int > node_ids
Definition: mesh.h:418
Mesh::get_local_part
virtual const LongIdx * get_local_part()
Definition: mesh.cc:255
Distribution
Definition: distribution.hh:50
Mesh::node_ids_
BidirectionalMap< int > node_ids_
Maps node ids to indexes into vector node_vec_.
Definition: mesh.h:542
Mesh::BBsearch
@ BBsearch
Definition: mesh.h:98
Mesh::check_mesh_on_read
void check_mesh_on_read()
Definition: mesh.cc:308
Mesh::n_corners
unsigned int n_corners()
Definition: mesh.cc:241
Mesh::find_lower_dim_element
bool find_lower_dim_element(vector< unsigned int > &element_list, unsigned int dim, unsigned int &element_idx)
Definition: mesh.cc:459
Mesh::count_element_types
void count_element_types()
Definition: mesh.cc:264
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
Mesh::get_bih_tree
const BIHTree & get_bih_tree()
Getter for BIH. Creates and compute BIH at first call.
Definition: mesh.cc:1007
Mesh::distribute_nodes
void distribute_nodes()
Fill array node_4_loc_ and create object node_ds_ according to element distribution.
Definition: mesh.cc:1275
Mesh::get_node_4_loc
LongIdx * get_node_4_loc() const
Definition: mesh.h:180
Mesh::read_gmsh_from_stream
void read_gmsh_from_stream(istream &in)
Mesh::get_bc_mesh
BCMesh * get_bc_mesh()
Create boundary mesh if doesn't exist and return it.
Definition: mesh.cc:1269
Mesh::node_vec_
vector< Node > node_vec_
Definition: mesh.h:539
mpi.h
accessors.hh
Mesh::el_4_loc
LongIdx * el_4_loc
Index set assigning to local element index its global index.
Definition: mesh.h:565
Mesh::elements_id_maps
void elements_id_maps(vector< LongIdx > &bulk_elements_id, vector< LongIdx > &boundary_elements_id) const
Definition: mesh.cc:814
Mesh::ElementTmpData::dim
unsigned int dim
Definition: mesh.h:415
Mesh::side_nodes
vector< vector< vector< unsigned int > > > side_nodes
Definition: mesh.h:301
Mesh::region_db_
RegionDB region_db_
Definition: mesh.h:495
bidirectional_map.hh
Implementation of bidirectional map.
Mesh::IntersectionSearch
IntersectionSearch
Types of search algorithm for finding intersection candidates.
Definition: mesh.h:95
Mesh::find_elem_id
int find_elem_id(unsigned int pos) const
Return element id (in GMSH file) of element of given position in element vector.
Definition: mesh.h:370
Mesh::region_db
const RegionDB & region_db() const
Definition: mesh.h:147
sys_vector.hh
Vector classes to support both Iterator, index and Id access and creating co-located vectors.
Mesh::master_elements
vector< vector< unsigned int > > master_elements
Definition: mesh.h:275
Mesh::mesh_file
FilePath mesh_file()
Return FilePath object representing "mesh_file" input key.
Definition: mesh.h:332
RegionDB
Definition: region.hh:292
Mesh::bih_tree_
std::shared_ptr< BIHTree > bih_tree_
Definition: mesh.h:504
Mesh::node_ds_
Distribution * node_ds_
Parallel distribution of nodes. Depends on elements distribution.
Definition: mesh.h:571
Input::Type::Selection
Template for classes storing finite set of named values.
Definition: type_selection.hh:65
std::map< unsigned int, unsigned int >
Mesh::check_compatible_mesh
virtual bool check_compatible_mesh(Mesh &mesh, vector< LongIdx > &bulk_elements_id, vector< LongIdx > &boundary_elements_id)
Definition: mesh.cc:855
bounding_box.hh
Mesh::same_sides
bool same_sides(const SideIter &si, vector< unsigned int > &side_nodes)
Definition: mesh.cc:479
Mesh::element_to_neigh_vb
void element_to_neigh_vb()
Definition: mesh.cc:752
Mesh::check_element_size
void check_element_size(unsigned int elem_idx) const
Check if given index is in element_vec_.
Definition: mesh.cc:1128
Mesh::get_comm
MPI_Comm get_comm() const
Definition: mesh.h:189
Mesh::add_element
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.
Definition: mesh.cc:1033
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
MPI_Comm
int MPI_Comm
Definition: mpi.h:141
Mesh::~Mesh
virtual ~Mesh()
Destructor.
Definition: mesh.cc:202
Mesh::n_bb_neigh
unsigned int n_bb_neigh
Definition: mesh.h:483
Mesh::create_node_element_lists
void create_node_element_lists()
Definition: mesh.cc:414
Mesh::edges
std::vector< Edge > edges
Vector of MH edges, this should not be part of the geometrical mesh.
Definition: mesh.h:261
Mesh::setup_topology
void setup_topology()
Definition: mesh.cc:369
Mesh::modify_element_ids
void modify_element_ids(const RegionDB::MapElementIDToRegionID &map)
Definition: mesh.cc:281
Mesh
Definition: mesh.h:80
Mesh::BIHsearch
@ BIHsearch
Definition: mesh.h:96
Mesh::elem_index
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.
Definition: mesh.h:364
boundaries.h
Range
Range helper class.
Definition: mesh.h:52
Mesh::make_neighbours_and_edges
void make_neighbours_and_edges()
Definition: mesh.cc:496
Mesh::init_node_vector
void init_node_vector(unsigned int size)
Initialize node_vec_, set size.
Definition: mesh.cc:1093
Input::Array
Accessor to input data conforming to declared Array.
Definition: accessors.hh:566
Mesh::Mesh
Mesh()
Definition: mesh.cc:102
Mesh::n_vb_neigh
unsigned int n_vb_neigh
Definition: mesh.h:483
Mesh::n_boundaries
unsigned int n_boundaries() const
Definition: mesh.h:137
Mesh::n_lines
int n_lines
Definition: mesh.h:288
RegionIdx
Definition: region.hh:67
Mesh::node_index
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.
Definition: mesh.h:376
BCMesh
Class represents boundary part of mesh.
Definition: bc_mesh.hh:35
Mesh::check_and_finish
void check_and_finish()
Definition: mesh.cc:977
BoundarySegment::input_type
static Input::Type::Record input_type
Definition: mesh.h:71
NodeAccessor
Definition: mesh.h:54
Mesh::node_elements_
vector< vector< unsigned int > > node_elements_
For each node the vector contains a list of elements that use this node.
Definition: mesh.h:361
MPI_COMM_WORLD
#define MPI_COMM_WORLD
Definition: mpi.h:123
region.hh
Mesh::element_ids_
BidirectionalMap< int > element_ids_
Maps element ids to indexes into vector element_vec_.
Definition: mesh.h:534
Mesh::add_node
void add_node(unsigned int node_id, arma::vec3 coords)
Add new node of given id and coordinates to mesh.
Definition: mesh.cc:1025
edges.h
Mesh::max_edge_sides
unsigned int max_edge_sides(unsigned int dim) const
Definition: mesh.h:202
Mesh::bc_element_tmp_
vector< ElementTmpData > bc_element_tmp_
Hold data of boundary elements during reading mesh (allow to preserve correct order during reading of...
Definition: mesh.h:525
Mesh::node_accessor
NodeAccessor< 3 > node_accessor(unsigned int idx) const
Create and return NodeAccessor to node of given idx.
Definition: mesh.cc:808
NodeIter
Iter< NodeAccessor< 3 > > NodeIter
Definition: mesh.h:67
Mesh::part_
std::shared_ptr< Partitioning > part_
Definition: mesh.h:499
long_idx.hh
Mesh::bulk_size_
unsigned int bulk_size_
Count of bulk elements.
Definition: mesh.h:528
Mesh::row_4_el
LongIdx * row_4_el
Index set assigning to global element index the local index used in parallel vectors.
Definition: mesh.h:563
Mesh::add_element_to_vector
Element * add_element_to_vector(int id, bool boundary=false)
Adds element to mesh data structures (element_vec_, element_ids_), returns pointer to this element.
Definition: mesh.cc:1100
Mesh::node_elements
const vector< vector< unsigned int > > & node_elements()
Definition: mesh.cc:1074
Mesh::comm_
MPI_Comm comm_
Definition: mesh.h:515
Mesh::global_snap_radius
double global_snap_radius() const
Maximal distance of observe point from Mesh relative to its size.
Definition: mesh.cc:1016
Mesh::n_local_nodes
unsigned int n_local_nodes() const
Definition: mesh.h:183
Mesh::n_elements
virtual unsigned int n_elements(bool boundary=false) const
Returns count of boundary or bulk elements.
Definition: mesh.h:355
Mesh::get_part
virtual Partitioning * get_part()
Definition: mesh.cc:251
Mesh::n_insides
int n_insides
Definition: mesh.h:284
Mesh::bc_mesh_
BCMesh * bc_mesh_
Boundary mesh, object is created only if it's necessary.
Definition: mesh.h:575
Mesh::mixed_intersections
MixedMeshIntersections & mixed_intersections()
Definition: mesh.cc:785
Mesh::BIHonly
@ BIHonly
Definition: mesh.h:97
Mesh::element_accessor
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
Definition: mesh.cc:802
Mesh::n_nodes
virtual unsigned int n_nodes() const
Definition: mesh.h:133
Mesh::raw_ngh_output_file
ofstream raw_ngh_output_file
Definition: mesh.h:577
Mesh::find_node_id
int find_node_id(unsigned int pos) const
Return node id (in GMSH file) of node of given position in node vector.
Definition: mesh.h:382
accessors_impl.hh
SideIter
Definition: sides.h:131
Mesh::add_physical_name
void add_physical_name(unsigned int dim, unsigned int id, std::string name)
Add new node of given id and coordinates to mesh.
Definition: mesh.cc:1020
Mesh::vb_neighbours_
vector< Neighbour > vb_neighbours_
Definition: mesh.h:282
Mesh::x_coord
@ x_coord
Definition: mesh.h:112
Mesh::ElementTmpData
Definition: mesh.h:409
Mesh::n_triangles
int n_triangles
Definition: mesh.h:289
DuplicateNodes
Definition: duplicate_nodes.h:96
BidirectionalMap::size
unsigned int size() const
Return size of map.
Definition: bidirectional_map.hh:77
range_wrapper.hh
Implementation of range helper class.
Mesh::get_el_4_loc
LongIdx * get_el_4_loc() const
Definition: mesh.h:174
Mesh::intersections
std::shared_ptr< MixedMeshIntersections > intersections
Definition: mesh.h:269