Flow123d  JS_before_hm-1880-gdd969e4e2
accessors.hh
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 accessors.hh
15  * @brief
16  */
17 
18 #ifndef ACCESSORS_HH_
19 #define ACCESSORS_HH_
20 
21 #include "mesh/bounding_box.hh"
22 #include "mesh/region.hh"
23 #include "mesh/elements.h"
24 #include "mesh/mesh.h"
25 #include "mesh/node_accessor.hh"
26 #include "mesh/ref_element.hh"
27 #include "la/distribution.hh"
28 #include "mesh/point.hh"
29 #include <vector>
30 #include <armadillo>
31 
32 
33 /**
34  * Due to circular dependence of return parameters in mesh accessors,
35  * and the intention to have all methods inlined,
36  * we gathered the accessors into a single file.
37  * This way, it is possible to implement it, see the simple test below.
38  *
39  * Do not include accessors_impl.hh file anywhere but at the end of this file!
40  *
41  * previous include loops:
42  * side -> boundary -> elemen accessor
43  * element accessor <-> side
44  * edge <-> side
45  * boundary -> edge
46  */
47 
48 // Compilable test of class loop dependence of return parameters.
49 // class A;
50 // class B;
51 
52 // class A{
53 // public:
54 // A()
55 // {};
56 
57 // B create_b();
58 // };
59 
60 // class B{
61 // public:
62 // B()
63 // {};
64 
65 // A create_a();
66 // };
67 
68 
69 // B A::create_b()
70 // { return B(); }
71 
72 // A B::create_a()
73 // { return A(); }
74 
75 
76 class Side;
77 class SiderIter;
78 class Edge;
79 class Boundary;
80 
81 /**
82  * Element accessor templated just by dimension of the embedding space, used by Fields.
83  * This should allow algorithms over elements where dimension of particular element is runtime parameter.
84  *
85  * This class suites as interface of Fields to the mesh elements, in particular this accessor knows directly
86  * the region, and also can be used as an accessor that works on the whole region if used by Fields that do not depend on
87  * particular elements as FieldConstant, FiledFormula, and FieldPython.
88  *
89  * TODO:
90  * - make this kind of accessor subclass of FieldCommonBase or at least move it into src/fields
91  * since it has functionality particular for Fields
92  *
93  * Ideas:
94  * need function to calculate intersection (object) of two ElementAccessors, but this definitely should be templated by
95  * dimension of the ref. element (or rather shape of ref. element), here we can have case dispatch
96  *
97  */
98 template <int spacedim>
99 class ElementAccessor {
100 public:
101  /// Default invalid accessor.
102  ElementAccessor();
103 
104  /// Regional accessor.
105  ElementAccessor(const Mesh *mesh, RegionIdx r_idx);
106 
107  /// Element accessor.
108  ElementAccessor(const Mesh *mesh, unsigned int idx);
109 
110  /// Incremental function of the Element iterator.
111  void inc();
112 
113  /// Return list of element vertices.
115 
116  /// Computes the measure of the element.
117  double measure() const;
118 
119  inline bool inverted() const {
120  return element()->inverted;
121  }
122 
123  inline double sign() const {
124  return inverted() ? -1 : 1;
125  }
126 
127  /**
128  * Returns Jacobian of 3D element.
129  * Used by measure and in intersections.
130  */
131  inline double jacobian_S3() const {
132  ASSERT_DBG(dim() == 3)(dim()).error("Dimension mismatch.");
133  return arma::dot( arma::cross(*( node(1) ) - *( node(0) ),
134  *( node(2) ) - *( node(0) )),
135  *( node(3) ) - *( node(0) )
136  );
137  }
138 
139  /**
140  * Returns Jacobian of 2D element.
141  */
142  inline double jacobian_S2() const {
143  ASSERT_DBG(dim() == 2)(dim()).error("Dimension mismatch.");
144  return arma::norm(
145  arma::cross(*( node(1) ) - *( node(0) ), *( node(2) ) - *( node(0) )),
146  2
147  );
148  }
149 
150  /**
151  * Returns Jacobian of 1D element.
152  */
153  inline double jacobian_S1() const {
154  ASSERT_DBG(dim() == 1)(dim()).error("Dimension mismatch.");
155  return arma::norm(*( node(1) ) - *( node(0) ) , 2);
156  }
157 
158  /// Computes the barycenter.
159  arma::vec::fixed<spacedim> centre() const;
160 
161  /**
162  * Quality of the element based on the smooth and scale-invariant quality measures proposed in:
163  * J. R. Schewchuk: What is a Good Linear Element?
164  *
165  * We scale the measure so that is gives value 1 for regular elements. Line 1d elements
166  * have always quality 1.
167  *
168  * We return signed value in order to detect inverted elements.
169  */
170  double quality_measure_smooth() const;
171 
172  SideIter side(const unsigned int loc_index);
173 
174  const SideIter side(const unsigned int loc_index) const;
175 
176 
177 
178  inline bool is_regional() const {
179  return r_idx_.is_valid();
180  }
181 
182  inline bool is_elemental() const {
183  return ( is_valid() && ! is_regional() );
184  }
185 
186  inline bool is_valid() const {
187  return mesh_ != NULL;
188  }
189 
190  inline unsigned int dim() const {
191  ASSERT_DBG(! is_regional());
192  return element()->dim();
193  }
194 
195  inline const Element * element() const {
197  return &(mesh_->element_vec_[element_idx_]);
198  }
199 
200 
201  inline Region region() const
202  { return Region( region_idx(), mesh_->region_db()); }
203 
204  inline RegionIdx region_idx() const {
205  if (r_idx_.is_valid()) {
206  return r_idx_;
207  } else {
208  return element()->region_idx();
209  }
210  }
211 
212  /// We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular mesh
213  //unsigned int region_id() const {
214  // return region().id();
215  //}
216 
217  bool is_boundary() const {
219  return (element_idx_>=mesh_->n_elements());
220  }
221 
222  /// Return local idx of element in boundary / bulk part of element vector
223  unsigned int idx() const {
225  if (is_boundary()) return ( element_idx_ - mesh_->bulk_size_ );
226  else return element_idx_;
227  }
228 
229  /// Return global idx of element in full element vector
230  unsigned int mesh_idx() const {
232  return element_idx_;
233  }
234 
235  unsigned int index() const {
236  return (unsigned int)mesh_->find_elem_id(element_idx_);
237  }
238 
239  unsigned int proc() const {
242  }
243 
244 
245  NodeAccessor<3> node(unsigned int ni) const {
246  return mesh_->node( element()->node_idx(ni) );
247  }
248 
249  /**
250  * Return bounding box of the element.
251  * Simpler code, but need to check performance penelty.
252  */
254  return BoundingBox(this->vertex_list());
255  }
256 
257  bool operator==(const ElementAccessor<spacedim>& other) const {
258  return (element_idx_ == other.element_idx_);
259  }
260 
261  inline bool operator!=(const ElementAccessor<spacedim>& other) const {
262  return (element_idx_ != other.element_idx_);
263  }
264 
265  /**
266  * -> dereference operator
267  *
268  * Allow simplify calling of element() method. Example:
269  @code
270  ElementAccessor<3> elm_ac(mesh, index);
271  arma::vec centre;
272  centre = elm_ac.element()->node_idx(0); // full format of access to element
273  centre = elm_ac->node_idx(0); // short format with dereference operator
274  @endcode
275  */
276  const Element * operator ->() const {
278  return &(mesh_->element_vec_[element_idx_]);
279  }
280 
281 
282 private:
283  /**
284  * When dim_ == undefined_dim_ ; the value of element_idx_ is invalid.
285  * Is used for ElementAccessors for whole region
286  */
287  static const unsigned int undefined_dim_ = 100;
288 
289  /// Pointer to the mesh owning the element.
290  const Mesh *mesh_;
291 
292  /// Index into Mesh::element_vec_ array.
293  unsigned int element_idx_;
294 
295  // Hack for sorption tables. TODO: remove
296  // undefined for regular elements
298 
299 };
300 
301 
302 
303 
304 
305 //=============================================================================
306 // Edge class
307 //=============================================================================
308 class Edge
309 {
310 public:
311  /// Default invalid edge accessor constructor.
312  Edge();
313 
314  /// Valid edge accessor constructor.
315  Edge(const Mesh *mesh, unsigned int edge_idx);
316 
317  /// Gets side iterator of the @p i -th side.
318  SideIter side(const unsigned int i) const;
319 
320 
321 
322  bool is_valid() const
323  { return mesh_ != nullptr; }
324 
325  /// Returns edge global index.
326  unsigned int idx() const {
327  ASSERT_DBG(is_valid());
328  return edge_idx_;
329  }
330 
331  /// Incremental function of the Edge iterator.
332  void inc() {
333  ASSERT_DBG(is_valid()).error("Do not call inc() for invalid accessor!");
334  edge_idx_++;
335  }
336 
337  /// Comparison operator of the iterator.
338  bool operator==(const Edge& other) const{
339  return (edge_idx_ == other.edge_idx_);
340  }
341 
342  /// Returns number of sides aligned with the edge.
343  unsigned int n_sides() const
344  { return edge_data()->n_sides;}
345 
346 private:
347  /// Pointer to the mesh owning the node.
348  const Mesh *mesh_;
349  /// Index into Mesh::edges vector.
350  unsigned int edge_idx_;
351 
352  /// Getter for edge data from mesh.
353  const EdgeData* edge_data() const;
354 };
355 
356 
357 
358 
359 
360 //=============================================================================
361 // Boundary class
362 //=============================================================================
363 class Boundary
364 {
365 public:
366  Boundary();
367  Boundary(BoundaryData* boundary_data);
368 
369  Edge edge();
371  Region region();
372  Element * element();
373 
374  bool is_valid() const {
375  return boundary_data_ != nullptr;
376  }
377 
378  Mesh* mesh() {
379  ASSERT_DBG(is_valid());
380  return boundary_data_->mesh_;
381  }
382 
384  ASSERT_DBG(is_valid());
385  return boundary_data_->edge_idx_;
386  }
387 
389  ASSERT_DBG(is_valid());
390  return boundary_data_->bc_ele_idx_;
391  }
392 
393 private:
395 };
396 
397 
398 
399 
400 
401 //=============================================================================
402 // Side class
403 //=============================================================================
404 class Side {
405 public:
406  /// Default invalid side accessor constructor.
407  Side();
408 
409  /// Valid edge accessor constructor.
410  Side(const Mesh * mesh, unsigned int elem_idx, unsigned int set_lnum);
411 
412  double measure() const; ///< Calculate metrics of the side
413  arma::vec3 centre() const; ///< Centre of side
414  arma::vec3 normal() const; ///< Vector of (generalized) normal
415  double diameter() const; ///< Calculate the side diameter.
416 
417  /// Returns dimension of the side, that is dimension of the element minus one.
418  unsigned int dim() const;
419 
420  /// Returns true for all sides either on boundary or connected to vb neigboring.
421  bool is_external() const;
422 
423  /// Returns true for side on the boundary.
424  bool is_boundary() const;
425 
426  /// Returns node for given local index @p i on the side.
427  NodeAccessor<3> node(unsigned int i) const;
428 
429  /// Returns iterator to the element of the side.
430  ElementAccessor<3> element() const;
431 
432  /// Returns global index of the edge connected to the side.
433  unsigned int edge_idx() const;
434 
435  /// Returns pointer to the edge connected to the side.
436  Edge edge() const;
437 
438  /**
439  * Returns boundary condition prescribed on the side.
440  * Fails on assert if side if not on boundary and no BC is prescribed.
441  */
442  Boundary cond() const;
443 
444  /// Returns global index of the prescribed boundary condition.
445  unsigned int cond_idx() const;
446 
447 
448 
449  /// Returns number of nodes of the side.
450  unsigned int n_nodes() const
451  { return dim()+1; }
452 
453  /// Returns pointer to the mesh.
454  const Mesh * mesh() const
455  { return this->mesh_; }
456 
457  /// Returns local index of the side on the element.
458  unsigned int side_idx() const
459  { return side_idx_; }
460 
461  /// Returns index of element in Mesh::element_vec_.
462  unsigned int elem_idx() const
463  { return elem_idx_; }
464 
465  /// Returns true if the side has assigned element.
466  bool is_valid() const
467  { return mesh_!= nullptr; }
468 
469  /// Iterate over local sides of the element.
470  void inc() {
471  ASSERT_DBG(is_valid()).error("Do not call inc() for invalid accessor!");
472  side_idx_++;
473  }
474 
475  bool operator==(const Side &other) const {
476  return (mesh_ == other.mesh_ ) && ( elem_idx_ == other.elem_idx_ )
477  && ( side_idx_ == other.side_idx_ );
478  }
479 
480  bool operator!=(const Side &other) const {
481  return !( *this == other);
482  }
483 
484  /// This is necessary by current DofHandler, should change this
485  //void *make_ptr() const;
486 private:
487 
488  arma::vec3 normal_point() const;
489  arma::vec3 normal_line() const;
490  arma::vec3 normal_triangle() const;
491 
492  // Topology of the mesh
493 
494  const Mesh * mesh_; ///< Pointer to Mesh to which belonged
495  unsigned int elem_idx_; ///< Index of element in Mesh::element_vec_
496  unsigned int side_idx_; ///< Local # of side in element (to remove it, we heve to remove calc_side_rhs)
497 
498 };
499 
500 
501 /*
502  * Iterator to a side.
503  */
504 class SideIter {
505 public:
507  {}
508 
509  SideIter(const Side &side)
510  : side_(side)
511  {}
512 
513  bool operator==(const SideIter &other) {
514  return (side_.mesh() == other.side_.mesh() ) && ( side_.elem_idx() == other.side_.elem_idx() )
515  && ( side_.side_idx() == other.side_.side_idx() );
516  }
517 
518 
519  bool operator!=(const SideIter &other) {
520  return !( *this == other);
521  }
522 
523  /// * dereference operator
524  const Side & operator *() const
525  { return side_; }
526 
527  /// -> dereference operator
528  const Side * operator ->() const
529  { return &side_; }
530 
531  /// prefix increment iterate only on local element
533  side_.inc();
534  return (*this);
535  }
536 
537 private:
539 };
540 
541 
542 
543 #include "mesh/accessors_impl.hh"
544 
545 #endif /* ACCESSORS_HH_ */
ElementAccessor::dim
unsigned int dim() const
Definition: accessors.hh:190
SideIter::operator->
const Side * operator->() const
-> dereference operator
Definition: accessors.hh:528
Mesh::get_el_ds
Distribution * get_el_ds() const
Definition: mesh.h:198
Side::edge
Edge edge() const
Returns pointer to the edge connected to the side.
Definition: accessors_impl.hh:221
Side::side_idx_
unsigned int side_idx_
Local # of side in element (to remove it, we heve to remove calc_side_rhs)
Definition: accessors.hh:496
Side::mesh
const Mesh * mesh() const
Returns pointer to the mesh.
Definition: accessors.hh:454
Boundary
Definition: accessors.hh:363
ElementAccessor::mesh_idx
unsigned int mesh_idx() const
Return global idx of element in full element vector.
Definition: accessors.hh:230
ElementAccessor::r_idx_
RegionIdx r_idx_
Definition: accessors.hh:297
ref_element.hh
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.
ElementAccessor::operator==
bool operator==(const ElementAccessor< spacedim > &other) const
Definition: accessors.hh:257
SideIter::side_
Side side_
Definition: accessors.hh:538
ElementAccessor::inverted
bool inverted() const
Definition: accessors.hh:119
Side::elem_idx_
unsigned int elem_idx_
Index of element in Mesh::element_vec_.
Definition: accessors.hh:495
Element::inverted
bool inverted
Inverted permutation of element nodes, negative Jacobian.
Definition: elements.h:101
Side::is_external
bool is_external() const
Returns true for all sides either on boundary or connected to vb neigboring.
Definition: accessors_impl.hh:197
ElementAccessor::mesh_
const Mesh * mesh_
Pointer to the mesh owning the element.
Definition: accessors.hh:290
Boundary::edge_idx
uint edge_idx()
Definition: accessors.hh:383
Edge::mesh_
const Mesh * mesh_
Pointer to the mesh owning the node.
Definition: accessors.hh:348
SideIter::SideIter
SideIter(const Side &side)
Definition: accessors.hh:509
Side::Side
Side()
Default invalid side accessor constructor.
Definition: accessors_impl.hh:182
Element::dim
unsigned int dim() const
Definition: elements.h:127
Edge::inc
void inc()
Incremental function of the Edge iterator.
Definition: accessors.hh:332
Side::mesh_
const Mesh * mesh_
Pointer to Mesh to which belonged.
Definition: accessors.hh:494
distribution.hh
Support classes for parallel programing.
Edge::n_sides
unsigned int n_sides() const
Returns number of sides aligned with the edge.
Definition: accessors.hh:343
ElementAccessor::jacobian_S2
double jacobian_S2() const
Definition: accessors.hh:142
point.hh
BoundaryData::edge_idx_
unsigned int edge_idx_
Definition: mesh_data.hh:49
Side::is_boundary
bool is_boundary() const
Returns true for side on the boundary.
Definition: accessors_impl.hh:202
Mesh::element_vec_
vector< Element > element_vec_
Definition: mesh.h:598
ASSERT_DBG
#define ASSERT_DBG(expr)
Definition: include_fadbad.hh:28
RegionIdx::is_valid
bool is_valid() const
Returns false if the region has undefined/invalid value.
Definition: region.hh:78
Side::dim
unsigned int dim() const
Returns dimension of the side, that is dimension of the element minus one.
Definition: accessors_impl.hh:192
std::vector< arma::vec3 >
Side::measure
double measure() const
Calculate metrics of the side.
Definition: accessors.cc:27
ElementAccessor
Definition: dh_cell_accessor.hh:32
Side::elem_idx
unsigned int elem_idx() const
Returns index of element in Mesh::element_vec_.
Definition: accessors.hh:462
arma::vec3
Definition: doxy_dummy_defs.hh:17
Edge::idx
unsigned int idx() const
Returns edge global index.
Definition: accessors.hh:326
SideIter::operator==
bool operator==(const SideIter &other)
Definition: accessors.hh:513
Mesh::get_row_4_el
LongIdx * get_row_4_el() const
Definition: mesh.h:201
BoundaryData
Definition: mesh_data.hh:40
Edge::edge_data
const EdgeData * edge_data() const
Getter for edge data from mesh.
Definition: accessors_impl.hh:164
EdgeData
Definition: mesh_data.hh:25
uint
unsigned int uint
Definition: mh_dofhandler.hh:101
Side::cond
Boundary cond() const
Definition: accessors_impl.hh:225
ElementAccessor::is_elemental
bool is_elemental() const
Definition: accessors.hh:182
Edge::is_valid
bool is_valid() const
Definition: accessors.hh:322
ElementAccessor::element
const Element * element() const
Definition: accessors.hh:195
Edge::Edge
Edge()
Default invalid edge accessor constructor.
Definition: accessors_impl.hh:154
BoundaryData::bc_ele_idx_
unsigned int bc_ele_idx_
Definition: mesh_data.hh:53
ElementAccessor::quality_measure_smooth
double quality_measure_smooth() const
Definition: accessors_impl.hh:105
Side::normal_point
arma::vec3 normal_point() const
This is necessary by current DofHandler, should change this.
Definition: accessors.cc:64
Mesh::n_elements
virtual unsigned int n_elements() const
Returns count of boundary or bulk elements.
Definition: mesh.h:398
Element
Definition: elements.h:40
accessors_impl.hh
Implementation of the inline functions of the mesh accessors.
BoundingBox
Bounding box in 3d ambient space.
Definition: bounding_box.hh:54
Side::normal_triangle
arma::vec3 normal_triangle() const
Definition: accessors.cc:101
Region
Definition: region.hh:146
Distribution::get_proc
unsigned int get_proc(unsigned int idx) const
get processor of the given index
Definition: distribution.cc:130
Boundary::bc_ele_idx
uint bc_ele_idx()
Definition: accessors.hh:388
ElementAccessor::is_boundary
bool is_boundary() const
We need this method after replacing Region by RegionIdx, and movinf RegionDB instance into particular...
Definition: accessors.hh:217
ElementAccessor::bounding_box
BoundingBox bounding_box() const
Definition: accessors.hh:253
Side::edge_idx
unsigned int edge_idx() const
Returns global index of the edge connected to the side.
Definition: accessors_impl.hh:217
Side::cond_idx
unsigned int cond_idx() const
Returns global index of the prescribed boundary condition.
Definition: accessors_impl.hh:229
elements.h
Edge::side
SideIter side(const unsigned int i) const
Gets side iterator of the i -th side.
Definition: accessors_impl.hh:171
Side::normal_line
arma::vec3 normal_line() const
Definition: accessors.cc:80
ElementAccessor::operator!=
bool operator!=(const ElementAccessor< spacedim > &other) const
Definition: accessors.hh:261
ElementAccessor::inc
void inc()
Incremental function of the Element iterator.
Definition: accessors_impl.hh:49
Boundary::is_valid
bool is_valid() const
Definition: accessors.hh:374
Side::inc
void inc()
Iterate over local sides of the element.
Definition: accessors.hh:470
Side
Definition: accessors.hh:404
ElementAccessor::sign
double sign() const
Definition: accessors.hh:123
ElementAccessor::jacobian_S3
double jacobian_S3() const
Definition: accessors.hh:131
ElementAccessor::undefined_dim_
static const unsigned int undefined_dim_
Definition: accessors.hh:287
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:412
Mesh::region_db
const RegionDB & region_db() const
Definition: mesh.h:187
SideIter::operator*
const Side & operator*() const
Definition: accessors.hh:524
SideIter::SideIter
SideIter()
Definition: accessors.hh:506
Side::element
ElementAccessor< 3 > element() const
Returns iterator to the element of the side.
Definition: accessors_impl.hh:212
ElementAccessor::vertex_list
vector< arma::vec3 > vertex_list() const
Return list of element vertices.
Definition: accessors_impl.hh:55
mesh.h
Edge::operator==
bool operator==(const Edge &other) const
Comparison operator of the iterator.
Definition: accessors.hh:338
SideIter::operator!=
bool operator!=(const SideIter &other)
Definition: accessors.hh:519
Boundary::element_accessor
ElementAccessor< 3 > element_accessor()
Definition: accessors_impl.hh:253
Side::n_nodes
unsigned int n_nodes() const
Returns number of nodes of the side.
Definition: accessors.hh:450
ElementAccessor::proc
unsigned int proc() const
Definition: accessors.hh:239
bounding_box.hh
ElementAccessor::node
NodeAccessor< 3 > node(unsigned int ni) const
Definition: accessors.hh:245
Side::centre
arma::vec3 centre() const
Centre of side.
Definition: accessors.cc:116
Side::side_idx
unsigned int side_idx() const
Returns local index of the side on the element.
Definition: accessors.hh:458
Boundary::element
Element * element()
Definition: accessors_impl.hh:264
EdgeData::n_sides
unsigned int n_sides
Definition: mesh_data.hh:29
ElementAccessor::is_valid
bool is_valid() const
Definition: accessors.hh:186
Mesh
Definition: mesh.h:98
ElementAccessor::ElementAccessor
ElementAccessor()
Default invalid accessor.
Definition: accessors_impl.hh:25
Edge
Definition: accessors.hh:308
Side::operator!=
bool operator!=(const Side &other) const
Definition: accessors.hh:480
Side::diameter
double diameter() const
Calculate the side diameter.
Definition: accessors.cc:132
RegionIdx
Definition: region.hh:67
ElementAccessor::jacobian_S1
double jacobian_S1() const
Definition: accessors.hh:153
ElementAccessor::region
Region region() const
Definition: accessors.hh:201
Boundary::mesh
Mesh * mesh()
Definition: accessors.hh:378
Boundary::boundary_data_
BoundaryData * boundary_data_
Definition: accessors.hh:394
NodeAccessor
Definition: mesh.h:55
region.hh
Boundary::Boundary
Boundary()
Definition: accessors_impl.hh:239
ElementAccessor::idx
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
Definition: accessors.hh:223
ElementAccessor::operator->
const Element * operator->() const
Definition: accessors.hh:276
ElementAccessor::element_idx_
unsigned int element_idx_
Index into Mesh::element_vec_ array.
Definition: accessors.hh:293
Mesh::bulk_size_
unsigned int bulk_size_
Count of bulk elements.
Definition: mesh.h:604
Side::is_valid
bool is_valid() const
Returns true if the side has assigned element.
Definition: accessors.hh:466
SideIter::operator++
SideIter & operator++()
prefix increment iterate only on local element
Definition: accessors.hh:532
Side::node
NodeAccessor< 3 > node(unsigned int i) const
Returns node for given local index i on the side.
Definition: accessors_impl.hh:206
ElementAccessor::side
SideIter side(const unsigned int loc_index)
Definition: accessors_impl.hh:139
Mesh::node
NodeAccessor< 3 > node(unsigned int idx) const
Create and return NodeAccessor to node of given idx.
Definition: mesh.cc:823
BoundaryData::mesh_
Mesh * mesh_
Definition: mesh_data.hh:54
Edge::edge_idx_
unsigned int edge_idx_
Index into Mesh::edges vector.
Definition: accessors.hh:350
Element::region_idx
RegionIdx region_idx() const
Definition: elements.h:53
Side::operator==
bool operator==(const Side &other) const
Definition: accessors.hh:475
ElementAccessor::index
unsigned int index() const
Definition: accessors.hh:235
Boundary::region
Region region()
Definition: accessors_impl.hh:259
SideIter
Definition: accessors.hh:504
Boundary::edge
Edge edge()
Definition: accessors_impl.hh:247
Side::normal
arma::vec3 normal() const
Vector of (generalized) normal.
Definition: accessors.cc:48
ElementAccessor::measure
double measure() const
Computes the measure of the element.
Definition: accessors_impl.hh:67
ElementAccessor::region_idx
RegionIdx region_idx() const
Definition: accessors.hh:204
ElementAccessor::centre
arma::vec::fixed< spacedim > centre() const
Computes the barycenter.
Definition: accessors_impl.hh:89
ElementAccessor::is_regional
bool is_regional() const
Definition: accessors.hh:178
node_accessor.hh