LifeV
RegionMesh.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  * @file
29  * @brief File containing Mesh Classes
30  *
31  * @author Luca Formaggia <luca.formaggia@polimi.it>
32  * @author Miguel Fernandez
33  *
34  * @contributor Simone Pezzuto <simone.pezzuto@mail.polimi.it>
35  * @contributor Antonio Cervone <ant.cervone@gmail.com>
36  * @contributor Mauro Perego <mperego@fsu.edu>
37  * @mantainer Simone Pezzuto <simone.pezzuto@mail.polimi.it>
38  */
39 
40 #ifndef _REGIONMESH_HH_
41 #define _REGIONMESH_HH_
42 
43 #include <fstream>
44 
45 
46 #include <Epetra_ConfigDefs.h>
47 #ifdef EPETRA_MPI
48 #include <mpi.h>
49 #include <Epetra_MpiComm.h>
50 #else
51 #include <Epetra_SerialComm.h>
52 #endif
53 
54 
55 #include <lifev/core/LifeV.hpp>
56 #include <lifev/core/util/LifeDebug.hpp>
57 #include <lifev/core/mesh/MeshElementMarked.hpp>
58 #include <lifev/core/util/Switch.hpp>
59 #include <lifev/core/mesh/MeshElementBare.hpp>
60 
61 #include <lifev/core/mesh/MeshEntityContainer.hpp>
62 #include <lifev/core/array/ArraySimple.hpp>
63 #include <lifev/core/mesh/ElementShapes.hpp>
64 #include <lifev/core/mesh/MeshUtility.hpp>
65 
66 namespace LifeV
67 {
68 
69 /**
70  * @class RegionMesh
71  * @brief Class for 3D, 2D and 1D Mesh
72  *
73  * @author Luca Formaggia <luca.formaggia@polimi.it>
74  * @author Miguel Fernandez
75  * @contributor Mauro Perego <mperego@fsu.edu>
76  *
77  * This is the class that stores the mesh entities for a single region.
78  *
79  * In a region elements are all of the same type.
80  *
81  * Note: to provide data useful in a parallel setting some methods
82  * return either the number of entities in the current mesh region or
83  * the ones in the global mesh, before partitioning. The latter are identified
84  * by the keyword Global in the name, e.g. numGlobalFaces() versus numFaces()
85  */
86 template <typename GeoShapeType, typename MCType = defaultMarkerCommon_Type >
88  :
89 public MeshEntity
90 {
91 public:
92 
93  typedef GeoShapeType geoShape_Type;
94 
95  //! Common Markers
96  typedef MCType markerCommon_Type;
97 
98  //! static const S_geoDimensions: the dimensions (1,2,3) of the geometry
99  static const UInt S_geoDimensions = geoShape_Type::S_nDimensions;
100  static const Int S_facetDimension = static_cast<const Int>(S_geoDimensions)-1;
101  static const Int S_ridgeDimension = static_cast<const Int>(S_geoDimensions)-2;
102  static const Int S_peakDimension = static_cast<const Int>(S_geoDimensions)-3;
103 
104  /** @name GeoDim Types
105  * @ingroup public_types
106  * dummy types that allows to select the correct method based on the dimension of the geometry.
107  *
108  * @{
109  */
110  typedef GeoDim<1> oneD_Type;
111  typedef GeoDim<2> twoD_Type;
112  typedef GeoDim<3> threeD_Type;
114  /** @} */ // End of group GeoDim Types
115 
116  /** @name Marker Types
117  * @ingroup public_types
118  * Markers for Point, Edge, Face, Volume and Region.
119  *
120  * @{
121  */
122 
123  //! Point Marker
125  //! Edge Marker
127  //! Face Marker
129  //! Volume Marker
131  //! Region Marker
133  /** @} */ // End of group Marker Types
134 
135 
136  /** @name Geometric Element Types
137  * @ingroup public_types
138  * volume_Type, face_Type, edge_Type, point_Type, element_Type, facet_Type, ridge_Type, peak_Type.
139  * Correspondences table:
140  * @table
141  * | | element_Type | facet_Type | ridge_Type | peak_Type |
142  * --------------------------------------------------------------|
143  * | 3D | volume_Type | face_Type | edge_Type | point_Type |
144  * | 2D | face_Type | edge_Type | point_Type | - |
145  * | 1D | edge_Type | point_Type | - | - |
146  * @endtable
147  * @{
148  */
149 
150 
155 
160 
161  /** @} */ // End of group Geometric Element Types
162 
163 
164  /** @name Basic Element Shape Types
165  * @ingroup public_types
166  * volumeShape_Type, faceShape_Type, edgeShape_Type, facetShape_Type, ridgeShape_Type, ridgeShape_Type.
167  * @{
168  */
169 
170  //! Element Shape.
174 
178  /** @} */ // End of group Basic Element Shape Types
179 
180  /** @name Geometric Element Container Types
181  * @ingroup public_types
182  * Typedefs for STL complaint containers of mesh geometric entities.
183  * @{
184  */
189 
194 
195  /** @} */ // End of group Geometric Element Container Types
196 
198 
199  /** @name Constructors & Destructor
200  * Default and Copy Constructor for the class.
201  * @{
202  */
203 
204  //! Default constructor
205  RegionMesh();
206 
207  //! Constructor
208  /**
209  * @param comm communicator to manage output
210  */
211  explicit RegionMesh ( commPtr_Type const& comm );
212 
213  //! Constructor
214  /**
215  * @param comm communicator to manage output
216  * @param id markerId of the RegionMesh
217  */
218  RegionMesh ( UInt id, commPtr_Type const& comm );
219 
220  //! Destructor
221  virtual ~RegionMesh();
222 
223  /** @} */ // End of group Constructors & Destructor
224 
225 
226  /** @defgroup public_methods Public Methods
227  *
228  */
229 
230  /** @name Utilities
231  * @ingroup utilities
232  * Utilities for mesh checking and debugging.
233  *
234  * @{
235  */
236 
237  //! Display general information about the content of the class.
238  /**
239  * Pretty output of information about the mesh.
240  *
241  * @param verbose If true output is verbose, false otherwise (default);
242  * @param out Output stream (std::cout default);
243  * @return Output stream (for concatenation).
244  */
245  std::ostream& showMe ( bool verbose = false, std::ostream& out = std::cout ) const;
246 
247  //! Basic tests for mesh consistency.
248  /**
249  * Check consistency of the mesh and fix errors.
250  *
251  * @param level Indicates level.
252  * - 0 => minimal level, just sets the switches to the appropriate value
253  * - 1 => launch an external function from mesh_util.h which performs a series of
254  * sophisticated tests.
255  * @param fix If true and level=1 it fixes the mesh.
256  * @param verbose If true output is verbose, false otherwise (default);
257  * @param out Output stream (std::cerr default);
258  * @return Severity level. If different from 0 the mesh has problem. If positive the problems are such that the mesh may not
259  * work in any case. If less than zero it may work in some cases.
260  */
261  Int check ( Int level = 0, bool const fix = false, bool verbose = true, std::ostream& out = std::cerr );
262 
263  //! Display local to global mapping.
264  /**
265  * @param os Output stream.
266  */
267  void printLtGMap (std::ostream& os);
268 
269  //! Return the handle to perform transormations on the mesh
271 
272  //! Return the communicator
273  commPtr_Type comm() const;
274 
275  //! Setter for the communicator
276  void setComm ( commPtr_Type const& comm );
277 
278  /** @} */ // End of group Utilities
279 
280  /** @name Switches Methods
281  * @ingroup public_methods
282  * Switches are used to store the status of the RegionMesh The switches
283  * are used internally to control whether some data structures have been
284  * set up.
285  *
286  * The possible Switches are:
287  * - \c HAS_ALL_FACETS
288  * - \c HAS_ALL_RIDGES
289  * - \c HAS_BOUNDARY_FACETS
290  * - \c HAS_BOUNDARY_RIDGES
291  * - \c HAS_ELEMENT_TO_FACETS
292  * - \c HAS_ELEMENT_TO_RIDGES
293  * - \c HAS_BEEN_CHECKED
294  * - \c FACETS_HAVE_ADIACENCY
295  *
296  * @{
297  */
298 
299  //! Get the number of switch which have been set.
300  /**
301  * @return The number of switches which have been set.
302  */
303  const UInt& numSwitches() const
304  {
305  return switches.size();
306  }
307 
308  //! Interrogate Switch.
309  /**
310  * @param _s Name of the switch.
311  * @return true if the name is in the switch, false otherwise.
312  */
313  bool getLinkSwitch ( std::string const& _s ) const;
314 
315  //! Set a switch using a given name
316  /**
317  * @param _s Name of the switch.
318  */
319  void setLinkSwitch ( std::string const& _s );
320 
321  //! Unset a switch.
322  /**
323  * @param _s Name of the switch.
324  */
325  void unsetLinkSwitch ( std::string const& _s );
326  //! Output switches contents
327  /**
328  * @param verbose Verbosity of the output.
329  * @param out Output stream.
330  * @return Output stream for concatenation.
331  */
332  std::ostream& showLinkSwitch ( bool verbose = false, std::ostream& out = std::cout )
333  {
334  return switches.showMe ( verbose, out );
335  }
336 
337  /** @} */ // End of group Switch Methods
338 
339  /** @name Generic Methods
340  * @ingroup public_methods
341  *
342  * These are the generic methods to get information about the number of
343  * elements.
344  *
345  * It is a generic interface common for all RegionMeshes (3D -- 1D).
346  *
347  * @{
348  */
349 
350  //! get mesh marker.
351  /**
352  * @return regionmesh marker.
353  */
355  {
356  return M_marker;
357  }
358 
359  //! get only mesh marker id.
360  /**
361  * @return regionmesh marker id.
362  */
364  {
365  return M_marker.markerID();
366  }
367 
368  //! get M_isPartitioned bool
369  /**
370  * @brief isPartitioned
371  * @return M_isPartitioned member
372  */
373  bool isPartitioned() const
374  {
375  return M_isPartitioned;
376  }
377 
378  /** @} */ // End of group Generic Methods
379 
380 
381  /** @name Volume Methods
382  * @anchor volume_methods
383  * @ingroup public_methods
384  *
385  * Methods which operates on 3D elements.
386  *
387  * There are different way of counting gemetry entities:
388  * - <strong>Counter</strong>: A counter stored the number of entities (element, faces
389  * etc) in the mesh. It does NOT necessarily correspond to the numer of entities
390  * actually stored. Indeed, I may not stor edges, yet having a counter with
391  * the number of edges in the mesh;
392  *
393  * - <strong>Stored</strong>: The number of stored entities corresponds to the size()
394  * of the container. A container may store all mesh entities (this is the
395  * default for the Points and the Volumes), only the boundary entities
396  * (this is the default with the Faces) or even none (this is the default
397  * with the edges);
398  *
399  * - <strong>Capacity</strong>: The maximum number of entities that may stored
400  * before the container is resized.
401  *
402  * @{
403  */
404 
405  //! Returns Number of Volumes.
406  /**
407  * Returns number of Volume elements in the mesh as given by the internal counter.
408  * @return Number of Volumes.
409  */
410  UInt numVolumes() const
411  {
412  return M_numVolumes;
413  }
414 
415  //! Returns Global Number of Volumes
416  /**
417  * Returns number of Global Volume elements in the mesh as given by the internal counter.
418  * @return Number of Global Volumes.
419  */
421  {
422  return M_numGlobalVolumes;
423  }
424 
425  //! Volumes actually stored in list.
426  /**
427  * @return Number of stored Volumes.
428  */
430  {
431  return volumeList.size();
432  }
433 
434  //! Current capacity of Volumes Container.
435  /**
436  * @return how many volumes may be stored.
437  */
439  {
440  return maxNumItems ( volumeList );
441  }
442 
443 
444  //! set mesh marker.
445  /**
446  * @param marker to be set.
447  */
448  void setMarkerClass ( typename MCType::regionMarker_Type const& marker )
449  {
450  M_marker = marker;
451  }
452 
453 
454  //! set only the mesh marker id.
455  /**
456  * @param marker id to be set.
457  */
458  void setMarkerID ( markerID_Type const& markerId )
459  {
460  M_marker.setMarkerID ( markerId );
461  }
462 
463  void setIsPartitioned ( bool const isPartitioned )
464  {
465  M_isPartitioned = isPartitioned;
466  }
467 
468  //! Changes Current capacity of Volumes.
469  /**
470  * Changes Current capacity of Volumes (Optionally sets internal counter).
471  *
472  * @param n Maximum number of volumes.
473  * @param setcounter true to set the counter, false otherwise (default).
474  */
475  void setMaxNumVolumes ( UInt const n, bool const setcounter = false );
476 
477  //! Set the number of global volumes.
478  /**
479  * Set the number of global volumes.
480  *
481  * @param n maximum number of global volumes.
482  */
483  void setMaxNumGlobalVolumes ( UInt const n )
484  {
485  M_numGlobalVolumes = n;
486  }
487 
488  //! Set number of volumes.
489  /**
490  * Set number of volumes in the mesh by changing internal counter.
491  * @param n number of volumes.
492  */
493  void setNumVolumes ( UInt const n )
494  {
495  M_numVolumes = n;
496  }
497 
498  //! Adds volume.
499  /**
500  * Adds volume. Local and global ID computed automatically.
501  * @return Reference to added volume.
502  */
504 
505  //! Adds volume
506  /**
507  * Adds volume. Local ID computed automatically.
508  * Global ID is left unchanged
509  * @param v Volume to be added.
510  * @return Reference to the newly added volume.
511  */
512  element_Type& addVolume ( element_Type const& vol );
513 
514  //! Adds volume in a certain position.
515  /**
516  * Adds volume to a specified position.
517  * @param v Volume to be added.
518  * @param pos Position of the volume.
519  * @return Reference to the newly added volume.
520  */
521  element_Type& setVolume ( element_Type const& v, UInt const pos );
522 
523  //! set numVolumes counter.
525  {
526  M_numVolumes = volumeList.size();
527  }
528 
529  //! Reference to last volume stored in list.
530  /**
531  * Reference to last volume stored in list.
532  * Useful for mesh readers.
533  * @return reference of the last volume in the list.
534  */
536  {
537  return volumeList.back();
538  }
539 
540  //! i-th mesh 3D Element.
541  /**
542  * @param i index of the mesh 3D Element.
543  * @return the i-th volume.
544  */
545  element_Type const& volume ( UInt const i ) const;
546 
547  //! i-th mesh 3D Element.
548  /**
549  * @param i index of the mesh volume.
550  * @return reference to the ith mesh volume.
551  */
552  element_Type& volume ( UInt const i );
553 
554  /** @} */ // End of group Volume Methods
555 
556 
557  /** @name Element Adjacency Methods
558  * @ingroup public_methods
559  * Methods to obtain the ID of Face and Edge belonging to an element.
560  *
561  * Accessing this information requires that the appropriate data
562  * structures have been set by using the updateElementEdges() or
563  * updateElementFaces() methods.
564  *
565  * It is NOT required to have the full information about edges and faces:
566  * The ID of the Face and Edge entities may be calculated without
567  * contructing the corresponding Edge of Face Object. This saves
568  * memory. However the methods has the capability of
569  * building the actual internal Faces (the boundary GeoFaces must
570  * already exist!) of the Edges. In this case the MarkerFlag is inherited using the rules stated in the
571  * marker_traits class.
572  *
573  * @{
574  */
575 
576  //! Is the array for local facets set up?
577  /**
578  * It does not use switches, but interrogates the container directly
579  *
580  * @return true if the array for local facets in not empty.
581  */
582  bool hasLocalFacets() const
583  {
584  return ! M_ElemToFacet.empty();
585  }
586 
587  //! Is the array for local faces set up?
588  /**
589  * It does not use switches, but interrogates the container directly
590  *
591  * @return true if array for local faces in not empty.
592  */
593  bool hasLocalFaces() const
594  {
595  return hasLocalFaces ( twoD_Type() );
596  }
597 
598  //! Build localFacetId table and optionally fills the list of Facets.
599  /**
600  * @param createFacets is set true if we want also to create the actual list
601  * of internal facets. There is another utility (in mesh_util.hpp), which
602  * might be used for the same purpose if we want just to create the faces
603  * and not also the LocaFaceID table.
604  * @param verbose if true, output is verbose.
605  * @param estimateFacetNumber is a guess provided by the user of the total
606  * number of faces. It is relevant only when createFaces=true. Setting it
607  * to a proper value helps in reducing time and memory.
608  *
609  * @note Facets are renumbered so that boundary facets are stored first
610  * @pre The routine assumes that the boundary facets are properly set, if not use the
611  * methods in #include MeshChecks.hpp
612  *
613  */
614  void updateElementFacets ( bool createFaces = false, bool verbose = false, UInt estimateFacetNumber = 0 );
615 
616 
617 
618  //! Build localFaceId table and optionally fills the list of Faces.
619  /**
620  * @param createFacet is set true if we want also to create the actual list
621  * of internal faces. There is another utility (in mesh_util.hpp), which
622  * might be used for the same purpose if we want just to create the faces
623  * and not also the LocaFaceID table.
624  * @param verbose if true, output is verbose.
625  * @param estimateFaceNumber is a guess provided by the user of the total
626  * number of faces. It is relevant only when createFaces=true. Setting it
627  * to a proper value helps in reducing time and memory.
628  *
629  * @pre The routine assumes that the boundary facets are properly set, if not use the
630  * methods in #include MeshChecks.hpp
631  *
632  */
633  void updateElementFaces ( bool createFaces = false, const bool verbose = false, UInt estimateFaceNumber = 0 );
634 
635  //! Destroys element-to-facet container. Useful to save memory!
636  void cleanElementFacets();
637 
638  //! Destroys element-to-face container. Useful to save memory!
639  void cleanElementFaces();
640 
641  //! Local Facet Id.
642  /** @param elemId Id of element.
643  * @param locF local facet number 0 < LocF < numLocalFacets().
644  * @return ID of the facet.
645  */
646  UInt localFacetId ( UInt const elemId, UInt const locF ) const;
647 
648  //! Local Face Id.
649  /** @param volId Id of volume.
650  * @param locF local face number 0 < LocF < numLocalFaces().
651  * @return ID of the face.
652  */
653  UInt localFaceId ( UInt const volId, UInt const locF ) const;
654 
655  //! Local Face Id.
656  /** @param ivol Reference to a volume.
657  * @param locF local face number 0 < LocF < numLocalFaces().
658  * @return ID of the face.
659  */
660  UInt localFaceId ( const volume_Type& vol, UInt const locF ) const
661  {
662  return localFacetId ( vol, locF );
663  }
664 
665  //! Is the array for ridges set up?
666  /**
667  * It does not use switches, but interrogates the container directly.
668  *
669  * @return true if ridges information are available, false otherwise.
670  */
671  bool hasLocalRidges() const
672  {
673  return ! M_ElemToRidge.empty();
674  }
675 
676  //! Is the array for local Edges set up?
677  /**
678  * It does not use switches, but interrogates the container directly.
679  *
680  * @return true if edges information are available, false otherwise.
681  */
682  bool hasLocalEdges() const
683  {
684  return hasLocalEdges ( edge_Type() );
685  }
686 
687  //! Build localRidgeId table and optionally fills the list of Ridges
688  /**
689  *
690  * @param createRdges is set true if we want also to create the actual list
691  * of edges. There is another utility (MeshChecks.hpp), which
692  * might be used for the same purpose if we want just to create the faces
693  * and not also the LocalRidgeID table.
694  * @param verbose If true, output is verbose.
695  * @param estimateRidgeNumber is a guess provided by the user of the total
696  * number of ridges. It is relevant only when createFacets=true. Setting it
697  * to a proper value helps in reducing time and memory.
698  * @param renumber Relevant only if createFacets=true.It makes sure that boundary edges are first
699  * if set to false possibly existing edges are never moved
700  *
701  * @note This method does not assume that boundary edges are stores, since
702  * this condition is NOT a a paradigm for a RegionMesh.
703  */
704  void updateElementRidges ( bool createRidges = false, const bool verbose = false,
705  UInt estimateRidgeNumber = 0, bool renumber = true)
706  {
707  updateElementRidges ( M_geoDim, createRidges, verbose, estimateRidgeNumber, renumber);
708  }
709 
710  //! Builds localEdgeId table and optionally fills the list of Edges
711  /**
712  *
713  * @param createEdges is set true if we want also to create the actual
714  * edges. There is another utility (MeshChecks.hpp),
715  * might be used for the same purpose if we want just to create the edges
716  * and not also the LocalEdgeID table.
717  * @param verbose If true, output is verbose.
718  * @param estimateEdgeNumber is a guess provided by the user of the total
719  * number of edges. It is relevant only when createEdges=true. Setting it
720  * to a proper value helps in reducing time and memory.
721  * @param renumber Relevant only if createFaces=true.It makes sure that boundary edges are first
722  * if set to false possibly existing edges are never moved
723  *
724  * @note This method does not assume that boundary edges are already stored, since
725  * this condition is NOT an invariant of a RegionMesh3D.
726  */
727  void updateElementEdges ( bool createEdges = false, const bool verbose = false,
728  UInt estimateEdgeNumber = 0, bool renumber = true)
729  {
730  updateElementEdges ( edge_Type(), createEdges, verbose, estimateEdgeNumber, renumber);
731  }
732 
733  //! Destroys Ridge-To-Facet lookup table.
734  void cleanElementRidges();
735 
736  //! Destroys edge To facet lookup table.
738  {
739  cleanElementEdges ( edge_Type() );
740  }
741 
742  //! Local Ridge ID of a ridge in an element stored in the mesh
743  /** @param elemId local ID of the element
744  * @param locR local ridge number (elemental) 0 <= locR < numLocalRidges().
745  * @return local ID of the ridge.
746  */
747  ID localRidgeId ( UInt const elemId, UInt const locR ) const
748  {
749  return localRidgeId ( M_geoDim, elemId, locR );
750  }
751 
752 
753  //! Local Ridge.
754  /** @param elem Reference of the element.
755  * @param locR local ridge number.
756  * @return local ID of the ridge.
757  */
758  ID localRidgeId ( const element_Type& elem, UInt const locR ) const
759  {
760  return localRidgeId ( M_geoDim, elem.localId(), locR );
761  }
762 
763 
764  //! Local Edge.
765  /** @param elemId Id of element.
766  * @param locE local edge number 0 <= LocE < numLocalEdges().
767  * @return local ID of the edge.
768  */
769  ID localEdgeId ( UInt const elemId, UInt const locE ) const
770  {
771  return localEdgeId ( M_geoDim, elemId, locE );
772  }
773 
774  //! Local Edge (specialization for 3D geometries).
775  /** @param elem Reference of the element.
776  * @param locE local edge number 0 <= LocE < numLocalEdges().
777  * @return local ID of the edge.
778  */
779  ID localEdgeId ( const volume_Type& elem, UInt const locE ) const
780  {
781  return localRidgeId ( elem, elem.localId(), locE );
782  }
783 
784 
785  //! Local Edge (specialization for 2D geometries).
786  /** @param elem Reference of the element.
787  * @param locE local edge number 0 <= LocE < numLocalEdges().
788  * @return local ID of the edge.
789  */
790  ID localEdgeId ( const face_Type& elem, UInt const locE ) const
791  {
792  return localFacetId ( elem.localId(), locE );
793  }
794  /** @} */ // End of group Element Adjacency Methods
795 
796 
797  /** @name Faces Methods
798  * @anchor face_methods
799  * @ingroup public_methods
800  *
801  * Methods to access/create/modify faces data
802  *
803  * There are different way of counting Faces:
804  * - <strong>Number of Faces</strong>: is the declared number of total faces in the mesh.
805  * It uses an internal counter.
806  * @warning A value different from zero does NOT imply that the
807  * faces are actually stored. This counter declares the number of Faces
808  * that the mash have not those that are actually stored in the list of
809  * faces!
810  * - <strong>Number of Boundary Faces</strong>: is the declared number of boundary faces
811  * in the mesh. It uses an internal counter.
812  * @warning A value different from zero does NOT imply that the
813  * boundary faces are actually stored.
814  * - <strong>Number of Stored Faces</strong>: It is the number of Faces actually stored
815  * on the face container.
816  * - <strong>Maximum number of stored faces</strong>: The number of faces that may stored
817  * before the container is resized.
818  * @note This parameter has to be set BEFORE inserting faces
819  * in the container if we want that pointer into the container maintains
820  * their validity. The container will also have a better performance.
821  *
822  * See also \ref volume_methods.
823  *
824  * @{
825  */
826 
827  //! Returns Number of Faces
828  /**
829  * Returns number of Face elements in the mesh
830  * as given by the internal counter.
831  *
832  * @return Number of Faces.
833  */
834  UInt numFaces() const;
835 
836 
837  //! Returns Number of Facets
838  /**
839  * Returns number of Facets in the mesh
840  * as given by the internal counter.
841  *
842  * @return Number of Facets.
843  */
844  UInt numFacets() const
845  {
846  return numFacets ( M_geoDim );
847  }
848 
849 
850  //! Returns Global Number of Faces
851  /**
852  * Returns global number of Face elements in the mesh
853  * as given by the internal counter.
854  *
855  * @return Global Number of Faces.
856  */
857  UInt numGlobalFaces() const;
858 
859  //! Number of Faces actually stored.
860  /**
861  * Faces actually stored in list
862  * @return Number of faces actually stored in list.
863  */
864  UInt storedFaces() const;
865 
866  //! Current capacity of Faces Container.
867  /**
868  * How many elements may be stored.
869  * @return Number of maximum element that can be stored.
870  */
871  UInt maxNumFaces() const;
872 
873  //! Changes Current capacity of Faces.
874  /**
875  * Changes Current capacity of Faces (Optionally sets internal counter).
876  *
877  * @param n Maximum number of faces.
878  * @param setcounter true to set the counter, false otherwise.
879  */
880  void setMaxNumFaces ( UInt const n, bool const setcounter = false );
881 
882  //! Changes Current capacity of Global Faces.
883  /**
884  * Changes Current capacity of Global Faces (Optionally sets internal counter).
885  *
886  * @param n maximum number of global faces.
887  */
888  void setMaxNumGlobalFaces ( UInt const n );
889 
890  //! Changes Current capacity of Global Facets.
891  /**
892  * Changes Current capacity of Global Facets (Optionally sets internal counter).
893  *
894  * @param n maximum number of global facets.
895  */
896  void setMaxNumGlobalFacets ( UInt const n )
897  {
898  setMaxNumGlobalFacets ( M_geoDim, n );
899  }
900 
901  //! Adds a face.
902  /**
903  * Adds a face. Id computed automatically.
904  * @return Reference to added face.
905  */
907  {
908  return addFace ( face_Type() );
909  }
910 
911  //! Adds a face.
912  /**
913  * Adds a face (optionally a boundary face). Local and global ID
914  * are computed automatically.
915  * @param boundary true if it's a boundary face.
916  * @return Reference to added face.
917  */
918  face_Type& addFace ( bool const boundary );
919 
920  //! Adds a face.
921  /**
922  * Adds a face (optionally a boundary face). Local ID computed automatically.
923  * It assumes that all attributes of face f have been properly set
924  * @param f Face to be added.
925  * @return Reference to the newly added face.
926  */
927  face_Type& addFace ( face_Type const& f );
928 
929  //! Adds a face in a certain position.
930  /**
931  * Add face to a specified position (optionally a boundary face).
932  * It assumes that all attributes of face f have been properly set a part the id
933  * which is set to pos
934  * @param f Face to add.
935  * @param pos Position of the face.
936  * @return Reference to the newly added face.
937  * @note If you add a face on the boundary you may need to reorder the list of faces
938  */
939  face_Type& setFace ( face_Type const& f, UInt pos);
940 
941  //! Reference to last face stored in list.
942  /**
943  * Reference to last face stored in list.
944  * Useful for mesh readers.
945  * @return reference of the last face in the list.
946  */
947  face_Type& lastFace();
948 
949  //! i-th mesh Face.
950  /**
951  * @param i index of the mesh face.
952  * @return the i-th face.
953  */
954  face_Type const& face ( UInt const i ) const;
955 
956  //! i-th mesh face.
957  /**
958  * @param i index of the mesh face.
959  * @return reference to the ith mesh face.
960  */
961  face_Type& face ( UInt const i );
962 
963  //! i-th mesh boundary face.
964  /**
965  * @param i index of the mesh boundary face.
966  * @return the i-th face.
967  */
968  face_Type const& boundaryFace ( UInt const i ) const;
969 
970  //! i-th mesh boundary face.
971  /**
972  * @param i index of the mesh boundary face.
973  * @return the i-th face.
974  */
975  face_Type& boundaryFace ( UInt const i );
976 
977  //! Set counter of faces.
978  /**
979  * @param n Number of faces.
980  */
981  void setNumFaces ( UInt const n );
982 
983  //! Set counter of boundary faces.
984  /**
985  * @param n Number of boundary faces.
986  */
987  void setNumBFaces ( UInt const n ) ;
988 
989  //! Do I store mesh faces?
990  bool hasFaces() const;
991 
992  //! Do I store also internal faces?
993  bool hasInternalFaces() const;
994 
995  //! Number of Boundary Faces.
996  /**
997  * @return Number of boundary faces.
998  */
999  UInt numBFaces() const ;
1000 
1001  //! Is face whose id is given on boundary?
1002  /**
1003  * @param id Face Id.
1004  * @return true if f in on boundary.
1005  */
1006  bool isBoundaryFace ( UInt const& id ) const;
1007 
1008  //! Number of local faces for each 3Delement.
1009  /**
1010  * @return Number of local faces.
1011  */
1012  UInt numLocalFaces() const ;
1013 
1014  //! Does this id corresponds to a full face?
1015  /** A FULL FACE is a 2DElement that is actually
1016  * stored in the Face container.
1017  * @param id Face id.
1018  * @return false if id does not corresponfd to a boundary face and internal faces are not stored.
1019  */
1020  bool isFullFace ( UInt const& id ) const ;
1021 
1022  //! Id of the Volume Element adjacent to a Face.
1023  /** The first element is the one <em>ORIENTED coherently with the
1024  * face</em> (AS STORED in Faces). It means that the face orientation is
1025  * OUTWARD with respect to the element. The second element is either null
1026  * (boundary face) or indicates that the normal of the face appears INWARD
1027  * with respect to that element.
1028  *
1029  * @param faceId Id of the face.
1030  * @param Pos is equal to 0 or 1 and indicates first or second element.
1031  * @return Id of adjacent volume element or NotAnId if none.
1032  */
1033  UInt faceElement ( UInt const faceId, UInt const Pos ) const ;
1034 
1035  //! 3DElement adjacent to a FACE. Face reference given.
1036  /**
1037  * @param f Face reference.
1038  * @param Pos is equal to 0 or 1 and indicates first or second element.
1039  * @return Id of adjacent volume element or 0 if none.
1040  */
1041  UInt faceElement ( facet_Type const& f, UInt const Pos ) const;
1042 
1043  /** @} */ // End of group Faces Methods
1044 
1045 
1046  /** @name Edge Methods
1047  * @ingroup public_methods
1048  * All methods which operates on 1D elements.
1049  *
1050  * There are different point counters which may bi interrogated or set:
1051  * - <strong>Number of Edges</strong>: is the declared number of total edges in the mesh.\n
1052  * <strong>Beware</strong>: A value different from zero does NOT imply that the
1053  * edges are actually stored.
1054  * - <strong>Number of Boundary Edges</strong>: is the declared number of boundary edges
1055  * in the mesh.\n
1056  * <strong>Beware</strong>: A value different from zero does NOT imply that
1057  * the boundary edges are actually stored.
1058  * - <strong>Number of Stored Edges</strong>: It is the number of Edges actually stored
1059  * on the edge container.
1060  * - <strong>Maximum number of stored edges</strong>: The number of edges that may stored
1061  * before the container is resized.\n
1062  * <strong>Important</strong>: This parameter has to be
1063  * set BEFORE inserting edges in the container if we want that pointer
1064  * into the container maintains their validity. The container will also
1065  * have a better performance.
1066  *
1067  * @note To have more information on the Edge methods
1068  * look at the documentation of th eanalogous Edges methods @ref face_methods and in @ref volume_methods.
1069  *
1070  * @{
1071  */
1072 
1073  //! Number of Edges.
1074  /**
1075  * Returns number of Edge elements in the mesh
1076  * as given by the internal counter.
1077  *
1078  * @return Number of Edges.
1079  */
1080  UInt numEdges() const;
1081 
1082  //! Global number of Edges.
1083  /**
1084  * Returns global number of Edge elements in the mesh
1085  * as given by the internal counter.
1086  *
1087  * @return Global number of Edges.
1088  */
1089  UInt numGlobalEdges() const;
1090 
1091  //! Number of local edges for each (3D) element.
1092  /**
1093  * @return Number of local edges for each (3D) element
1094  */
1095  UInt numLocalEdges() const;
1096 
1097  //! Number of stored Edges.
1098  /**
1099  * Edges actually stored in list.
1100  *
1101  * @return number of edges actually stored in list.
1102  */
1103  UInt storedEdges() const;
1104 
1105  //! Capacity of Edge Container.
1106  /**
1107  * Current capacity of Edges Container,
1108  * i.e. how many elements may be stored.
1109  *
1110  * @return Edges Container Capacity.
1111  */
1112  UInt maxNumEdges() const;
1113 
1114  //! Changes Current capacity of Edges.
1115  /**
1116  * Optionally sets internal counter.
1117  *
1118  * @param n Maximum number of edges.
1119  * @param setcounter true to set the counter, false otherwise.
1120  */
1121  void setMaxNumEdges ( UInt const n, bool const setcounter = false );
1122 
1123  //! Changes Current capacity of Global Edges.
1124  /**
1125  * Optionally sets internal counter.
1126  *
1127  * @param n Maximum number of global edges.
1128  */
1129  void setMaxNumGlobalEdges ( UInt const n );
1130 
1131  //! Adds an Edge.
1132  /**
1133  * Adds an edge. Id computed automatically.
1134  *
1135  * @param boundary true if is on boundary.
1136  * @return Reference to added edge.
1137  */
1138  edge_Type& addEdge ( bool const boundary );
1139 
1140  //! Adds an Edge.
1141  /**
1142  * Adds an edge to the end of the list
1143  * and adjourn its Id. The edge attributes (a part the id) should be
1144  * correctly set.
1145  *
1146  * @param f Edge to add.
1147  * @return Reference to added edge.
1148  */
1149  edge_Type& addEdge ( edge_Type const& r );
1150 
1151  //! Add an Edge to specified position.
1152  /**
1153  * Adds an edge and sets its Id to position.
1154  *
1155  * @param e Edge to add.
1156  * @param position Position of the edge.
1157  * @return Reference to added edge.
1158  */
1159  edge_Type& setEdge ( edge_Type const& e, UInt position );
1160 
1161  //! Reference to last edge stored in list.
1162  /**
1163  * Useful for mesh readers
1164  * @return reference of the last edge in the list.
1165  */
1166  edge_Type& lastEdge();
1167 
1168  //! i-th mesh edge.
1169  /**
1170  * Returns the i-th edge.
1171  *
1172  * @param i Index of the mesh edge.
1173  * @return The i-th edge.
1174  */
1175  edge_Type const& edge ( UInt const i ) const;
1176 
1177  //! i-th mesh edge reference.
1178  /**
1179  * Returns a reference to the i-th mesh Edge.
1180  *
1181  * @param i Index of the mesh 1D Edge.
1182  * @return Reference to the i-th Edge.
1183  */
1184  edge_Type& edge ( UInt const i );
1185 
1186  //! i-th mesh 1D Boundary Edge.
1187  /**
1188  * Returns the i-th mesh Boundary Edge.
1189  *
1190  * @param i Index of the mesh 1D Boundary Edge.
1191  * @return i-th Boundary Edge.
1192  */
1193  edge_Type const& boundaryEdge ( UInt const i ) const;
1194 
1195  //! i-th mesh 1D Boundary Edge Reference.
1196  /**
1197  * Returns a reference to the i-th mesh Boundary Edge.
1198  *
1199  * @param i Index of the mesh 1D Boundary Edge.
1200  * @return Reference to the i-th Boundary edge.
1201  */
1202  edge_Type& boundaryEdge ( UInt const i );
1203 
1204  //! Set boundary Edge counter.
1205  /**
1206  * Set the Boundary Edges counter to a given number.
1207  *
1208  * @param n Count of Boundary Edge.
1209  */
1210  void setNumBEdges ( UInt const n );
1211 
1212  //! Do I store mesh edges?
1213  /**
1214  * Returns true if edges are stored.
1215  *
1216  * @return true if edge are stored, false otherwise.
1217  */
1218  bool hasEdges() const;
1219 
1220  //! Edge on boundary check.
1221  /**
1222  * Is this edge on boundary?
1223  *
1224  * @param e The Edge.
1225  * @return true if the edge is on the boundary, false otherwise.
1226  */
1227  bool isBoundaryEdge ( ridge_Type const& e ) const
1228  {
1229  return e.boundary();
1230  }
1231 
1232  //! Edge on boundary check by id.
1233  /**
1234  * Is this edge, of given id, on boundary?
1235  *
1236  * @param id Id of the edge.
1237  * @return true if the edge is on the boundary, false otherwise.
1238  */
1239  bool isBoundaryEdge ( UInt const& id ) const
1240  {
1241  return (id < M_numBEdges );
1242  }
1243 
1244  //! Full Edge check by id.
1245  /**
1246  * Does this ID corresponds to a full edge?
1247  *
1248  * A FULL EDGE is a 1D Element that is actually stored in the Edge container.
1249  *
1250  * @param id Id of the edge.
1251  * @return true if the edge is actually stored, false otherwise.
1252  */
1253  bool isFullEdge ( UInt const& id ) const;
1254 
1255  //! Number of Boundary Edges.
1256  /**
1257  * Returns number of boundary edge elements in the mesh
1258  * as given by the internal counter.
1259  *
1260  * @return Number of Boundary Edges.
1261  */
1262  UInt numBEdges() const;
1263 
1264  //! Set internal counter of number of Edges.
1265  /**
1266  * @param n Number of Edges.
1267  */
1268  void setNumEdges ( UInt const n );
1269 
1270  //! Do I store internal Edges?
1271  /**
1272  * @return true if internal edges are stored.
1273  */
1274  bool hasInternalEdges() const;
1275 
1276  //! Number of edges on each face.
1277  /**
1278  * @return Number of edges for each face.
1279  */
1280  UInt numLocalEdgesOfFace() const ;
1281 
1282  /** @} */ // End of group Edges Methods
1283 
1284 
1285  /** @name Points Methods
1286  * @ingroup public_methods
1287  * All methods which operates on Point Elements.
1288  *
1289  * There are different Point counters which may be interrogated or set:
1290  * - <strong>Number of Points</strong>: is the declared number of total points in
1291  * the mesh.
1292  * - <strong>Number of Boundary Points</strong>: is the declared number of boundary
1293  * points in the mesh.\n
1294  * Does NOT imply that the boundary points are actually stored.
1295  * - <strong>Number of Stored Points</strong>: It is the number of Points actually stored
1296  * on the points container.
1297  * - <strong>Maximum number of stored points</strong>: The number of points that may
1298  * stored before the container is resized.\n
1299  * <strong>Very Important</strong>: This parameter has to be set <strong>BEFORE</strong>
1300  * inserting points in the container. Since MeshElementMarkeds will contain POINTERS
1301  * into the container!\n
1302  * This is a debatable point!
1303  *
1304  * @note To have more information on the Point methods look at the
1305  * documentation of the analogous Edges methods (\ref face_methods).
1306  *
1307  * @{
1308  */
1309 
1310  //! Returns number of points in the mesh.
1311  /**
1312  * Interrogation to the counter of points in the mesh.
1313  *
1314  * @return Number of points in the mesh.
1315  */
1316  UInt numPoints() const;
1317 
1318  //! Returns a reference to number of points in the mesh.
1319  /**
1320  * Returns a reference to the internal counter of the number of points in the mesh.
1321  *
1322  * @return Reference to the internal counter of number of points in the mesh.
1323  */
1324  UInt& numPoints();
1325 
1326  //! Returns number of points in the mesh actually stored.
1327  /**
1328  * Returns number of points in the mesh actually stored interrogating the internal counter.
1329  *
1330  * @return Number of stored points in the mesh.
1331  */
1332  UInt storedPoints() const;
1333 
1334  //! Returns number of boundary points in the mesh actually stored.
1335  /**
1336  * Returns number of boundary points in the mesh actually stored interrogating the internal counter.
1337  *
1338  * @return Number of stored boundary points in the mesh.
1339  */
1340  UInt storedBPoints() const;
1341 
1342  //! Returns the number of storable points in the mesh.
1343  /**
1344  * Returns the number of storable points in the mesh interrogating the internal counter.
1345  *
1346  * @return The number of storable points.
1347  */
1348  UInt maxNumPoints() const;
1349 
1350  //! Set the number of storable points in the mesh.
1351  /**
1352  * Set the internal counter of storable points in the mesh.
1353  *
1354  * @param n Maximum number of storable points in the mesh.
1355  * @param setcounter If true, it sets the internal counter, otherwise not (default).
1356  */
1357  void setMaxNumPoints ( UInt const n, bool const setcounter = false );
1358 
1359  //! Set the number of storable global points in the mesh.
1360  /**
1361  * Set the internal counter of storable global points in the mesh.
1362  *
1363  * @param n Maximum number of storable global points in the mesh.
1364  */
1365  void setMaxNumGlobalPoints ( UInt const n);
1366 
1367  //! Adds a Point in the mesh.
1368  /**
1369  * Adds a Point inside the mesh, eventually specifing if it's a boundary point or a vertex.
1370  *
1371  * @param boundary If true, it's a boundary point, otherwise not (default).
1372  * @param vertices If true, it's a vertex, otherwise not (default).
1373  * @return Reference to the newly added Point.
1374  */
1375  point_Type& addPoint ( bool const boundary, bool const vertices);
1376 
1377  //! Adds a Point in the mesh.
1378  /**
1379  * Adds a Point inside the mesh.
1380  * Point will be add at the end of the list and the Id is computed automatically
1381  *
1382  * @param p Point to be added.
1383  * @return Reference to the newly added Point.
1384  */
1385  point_Type& addPoint ( point_Type const& p);
1386 
1387  //! Returns the first mesh Point.
1388  /**
1389  * Returns the first Point in the mesh.
1390  *
1391  * @return const reference to the first mesh Point.
1392  */
1393  point_Type const& firstPoint() const
1394  {
1395  return pointList.front();
1396  }
1397 
1398  //! Returns the last mesh Point.
1399  /**
1400  * Returns the last Point in the mesh.
1401  *
1402  * @return const reference to the last mesh Point.
1403  */
1404  point_Type const& lastPoint() const
1405  {
1406  return pointList.back();
1407  }
1408 
1409  //! Returns the i-th mesh Point.
1410  /**
1411  * Returns the i-th Point in the mesh.
1412  *
1413  * @param i Id of the Point.
1414  * @return i-th mesh Point.
1415  */
1416  point_Type const& point ( UInt const i ) const;
1417 
1418  //! Returns a reference to the i-th mesh point.
1419  /**
1420  * Returns the i-th point in the mesh.
1421  *UInt const i
1422  * @param i Id of the point.
1423  * @return Reference i-th mesh point.
1424  */
1425  point_Type& point ( UInt const i );
1426 
1427  //! Returns a reference to the i-th mesh Boundary Point.
1428  /**
1429  * Returns the i-th Boundary Point in the mesh.
1430  *
1431  * @param i Id of the Boundary Point.
1432  * @return Reference i-th mesh Boundary Point.
1433  */
1434  point_Type const& boundaryPoint ( UInt const i ) const;
1435 
1436  //! Returns a reference to the i-th mesh Boundary Point.
1437  /**
1438  * Returns the i-th Boundary Point in the mesh.
1439  *
1440  * @param i Id of the Boundary Point.
1441  * @return Reference i-th mesh Boundary Point.
1442  */
1443  point_Type& boundaryPoint ( UInt const i );
1444 
1445  //! Returns the number of Boundary Points.
1446  /**
1447  * Returns the counter of the number of Boundary Points.
1448  *
1449  * @return Number Boundary Points.
1450  */
1451  UInt numBPoints() const;
1452 
1453  //! Sets the number of Boundary Points.
1454  /**
1455  * Sets the counter of the number of Boundary Points.
1456  *
1457  * @param n Number Boundary Points.
1458  */
1459  void setNumBPoints ( UInt const n );
1460 
1461  //! Is this point on boundary?
1462  /**
1463  * Is this point on boundary?
1464  *
1465  * @param p The Point.
1466  * @return true if the point is on the boundary, false otherwise.
1467  */
1468  bool isBoundaryPoint ( point_Type const& p ) const ;
1469 
1470  //! Is this point on boundary?
1471  /**
1472  * Is this point, of given id, on boundary?
1473  *
1474  * @param id Id of the point.
1475  * @return true if the point is on the boundary, false otherwise.
1476  */
1477  bool isBoundaryPoint ( UInt const& id ) const;
1478 
1479  //! List of points
1480  /**
1481  * @param fct Function of three Real arguments.
1482  * @param list_pts List of Points.
1483  * @todo Move away, this can be done using the utility of the list of pts
1484  */
1485  void getListOfPoints ( bool ( *fct ) ( Real, Real, Real ), std::vector<UInt>& list_pts );
1486 
1487  /** @} */ // End of group Points Methods
1488 
1489 
1490  /** @name Vertices Methods
1491  * @ingroup public_methods
1492  * All methods which operates on Vertex Elements.
1493  *
1494  * @{
1495  */
1496 
1497  //! Number of Vertices in Region.
1498  /**
1499  * Returns the number of Vertices in Region.
1500  *
1501  * @return Number of Vertices in Region.
1502  */
1503  UInt numVertices () const;
1504 
1505  //! Number of Boundary Vertices in Region.
1506  /**
1507  * Returns the number of Boundary Vertices in Region.
1508  *
1509  * @return Number of Vertices in Region.
1510  */
1511  UInt numBVertices() const;
1512 
1513  //! Reference to the number of Boundary Vertices in Region.
1514  /**
1515  * Returns a reference to the number of Boundary Vertices in Region.
1516  *
1517  * @return Reference to the number of Vertices in Region.
1518  */
1519  UInt& numBVertices();
1520 
1521  //! Number of local vertices for each (3D) element.
1522  /**
1523  * @return Number of local vertices for each (3D) element.
1524  */
1525  UInt numLocalVertices() const;
1526 
1527  //! Returns the global number of vertices in the mesh.
1528  /**
1529  * Interrogation to the counter of vertices in the mesh.
1530  *
1531  * @return Number of vertices in the mesh.
1532  */
1533  UInt numGlobalVertices() const;
1534 
1535  //! Returns the global number of points in the mesh.
1536  /**
1537  * Interrogation to the counter of points in the mesh.
1538  *
1539  * @return Number of points in the mesh.
1540  */
1542  {
1543  return M_numGlobalPoints;
1544  }
1545 
1546  //! Vertex check.
1547  /**
1548  * Is this Point a Vertex?
1549  *
1550  * @param id Point's id.
1551  * @return true if the Point is a Vertex, false otherwise.
1552  */
1553  bool isVertex ( UInt const& id ) const;
1554 
1555  //! Vertex check.
1556  /**
1557  * Is this Point a Vertex?
1558  *
1559  * @param p A Point.
1560  * @return true if the Point is a Vertex, false otherwise.
1561  */
1562  bool isVertex ( point_Type const& p ) const;
1563 
1564  //! Changes number of Vertices.
1565  /**
1566  * Allows to change number of vertices in Region.
1567  *
1568  * @param n Number of vertices in the mesh.
1569  */
1570  void setNumVertices (UInt const n);
1571 
1572  //! Set the number of vertices in the mesh.
1573  /**
1574  * Set the internal counter of vertices points in the mesh.
1575  *
1576  * @param n Number of vertices in the mesh.
1577  */
1578  void setNumGlobalVertices ( UInt const n );
1579 
1580  //! Changes number of Boundary Vertices.
1581  /**
1582  * Allows to change number of boundary vertices in Region.
1583  *
1584  * @param n Number of boundary vertices in the mesh.
1585  */
1586  void setNumBVertices (UInt const n);
1587 
1588  /** @} */ // End of group Vertices Methods
1589 
1590 
1591 
1592  /** @name Polytope Methods
1593  * @ingroup public_methods
1594  *
1595  * These are the polytope methods to get information about the number of
1596  * polytopes (elements, facets, ridges, peaks).
1597  *
1598  * Interfaces common for all RegionMeshes (3D -- 1D).
1599  *
1600  * @{
1601  */
1602 
1603  //! Number of elements in mesh.
1604  /**
1605  * @return Number of elements in mesh.
1606  * @sa numFaces
1607  * @note Alias to numFaces()
1608  */
1610  {
1611  return numElements (M_geoDim);
1612  }
1613 
1614  //! Number of Boundary facets.
1615  /**
1616  * @return Number of Boundary facets.
1617  */
1619  {
1620  return numBoundaryFacets ( M_geoDim);
1621  }
1622 
1623  //! Get element at the i-th index.
1624  /**
1625  * @param i Index of the element
1626  * @return Element at index i
1627  */
1628  element_Type& element ( const UInt& i )
1629  {
1630  return element (M_geoDim, i );
1631  }
1632 
1633  //! Get element at the i-th index.
1634  /**
1635  * @param i Index of the element
1636  * @return Element at index i
1637  */
1638  const element_Type& element ( const UInt& i ) const
1639  {
1640  return element (M_geoDim, i );
1641  }
1642 
1643  //! Get boundary facet at the i-th index.
1644  /**
1645  * @param i Index of the element
1646  * @return Boundary facet at index i
1647  */
1649  {
1650  return boundaryFacet (M_geoDim, i);
1651  }
1652 
1653  //! Get boundary facet at the i-th index.
1654  /**
1655  * @param i Index of the element
1656  * @return Boundary facet at index i
1657  */
1658  const facet_Type& boundaryFacet ( const UInt& i ) const
1659  {
1660  return boundaryFacet (M_geoDim, i);
1661  }
1662 
1663  //! Number of global elements.
1664  /**
1665  * @return Number of global Elements (Volumes).
1666  */
1668  {
1669  return numGlobalElements ( M_geoDim );
1670  }
1671 
1672  //! Current capacity of the container of Elements.
1673  /**
1674  * @return how many elements may be stored.
1675  */
1677  {
1678  return maxNumVolumes ( M_geoDim );
1679  }
1680 
1681  //! Set counter of elements.
1682  /**
1683  * @param n Number of elements.
1684  */
1685  void setNumElements ( UInt const n )
1686  {
1687  setNumElements ( M_geoDim, n );
1688  }
1689 
1690  //! Changes Current capacity of the container of elements.
1691  /**
1692  * Changes Current capacity of the container of elements (Optionally sets internal counter).
1693  *
1694  * @param n Maximum number of elements.
1695  * @param setcounter true to set the counter, false otherwise (default).
1696  */
1697 
1698  void setMaxNumElements ( UInt const n, bool const setcounter = false )
1699  {
1700  setMaxNumElements (M_geoDim, n, setcounter);
1701  }
1702 
1703  //! Set the number of global elements.
1704  /**
1705  * Set the number of global elements.
1706  *
1707  * @param n maximum number of global elements.
1708  */
1710  {
1711  setMaxNumGlobalElements (M_geoDim, n) ;
1712  }
1713 
1714  //! Adds element.
1715  /**
1716  * Adds element. Id computed automatically.
1717  * @return Reference to added element.
1718  */
1720  {
1721  return addElement ( element_Type() );
1722  }
1723 
1724  //! Adds element in a certain position (specialization for 3D geometry).
1725  /**
1726  * Adds element to a specified position.
1727  * @param element element to be added.
1728  * @param pos Position of the element.
1729  * @return Reference to the newly added element.
1730  */
1731  element_Type& setElement ( volume_Type const& elem, UInt const pos )
1732  {
1733  return setVolume ( elem, pos );
1734  }
1735 
1736  //! Adds element in a certain position (specialization for 2D geometry).
1737  /**
1738  * Adds element to a specified position.
1739  * @param element element to be added.
1740  * @param pos Position of the element.
1741  * @return Reference to the newly added element.
1742  */
1743  element_Type& setElement ( face_Type const& elem, UInt const pos )
1744  {
1745  return setFace ( elem, pos );
1746  }
1747 
1748  //! Adds element in a certain position (specialization for 1D geometry).
1749  /**
1750  * Adds element to a specified position.
1751  * @param element element to be added.
1752  * @param pos Position of the element.
1753  * @return Reference to the newly added element.
1754  */
1755  element_Type& setElement ( edge_Type const& elem, UInt const pos )
1756  {
1757  return setEdge ( elem, pos );
1758  }
1759 
1760  //! Returns Global Number of Facets
1761  /**
1762  * Returns global number of Facets in the mesh
1763  * as given by the internal counter.
1764  *
1765  * @return Global Number of Facets.
1766  */
1768  {
1769  return numGlobalFacets ( M_geoDim );
1770  }
1771 
1772  //! Changes Current capacity of Facets.
1773  /**
1774  * Changes Current capacity of Facets (Optionally sets internal counter).
1775  *
1776  * @param n Maximum number of facets.
1777  * @param setcounter true to set the counter, false otherwise.
1778  */
1779  void setMaxNumFacets ( UInt const n, bool const setcounter = false )
1780  {
1781  setMaxNumFacets ( M_geoDim, n, setcounter);
1782  }
1783 
1784  //! Adds a facet.
1785  /**
1786  * Adds a facet (optionally a boundary facet). Id computed automatically.
1787  * @param boundary true if it's a boundary facet.
1788  * @return Reference to added facet.
1789  */
1790  facet_Type& addFacet ( bool const boundary )
1791  {
1792  return addFacet ( M_geoDim, boundary);
1793  }
1794 
1795 
1796  //! Adds a facet. 3D specialization
1797  /**
1798  * Adds a facet (optionally a boundary face). Id computed automatically.
1799  * It assumes that all attributes of facet f have been properly set
1800  * @param f Facet to be added.
1801  * @return Reference to the newly added facet.
1802  */
1803  facet_Type& addFacet ( face_Type const& facet )
1804  {
1805  return addFace (facet);
1806  }
1807 
1808  //! Adds a facet. 2D specialization
1809  /**
1810  * Adds a facet (optionally a boundary face). Id computed automatically.
1811  * It assumes that all attributes of facet f have been properly set
1812  * @param f Facet to be added.
1813  * @return Reference to the newly added facet.
1814  */
1815  facet_Type& addFacet ( edge_Type const& facet )
1816  {
1817  return addEdge (facet);
1818  }
1819 
1820  //! Adds a facet. 1D specialization
1821  /**
1822  * Adds a facet (optionally a boundary face). Id computed automatically.
1823  * It assumes that all attributes of facet f have been properly set
1824  * @param f Facet to be added.
1825  * @return Reference to the newly added facet.
1826  */
1827  facet_Type& addFacet ( point_Type const& facet )
1828  {
1829  return addPoint (facet);
1830  }
1831 
1832  //! i-th mesh Facet.
1833  /**
1834  * @param i index of the mesh facet.
1835  * @return the i-th facet.
1836  */
1837  facet_Type const& facet ( UInt const i ) const
1838  {
1839  return facet ( M_geoDim, i);
1840  }
1841 
1842 
1843  //! i-th mesh facet.
1844  /**
1845  * @param i index of the mesh facet.
1846  * @return reference to the ith mesh facet.
1847  */
1848  facet_Type& facet ( UInt const i )
1849  {
1850  return facet ( M_geoDim, i);
1851  }
1852 
1853  //! Set counter of facets.
1854  /**
1855  * @param n Number of facets.
1856  */
1857  void setNumFacets ( UInt const n )
1858  {
1859  setNumFacets ( M_geoDim, n );
1860  }
1861 
1862  //! Set counter of boundary facets.
1863  /**
1864  * @param n Number of boundary facets.
1865  */
1866  void setNumBoundaryFacets ( UInt const n )
1867  {
1868  setNumBoundaryFacets ( M_geoDim, n ) ;
1869  }
1870 
1871  //! Is facet whose id is given on boundary?
1872  /**
1873  * @param id Facet Id.
1874  * @return true if f in on boundary.
1875  */
1876  bool isBoundaryFacet ( UInt const& id ) const
1877  {
1878  return isBoundaryFacet ( M_geoDim, id );
1879  }
1880 
1881  //! Number of Ridges.
1882  /**
1883  * Returns number of Ridges in the mesh
1884  * as given by the internal counter.
1885  *
1886  * @return Number of Ridges.
1887  */
1888  UInt numRidges() const
1889  {
1890  return numRidges (M_geoDim);
1891  }
1892 
1893  //! Global number of Ridges.
1894  /**
1895  * Returns global number of Ridges in the mesh
1896  * as given by the internal counter.
1897  *
1898  * @return Global number of Ridges.
1899  */
1901  {
1902  return numGlobalRidges (M_geoDim );
1903  }
1904 
1905  //! Changes Current capacity of Ridges.
1906  /**
1907  * Optionally sets internal counter.
1908  *
1909  * @param n Maximum number of ridges.
1910  * @param setcounter true to set the counter, false otherwise.
1911  */
1912  void setMaxNumRidges ( UInt const n, bool const setcounter = false )
1913  {
1914  setMaxNumRidges (M_geoDim, n, setcounter);
1915  }
1916 
1917  //! Changes Current capacity of Global Ridges.
1918  /**
1919  * Optionally sets internal counter.
1920  *
1921  * @param n Maximum number of global ridges.
1922  */
1923  void setMaxNumGlobalRidges ( UInt const n )
1924  {
1925  setMaxNumGlobalRidges (M_geoDim, n);
1926  }
1927 
1928  //! Set counter of facets.
1929  /**
1930  * @param n Number of facets.
1931  */
1932  void setNumRidges ( UInt const n )
1933  {
1934  setNumRidges ( M_geoDim, n );
1935  }
1936 
1937  //! Adds a Ridge.
1938  /**
1939  * Adds a ridge. Id computed automatically.
1940  *
1941  * @param boundary true if is on boundary.
1942  * @return Reference to added ridge.
1943  */
1944  ridge_Type& addRidge ( bool const boundary )
1945  {
1946  return addRidge ( M_geoDim, boundary);
1947  }
1948 
1949  //! Adds a Ridge. Specialization for 3D geometries
1950  /**
1951  * Adds a ridge to the end of the list
1952  * and adjourn its Id. The ridge attributes (a part the id) should be
1953  * correctly set.
1954  *
1955  * @param e ridge to add.
1956  * @return Reference to added ridge.
1957  */
1959  {
1960  return addEdge ( r );
1961  }
1962 
1963  //! Adds a Ridge. Specialization for 2D geometries
1964  /**
1965  * Adds a ridge to the end of the list
1966  * and adjourn its Id. The ridge attributes (a part the id) should be
1967  * correctly set.
1968  *
1969  * @param e ridge to add.
1970  * @return Reference to added ridge.
1971  */
1973  {
1974  return addPoint ( r );
1975  }
1976 
1977  //! i-th mesh ridge.
1978  /**
1979  * Returns the i-th ridge.
1980  *
1981  * @param i Index of the mesh ridge.
1982  * @return The i-th ridge.
1983  */
1984  ridge_Type const& ridge ( UInt const i ) const
1985  {
1986  return ridge (M_geoDim, i);
1987  }
1988 
1989  //! i-th mesh ridge reference.
1990  /**
1991  * Returns a reference to the i-th mesh ridge.
1992  *
1993  * @param i Index of the mesh ridge.
1994  * @return Reference to the i-th ridge.
1995  */
1996  ridge_Type& ridge ( UInt const i )
1997  {
1998  return ridge ( M_geoDim, i);
1999  }
2000 
2001  //! Set boundary ridge counter.
2002  /**
2003  * Set the Boundary ridges counter to a given number.
2004  *
2005  * @param n Count of Boundary Ridge.
2006  */
2007  void setNumBoundaryRidges ( UInt const n )
2008  {
2009  setNumBoundaryRidges ( M_geoDim, n );
2010  }
2011 
2012  //! Ridge on boundary check. Specialization for 3D geometries.
2013  /**
2014  * Is this ridge on boundary?
2015  *
2016  * @param e The ridge.
2017  * @return true if thee ridge is on the boundary, false otherwise.
2018  */
2019  bool isBoundaryRidge ( edge_Type const& r ) const
2020  {
2021  return isBoundaryEdge (r);
2022  }
2023 
2024  //! Ridge on boundary check. Specialization for 2D geometries.
2025  /**
2026  * Is this ridge on boundary?
2027  *
2028  * @param e The ridge.
2029  * @return true if thee ridge is on the boundary, false otherwise.
2030  */
2031  bool isBoundaryRidge ( point_Type const& r ) const
2032  {
2033  return isBoundaryPoint (r);
2034  }
2035 
2036  //! Ridge on boundary check by id.
2037  /**
2038  * Is this ridge, of given id, on boundary?
2039  *
2040  * @param id Id of the ridge.
2041  * @return true if the ridge is on the boundary, false otherwise.
2042  */
2043  bool isBoundaryRidge ( UInt const& id ) const
2044  {
2045  return isBoundaryRidge ( M_geoDim, id );
2046  }
2047 
2048  //! Returns the i-th mesh Peak.
2049  /**
2050  * Returns the i-th peak in the mesh.
2051  *
2052  * @param i Id of the peak.
2053  * @return i-th mesh peak.
2054  */
2055  peak_Type const& peak ( UInt const i ) const
2056  {
2057  return peak ( M_geoDim, i );
2058  }
2059 
2060  //! Returns a reference to the i-th mesh peak.
2061  /**
2062  * Returns the i-th peak in the mesh.
2063  *UInt const i
2064  * @param i Id of the peak.
2065  * @return Reference i-th mesh peak.
2066  */
2067  // peak_Type & peak( UInt const i ) {return peak( M_geoDim, i );}
2068 
2069  //! Returns the global number of peaks in the mesh.
2070  /**
2071  * Interrogation to the counter of peaks in the mesh.
2072  *
2073  * @return Number of peaks in the mesh.
2074  */
2076  {
2077  return numGlobalPeaks (M_geoDim );
2078  }
2079 
2080  /** @} */ // End of group Polytope Methods
2081 
2082  /** @defgroup public_attributes Public Attributes
2083  *
2084  */
2085 
2086  /** @name Region Containers
2087  * @ingroup public_attributes
2088  *
2089  * STL compliant containers for basic structure.
2090  *
2091  * I expose them since they are standard containers.
2092  *
2093  * @{
2094  */
2095 
2096  //! Container of mesh Points/Vertices.
2098  //! Container of mesh Faces.
2100 
2101  //! Container of mesh Edges.
2103  //! Container of mesh 3D Elements
2105  //! Boundary points list.
2107  /** @} */ // End of group Region Containers
2108 
2109  /** @name Container Polytope Getters
2110  * @ingroup public_attributes
2111  * getters for region Containers, by polytope names
2112  * @{
2113  */
2114 
2115  //! returns a reference to the elements' container
2117  {
2118  return elementList (M_geoDim );
2119  }
2120 
2121  //! returns a reference to the facets' container
2123  {
2124  return facetList (M_geoDim);
2125  }
2126 
2127  //! returns a reference to the ridges' container
2129  {
2130  return ridgeList (M_geoDim );
2131  }
2132 
2133  /** @} */ // End of group Container Polytope Getters
2134 
2135 
2136  /** @name Switches
2137  * @ingroup public_attributes
2138  *
2139  * @{
2140  */
2141 
2142  //! Switches
2144 
2145  /** @} */ // End of group Switches
2146 
2147  //! Is the array for local Edges set up? Specialization for 3D geometries
2148  bool hasLocalEdges ( ridge_Type ) const
2149  {
2150  return hasLocalRidges();
2151  }
2152 
2153  //! Is the array for local Edges set up? Specialization for 2D geometries
2155  {
2156  return hasLocalFacets();
2157  }
2158 
2159 
2160 private:
2161 
2162  /*! Arrays containing the ids of Edges and Faces of each element
2163  I use a Define to use localto global array or directly the
2164  bareedges */
2167 
2169 
2172 
2175 
2178 
2181 
2187 
2191 
2192  // communicator
2194 
2195  //used to select the correct method specialization
2197 
2198  //fake ridge, used in 1D geometries to avoid compilation errors when a ridge& is required in output
2200 
2201  //fake peak, used in 1D geometries to avoid compilation errors when a peak& is required in output
2203 
2205  {
2206  return numVolumes();
2207  }
2209  {
2210  return numFaces();
2211  }
2213  {
2214  return numEdges();
2215  }
2216 
2217  //! Number of Boundary facets
2219  {
2220  return numBFaces();
2221  }
2223  {
2224  return numBEdges();
2225  }
2227  {
2228  return numBVertices();
2229  }
2230 
2231  //! Get element at the i-th index.
2233  {
2234  return volume (i);
2235  }
2237  {
2238  return face (i);
2239  }
2241  {
2242  return edge (i);
2243  }
2244 
2245  //! Get element at the i-th index.
2246  const element_Type& element ( threeD_Type, const UInt& i ) const
2247  {
2248  return volume (i);
2249  }
2250  const element_Type& element ( twoD_Type, const UInt& i ) const
2251  {
2252  return face (i);
2253  }
2254  const element_Type& element ( oneD_Type, const UInt& i ) const
2255  {
2256  return edge (i);
2257  }
2258 
2259  //! Get boundary facet at the i-th index.
2261  {
2262  return boundaryFace (i);
2263  }
2265  {
2266  return boundaryEdge (i);
2267  }
2268  inline facet_Type& boundaryFacet ( oneD_Type, const UInt& i );
2269 
2270  //! Get boundary facet at the i-th index.
2271  const facet_Type& boundaryFacet ( threeD_Type, const UInt& i ) const
2272  {
2273  return boundaryFace (i);
2274  }
2275  const facet_Type& boundaryFacet ( twoD_Type, const UInt& i ) const
2276  {
2277  return boundaryEdge (i);
2278  }
2279  const facet_Type& boundaryFacet ( oneD_Type, const UInt& i ) const
2280  {
2281  return boundaryPoint (i);
2282  }
2283 
2284  //! Number of global elements.
2286  {
2287  return numGlobalVolumes();
2288  }
2290  {
2291  return numGlobalFaces();
2292  }
2294  {
2295  return numGlobalEdges();
2296  }
2297 
2298  //! Current capacity of the container of Elements.
2300  {
2301  return maxNumVolumes();
2302  }
2304  {
2305  return maxNumFaces();
2306  }
2308  {
2309  return maxNumEdges();
2310  }
2311 
2312  //! Set counter of elements.
2313  void setNumElements ( threeD_Type, UInt const n )
2314  {
2315  setNumVolumes ( n );
2316  }
2317  void setNumElements ( twoD_Type, UInt const n )
2318  {
2319  setNumFaces ( n );
2320  }
2321  void setNumElements ( oneD_Type, UInt const n )
2322  {
2323  setNumEdges ( n );
2324  }
2325 
2326  //! Changes Current capacity of the container of elements.
2327  void setMaxNumElements ( threeD_Type, UInt const n, bool const setcounter = false )
2328  {
2329  setMaxNumVolumes ( n, setcounter);
2330  }
2331  void setMaxNumElements ( twoD_Type, UInt const n, bool const setcounter = false )
2332  {
2333  setMaxNumFaces ( n, setcounter);
2334  }
2335  void setMaxNumElements ( oneD_Type, UInt const n, bool const setcounter = false )
2336  {
2337  setMaxNumEdges ( n, setcounter);
2338  }
2339 
2340  //! Set the number of global elements.
2342  {
2344  }
2346  {
2348  }
2350  {
2352  }
2353 
2354  //! Adds element.
2356  {
2357  return addVolume (elem);
2358  }
2360  {
2361  return addFace (elem);
2362  }
2364  {
2365  return addEdge (elem);
2366  }
2367 
2368  //! Is the array for local faces set up?
2370  {
2371  return hasLocalFacets();
2372  }
2374  {
2375  return hasLocalRidges();
2376  }
2377 
2378  //! Build localEdgeId table and optionally fills the list of Edges
2379  void updateElementEdges ( ridge_Type, bool createEdges = false, const bool verbose = false,
2380  UInt estimateEdgeNumber = 0, bool renumber = true)
2381  {
2382  updateElementRidges ( M_geoDim, createEdges, verbose, estimateEdgeNumber, renumber);
2383  }
2384 
2385  //! Build localEdgeId table and optionally fills the list of Edges
2386  void updateElementEdges ( facet_Type, bool createEdges = false, const bool verbose = false,
2387  UInt estimateEdgeNumber = 0, bool /*renumber*/ = true)
2388  {
2389  updateElementFacets ( createEdges, verbose, estimateEdgeNumber);
2390  }
2391 
2392  //! Build localRidgeId table and optionally fills the list of Ridges
2393  void updateElementRidges ( threeD_Type, bool createRidges = false, const bool verbose = false,
2394  UInt estimateRidgeNumber = 0, bool renumber = true);
2395  void updateElementRidges ( twoD_Type, bool, const bool, UInt, bool)
2396  {
2397  ERROR_MSG ("RegionMesh::updateElementRidges, It is not possible to use this method with 2D geometries.");
2398  }
2399  void updateElementRidges ( oneD_Type, bool, const bool, UInt, bool)
2400  {
2401  ERROR_MSG ("RegionMesh::updateElementRidges, It is not possible to use this method with 1D geometries.");
2402  }
2403 
2404  //! specializations for cleanElementEdges
2406  {
2408  }
2410  {
2412  }
2413 
2414  //! Local Ridge.
2415  ID localRidgeId ( threeD_Type, UInt const elemId, UInt const locR ) const;
2416  ID localRidgeId ( twoD_Type, UInt const elemId, UInt const locR ) const
2417  {
2418  return element (elemId).point (locR).localId();
2419  }
2420  ID localRidgeId ( oneD_Type, UInt const, UInt const) const
2421  {
2422  return NotAnId;
2423  }
2424 
2425 
2426  //! Local Edge (specialization for 3D geometries).
2427  ID localEdgeId ( const threeD_Type, UInt const elemId, UInt const locE ) const
2428  {
2429  return localRidgeId ( threeD_Type(), elemId, locE );
2430  }
2431 
2432  //! Local Edge (specialization for 2D geometries).
2433  ID localEdgeId ( const twoD_Type, UInt const elemId, UInt const locE ) const
2434  {
2435  return localFacetId ( elemId, locE );
2436  }
2437 
2438  //! Local Edge (specialization for 1D geometries). It calls an error.
2439  ID localEdgeId ( const oneD_Type, UInt const /*elemId*/, UInt const /*locE*/ ) const
2440  {
2441  ERROR_MSG ( "localEdgeId not implemented for oneD_Type." );
2442  return static_cast<ID> (0);
2443  }
2444 
2445  //! specializations for numFacets
2447  {
2448  return numFaces();
2449  }
2451  {
2452  return numEdges();
2453  }
2455  {
2456  return numVertices();
2457  }
2458 
2459  //! specializations numGlobalFacets
2461  {
2462  return numGlobalFaces();
2463  }
2465  {
2466  return numGlobalEdges();
2467  }
2469  {
2470  return numGlobalVertices();
2471  }
2472 
2473  //! Changes Current capacity of Facets.
2474  void setMaxNumFacets ( threeD_Type, UInt const n, bool const setcounter = false )
2475  {
2476  setMaxNumFaces ( n, setcounter);
2477  }
2478  void setMaxNumFacets ( twoD_Type, UInt const n, bool const setcounter = false )
2479  {
2480  setMaxNumEdges ( n, setcounter);
2481  }
2482  void setMaxNumFacets ( oneD_Type, UInt const n, bool const setcounter = false )
2483  {
2484  setMaxNumPoints ( n, setcounter);
2485  }
2486 
2487  //! Changes Current capacity of Global Facets.
2489  {
2491  }
2493  {
2495  }
2497  {
2499  }
2500 
2501  //! Adds a facet.
2502  facet_Type& addFacet ( threeD_Type, bool const boundary )
2503  {
2504  return addFace (boundary);
2505  }
2506  facet_Type& addFacet ( twoD_Type, bool const boundary )
2507  {
2508  return addEdge (boundary);
2509  }
2510  facet_Type& addFacet ( oneD_Type, bool const boundary )
2511  {
2512  return addPoint (boundary);
2513  }
2514 
2515  //! i-th mesh Facet.
2516  facet_Type const& facet ( threeD_Type, UInt const i ) const
2517  {
2518  return face (i);
2519  }
2520  facet_Type const& facet ( twoD_Type, UInt const i ) const
2521  {
2522  return edge (i);
2523  }
2524  facet_Type const& facet ( oneD_Type, UInt const i ) const
2525  {
2526  return point (i);
2527  }
2528 
2529  //! i-th mesh facet.
2531  {
2532  return face (i);
2533  }
2535  {
2536  return edge (i);
2537  }
2539  {
2540  return point (i);
2541  }
2542 
2543  //! Set counter of facets.
2544  void setNumFacets ( threeD_Type, UInt const n )
2545  {
2546  setNumFaces ( n );
2547  }
2548  void setNumFacets ( twoD_Type, UInt const n )
2549  {
2550  setNumEdges ( n );
2551  }
2552  void setNumFacets ( oneD_Type, UInt const n )
2553  {
2554  setNumVertices ( n );
2555  }
2556 
2557  //! Set counter of boundary facets.
2559  {
2560  setNumBFaces ( n ) ;
2561  }
2563  {
2564  setNumBEdges ( n ) ;
2565  }
2567  {
2568  setNumBVertices ( n ) ;
2569  }
2570 
2571  //! Is facet whose id is given on boundary?
2572  bool isBoundaryFacet ( threeD_Type, UInt const& id ) const
2573  {
2574  return isBoundaryFace ( id );
2575  }
2576  bool isBoundaryFacet ( twoD_Type, UInt const& id ) const
2577  {
2578  return isBoundaryEdge ( id );
2579  }
2580  bool isBoundaryFacet ( oneD_Type, UInt const& id ) const
2581  {
2582  return isBoundaryPoint ( id );
2583  }
2584 
2585  //! Number of Ridges.
2587  {
2588  return numEdges();
2589  }
2591  {
2592  return numPoints();
2593  }
2595  {
2596  return 0;
2597  }
2598 
2599  //! Global number of Ridges.
2601  {
2602  return numGlobalEdges();
2603  }
2605  {
2606  return numGlobalVertices();
2607  }
2609  {
2610  return 0;
2611  }
2612 
2613  //! Changes Current capacity of Ridges.
2614  void setMaxNumRidges ( threeD_Type, UInt const n, bool const setcounter )
2615  {
2616  setMaxNumEdges ( n, setcounter);
2617  }
2618  void setMaxNumRidges ( twoD_Type, UInt const n, bool const setcounter )
2619  {
2620  setMaxNumPoints ( n, setcounter);
2621  }
2622  void setMaxNumRidges ( oneD_Type, UInt const, bool const )
2623  {
2624  ERROR_MSG ("RegionMesh::setMaxNumRidges, No ridges in 1D");
2625  }
2626 
2627  //! Changes Current capacity of Global Ridges.
2629  {
2631  }
2633  {
2635  }
2637  {
2638  ERROR_MSG ("RegionMesh::setMaxNumGlobalRidges, No ridges in 1D");
2639  }
2640 
2641  //! Adds a Ridge.
2642  ridge_Type& addRidge ( threeD_Type, bool const boundary )
2643  {
2644  return addEdge ( boundary);
2645  }
2646  ridge_Type& addRidge ( twoD_Type, bool const boundary )
2647  {
2648  return addPoint ( boundary, false );
2649  }
2650  ridge_Type& addRidge ( oneD_Type, bool const )
2651  {
2652  ERROR_MSG ("RegionMesh::addRidge, No ridges in 1D"); ;
2653  return M_aRidge;
2654  }
2655 
2656  //! i-th mesh ridge.
2657  ridge_Type const& ridge ( threeD_Type, UInt const i ) const
2658  {
2659  return edge (i);
2660  }
2661  ridge_Type const& ridge ( twoD_Type, UInt const i ) const
2662  {
2663  return point (i);
2664  }
2665  ridge_Type const& ridge ( oneD_Type, UInt const ) const
2666  {
2667  ERROR_MSG ("RegionMesh::ridge, No ridges in 1D");
2668  return M_aRidge;
2669  }
2670 
2671  //! i-th mesh ridge reference.
2673  {
2674  return edge (i);
2675  }
2677  {
2678  return point (i);
2679  }
2681  {
2682  ERROR_MSG ("RegionMesh::ridge, No ridges in 1D");
2683  return M_aRidge;
2684  }
2685 
2686  //! Set counter of ridges.
2687  void setNumRidges ( threeD_Type, UInt const n )
2688  {
2689  setNumEdges ( n );
2690  }
2691 
2692  //! Set boundary ridge counter.
2694  {
2695  setNumBEdges ( n );
2696  }
2698  {
2699  setNumBPoints ( n );
2700  }
2702  {
2703  ERROR_MSG ("RegionMesh::setNumBoundaryRidges, No ridges in 1D");
2704  }
2705 
2706  //! Ridge on boundary check by id.
2707  bool isBoundaryRidge ( threeD_Type, UInt const& id ) const
2708  {
2709  return isBoundaryEdge ( id );
2710  }
2711  bool isBoundaryRidge ( twoD_Type, UInt const& id ) const
2712  {
2713  return isBoundaryPoint ( id );
2714  }
2715  bool isBoundaryRidge ( oneD_Type, UInt const& ) const
2716  {
2717  ERROR_MSG ("RegionMesh::isBoundaryRidge, No ridges in 1D");
2718  return bool();
2719  }
2720 
2721  //! Returns the i-th mesh Peak.
2722  peak_Type const& peak ( threeD_Type, UInt const i ) const
2723  {
2724  return point (i);
2725  }
2726  peak_Type const& peak ( twoD_Type, UInt const ) const
2727  {
2728  ERROR_MSG ("RegionMesh::peak, No peak in 2D");
2729  return M_aPeak;
2730  }
2731  peak_Type const& peak ( oneD_Type, UInt const ) const
2732  {
2733  ERROR_MSG ("RegionMesh::peak, No peak in 1D");
2734  return M_aPeak;
2735  }
2736 
2737  //! Returns a reference to the i-th mesh peak.
2739  {
2740  return point (i);
2741  }
2743  {
2744  ERROR_MSG ("RegionMesh::peak, No peak in 2D");
2745  return M_aPeak;
2746  }
2748  {
2749  ERROR_MSG ("RegionMesh::peak, No peak in 2D");
2750  return M_aPeak;
2751  }
2752 
2753  //! Returns the global number of peaks in the mesh.
2755  {
2756  return numGlobalVertices();
2757  }
2759  {
2760  return 0;
2761  }
2763  {
2764  return 0;
2765  }
2766 
2767  //! returns a reference to the elements' container
2769  {
2770  return volumeList;
2771  }
2773  {
2774  return faceList;
2775  }
2777  {
2778  return edgeList;
2779  }
2780 
2781  //! returns a reference to the facets' container
2783  {
2784  return faceList;
2785  }
2787  {
2788  return edgeList;
2789  }
2791  {
2792  return pointList;
2793  }
2794 
2795  //! returns a reference to the ridges' container
2797  {
2798  return edgeList;
2799  }
2801  {
2802  return pointList;
2803  }
2805  {
2806  ERROR_MSG ("RegionMesh::ridgeList, no RidgeList in 1D");
2807  return ridges_Type();
2808  }
2809 }; // End of class RegionMesh
2810 
2811 
2812 // =================================================== //
2813 // =================================================== //
2814 // IMPLEMENTATION //
2815 // =================================================== //
2816 // =================================================== //
2817 
2818 
2819 void set_switches_for_regionmesh ( Switch& sw );
2820 
2821 template <typename GeoShapeType, typename MCType>
2822 inline RegionMesh<GeoShapeType, MCType>::RegionMesh() :
2823  MeshEntity(),
2824  switches(),
2825  M_numVolumes ( 0 ),
2826  M_numVertices ( 0 ),
2827  M_numBVertices ( 0 ),
2828  M_numPoints ( 0 ),
2829  M_numBPoints ( 0 ),
2830  M_numFaces ( 0 ),
2831  M_numBFaces ( 0 ),
2832  M_numEdges ( 0 ),
2833  M_numBEdges ( 0 ),
2834  M_isPartitioned ( false ),
2835  M_meshTransformer ( *this ),
2836  M_comm()
2837 {
2838  set_switches_for_regionmesh ( switches );
2839 }
2840 
2841 template <typename GeoShapeType, typename MCType>
2842 inline RegionMesh<GeoShapeType, MCType>::RegionMesh ( commPtr_Type const& comm ) :
2843  MeshEntity(),
2844  switches(),
2845  M_numVolumes ( 0 ),
2846  M_numVertices ( 0 ),
2847  M_numBVertices ( 0 ),
2848  M_numPoints ( 0 ),
2849  M_numBPoints ( 0 ),
2850  M_numFaces ( 0 ),
2851  M_numBFaces ( 0 ),
2852  M_numEdges ( 0 ),
2853  M_numBEdges ( 0 ),
2854  M_isPartitioned ( false ),
2855  M_meshTransformer ( *this ),
2856  M_comm ( comm )
2857 {
2858  //Modif Miguel:11/2002
2859  set_switches_for_regionmesh ( switches );
2860 }
2861 
2862 
2863 template <typename GeoShapeType, typename MCType>
2864 inline RegionMesh<GeoShapeType, MCType>::RegionMesh ( UInt id, commPtr_Type const& comm ) :
2865  MeshEntity ( id ),
2866  switches(),
2867  M_numVolumes ( 0 ),
2868  M_numVertices ( 0 ),
2869  M_numBVertices ( 0 ),
2870  M_numPoints ( 0 ),
2871  M_numBPoints ( 0 ),
2872  M_numFaces ( 0 ),
2873  M_numBFaces ( 0 ),
2874  M_numEdges ( 0 ),
2875  M_numBEdges ( 0 ),
2876  M_isPartitioned ( false ),
2877  M_meshTransformer ( *this ),
2878  M_comm ( comm )
2879 {
2880  //Modif Miguel:11/2002
2881  set_switches_for_regionmesh ( switches );
2882 }
2883 
2884 template <typename GeoShapeType, typename MCType>
2885 inline RegionMesh<GeoShapeType, MCType>::~RegionMesh()
2886 {
2887 }
2888 
2889 template <typename GeoShapeType, typename MCType>
2890 inline UInt
2891 RegionMesh<GeoShapeType, MCType>::numLocalVertices() const
2892 {
2893  return element_Type::S_numLocalVertices;
2894 }
2895 
2896 template <typename GeoShapeType, typename MCType>
2897 inline UInt
2898 RegionMesh<GeoShapeType, MCType>::numLocalFaces() const
2899 {
2900  return element_Type::S_numLocalFaces;
2901 }
2902 
2903 template <typename GeoShapeType, typename MCType>
2904 inline UInt
2905 RegionMesh<GeoShapeType, MCType>::numLocalEdges() const
2906 {
2907  return element_Type::S_numLocalEdges;
2908 }
2909 
2910 template <typename GeoShapeType, typename MCType>
2911 inline UInt
2912 RegionMesh<GeoShapeType, MCType>::numLocalEdgesOfFace() const
2913 {
2914  return face_Type::S_numLocalEdges;
2915 }
2916 
2917 // ***************************** VOLUMES
2918 
2919 template <typename GeoShapeType, typename MCType>
2920 inline void
2921 RegionMesh<GeoShapeType, MCType>::setMaxNumVolumes ( UInt const n, bool const setcounter )
2922 {
2923  volumeList.setMaxNumItems (n);
2924  if ( setcounter )
2925  {
2926  M_numVolumes = n;
2927  }
2928 }
2929 
2930 template <typename GeoShapeType, typename MCType>
2931 typename RegionMesh<GeoShapeType, MCType>::element_Type&
2932 RegionMesh<GeoShapeType, MCType>::addVolume()
2933 {
2934  // I need to set the global ID
2935  element_Type aVolume;
2936  return addVolume ( aVolume );
2937 }
2938 
2939 template <typename GeoShapeType, typename MCType>
2940 inline typename RegionMesh<GeoShapeType, MCType>::element_Type&
2941 RegionMesh<GeoShapeType, MCType>::addVolume ( element_Type const& v )
2942 {
2943  volumeList.push_back ( v );
2944  volume_Type& thisVolume (volumeList.back() );
2945  thisVolume.setFlag ( EntityFlags::DEFAULT );
2946  thisVolume.setLocalId ( volumeList.size() - 1 );
2947  return thisVolume;
2948 }
2949 
2950 template <typename GeoShapeType, typename MCType>
2951 inline
2952 typename RegionMesh<GeoShapeType, MCType>::element_Type&
2953 RegionMesh<GeoShapeType, MCType>::setVolume ( element_Type const& v, UInt const pos )
2954 {
2955  ASSERT_PRE ( pos < volumeList.capacity() , "position requested exceed capacity" <<
2956  pos << " " << volumeList.capacity() ) ;
2957  volumeList ( pos ) = v;
2958  volumeList ( pos ).setLocalId ( pos );
2959  return volumeList ( pos );
2960 }
2961 
2962 template <typename GeoShapeType, typename MCType>
2963 inline
2964 typename RegionMesh<GeoShapeType, MCType>::element_Type const&
2965 RegionMesh<GeoShapeType, MCType>::volume ( UInt const i ) const
2966 {
2967  ASSERT_BD ( i < volumeList.size() ) ;
2968  return volumeList[ i ];
2969 }
2970 
2971 template <typename GeoShapeType, typename MCType>
2972 inline
2973 typename RegionMesh<GeoShapeType, MCType>::element_Type&
2974 RegionMesh<GeoShapeType, MCType>::volume ( UInt const i )
2975 {
2976  ASSERT_BD ( i < volumeList.size() ) ;
2977  return volumeList[ i ];
2978 }
2979 
2980 // ************************* FACES ******************************
2981 template <typename GeoShapeType, typename MCType>
2982 inline UInt /*const*/
2983 RegionMesh<GeoShapeType, MCType>::numFaces() const
2984 {
2985  return M_numFaces;
2986 }
2987 
2988 template <typename GeoShapeType, typename MCType>
2989 inline UInt /*const*/
2990 RegionMesh<GeoShapeType, MCType>::numGlobalFaces() const
2991 {
2992  return M_numGlobalFaces;
2993 }
2994 
2995 template <typename GeoShapeType, typename MCType>
2996 inline UInt
2997 RegionMesh<GeoShapeType, MCType>::storedFaces() const
2998 {
2999  return faceList.size();
3000 }
3001 
3002 template <typename GeoShapeType, typename MCType>
3003 inline UInt
3004 RegionMesh<GeoShapeType, MCType>::maxNumFaces() const
3005 {
3006  return faceList.maxNumItems();
3007 }
3008 
3009 template <typename GeoShapeType, typename MCType>
3010 inline void
3011 RegionMesh<GeoShapeType, MCType>::setMaxNumFaces ( UInt const n, bool const setcounter )
3012 {
3013  faceList.setMaxNumItems (n);
3014  if ( setcounter )
3015  {
3016  M_numFaces = n;
3017  }
3018 }
3019 
3020 template <typename GeoShapeType, typename MCType>
3021 inline void
3022 RegionMesh<GeoShapeType, MCType>::setMaxNumGlobalFaces ( UInt const n )
3023 {
3024  M_numGlobalFaces = n;
3025 }
3026 
3027 template <typename GeoShapeType, typename MCType>
3028 inline
3029 typename RegionMesh<GeoShapeType, MCType>::face_Type&
3030 RegionMesh<GeoShapeType, MCType>::addFace ( bool const boundary )
3031 {
3032  face_Type aFace;
3033  aFace.setBoundary ( boundary );
3034  return this->addFace ( aFace );
3035 }
3036 
3037 
3038 template <typename GeoShapeType, typename MCType>
3039 inline
3040 typename RegionMesh<GeoShapeType, MCType>::face_Type&
3041 RegionMesh<GeoShapeType, MCType>::addFace ( face_Type const& f )
3042 {
3043  faceList.push_back ( f );
3044  face_Type& thisFace = faceList.back();
3045  thisFace.setFlag ( EntityFlags::DEFAULT );
3046  thisFace.setLocalId ( faceList.size() - 1 );
3047  return thisFace;
3048 }
3049 
3050 template <typename GeoShapeType, typename MCType>
3051 inline
3052 typename RegionMesh<GeoShapeType, MCType>::face_Type&
3053 RegionMesh<GeoShapeType, MCType>::setFace ( face_Type const& f, UInt position)
3054 {
3055  ASSERT_PRE ( position < faceList.capacity(), "Face list size exceeded" <<
3056  position << " " << faceList.capacity() ) ;
3057  faceList ( position ) = f;
3058  faceList ( position ).setLocalId ( position );
3059  return faceList ( position );
3060 }
3061 
3062 template <typename GeoShapeType, typename MCType>
3063 inline
3064 typename RegionMesh<GeoShapeType, MCType>::face_Type&
3065 RegionMesh<GeoShapeType, MCType>::lastFace()
3066 {
3067  return faceList.back();
3068 }
3069 
3070 
3071 template <typename GeoShapeType, typename MCType>
3072 inline
3073 typename RegionMesh<GeoShapeType, MCType>::face_Type const&
3074 RegionMesh<GeoShapeType, MCType>::face ( UInt const i ) const
3075 {
3076  ASSERT_BD ( i < faceList.size() ) ;
3077  return faceList[ i ];
3078 }
3079 
3080 template <typename GeoShapeType, typename MCType>
3081 inline
3082 typename RegionMesh<GeoShapeType, MCType>::face_Type&
3083 RegionMesh<GeoShapeType, MCType>::face ( UInt const i )
3084 {
3085  ASSERT_BD ( i < faceList.size() ) ;
3086  return faceList[ i ];
3087 }
3088 
3089 
3090 template <typename GeoShapeType, typename MCType>
3091 inline
3092 typename RegionMesh<GeoShapeType, MCType>::face_Type const&
3093 RegionMesh<GeoShapeType, MCType>::boundaryFace ( UInt const i ) const
3094 {
3095  ASSERT_PRE ( faceList.size() != 0, "Boundary Faces not stored" ) ;
3096  //ASSERT_BD( i < this->numBFaces()) ; //TODO TO BE FIXED! LF
3097  ASSERT_BD ( i < faceList.size() ) ;
3098  return faceList[ i ];
3099 }
3100 
3101 template <typename GeoShapeType, typename MCType>
3102 inline
3103 typename RegionMesh<GeoShapeType, MCType>::face_Type&
3104 RegionMesh<GeoShapeType, MCType>::boundaryFace ( UInt const i )
3105 {
3106  ASSERT_PRE ( faceList.size() != 0, "Boundary Faces not stored" ) ;
3107  // ASSERT_BD( i < this->numBFaces()) ;
3108  ASSERT_BD ( i < faceList.size() ) ;
3109  return faceList[ i ];
3110 }
3111 
3112 template <typename GeoShapeType, typename MCType>
3113 inline UInt
3114 RegionMesh<GeoShapeType, MCType>::numBFaces() const
3115 {
3116  return M_numBFaces;
3117 }
3118 
3119 template <typename GeoShapeType, typename MCType>
3120 inline void
3121 RegionMesh<GeoShapeType, MCType>::setNumFaces ( UInt const n )
3122 {
3123  M_numFaces = n;
3124 }
3125 
3126 template <typename GeoShapeType, typename MCType>
3127 inline void
3128 RegionMesh<GeoShapeType, MCType>::setNumBFaces ( UInt const n )
3129 {
3130  M_numBFaces = n;
3131 }
3132 
3133 // ************************* EDGES ******************************
3134 
3135 template <typename GeoShapeType, typename MCType>
3136 inline UInt /*const*/
3137 RegionMesh<GeoShapeType, MCType>::numEdges() const
3138 {
3139  return M_numEdges;
3140 }
3141 
3142 template <typename GeoShapeType, typename MCType>
3143 inline UInt /*const*/
3144 RegionMesh<GeoShapeType, MCType>::numGlobalEdges() const
3145 {
3146  return M_numGlobalEdges;
3147 }
3148 
3149 template <typename GeoShapeType, typename MCType>
3150 inline UInt
3151 RegionMesh<GeoShapeType, MCType>::storedEdges() const
3152 {
3153  return edgeList.size();
3154 }
3155 
3156 template <typename GeoShapeType, typename MCType>
3157 inline UInt
3158 RegionMesh<GeoShapeType, MCType>::maxNumEdges() const
3159 {
3160  return edgeList.maxNumItems();
3161 }
3162 
3163 template <typename GeoShapeType, typename MCType>
3164 inline void
3165 RegionMesh<GeoShapeType, MCType>::setMaxNumEdges ( UInt const n, bool const setcounter )
3166 {
3167  edgeList.setMaxNumItems (n);
3168  if ( setcounter )
3169  {
3170  M_numEdges = n;
3171  }
3172 }
3173 
3174 template <typename GeoShapeType, typename MCType>
3175 inline void
3176 RegionMesh<GeoShapeType, MCType>::setMaxNumGlobalEdges ( UInt const n )
3177 {
3178  M_numGlobalEdges = n;
3179 }
3180 
3181 template <typename GeoShapeType, typename MCType>
3182 inline void
3183 RegionMesh<GeoShapeType, MCType>::setNumEdges ( UInt const n)
3184 {
3185  M_numEdges = n;
3186 }
3187 
3188 template <typename GeoShapeType, typename MCType>
3189 inline typename RegionMesh<GeoShapeType, MCType>::edge_Type&
3190 RegionMesh<GeoShapeType, MCType>::addEdge ( bool const boundary )
3191 {
3192  edge_Type anEdge;
3193  anEdge.setBoundary ( boundary );
3194  return addEdge ( anEdge );
3195 }
3196 
3197 template <typename GeoShapeType, typename MCType>
3198 inline typename RegionMesh<GeoShapeType, MCType>::edge_Type&
3199 RegionMesh<GeoShapeType, MCType>::addEdge ( edge_Type const& f)
3200 {
3201  edgeList.push_back ( f );
3202  edge_Type& thisEdge = edgeList.back();
3203  thisEdge.setFlag ( EntityFlags::DEFAULT );
3204  thisEdge.setLocalId ( edgeList.size() - 1 );
3205  return thisEdge;
3206 }
3207 
3208 template <typename GeoShapeType, typename MCType>
3209 inline
3210 typename RegionMesh<GeoShapeType, MCType>::edge_Type&
3211 RegionMesh<GeoShapeType, MCType>::setEdge ( edge_Type const& f, UInt position)
3212 {
3213  ASSERT_PRE ( position < edgeList.capacity(), "Edge list size exceeded" <<
3214  position << " " << edgeList.capacity() ) ;
3215  edgeList ( position ) = f;
3216  edge_Type& thisEdge (edgeList ( position ) );
3217  thisEdge.setLocalId ( position );
3218  return thisEdge;
3219 }
3220 
3221 
3222 template <typename GeoShapeType, typename MCType>
3223 inline
3224 typename RegionMesh<GeoShapeType, MCType>::edge_Type&
3225 RegionMesh<GeoShapeType, MCType>::lastEdge()
3226 {
3227  return edgeList.back();
3228 }
3229 
3230 
3231 
3232 template <typename GeoShapeType, typename MCType>
3233 inline
3234 typename RegionMesh<GeoShapeType, MCType>::edge_Type const&
3235 RegionMesh<GeoShapeType, MCType>::edge ( UInt const i ) const
3236 {
3237  ASSERT_BD ( i < edgeList.size() ) ;
3238  return edgeList[ i ];
3239 }
3240 
3241 template <typename GeoShapeType, typename MCType>
3242 inline
3243 typename RegionMesh<GeoShapeType, MCType>::edge_Type&
3244 RegionMesh<GeoShapeType, MCType>::edge ( UInt const i )
3245 {
3246  ASSERT_BD ( i < edgeList.size() ) ;
3247  return edgeList[ i ];
3248 }
3249 
3250 
3251 template <typename GeoShapeType, typename MCType>
3252 inline
3253 typename RegionMesh<GeoShapeType, MCType>::edge_Type const&
3254 RegionMesh<GeoShapeType, MCType>::boundaryEdge ( UInt const i ) const
3255 {
3256  ASSERT_PRE ( edgeList.size() != 0, "Boundary Edges not stored" ) ;
3257  ASSERT_BD ( i < edgeList.size() ) ;
3258  return edgeList[ i ];
3259 }
3260 
3261 template <typename GeoShapeType, typename MCType>
3262 inline
3263 typename RegionMesh<GeoShapeType, MCType>::edge_Type&
3264 RegionMesh<GeoShapeType, MCType>::boundaryEdge ( UInt const i )
3265 {
3266  ASSERT_PRE ( edgeList.size() != 0, "Boundary Edges not stored" ) ;
3267  ASSERT_BD ( i < edgeList.size() ) ;
3268  return edgeList[ i ];
3269 }
3270 
3271 template <typename GeoShapeType, typename MCType>
3272 inline UInt
3273 RegionMesh<GeoShapeType, MCType>::numBEdges() const
3274 {
3275  return M_numBEdges;
3276 }
3277 
3278 template <typename GeoShapeType, typename MCType>
3279 inline void
3280 RegionMesh<GeoShapeType, MCType>::setNumBEdges ( UInt const n )
3281 {
3282  M_numBEdges = n;
3283 }
3284 
3285 // ************************ Points/Vertices
3286 
3287 template <typename GeoShapeType, typename MCType>
3288 inline UInt
3289 RegionMesh<GeoShapeType, MCType>::numPoints() const
3290 {
3291  return M_numPoints;
3292 }
3293 
3294 template <typename GeoShapeType, typename MCType>
3295 inline UInt&
3296 RegionMesh<GeoShapeType, MCType>::numPoints()
3297 {
3298  return M_numPoints;
3299 }
3300 
3301 template <typename GeoShapeType, typename MCType>
3302 inline UInt
3303 RegionMesh<GeoShapeType, MCType>::storedPoints() const
3304 {
3305  return pointList.size();
3306 }
3307 
3308 template <typename GeoShapeType, typename MCType>
3309 inline UInt
3310 RegionMesh<GeoShapeType, MCType>::storedBPoints() const
3311 {
3312  return _bPoints.size();
3313 }
3314 
3315 template <typename GeoShapeType, typename MCType>
3316 inline UInt
3317 RegionMesh<GeoShapeType, MCType>::maxNumPoints() const
3318 {
3319  return pointList.maxNumItems();
3320 }
3321 
3322 template <typename GeoShapeType, typename MCType>
3323 inline void
3324 RegionMesh<GeoShapeType, MCType>::setMaxNumPoints ( UInt const n, bool const setcounter )
3325 {
3326  pointList.setMaxNumItems (n);
3327  if ( setcounter )
3328  {
3329  M_numPoints = n;
3330  }
3331 }
3332 
3333 template <typename GeoShapeType, typename MCType>
3334 inline void
3335 RegionMesh<GeoShapeType, MCType>::setNumVertices ( UInt const n )
3336 {
3337  M_numVertices = n;
3338 }
3339 
3340 template <typename GeoShapeType, typename MCType>
3341 inline void
3342 RegionMesh<GeoShapeType, MCType>::setNumGlobalVertices ( UInt const n )
3343 {
3344  M_numGlobalVertices = n;
3345 }
3346 
3347 template <typename GeoShapeType, typename MCType>
3348 inline void
3349 RegionMesh<GeoShapeType, MCType>::setNumBVertices ( UInt const n )
3350 {
3351  M_numBVertices = n;
3352 }
3353 
3354 template <typename GeoShapeType, typename MCType>
3355 inline void
3356 RegionMesh<GeoShapeType, MCType>::setMaxNumGlobalPoints ( UInt const n )
3357 {
3358  M_numGlobalPoints = n;
3359 }
3360 
3361 template <typename GeoShapeType, typename MCType>
3362 inline
3363 typename RegionMesh<GeoShapeType, MCType>::point_Type&
3364 RegionMesh<GeoShapeType, MCType>::addPoint ( bool const boundary, bool const vertex )
3365 {
3366  point_Type aPoint;
3367  aPoint.setBoundary ( boundary );
3368  if ( vertex )
3369  {
3370  aPoint.setFlag ( EntityFlags::VERTEX );
3371  }
3372  return addPoint ( aPoint );
3373 }
3374 
3375 template <typename GeoShapeType, typename MCType>
3376 inline
3377 typename RegionMesh<GeoShapeType, MCType>::point_Type&
3378 RegionMesh<GeoShapeType, MCType>::addPoint ( point_Type const& p)
3379 {
3380  ASSERT_PRE ( pointList.size() < pointList.capacity(), "Point list size exceeded" <<
3381  pointList.size() + 1 << " " << pointList.capacity() ) ;
3382 
3383  pointList.push_back ( p );
3384  point_Type& thisPoint ( pointList.back() );
3385  thisPoint.setFlag ( EntityFlags::DEFAULT );
3386  thisPoint.setLocalId ( pointList.size() - 1 );
3387  //todo This is bug prone!
3388  if ( thisPoint.boundary() )
3389  {
3390  ASSERT_PRE ( _bPoints.size() < _bPoints.capacity(), "Boundary Point list size exceeded" <<
3391  _bPoints.size() + 1 << " " << _bPoints.capacity() ) ;
3392  _bPoints.push_back ( & pointList.back() );
3393  }
3394  return thisPoint;
3395 }
3396 
3397 template <typename GeoShapeType, typename MCType>
3398 inline
3399 typename RegionMesh<GeoShapeType, MCType>::point_Type const&
3400 RegionMesh<GeoShapeType, MCType>::point ( UInt const i ) const
3401 {
3402  ASSERT_BD ( i < pointList.size() ) ;
3403 
3404  return pointList[ i ];
3405 }
3406 
3407 template <typename GeoShapeType, typename MCType>
3408 inline
3409 typename RegionMesh<GeoShapeType, MCType>::point_Type&
3410 RegionMesh<GeoShapeType, MCType>::point ( UInt const i )
3411 {
3412  ASSERT_BD ( i < pointList.size() ) ;
3413 
3414  return pointList[ i ];
3415 }
3416 
3417 template <typename GeoShapeType, typename MCType>
3418 inline
3419 typename RegionMesh<GeoShapeType, MCType>::point_Type const&
3420 RegionMesh<GeoShapeType, MCType>::boundaryPoint ( UInt const i ) const
3421 {
3422  ASSERT_PRE ( _bPoints.size() != 0, " Boundary Points not Stored" ) ;
3423  ASSERT_BD ( i < _bPoints.size() ) ;
3424  return * ( _bPoints[ i ] );
3425 }
3426 
3427 template <typename GeoShapeType, typename MCType>
3428 inline
3429 typename RegionMesh<GeoShapeType, MCType>::point_Type&
3430 RegionMesh<GeoShapeType, MCType>::boundaryPoint ( UInt const i )
3431 {
3432  ASSERT_PRE ( _bPoints.size() != 0, " Boundary Points not Stored" ) ;
3433  ASSERT_BD ( i < _bPoints.size() ) ;
3434  return * ( _bPoints[ i ] );
3435 }
3436 
3437 template <typename GeoShapeType, typename MCType>
3438 inline UInt
3439 RegionMesh<GeoShapeType, MCType>::numBPoints() const
3440 {
3441  return M_numBPoints;
3442 }
3443 
3444 template <typename GeoShapeType, typename MCType>
3445 inline void
3446 RegionMesh<GeoShapeType, MCType>::setNumBPoints ( UInt const n )
3447 {
3448  M_numBPoints = n;
3449  _bPoints.reserve ( n );
3450 }
3451 
3452 template <typename GeoShapeType, typename MCType>
3453 inline UInt
3454 RegionMesh<GeoShapeType, MCType>::numVertices() const
3455 {
3456  return M_numVertices;
3457 }
3458 
3459 template <typename GeoShapeType, typename MCType>
3460 inline UInt
3461 RegionMesh<GeoShapeType, MCType>::numGlobalVertices() const
3462 {
3463  return M_numGlobalVertices;
3464 }
3465 
3466 
3467 template <typename GeoShapeType, typename MCType>
3468 inline UInt
3469 RegionMesh<GeoShapeType, MCType>::numBVertices() const
3470 {
3471  return M_numBVertices;
3472 }
3473 
3474 template <typename GeoShapeType, typename MCType>
3475 inline UInt&
3476 RegionMesh<GeoShapeType, MCType>::numBVertices()
3477 {
3478  return M_numBVertices;
3479 }
3480 
3481 // *************** GENERAL *******************
3482 
3483 template <typename GeoShapeType, typename MCType>
3484 inline std::ostream&
3485 RegionMesh<GeoShapeType, MCType>::showMe ( bool verbose, std::ostream& out ) const
3486 {
3487  out << "**************************************************" << std::endl;
3488  out << "**************************************************" << std::endl;
3489  out << " RegionMesh " << std::endl;
3490  out << "**************************************************" << std::endl;
3491  out << "**************************************************" << std::endl;
3492  out << " Global ID: " << this->id() << " Marker Flag: " << this->markerID() << std::endl;
3493  // out <<"Faces local to volumes stored: "<<hasLocalFaces()<<std::endl;
3494  //out <<"Edges local to volumes stored: "<<hasLocalEdges()<<std::endl;
3495  //out <<"Edges local to faces stored:"<<switches.test("FACEtoEDGE")<<std::endl;
3496  //out <<"Volumes adjacent to Faces stored: "<<switches.test("FACEtoVOLUME")<<std::endl;
3497  //out <<"Faces adjacent to Edges stored: "<<switches.test("EDGEtoFACE")<<std::endl<<std::endl;
3498  //out <<"Internal Faces Stored: " << hasInternalFaces()<<std::endl;
3499  //out <<"Edges Stored: " << hasEdges()<<" Internal: "
3500  // << hasInternalEdges()<<std::endl;
3501  out << "**************** COUNTERS ********************" << std::endl;
3502  out << "NumPoints=" << numPoints() << " " << "numBPoints=" << numBPoints() << std::endl;
3503  out << "NumVertices=" << numVertices() << " " << "numBVerices=" << numBVertices() << std::endl;
3504  out << "NumVolumes=" << numVolumes() << " " << "numFaces=" << numFaces() << std::endl;
3505  out << "NumBFaces=" << numBFaces() << " " << "numEdges=" << numEdges() << std::endl;
3506  out << "NumBEdges=" << numBEdges() << std::endl;
3507  out << "**************************************************" << std::endl;
3508  out << "************ACTUALLY STORED ********************" << std::endl;
3509  out << "Points=" << pointList.size() << " " << "Edges= " << edgeList.size() << std::endl;
3510  out << "Faces= " << faceList.size() << " " << "Volumes=" << volumeList.size() << std::endl;
3511  out << "**************************************************" << std::endl;
3512  out << "******* STATUS OF SWITCHES ************" << std::endl;
3513  switches.showMe ( verbose, out );
3514  out << "**************************************************" << std::endl;
3515  out << "**************************************************" << std::endl;
3516  if ( verbose )
3517  {
3518  out << "list of points " << this->numPoints() << std::endl;
3519  for ( UInt i = 0; i < this->numPoints(); i++ )
3520  {
3521  out << "p " << i << " (" << this->point ( i ).id() << "): "
3522  << this->point ( i ).coordinate ( 0 ) << " "
3523  << this->point ( i ).coordinate ( 1 ) << " "
3524  << this->point ( i ).coordinate ( 2 ) << std::endl;
3525  }
3526 
3527  out << "list of elements " << this->numElements() << std::endl;
3528  for ( UInt i = 0; i < this->numElements(); i++ )
3529  {
3530  out << "e " << i << " (" << this->element ( i ).id() << "): ";
3531  for ( UInt j = 0; j < element_Type::S_numPoints; j++ )
3532  {
3533  out << this->element ( i ).point ( j ).localId() << " ";
3534  }
3535  out << std::endl;
3536  }
3537 
3538  out << "list of facets " << this->numFacets() << std::endl;
3539  for ( UInt i = 0; i < this->numFacets(); i++ )
3540  {
3541  out << "f " << i << " (" << this->facet ( i ).id() << "): ";
3542  for ( UInt j = 0; j < facet_Type::S_numPoints; j++ )
3543  {
3544  out << this->facet ( i ).point ( j ).localId() << " ";
3545  }
3546  out << std::endl;
3547  }
3548 
3549  // @todo the ridge part cannot be printed since in 2d ridges
3550  // do not have S_numPoints
3551  /*
3552  out << "list of ridges " << this->numRidges() << std::endl;
3553  for( UInt i = 0; i < this->numRidges(); i++ )
3554  {
3555  out << "r " << i << " (" << this->ridge( i ).id() << "): ";
3556  for ( UInt j = 0; j < ridge_Type::S_numPoints; j++ )
3557  out << this->ridge( i ).point( j ).localId() << " ";
3558  out << std::endl;
3559  }
3560  */
3561  }
3562  return out;
3563 
3564 }
3565 
3566 
3567 
3568 
3569 template <typename GeoShapeType, typename MCType>
3570 inline Int
3571 RegionMesh<GeoShapeType, MCType>::check ( Int level, bool const fix, bool verb, std::ostream& out )
3572 {
3573  verb = verb && ( M_comm->MyPID() == 0 );
3574  Int severity = 0;
3575  Switch testsw;
3576  if ( verb )
3577  {
3578  out << "**************************************************" << std::endl;
3579  out << " Checkin RegionMesh " << std::endl;
3580  out << " ID: " << this->id() << std::endl;
3581  out << "**************************************************" << std::endl;
3582  }
3583  if ( level == 1 )
3584  {
3585  checkMesh3D ( *this, testsw, fix, verb, out, out, out );
3586  if ( verb )
3587  {
3588  out << "**********************************************" << std::endl <<
3589  "DETAILS OF EXTENDED CHECK:" << std::endl;
3590  testsw.showMe ( true, out );
3591  out << "**********************************************" << std::endl << std::endl;
3592  if ( testsw.test ( "ABORT_CONDITION" ) )
3593  {
3594  return 1;
3595  }
3596 
3597  }
3598  }
3599 
3600 
3601  if ( pointList.size() != M_numPoints )
3602  {
3603  if ( verb ) out << " Point list size " << pointList.size() << " not equal to internal counter value "
3604  << M_numPoints << std::endl;
3605  if ( fix )
3606  {
3607  M_numPoints = pointList.size();
3608  if ( verb )
3609  {
3610  out << "Fixed";
3611  out.flush();
3612  }
3613  }
3614  }
3615 
3616  if ( edgeList.size() == 0 )
3617  {
3618  if ( verb )
3619  {
3620  out << "WARNING: No Edges Stored" << std::endl;
3621  out << "MAY NOT WORK IF WE HAVE DOF ON EDGES AND ESSENTIAL BC!!!!" << std::endl;
3622  }
3623  severity = -1;
3624  unsetLinkSwitch ( "HAS_ALL_RIDGES" );
3625  unsetLinkSwitch ( "HAS_BOUNDARY_RIDGES" );
3626  }
3627  else if ( edgeList.size() == numBEdges() )
3628  {
3629 
3630  setLinkSwitch ( "HAS_BOUNDARY_RIDGES" );
3631  unsetLinkSwitch ( "HAS_ALL_RIDGES" );
3632  if ( verb )
3633  {
3634  out << "INFORMATION: Only Boundary Edges Stored" << std::endl;
3635  }
3636  }
3637  else if ( edgeList.size() == numEdges() )
3638  {
3639  setLinkSwitch ( "HAS_BOUNDARY_RIDGES" );
3640  setLinkSwitch ( "HAS_ALL_RIDGES" );
3641  }
3642  else
3643  {
3644  if ( verb )
3645  {
3646  out << "ERROR: Inconsistent numbering of edges" << std::endl;
3647  out << "Counters: Boundary=" << numBEdges() << " Total=" << numEdges() << std::endl;
3648  out << "Stored =" << edgeList.size() << std::endl;
3649  severity = 1;
3650  }
3651 
3652  }
3653 
3654  if ( faceList.size() == 0 )
3655  {
3656  if ( verb )
3657  {
3658  out << "ERROR: No Faces Stored: at least boundary faces are needed" << std::endl;
3659  out << "" << std::endl;
3660  }
3661  severity = 1;
3662  unsetLinkSwitch ( "HAS_ALL_FACETS" );
3663  unsetLinkSwitch ( "HAS_BOUNDARY_FACETS" );
3664  }
3665  else if ( faceList.size() == numBFaces() )
3666  {
3667  setLinkSwitch ( "HAS_BOUNDARY_FACETS" );
3668  unsetLinkSwitch ( "HAS_ALL_FACETS" );
3669  if ( verb )
3670  {
3671  out << "INFORMATION: Only Boundary Faces Stored" << std::endl;
3672  }
3673  }
3674  else if ( faceList.size() == numFaces() )
3675  {
3676  setLinkSwitch ( "HAS_BOUNDARY_FACETS" );
3677  setLinkSwitch ( "HAS_ALL_FACETS" );
3678  }
3679  else
3680  {
3681  if ( verb )
3682  {
3683  out << "ERROR: Inconsistent numbering of faces" << std::endl;
3684  out << "Counters: Boundary=" << numBFaces() << " Total=" << numFaces() << std::endl;
3685  out << "Stored =" << faceList.size() << std::endl;
3686  severity = 1;
3687  }
3688  }
3689 
3690 
3691  UInt count = 0;
3692  for ( typename points_Type::iterator i = pointList.begin(); i != pointList.end(); ++i )
3693  if ( i->boundary() )
3694  {
3695  ++count;
3696  }
3697  if ( count == 0 )
3698  {
3699  severity = 4;
3700  }
3701  if ( count != M_numBPoints )
3702  {
3703  if ( verb ) out << "Num Boundary points " << count << " not equal to internal counter value "
3704  << M_numBPoints << std::endl;
3705  if ( ( count != 0 ) & fix )
3706  {
3707  M_numBPoints = count;
3708  if ( verb )
3709  {
3710  out << "Fixed Counter";
3711  out.flush();
3712  }
3713  }
3714  }
3715 
3716  if ( M_numVertices == 0 )
3717  {
3718  severity = 6;
3719 
3720  if ( verb )
3721  {
3722  out << " SEVERITY ERROR: internal Vertices Counter unset";
3723  }
3724  }
3725 
3726  if ( M_numPoints == 0 )
3727  {
3728  severity = 6;
3729  if ( verb )
3730  {
3731  out << " SEVERITY ERROR: internal Points Counter unset";
3732  }
3733  }
3734  if ( M_numPoints == 0 )
3735  {
3736  severity = 6;
3737  if ( verb )
3738  {
3739  out << " SEVERITY ERROR: internal Points Counter unset";
3740  }
3741  }
3742  if ( M_numBPoints == 0 )
3743  {
3744  severity = 6;
3745  if ( verb )
3746  {
3747  out << " SEVERITY ERROR: boundary Points Counter unset";
3748  }
3749  }
3750  if ( M_numBVertices == 0 )
3751  {
3752  severity = 6;
3753  if ( verb )
3754  {
3755  out << " SEVERITY ERROR: boundary Vertices Counter unset";
3756  }
3757  }
3758 
3759  if ( verb )
3760  out << " Check Finished " << std::endl <<
3761  "***********************************************" << std::endl;
3762  setLinkSwitch ( "HAS_BEEN_CHECKED" );
3763 
3764  return severity;
3765 
3766 }
3767 
3768 
3769 template <typename GeoShapeType, typename MCType>
3770 inline
3771 UInt
3772 RegionMesh<GeoShapeType, MCType>::faceElement ( UInt const i, UInt const Pos ) const
3773 {
3774  ASSERT_PRE ( i < faceList.size(), "Not enough faces stored" ) ;
3775  ASSERT_PRE ( Pos <= 1 , "Wrong position (0 or 1)" ) ;
3776  if ( Pos == 0 )
3777  {
3778  return ( faceList[ i ] ).firstAdjacentElementIdentity();
3779  }
3780  else
3781  {
3782  return ( faceList[ i ] ).secondAdjacentElementIdentity();
3783  }
3784 }
3785 
3786 template <typename GeoShapeType, typename MCType>
3787 inline
3788 UInt
3789 RegionMesh<GeoShapeType, MCType>::faceElement ( facet_Type const& f, UInt const Pos ) const
3790 {
3791  ASSERT_BD ( ! faceList.empty() ) ;
3792  ASSERT_PRE ( Pos <= 1 , "Wrong position (0 or 1)" );
3793  if ( Pos == 0 )
3794  {
3795  return f.firstAdjacentElementIdentity();
3796  }
3797  else
3798  {
3799  return f.secondAdjacentElementIdentity();
3800  }
3801 }
3802 
3803 
3804 template <typename GeoShapeType, typename MCType>
3805 inline
3806 void
3807 RegionMesh<GeoShapeType, MCType>::setLinkSwitch ( std::string const& _s )
3808 {
3809  bool check = switches.set ( _s );
3810  ASSERT0 ( check, std::stringstream ( "Switch named " + _s + " is not allowed" ).str().c_str() );
3811  LIFEV_UNUSED ( check );
3812 }
3813 
3814 template <typename GeoShapeType, typename MCType>
3815 inline
3816 void
3817 RegionMesh<GeoShapeType, MCType>::unsetLinkSwitch ( std::string const& _s )
3818 {
3819  bool check = switches.unset ( _s );
3820  ASSERT0 ( check, std::stringstream ( "Switch named " + _s + " is not allowed" ).str().c_str() );
3821  LIFEV_UNUSED ( check );
3822 }
3823 
3824 template <typename GeoShapeType, typename MCType>
3825 inline
3826 bool
3827 RegionMesh<GeoShapeType, MCType>::getLinkSwitch ( std::string const& _s ) const
3828 {
3829  return switches.test ( _s );
3830 }
3831 
3832 template <typename GeoShapeType, typename MCType>
3833 inline
3834 bool
3835 RegionMesh<GeoShapeType, MCType>::hasInternalFaces() const
3836 {
3837  return faceList.size() > M_numBFaces;
3838 }
3839 
3840 template <typename GeoShapeType, typename MCType>
3841 inline
3842 bool
3843 RegionMesh<GeoShapeType, MCType>::hasInternalEdges() const
3844 {
3845  return edgeList.size() > M_numBEdges;
3846 }
3847 
3848 template <typename GeoShapeType, typename MCType>
3849 inline
3850 bool
3851 RegionMesh<GeoShapeType, MCType>::hasEdges() const
3852 {
3853  return ! edgeList.empty();
3854 }
3855 
3856 template <typename GeoShapeType, typename MCType>
3857 inline
3858 bool
3859 RegionMesh<GeoShapeType, MCType>::hasFaces() const
3860 {
3861  return ! faceList.empty();
3862 }
3863 
3864 template <typename GeoShapeType, typename MCType>
3865 inline
3866 bool
3867 RegionMesh<GeoShapeType, MCType>::isVertex ( point_Type const& p ) const
3868 {
3869  return Flag::testOneSet (p.flag(), EntityFlags::VERTEX);
3870 }
3871 
3872 template <typename GeoShapeType, typename MCType>
3873 inline
3874 bool
3875 RegionMesh<GeoShapeType, MCType>::isVertex ( UInt const& id ) const
3876 {
3877  return isVertex (pointList[id]);
3878 }
3879 
3880 
3881 template <typename GeoShapeType, typename MCType>
3882 inline
3883 bool
3884 RegionMesh<GeoShapeType, MCType>::isBoundaryPoint ( UInt const& id ) const
3885 {
3886  return point ( id ).boundary();
3887 }
3888 
3889 template <typename GeoShapeType, typename MCType>
3890 inline
3891 bool
3892 RegionMesh<GeoShapeType, MCType>::isBoundaryPoint ( point_Type const& p ) const
3893 {
3894  return p.boundary();
3895 }
3896 
3897 template <typename GeoShapeType, typename MCType>
3898 inline
3899 bool
3900 RegionMesh<GeoShapeType, MCType>::isBoundaryFace ( UInt const& id ) const
3901 {
3902  return this->faceList[id].boundary();
3903 }
3904 
3905 template <typename GeoShapeType, typename MCType>
3906 inline UInt
3907 RegionMesh<GeoShapeType, MCType>::localFacetId ( UInt const elemId, UInt const locF ) const
3908 {
3909  ASSERT_PRE ( !M_ElemToFacet.empty(), "Element to Facet array not set" );
3910  ASSERT_BD ( elemId < numElements() );
3911  ASSERT_BD ( locF < element_Type::S_numLocalFacets );
3912 
3913  return M_ElemToFacet.operator() ( locF, elemId );
3914 }
3915 
3916 template <typename GeoShapeType, typename MCType>
3917 inline UInt
3918 RegionMesh<GeoShapeType, MCType>::localFaceId ( UInt const volId, UInt const locF ) const
3919 {
3920  ASSERT_PRE (S_geoDimensions == 3, "RegionMesh::localFaceId, It is not possible to use this method with 2D and 1D geometries.");
3921  return localFacetId ( volId, locF );
3922 }
3923 
3924 template <typename GeoShapeType, typename MCType>
3925 inline
3926 UInt
3927 RegionMesh<GeoShapeType, MCType>::localRidgeId (threeD_Type, UInt const elemId, UInt const locR )
3928 const
3929 {
3930  ASSERT_PRE ( !M_ElemToRidge.empty(), "Volume to Edges array not set" );
3931  ASSERT_BD ( elemId < numElements() );
3932  ASSERT_BD ( locR < element_Type::S_numLocalRidges );
3933  return M_ElemToRidge ( locR, elemId );
3934 }
3935 
3936 template <typename GeoShapeType, typename MCType>
3937 inline
3938 bool
3939 RegionMesh<GeoShapeType, MCType>::isFullEdge ( UInt const& id ) const
3940 {
3941  return edgeList.size() > id;
3942 }
3943 
3944 template <typename GeoShapeType, typename MCType>
3945 bool
3946 RegionMesh<GeoShapeType, MCType>::isFullFace ( UInt const& id ) const
3947 {
3948  return faceList.size() > id;
3949 }
3950 
3951 template <typename GeoShapeType, typename MCType>
3952 typename RegionMesh<GeoShapeType, MCType>::facet_Type&
3953 RegionMesh<GeoShapeType, MCType>::boundaryFacet ( oneD_Type, const UInt& i )
3954 {
3955  ASSERT_BD (i < 2);
3956  return point (i * (numPoints() - 1) );
3957 }
3958 
3959 /********************************************************************************
3960  ELEMENT3D:GLOBAL FACES/EDGES
3961  *******************************************************************************/
3962 
3963 // Forward Declarations
3964 template <typename GeoShapeType, typename MCType>
3965 void
3966 RegionMesh<GeoShapeType, MCType>::updateElementRidges (threeD_Type, bool ce, bool verb, UInt ee, bool renumber )
3967 {
3968  bool verbose = verb && ( M_comm->MyPID() == 0 );
3969 
3970  if (S_geoDimensions != 3)
3971  {
3972  ERROR_MSG ("RegionMesh::updateElementRidges, It is not possible to use this method with 2D and 1D geometries.");
3973  }
3974 
3975  // If the counter is set we trust it! Otherwise we use Euler formula
3976  // this is ok for domains with at most 1 hole!
3977 
3978  if (verbose)
3979  {
3980  std::cout << " Updating element ridges ... " << std::flush;
3981  }
3982 
3983  renumber = renumber && ce && ! this->ridgeList().empty();
3984  if ( ce && ee == 0 )
3985  {
3986  ee = M_numEdges > M_numBEdges ? M_numEdges : ( GeoShapeType::S_numFaces / 2 - 1 ) * numVolumes() + M_numBFaces / 2 + numVertices();
3987  }
3988 
3989 
3990  if ( ce )
3991  {
3992  // We want to create the edges, we need to reserve space
3993  ridgeList().setMaxNumItems (ee);
3994  }
3995  MeshElementBareHandler<BareEdge> bareEdge;
3996  std::pair<UInt, bool> e;
3997  M_ElemToRidge.reshape ( numLocalEdges(), numVolumes() ); // DIMENSION ARRAY
3998 
3999  UInt elemLocalID, i1, i2;
4000  std::pair<BareEdge, bool> _edge;
4001  GeoShapeType ele;
4002  facetShape_Type bele;
4003  // First We check if we have already Edges stored
4004  if ( ! ridgeList().empty() )
4005  {
4006  // dump first the existing edges, to maintain the correct numbering
4007  // if everything is correct the numbering in the bareedge
4008  // structure will reflect the actual edge numbering
4009  std::pair<UInt, bool> _check;
4010  for ( UInt j = 0; j < ridgeList().size(); ++j )
4011  {
4012  i1 = ( ridge ( j ).point ( 0 ) ).localId();
4013  i2 = ( ridge ( j ).point ( 1 ) ).localId();
4014 
4015  _edge = makeBareEdge ( i1, i2 );
4016  _check = bareEdge.addIfNotThere ( _edge.first );
4017  }
4018  }
4019 
4020  ridge_Type edg;
4021 
4022  for ( typename faces_Type::iterator ifa = faceList.begin();
4023  ifa != faceList.begin() + M_numBFaces; ++ifa )
4024  {
4025  for ( UInt j = 0; j < numLocalEdgesOfFace(); j++ )
4026  {
4027  i1 = bele.edgeToPoint ( j, 0 );
4028  i2 = bele.edgeToPoint ( j, 1 );
4029  // go to global
4030  i1 = ( ifa->point ( i1 ) ).localId();
4031  i2 = ( ifa->point ( i2 ) ).localId();
4032 
4033  _edge = makeBareEdge ( i1, i2 );
4034 
4035  e = bareEdge.addIfNotThere ( _edge.first );
4036 
4037  if ( ce && e.second )
4038  {
4039  //
4040  for ( UInt k = 0; k < 2 + facetShape_Type::S_numPointsPerEdge; k++ )
4041  {
4042  UInt inode = bele.edgeToPoint (j, k);
4043  edg.setPoint ( k, ifa->point ( inode ) );
4044  }
4045  MeshUtility::inheritPointsWeakerMarker ( edg );
4046  edg.setBoundary ( true );
4047  edg.setId ( ridgeList().size() );
4048  addRidge ( edg );
4049  }
4050  }
4051 
4052  }
4053 
4054  if ( ce )
4055  {
4056  M_numBEdges = ridgeList().size();
4057  setLinkSwitch ( "HAS_BOUNDARY_RIDGES" );
4058  }
4059 
4060  for ( typename elements_Type::iterator elemIt = elementList().begin();
4061  elemIt != elementList().end(); ++elemIt )
4062  {
4063  elemLocalID = elemIt->localId();
4064 
4065  for ( UInt j = 0; j < numLocalEdges(); j++ )
4066  {
4067  i1 = ele.edgeToPoint ( j, 0 );
4068  i2 = ele.edgeToPoint ( j, 1 );
4069  // go to global
4070  i1 = ( elemIt->point ( i1 ) ).localId();
4071  i2 = ( elemIt->point ( i2 ) ).localId();
4072  _edge = makeBareEdge ( i1, i2 );
4073 
4074  e = bareEdge.addIfNotThere ( _edge.first );
4075  M_ElemToRidge.operator() ( j, elemLocalID ) = e.first;
4076  if ( ce && e.second )
4077  {
4078  for ( UInt k = 0; k < 2 + geoShape_Type::S_numPointsPerEdge; k++ )
4079  {
4080  UInt inode = ele.edgeToPoint (j, k);
4081  edg.setPoint ( k, elemIt->point ( inode ) );
4082  }
4083  MeshUtility::inheritPointsWeakerMarker ( edg );
4084  edg.setBoundary ( false );
4085  edg.setId ( ridgeList().size() );
4086  addRidge ( edg );
4087  }
4088  }
4089  }
4090 
4091  if ( ce )
4092  {
4093  M_numEdges = ridgeList().size();
4094  this->M_numBEdges =
4095  ridgeList().countElementsWithFlag (EntityFlags::PHYSICAL_BOUNDARY, &Flag::testOneSet);
4096  setLinkSwitch ( "HAS_ALL_RIDGES" );
4097  if (this->M_numGlobalEdges == 0)
4098  {
4099  this->M_numGlobalEdges = M_numEdges;
4100  }
4101  }
4102 
4103  if (renumber && !ridgeList().empty() )
4104  {
4105  // Reorder the ridges so that boundary ridges come first (and adjust their localId accordingly)
4106  std::vector<ID> newToOld = ridgeList().reorderAccordingToFlag (EntityFlags::PHYSICAL_BOUNDARY, &Flag::testOneSet).second;
4107  //Unfortunately I need oldToNew!
4108  std::vector<ID> oldToNew ( newToOld.size() );
4109  for (UInt j = 0; j < newToOld.size(); ++j)
4110  {
4111  oldToNew[ newToOld[j] ] = j;
4112  }
4113  // Save some memory annihilating newToOld
4114  std::vector<ID>().swap (newToOld);
4115  // Fix element to ridge array to reflect new ridge numbering
4116  // M_ElemToRidge is in fact a vector!
4117  std::vector<UInt> tmp ( M_ElemToRidge.size() );
4118  std::vector<UInt>::iterator tmp_it = tmp.begin();
4119  for (std::vector<UInt>::iterator it = M_ElemToRidge.begin(); it < M_ElemToRidge.end(); ++it, ++tmp_it)
4120  {
4121  *tmp_it = oldToNew[*it];
4122  }
4123  std::copy (tmp.begin(), tmp.end(), M_ElemToRidge.begin() );
4124  }
4125 
4126  UInt n = bareEdge.maxId();
4127 
4128  if (!ce)
4129  {
4130  if ( M_numEdges == 0 || M_numEdges == M_numBEdges )
4131  {
4132  M_numEdges = n;
4133  }
4134  }
4135 
4136  if (verbose)
4137  {
4138  std::cout << n << " edges found";
4139  }
4140  ASSERT_POS ( n == M_numEdges , "#Edges found is not equal to that in RegionMesh" << n << " " << M_numEdges ) ;
4141  setLinkSwitch ( std::string ( "HAS_ELEMENT_TO_RIDGES" ) );
4142 
4143  if (verbose)
4144  {
4145  std::cout << " done." << std::endl;
4146  }
4147 }
4148 
4149 
4150 //
4151 // Update element faces
4152 //
4153 
4154 template <typename GeoShapeType, typename MCType>
4155 void
4156 RegionMesh<GeoShapeType, MCType>::updateElementFacets ( bool cf, bool verbose, UInt ef )
4157 {
4158  verbose = verbose && ( M_comm->MyPID() == 0 );
4159 
4160  typedef BareEntitySelector<typename facetShape_Type::BasRefSha> bareEntitySelector_Type;
4161  typedef typename bareEntitySelector_Type::bareEntity_Type bareFacet_type;
4162 
4163  if (verbose)
4164  {
4165  std::cout << " Updating element facets ... " << std::flush;
4166  }
4167 
4168  ASSERT0 ( ! cf || numBoundaryFacets() > 0, std::stringstream ( std::string ("Boundary Facets Must have been set") +
4169  std::string ("in order to call updateElementFacets with createFacets=true") +
4170  std::string ("\nUse buildBoundaryFacets(..) from mesh_util.h") ).str().c_str() );
4171  // If the counter is set we trust it! Otherwise we use Euler formula
4172 
4173  if ( cf && ef == 0 )
4174  {
4175  ef = numFacets() > numBoundaryFacets() ? numFacets() : ( geoShape_Type::S_numFacets * numElements() + numBoundaryFacets() ) / 2;
4176  }
4177 
4178  ASSERT ( cf || numFacets() > 0 , "Mesh is not properly set!" );
4179 
4180  if ( cf )
4181  {
4182  facetList().setMaxNumItems ( ef );
4183  }
4184 
4185 
4186 
4187  facet_Type aFacet;
4188 
4189  MeshElementBareHandler<bareFacet_type> bareFacet;
4190  // Extra map for facets stored which are not boundary facets
4191  MeshElementBareHandler<bareFacet_type> extraBareFacet;
4192  std::pair<UInt, bool> e;
4193  M_ElemToFacet.reshape ( element_Type::S_numLocalFacets, numElements() ); // DIMENSION ARRAY
4194 
4195  UInt elemLocalID;
4196  std::pair<bareFacet_type, bool>_facet;
4197 
4198  GeoShapeType ele;
4199  // If we have all facets and the facets store all adjacency info
4200  // everything is easier
4201  if ( (facetList().size() == numFacets() ) && getLinkSwitch ( "FACETS_HAVE_ADIACENCY" ) && getLinkSwitch ( "HAS_ALL_FACETS" ) )
4202  {
4203  for ( typename facets_Type::iterator itf = facetList().begin(); itf != facetList().end(); ++itf )
4204  {
4205  if ( itf->firstAdjacentElementPosition() != NotAnId && itf->firstAdjacentElementIdentity() != NotAnId)
4206  {
4207  M_ElemToFacet ( itf->firstAdjacentElementPosition() , itf->firstAdjacentElementIdentity() ) = itf->localId();
4208  }
4209  if ( itf->secondAdjacentElementPosition() != NotAnId && itf->secondAdjacentElementIdentity() != NotAnId)
4210  {
4211  M_ElemToFacet ( itf->secondAdjacentElementPosition(), itf->secondAdjacentElementIdentity() ) = itf->localId();
4212  }
4213  }
4214  // we finish here
4215  setLinkSwitch ( "HAS_ELEMENT_TO_FACETS" );
4216  if (verbose)
4217  {
4218  std::cout << " done." << std::endl;
4219  }
4220 
4221  return ;
4222  }
4223 
4224  // If I have only boundary facets I need to process them first to keep the correct numbering
4225 
4226  // First We check if we have already Facets stored
4227  UInt _numOriginalStoredFacets = facetList().size();
4228  ID points[facetShape_Type::S_numVertices];
4229  if ( ! facetList().empty() )
4230  {
4231  // dump all facets in the container, to maintain the correct numbering
4232  // if everything is correct the numbering in the bareFacet structure
4233  // will reflect the actual facet numbering. However, if I want to create
4234  // the internal facets I need to make sure that I am processing only the
4235  // boundary ones in a special way.
4236  std::pair<UInt, bool> _check;
4237  for ( UInt j = 0; j < facetList().size(); ++j )
4238  {
4239  for (UInt k = 0; k < facetShape_Type::S_numVertices; k++)
4240  {
4241  points[k] = ( facet ( j ).point ( k ) ).localId();
4242  }
4243  _facet = bareEntitySelector_Type::makeBareEntity ( points );
4244  _check = bareFacet.addIfNotThere ( _facet.first );
4245  if ( ! ( this->facet ( j ).boundary() ) )
4246  {
4247  extraBareFacet.addIfNotThere ( _facet.first, j);
4248  }
4249  }
4250  }
4251  UInt numFoundBoundaryFacets = bareFacet.size();
4252  UInt facetCount = numFoundBoundaryFacets;
4253  for ( typename elements_Type::iterator elemIt = elementList().begin();
4254  elemIt != elementList().end(); ++elemIt )
4255  {
4256  elemLocalID = elemIt->localId();
4257  for ( UInt j = 0; j < element_Type::S_numLocalFacets; j++ )
4258  {
4259  for (UInt k = 0; k < facetShape_Type::S_numVertices; k++)
4260  {
4261  UInt id = ele.facetToPoint ( j, k );
4262  points[k] = elemIt->point ( id ).localId();
4263  }
4264  _facet = bareEntitySelector_Type::makeBareEntity ( points );
4265 
4266  e = bareFacet.addIfNotThere ( _facet.first );
4267  M_ElemToFacet ( j, elemLocalID ) = e.first;
4268  bool _isBound = e.first < numFoundBoundaryFacets;
4269  // Is the facet an extra facet (not on the boundary but originally included in the list)?
4270  bool _isExtra = (e.first >= numFoundBoundaryFacets && e.first < _numOriginalStoredFacets);
4271  if ( _isBound )
4272  {
4273  facet_Type& _thisFacet (facet (e.first) );
4274  _thisFacet.firstAdjacentElementIdentity() = elemLocalID;
4275  _thisFacet.firstAdjacentElementPosition() = j;
4276  _thisFacet.secondAdjacentElementIdentity() = NotAnId;
4277  _thisFacet.secondAdjacentElementPosition() = NotAnId;
4278  }
4279  else if (_isExtra)
4280  {
4281  // This is not a bfacets and I need to set up all info about adjacency properly
4282  facet_Type& _thisFacet (facet (e.first) );
4283  // I need to check if it is the first time I meet it. Then I delete it from the
4284  // map: if it as there it means that it is the first time I am treating this face
4285  if (extraBareFacet.deleteIfThere (_facet.first) )
4286  {
4287  // I need to be sure about orientation, the easiest thing is to rewrite the facet points
4288  for ( UInt k = 0; k < facet_Type::S_numPoints; ++k )
4289  {
4290  _thisFacet.setPoint ( k, elemIt->point ( ele.facetToPoint ( j, k ) ) );
4291  }
4292  _thisFacet.firstAdjacentElementIdentity() = elemLocalID;
4293  _thisFacet.firstAdjacentElementPosition() = j;
4294 
4295  }
4296  else
4297  {
4298  _thisFacet.secondAdjacentElementIdentity() = elemLocalID;
4299  _thisFacet.secondAdjacentElementPosition() = j;
4300  }
4301  }
4302  else if ( cf ) // A facet not contained in the original list.
4303  // I process it only if requested!
4304  {
4305  if ( e.second )
4306  {
4307  // a new facet It must be internal.
4308  for ( UInt k = 0; k < facet_Type::S_numPoints; ++k )
4309  {
4310  aFacet.setPoint ( k, elemIt->point ( ele.facetToPoint ( j, k ) ) );
4311  }
4312 
4313  aFacet.firstAdjacentElementIdentity() = elemLocalID;
4314  aFacet.firstAdjacentElementPosition() = j;
4315 
4316  // gets the marker from the RegionMesh
4317  aFacet.setMarkerID ( NotAnId );
4318  aFacet.setBoundary (false);
4319  aFacet.setId ( facetCount++ );
4320  addFacet ( aFacet); //The id should be correct
4321  }
4322  else
4323  {
4324  facet ( e.first ).secondAdjacentElementIdentity() = elemLocalID;
4325  facet ( e.first ).secondAdjacentElementPosition() = j;
4326  }
4327  }
4328  }
4329  }
4330 
4331  UInt n = bareFacet.maxId();
4332  // LF Fix _numfacets. This part has to be checked. One may want to use
4333  // this method on a partitioned mesh, in which case the Global facets are there
4334  setNumFacets (n); // We have found the right total number of facets in the mesh
4335  if (numGlobalFacets() == 0)
4336  {
4337  setMaxNumGlobalFacets (n); // If not already set fix it.
4338  }
4339 
4340  if (verbose)
4341  {
4342  std::cout << n << " facets ";
4343  }
4344  //ASSERT_POS( n == M_numFacets , "#Facets found inconsistent with that stored in RegionMesh" ) ;
4345  setLinkSwitch ( "HAS_ELEMENT_TO_FACETS" );
4346  if ( cf )
4347  {
4348  setLinkSwitch ( "HAS_ALL_FACETS" );
4349  }
4350  //if ( cf ) Facets have adjacency in any case!
4351  setLinkSwitch ( "FACETS_HAVE_ADIACENCY" );
4352  if (verbose)
4353  {
4354  std::cout << " done." << std::endl;
4355  }
4356 }
4357 
4358 template <typename GeoShapeType, typename MCType>
4359 void RegionMesh<GeoShapeType, MCType>::updateElementFaces ( bool createFaces, const bool verbose, UInt estimateFaceNumber)
4360 {
4361  ASSERT_PRE (S_geoDimensions == 3, "RegionMesh::updateElementFaces, It is not possible to use this method with 2D and 1D geometries.");
4362  updateElementFacets ( createFaces , verbose, estimateFaceNumber );
4363 }
4364 
4365 template <typename GeoShapeType, typename MCType>
4366 void
4367 RegionMesh<GeoShapeType, MCType>::cleanElementFacets()
4368 {
4369  M_ElemToFacet.clearArray();
4370 
4371  unsetLinkSwitch ( "HAS_ELEMENT_TO_FACETS" );
4372 }
4373 
4374 template <typename GeoShapeType, typename MCType>
4375 void
4376 RegionMesh<GeoShapeType, MCType>::cleanElementFaces()
4377 {
4378  ASSERT_PRE (S_geoDimensions == 3, "RegionMesh::cleanElementFaces(), It is not possible to use this method with 2D and 1D geometries.");
4380 }
4381 
4382 template <typename GeoShapeType, typename MCType>
4383 void
4384 RegionMesh<GeoShapeType, MCType>::cleanElementRidges()
4385 {
4386  M_ElemToRidge.clearArray();
4387  unsetLinkSwitch ( "HAS_ELEMENT_TO_RIDGES" );
4388 }
4389 
4390 
4391 template <typename GeoShapeType, typename MCType>
4392 inline void
4393 RegionMesh<GeoShapeType, MCType>::
4394 getListOfPoints ( bool ( *fct ) ( Real, Real, Real ), std::vector<UInt>& list_pts )
4395 {
4396  for ( UInt i = 0; i < M_numPoints; i++ )
4397  {
4398  MeshVertex& pt = pointList ( i );
4399  if ( fct ( pt.x(), pt.y(), pt.z() ) )
4400  {
4401  list_pts.push_back ( i );
4402  }
4403  }
4404 }
4405 
4406 
4407 template <typename GeoShapeType, typename MCType>
4408 inline MeshUtility::MeshTransformer<RegionMesh<GeoShapeType, MCType>, MCType >&
4409 RegionMesh<GeoShapeType, MCType>::meshTransformer()
4410 {
4411  return this->M_meshTransformer;
4412 }
4413 
4414 template <typename GeoShapeType, typename MCType>
4415 inline typename RegionMesh<GeoShapeType, MCType>::commPtr_Type
4416 RegionMesh<GeoShapeType, MCType>::comm() const
4417 {
4418  return this->M_comm;
4419 }
4420 
4421 template <typename GeoShapeType, typename MCType>
4422 void inline RegionMesh<GeoShapeType, MCType>::setComm ( commPtr_Type const& comm )
4423 {
4424  M_comm = comm;
4425 }
4426 
4427 } // End of namespace LifeV
4428 
4429 #endif //REGIONMESH_H
This is the base class to store basic properties of any mesh entity.
Definition: MeshEntity.hpp:97
ID localEdgeId(const oneD_Type, UInt const, UInt const) const
Local Edge (specialization for 1D geometries). It calls an error.
MeshEntityContainer< edge_Type > edges_Type
Definition: RegionMesh.hpp:187
facet_Type & boundaryFacet(oneD_Type, const UInt &i)
commPtr_Type M_comm
UInt faceElement(UInt const faceId, UInt const Pos) const
Id of the Volume Element adjacent to a Face.
void setMarkerID(markerID_Type const &markerId)
set only the mesh marker id.
Definition: RegionMesh.hpp:458
std::ostream & showLinkSwitch(bool verbose=false, std::ostream &out=std::cout)
Output switches contents.
Definition: RegionMesh.hpp:332
MeshUtility::MeshTransformer< RegionMesh< geoShape_Type, markerCommon_Type >, markerCommon_Type > & meshTransformer()
Return the handle to perform transormations on the mesh.
element_Type const & volume(UInt const i) const
i-th mesh 3D Element.
ID localEdgeId(const twoD_Type, UInt const elemId, UInt const locE) const
Local Edge (specialization for 2D geometries).
void setMaxNumVolumes(UInt const n, bool const setcounter=false)
Changes Current capacity of Volumes.
UInt numVertices() const
Number of Vertices in Region.
void setMaxNumRidges(threeD_Type, UInt const n, bool const setcounter)
Changes Current capacity of Ridges.
MeshElementMarked< S_ridgeDimension, S_geoDimensions, geoShape_Type, markerCommon_Type > ridge_Type
Definition: RegionMesh.hpp:158
void setMaxNumPoints(UInt const n, bool const setcounter=false)
Set the number of storable points in the mesh.
ID localRidgeId(twoD_Type, UInt const elemId, UInt const locR) const
edge_Type & setEdge(edge_Type const &e, UInt position)
Add an Edge to specified position.
markerCommon_Type::faceMarker_Type faceMarker_Type
Face Marker.
Definition: RegionMesh.hpp:128
bool hasFaces() const
Do I store mesh faces?
void setMaxNumGlobalRidges(twoD_Type, UInt const n)
bool getLinkSwitch(std::string const &_s) const
Interrogate Switch.
volume_Type::geoShape_Type volumeShape_Type
Element Shape.
Definition: RegionMesh.hpp:171
face_Type const & face(UInt const i) const
i-th mesh Face.
facet_Type & boundaryFacet(const UInt &i)
Get boundary facet at the i-th index.
UInt numGlobalPeaks(threeD_Type) const
Returns the global number of peaks in the mesh.
UInt numFacets(twoD_Type) const
GeoDim< S_geoDimensions > geoDim_Type
Definition: RegionMesh.hpp:113
void setMaxNumGlobalFacets(twoD_Type, UInt const n)
void setNumElements(threeD_Type, UInt const n)
Set counter of elements.
UInt numLocalEdgesOfFace() const
Number of edges on each face.
ridge_Type const & ridge(oneD_Type, UInt const) const
ID localRidgeId(UInt const elemId, UInt const locR) const
Local Ridge ID of a ridge in an element stored in the mesh.
Definition: RegionMesh.hpp:747
UInt numBoundaryFacets(oneD_Type) const
void setMaxNumGlobalRidges(UInt const n)
Changes Current capacity of Global Ridges.
edge_Type & edge(UInt const i)
i-th mesh edge reference.
void setNumVolumes(UInt const n)
Set number of volumes.
Definition: RegionMesh.hpp:493
facets_Type & facetList(oneD_Type)
std::vector< point_Type *> _bPoints
Boundary points list.
elements_Type & elementList(threeD_Type)
returns a reference to the elements&#39; container
edge_Type & lastEdge()
Reference to last edge stored in list.
#define ASSERT_BD(X)
Definition: LifeAssert.hpp:114
elements_Type & elementList(oneD_Type)
Class to transform a mesh.
bool isFullFace(UInt const &id) const
Does this id corresponds to a full face?
bool hasInternalEdges() const
Do I store internal Edges?
void setNumBoundaryRidges(twoD_Type, UInt const n)
UInt numGlobalElements(twoD_Type) const
void setMaxNumGlobalVolumes(UInt const n)
Set the number of global volumes.
Definition: RegionMesh.hpp:483
UInt numRidges(twoD_Type) const
I use standard constructor/destructors.
Definition: Switch.hpp:50
ID localEdgeId(const threeD_Type, UInt const elemId, UInt const locE) const
Local Edge (specialization for 3D geometries).
elements_Type & elementList()
returns a reference to the elements&#39; container
ridge_Type & ridge(twoD_Type, UInt const i)
bool isBoundaryEdge(UInt const &id) const
Edge on boundary check by id.
bool hasLocalEdges(facet_Type) const
Is the array for local Edges set up? Specialization for 2D geometries.
void setNumBoundaryRidges(oneD_Type, UInt const)
void setNumVertices(UInt const n)
Changes number of Vertices.
void setMaxNumElements(oneD_Type, UInt const n, bool const setcounter=false)
markerCommon_Type::edgeMarker_Type edgeMarker_Type
Edge Marker.
Definition: RegionMesh.hpp:126
static const Int S_peakDimension
Definition: RegionMesh.hpp:102
ridge_Type & addRidge(oneD_Type, bool const)
MeshEntityContainer< face_Type > faces_Type
Definition: RegionMesh.hpp:186
static const UInt S_geoDimensions
static const S_geoDimensions: the dimensions (1,2,3) of the geometry
Definition: RegionMesh.hpp:99
static const Int S_ridgeDimension
Definition: RegionMesh.hpp:101
ArraySimple< UInt > M_ElemToFacet
void setMaxNumGlobalRidges(oneD_Type, UInt const)
element_Type & addElement(face_Type const &elem)
UInt numGlobalPeaks(twoD_Type) const
void cleanElementFacets()
Destroys element-to-facet container. Useful to save memory!
UInt numGlobalRidges(oneD_Type) const
std::shared_ptr< Epetra_Comm > commPtr_Type
Definition: RegionMesh.hpp:197
bool hasLocalFacets() const
Is the array for local facets set up?
Definition: RegionMesh.hpp:582
bool isBoundaryFacet(UInt const &id) const
Is facet whose id is given on boundary?
peak_Type & peak(threeD_Type, UInt const i)
Returns a reference to the i-th mesh peak.
void setComm(commPtr_Type const &comm)
Setter for the communicator.
point_Type const & lastPoint() const
Returns the last mesh Point.
UInt numGlobalFacets(threeD_Type) const
specializations numGlobalFacets
element_Type & setElement(edge_Type const &elem, UInt const pos)
Adds element in a certain position (specialization for 1D geometry).
UInt maxNumFaces() const
Current capacity of Faces Container.
ridge_Type & ridge(UInt const i)
i-th mesh ridge reference.
UInt storedVolumes() const
Volumes actually stored in list.
Definition: RegionMesh.hpp:429
UInt numGlobalFacets(twoD_Type) const
ID localRidgeId(oneD_Type, UInt const, UInt const) const
UInt numElements(oneD_Type) const
UInt numEdges() const
Number of Edges.
markerCommon_Type::regionMarker_Type & markerClass() const
get mesh marker.
Definition: RegionMesh.hpp:354
void setMaxNumGlobalPoints(UInt const n)
Set the number of storable global points in the mesh.
UInt numBEdges() const
Number of Boundary Edges.
edges_Type edgeList
Container of mesh Edges.
RegionMesh()
Default constructor.
UInt localFaceId(UInt const volId, UInt const locF) const
Local Face Id.
edge_Type const & boundaryEdge(UInt const i) const
i-th mesh 1D Boundary Edge.
ridge_Type & addRidge(threeD_Type, bool const boundary)
Adds a Ridge.
const element_Type & element(oneD_Type, const UInt &i) const
void setIsPartitioned(bool const isPartitioned)
Definition: RegionMesh.hpp:463
UInt numGlobalFacets(oneD_Type) const
void setNumBoundaryFacets(threeD_Type, UInt const n)
Set counter of boundary facets.
void setMarkerClass(typename MCType::regionMarker_Type const &marker)
set mesh marker.
Definition: RegionMesh.hpp:448
void updateElementRidges(oneD_Type, bool, const bool, UInt, bool)
facets_Type & facetList()
returns a reference to the facets&#39; container
void setMaxNumElements(threeD_Type, UInt const n, bool const setcounter=false)
Changes Current capacity of the container of elements.
UInt numGlobalElements() const
Number of global elements.
void cleanElementRidges()
Destroys Ridge-To-Facet lookup table.
facet_Type & addFacet(oneD_Type, bool const boundary)
void setMaxNumGlobalElements(twoD_Type, UInt const n)
MeshVertex - Zero dimensional entity.
Definition: MeshVertex.hpp:59
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
UInt numGlobalElements(threeD_Type) const
Number of global elements.
MeshElementMarked< 0, S_geoDimensions, geoShape_Type, markerCommon_Type > point_Type
Definition: RegionMesh.hpp:154
peak_Type & peak(twoD_Type, UInt const)
UInt numGlobalPeaks() const
Returns a reference to the i-th mesh peak.
face_Type & addFace()
Adds a face.
Definition: RegionMesh.hpp:906
bool isBoundaryRidge(oneD_Type, UInt const &) const
ridge_Type const & ridge(threeD_Type, UInt const i) const
i-th mesh ridge.
UInt numFacets(threeD_Type) const
specializations for numFacets
UInt numGlobalRidges() const
Global number of Ridges.
std::ostream & showMe(bool verbose=false, std::ostream &out=std::cout) const
Definition: Switch.cpp:174
bool isBoundaryFace(UInt const &id) const
Is face whose id is given on boundary?
UInt numGlobalEdges() const
Global number of Edges.
MeshEntityContainer< facet_Type > facets_Type
Definition: RegionMesh.hpp:191
ID markerID_Type
markerID_Type is the type used to store the geometric entity marker IDs
Definition: Marker.hpp:81
void setVolumeCounter()
set numVolumes counter.
Definition: RegionMesh.hpp:524
UInt numGlobalRidges(threeD_Type) const
Global number of Ridges.
void setMaxNumGlobalElements(oneD_Type, UInt const n)
MeshElementMarked< S_facetDimension, S_geoDimensions, geoShape_Type, markerCommon_Type > facet_Type
Definition: RegionMesh.hpp:157
void setNumFacets(oneD_Type, UInt const n)
bool isPartitioned() const
get M_isPartitioned bool
Definition: RegionMesh.hpp:373
void printLtGMap(std::ostream &os)
Display local to global mapping.
UInt numElements(threeD_Type) const
point_Type const & firstPoint() const
Returns the first mesh Point.
markerCommon_Type::pointMarker_Type pointMarker_Type
Point Marker.
Definition: RegionMesh.hpp:124
UInt numFacets(oneD_Type) const
UInt numBoundaryFacets() const
Number of Boundary facets.
void updateInverseJacobian(const UInt &iQuadPt)
void setNumFaces(UInt const n)
Set counter of faces.
UInt numLocalVertices() const
Number of local vertices for each (3D) element.
element_Type & addElement(volume_Type const &elem)
Adds element.
element_Type & addElement()
Adds element.
void setMaxNumGlobalFacets(oneD_Type, UInt const n)
ID localRidgeId(threeD_Type, UInt const elemId, UInt const locR) const
Local Ridge.
ridges_Type & ridgeList()
returns a reference to the ridges&#39; container
facet_Type & boundaryFacet(twoD_Type, const UInt &i)
bool isBoundaryFacet(twoD_Type, UInt const &id) const
point_Type & addPoint(point_Type const &p)
Adds a Point in the mesh.
UInt & numBVertices()
Reference to the number of Boundary Vertices in Region.
point_Type const & point(UInt const i) const
Returns the i-th mesh Point.
bool testOneSet(flag_Type const &inputFlag, flag_Type const &refFlag)
returns true if at least one flag set in refFlag is set in inputFlag
Definition: LifeV.hpp:216
void setMaxNumGlobalElements(threeD_Type, UInt const n)
Set the number of global elements.
UInt localFacetId(UInt const elemId, UInt const locF) const
Local Facet Id.
void setMaxNumGlobalElements(UInt const n)
Set the number of global elements.
UInt numGlobalFaces() const
Returns Global Number of Faces.
ridge_Type & addRidge(edge_Type const &r)
Adds a Ridge. Specialization for 3D geometries.
face_Type & setFace(face_Type const &f, UInt pos)
Adds a face in a certain position.
ridges_Type & ridgeList(oneD_Type)
void updateElementFacets(bool createFaces=false, bool verbose=false, UInt estimateFacetNumber=0)
Build localFacetId table and optionally fills the list of Facets.
void setMaxNumFacets(oneD_Type, UInt const n, bool const setcounter=false)
geoDim_Type M_geoDim
Real & z()
Returns the reference to the z-coordinate and checks if working in two dimensions.
Definition: MeshVertex.hpp:149
UInt numLocalEdges() const
Number of local edges for each (3D) element.
facet_Type & addFacet(face_Type const &facet)
Adds a facet. 3D specialization.
void setNumBVertices(UInt const n)
Changes number of Boundary Vertices.
void setNumRidges(UInt const n)
Set counter of facets.
UInt numGlobalVolumes() const
Returns Global Number of Volumes.
Definition: RegionMesh.hpp:420
markerID_Type markerID() const
get only mesh marker id.
Definition: RegionMesh.hpp:363
element_Type & setElement(volume_Type const &elem, UInt const pos)
Adds element in a certain position (specialization for 3D geometry).
const flag_Type VERTEX(0x20)
#define ERROR_MSG(A)
Definition: LifeAssert.hpp:69
element_Type & element(const UInt &i)
Get element at the i-th index.
void setMaxNumFacets(twoD_Type, UInt const n, bool const setcounter=false)
element_Type & lastVolume()
Reference to last volume stored in list.
Definition: RegionMesh.hpp:535
dummy class for selecting correct function specializations based on geometry dimensions (1...
void unsetLinkSwitch(std::string const &_s)
Unset a switch.
UInt numPoints() const
Returns number of points in the mesh.
face_Type & boundaryFace(UInt const i)
i-th mesh boundary face.
edge_Type::geoShape_Type edgeShape_Type
Definition: RegionMesh.hpp:173
UInt storedEdges() const
Number of stored Edges.
UInt localFaceId(const volume_Type &vol, UInt const locF) const
Local Face Id.
Definition: RegionMesh.hpp:660
void updateElementRidges(bool createRidges=false, const bool verbose=false, UInt estimateRidgeNumber=0, bool renumber=true)
Build localRidgeId table and optionally fills the list of Ridges.
Definition: RegionMesh.hpp:704
void setMaxNumElements(twoD_Type, UInt const n, bool const setcounter=false)
element_Type & addElement(edge_Type const &elem)
bool isBoundaryRidge(threeD_Type, UInt const &id) const
Ridge on boundary check by id.
ridge_Type const & ridge(twoD_Type, UInt const i) const
RegionMesh(UInt id, commPtr_Type const &comm)
Constructor.
facet_Type const & facet(oneD_Type, UInt const i) const
#define ASSERT_PRE(X, A)
Definition: LifeAssert.hpp:96
The Edge basis class.
MeshUtility::MeshTransformer< RegionMesh< geoShape_Type, markerCommon_Type >, markerCommon_Type > M_meshTransformer
facet_Type & facet(oneD_Type, UInt const i)
element_Type & element(threeD_Type, const UInt &i)
Get element at the i-th index.
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
Real & x()
Returns the reference to the x-coordinate.
Definition: MeshVertex.hpp:131
uint32_type ID
IDs.
Definition: LifeV.hpp:194
element_Type & element(oneD_Type, const UInt &i)
void setMaxNumRidges(oneD_Type, UInt const, bool const)
face_Type & addFace(bool const boundary)
Adds a face.
MeshElementMarked< 3, S_geoDimensions, geoShape_Type, markerCommon_Type > volume_Type
Definition: RegionMesh.hpp:151
void setMaxNumEdges(UInt const n, bool const setcounter=false)
Changes Current capacity of Edges.
vectorSize_Type const numberOfColumns() const
Return the number of columns.
UInt maxNumElements(threeD_Type) const
Current capacity of the container of Elements.
const facet_Type & boundaryFacet(twoD_Type, const UInt &i) const
MeshEntityContainer< peak_Type > peaks_Type
Definition: RegionMesh.hpp:193
MeshEntityContainer< point_Type > points_Type
Definition: RegionMesh.hpp:188
Class for 3D, 2D and 1D Mesh.
Definition: RegionMesh.hpp:87
bool isBoundaryEdge(ridge_Type const &e) const
Edge on boundary check.
facet_Type & addFacet(edge_Type const &facet)
Adds a facet. 2D specialization.
void setMaxNumFaces(UInt const n, bool const setcounter=false)
Changes Current capacity of Faces.
const facet_Type & boundaryFacet(threeD_Type, const UInt &i) const
Get boundary facet at the i-th index.
UInt maxNumPoints() const
Returns the number of storable points in the mesh.
geoShape_Type elementShape_Type
Definition: RegionMesh.hpp:175
GeoShapeType geoShape_Type
Definition: RegionMesh.hpp:93
bool isVertex(point_Type const &p) const
Vertex check.
UInt numBPoints() const
Returns the number of Boundary Points.
UInt numRidges() const
Number of Ridges.
element_Type & volume(UInt const i)
i-th mesh 3D Element.
const flag_Type PHYSICAL_BOUNDARY(0x01)
facet_Type const & facet(UInt const i) const
i-th mesh Facet.
MeshEntityContainer< volume_Type > volumes_Type
Definition: RegionMesh.hpp:185
void setLinkSwitch(std::string const &_s)
Set a switch using a given name.
void setMaxNumFacets(UInt const n, bool const setcounter=false)
Changes Current capacity of Facets.
const flag_Type DEFAULT(0x00)
bool isBoundaryFacet(threeD_Type, UInt const &id) const
Is facet whose id is given on boundary?
ridge_Type const & ridge(UInt const i) const
i-th mesh ridge.
std::ostream & showMe(bool verbose=false, std::ostream &out=std::cout) const
Display general information about the content of the class.
MarkerCommon< MarkerIDStandardPolicy > defaultMarkerCommon_Type
The simplest MarkerCommon: uses all defaults.
UInt maxNumEdges() const
Capacity of Edge Container.
ID localEdgeId(const face_Type &elem, UInt const locE) const
Local Edge (specialization for 2D geometries).
Definition: RegionMesh.hpp:790
volumes_Type volumeList
Container of mesh 3D Elements.
ridge_Type & ridge(oneD_Type, UInt const)
void setNumEdges(UInt const n)
Set internal counter of number of Edges.
facetShape_Type::GeoBShape ridgeShape_Type
Definition: RegionMesh.hpp:177
GeoDim< 2 > twoD_Type
Definition: RegionMesh.hpp:111
ridge_Type & addRidge(point_Type const &r)
Adds a Ridge. Specialization for 2D geometries.
ID localEdgeId(UInt const elemId, UInt const locE) const
Local Edge.
Definition: RegionMesh.hpp:769
ridges_Type & ridgeList(threeD_Type)
returns a reference to the ridges&#39; container
void cleanElementEdges(facet_Type)
UInt numBoundaryFacets(threeD_Type) const
Number of Boundary facets.
const facet_Type & boundaryFacet(const UInt &i) const
Get boundary facet at the i-th index.
void setMaxNumFacets(threeD_Type, UInt const n, bool const setcounter=false)
Changes Current capacity of Facets.
GeoDim< 3 > threeD_Type
Definition: RegionMesh.hpp:112
UInt numGlobalElements(oneD_Type) const
peak_Type const & peak(twoD_Type, UInt const) const
peak_Type const & peak(UInt const i) const
Returns the i-th mesh Peak.
void setNumRidges(threeD_Type, UInt const n)
Set counter of ridges.
bool isBoundaryRidge(edge_Type const &r) const
Ridge on boundary check. Specialization for 3D geometries.
#define ASSERT0(X, A)
Definition: LifeAssert.hpp:71
void getListOfPoints(bool(*fct)(Real, Real, Real), std::vector< UInt > &list_pts)
List of points.
bool isBoundaryPoint(UInt const &id) const
Is this point on boundary?
facets_Type & facetList(threeD_Type)
returns a reference to the facets&#39; container
ridges_Type & ridgeList(twoD_Type)
UInt numGlobalVertices() const
Returns the global number of vertices in the mesh.
UInt maxNumVolumes() const
Current capacity of Volumes Container.
Definition: RegionMesh.hpp:438
void setNumFacets(twoD_Type, UInt const n)
point_Type & point(UInt const i)
Returns a reference to the i-th mesh point.
commPtr_Type comm() const
Return the communicator.
UInt numFaces() const
Returns Number of Faces.
void setMaxNumElements(UInt const n, bool const setcounter=false)
Changes Current capacity of the container of elements.
void updateElementEdges(facet_Type, bool createEdges=false, const bool verbose=false, UInt estimateEdgeNumber=0, bool=true)
Build localEdgeId table and optionally fills the list of Edges.
void setNumElements(UInt const n)
Set counter of elements.
face_Type & lastFace()
Reference to last face stored in list.
const element_Type & element(threeD_Type, const UInt &i) const
Get element at the i-th index.
UInt maxNumElements(oneD_Type) const
facet_Type & addFacet(bool const boundary)
Adds a facet.
geoShape_Type::GeoBShape facetShape_Type
Definition: RegionMesh.hpp:176
ridge_Type & addRidge(twoD_Type, bool const boundary)
double Real
Generic real data.
Definition: LifeV.hpp:175
void updateElementFaces(bool createFaces=false, const bool verbose=false, UInt estimateFaceNumber=0)
Build localFaceId table and optionally fills the list of Faces.
faces_Type faceList
Container of mesh Faces.
facet_Type & facet(threeD_Type, UInt const i)
i-th mesh facet.
bool isBoundaryFacet(oneD_Type, UInt const &id) const
#define LIFEV_UNUSED(x)
Definition: LifeV.hpp:125
element_Type & element(twoD_Type, const UInt &i)
edge_Type & addEdge(edge_Type const &r)
Adds an Edge.
void setMaxNumGlobalFacets(UInt const n)
Changes Current capacity of Global Facets.
Definition: RegionMesh.hpp:896
ID localRidgeId(const element_Type &elem, UInt const locR) const
Local Ridge.
Definition: RegionMesh.hpp:758
UInt numElements(twoD_Type) const
Switch switches
Switches.
flag related free functions and functors
Definition: LifeV.hpp:203
void setMaxNumGlobalFaces(UInt const n)
Changes Current capacity of Global Faces.
UInt numBoundaryFacets(twoD_Type) const
ridge_Type & addRidge(bool const boundary)
Adds a Ridge.
bool hasLocalFaces() const
Is the array for local faces set up?
Definition: RegionMesh.hpp:593
markerCommon_Type::volumeMarker_Type volumeMarker_Type
Volume Marker.
Definition: RegionMesh.hpp:130
virtual ~RegionMesh()
Destructor.
container_Type::const_iterator containerConstIterator_Type
facet_Type & addFacet(threeD_Type, bool const boundary)
Adds a facet.
point_Type & boundaryPoint(UInt const i)
Returns a reference to the i-th mesh Boundary Point.
peak_Type const & peak(threeD_Type, UInt const i) const
Returns the i-th mesh Peak.
available bit-flags for different geometric properties
Definition: MeshEntity.hpp:48
void updateElementEdges(bool createEdges=false, const bool verbose=false, UInt estimateEdgeNumber=0, bool renumber=true)
Builds localEdgeId table and optionally fills the list of Edges.
Definition: RegionMesh.hpp:727
UInt numRidges(threeD_Type) const
Number of Ridges.
void setNumBoundaryFacets(oneD_Type, UInt const n)
element_Type & setElement(face_Type const &elem, UInt const pos)
Adds element in a certain position (specialization for 2D geometry).
UInt storedPoints() const
Returns number of points in the mesh actually stored.
UInt numLocalFaces() const
Number of local faces for each 3Delement.
MeshElementMarked< 2, S_geoDimensions, geoShape_Type, markerCommon_Type > face_Type
Definition: RegionMesh.hpp:152
void updateElementRidges(twoD_Type, bool, const bool, UInt, bool)
face_Type & face(UInt const i)
i-th mesh face.
void cleanElementEdges()
Destroys edge To facet lookup table.
Definition: RegionMesh.hpp:737
Class for describing a geometric Entity immersed in 1D, 2D or 3D Geometry.
bool hasLocalFaces(ridge_Type) const
edge_Type & boundaryEdge(UInt const i)
i-th mesh 1D Boundary Edge Reference.
UInt & numPoints()
Returns a reference to number of points in the mesh.
void setNumElements(oneD_Type, UInt const n)
void setNumElements(twoD_Type, UInt const n)
void setNumBPoints(UInt const n)
Sets the number of Boundary Points.
bool hasInternalFaces() const
Do I store also internal faces?
#define ASSERT_POS(X, A)
Definition: LifeAssert.hpp:102
face_Type const & boundaryFace(UInt const i) const
i-th mesh boundary face.
void setNumFacets(UInt const n)
Set counter of facets.
facet_Type & facet(UInt const i)
i-th mesh facet.
void setMaxNumGlobalEdges(UInt const n)
Changes Current capacity of Global Edges.
UInt faceElement(facet_Type const &f, UInt const Pos) const
3DElement adjacent to a FACE. Face reference given.
const ID NotAnId
Definition: LifeV.hpp:264
bool isBoundaryRidge(UInt const &id) const
Ridge on boundary check by id.
UInt numBVertices() const
Number of Boundary Vertices in Region.
UInt numGlobalPeaks(oneD_Type) const
void setNumBoundaryFacets(UInt const n)
Set counter of boundary facets.
void setMaxNumGlobalFacets(threeD_Type, UInt const n)
Changes Current capacity of Global Facets.
static const Int S_facetDimension
Definition: RegionMesh.hpp:100
MeshEntityContainer< element_Type > elements_Type
Definition: RegionMesh.hpp:190
UInt numRidges(oneD_Type) const
facets_Type & facetList(twoD_Type)
UInt storedFaces() const
Number of Faces actually stored.
markerCommon_Type::regionMarker_Type M_marker
markerCommon_Type::regionMarker_Type regionMarker_Type
Region Marker.
Definition: RegionMesh.hpp:132
element_Type & setVolume(element_Type const &v, UInt const pos)
Adds volume in a certain position.
ridge_Type & ridge(threeD_Type, UInt const i)
i-th mesh ridge reference.
elements_Type & elementList(twoD_Type)
const element_Type & element(const UInt &i) const
Get element at the i-th index.
void setNumBEdges(UInt const n)
Set boundary Edge counter.
bool hasEdges() const
Do I store mesh edges?
facet_Type & addFacet(point_Type const &facet)
Adds a facet. 1D specialization.
UInt numGlobalPoints() const
Returns the global number of points in the mesh.
point_Type & addPoint(bool const boundary, bool const vertices)
Adds a Point in the mesh.
const facet_Type & boundaryFacet(oneD_Type, const UInt &i) const
void setNumFacets(threeD_Type, UInt const n)
Set counter of facets.
UInt storedBPoints() const
Returns number of boundary points in the mesh actually stored.
void setMaxNumRidges(UInt const n, bool const setcounter=false)
Changes Current capacity of Ridges.
MeshElementMarked< S_peakDimension, S_geoDimensions, geoShape_Type, markerCommon_Type > peak_Type
Definition: RegionMesh.hpp:159
Real & y()
Returns the reference to the y-coordinate.
Definition: MeshVertex.hpp:140
UInt maxNumElements(twoD_Type) const
peak_Type const & peak(oneD_Type, UInt const) const
face_Type::geoShape_Type faceShape_Type
Definition: RegionMesh.hpp:172
void setNumBoundaryRidges(UInt const n)
Set boundary ridge counter.
bool isBoundaryRidge(point_Type const &r) const
Ridge on boundary check. Specialization for 2D geometries.
facet_Type const & facet(twoD_Type, UInt const i) const
facet_Type & addFacet(twoD_Type, bool const boundary)
const UInt & numSwitches() const
Get the number of switch which have been set.
Definition: RegionMesh.hpp:303
void updateElementRidges(threeD_Type, bool createRidges=false, const bool verbose=false, UInt estimateRidgeNumber=0, bool renumber=true)
Build localRidgeId table and optionally fills the list of Ridges.
bool isFullEdge(UInt const &id) const
Full Edge check by id.
const element_Type & element(twoD_Type, const UInt &i) const
facet_Type const & facet(threeD_Type, UInt const i) const
i-th mesh Facet.
Int check(Int level=0, bool const fix=false, bool verbose=true, std::ostream &out=std::cerr)
Basic tests for mesh consistency.
void setNumBoundaryFacets(twoD_Type, UInt const n)
MCType markerCommon_Type
Common Markers.
Definition: RegionMesh.hpp:96
facet_Type & facet(twoD_Type, UInt const i)
ArraySimple< UInt > M_ElemToRidge
UInt numFacets() const
Returns Number of Facets.
Definition: RegionMesh.hpp:844
UInt numBFaces() const
Number of Boundary Faces.
UInt numVolumes() const
Returns Number of Volumes.
Definition: RegionMesh.hpp:410
element_Type & addVolume()
Adds volume.
element_Type & addVolume(element_Type const &vol)
Adds volume.
void setNumBoundaryRidges(threeD_Type, UInt const n)
Set boundary ridge counter.
bool hasLocalEdges() const
Is the array for local Edges set up?
Definition: RegionMesh.hpp:682
GeoDim< 1 > oneD_Type
Definition: RegionMesh.hpp:110
ridge_Type M_aRidge
bool hasLocalRidges() const
Is the array for ridges set up?
Definition: RegionMesh.hpp:671
MeshElementMarked< S_geoDimensions, S_geoDimensions, geoShape_Type, markerCommon_Type > element_Type
Definition: RegionMesh.hpp:156
edge_Type const & edge(UInt const i) const
i-th mesh edge.
points_Type pointList
Container of mesh Points/Vertices.
void setNumGlobalVertices(UInt const n)
Set the number of vertices in the mesh.
MeshElementMarked< 1, S_geoDimensions, geoShape_Type, markerCommon_Type > edge_Type
Definition: RegionMesh.hpp:153
bool test(const char *a) const
Definition: Switch.cpp:168
bool isVertex(UInt const &id) const
Vertex check.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
UInt numGlobalRidges(twoD_Type) const
void setMaxNumGlobalRidges(threeD_Type, UInt const n)
Changes Current capacity of Global Ridges.
facet_Type & boundaryFacet(threeD_Type, const UInt &i)
Get boundary facet at the i-th index.
point_Type const & boundaryPoint(UInt const i) const
Returns a reference to the i-th mesh Boundary Point.
BareEntitySelector class - Select the proper bare entity type (bareEdge or bareFace) based on the num...
void setNumBFaces(UInt const n)
Set counter of boundary faces.
void setMaxNumRidges(twoD_Type, UInt const n, bool const setcounter)
ID localEdgeId(const volume_Type &elem, UInt const locE) const
Local Edge (specialization for 3D geometries).
Definition: RegionMesh.hpp:779
peak_Type & peak(oneD_Type, UInt const)
bool isBoundaryPoint(point_Type const &p) const
Is this point on boundary?
edge_Type & addEdge(bool const boundary)
Adds an Edge.
bool isBoundaryRidge(twoD_Type, UInt const &id) const
UInt numGlobalFacets() const
Returns Global Number of Facets.
void cleanElementFaces()
Destroys element-to-face container. Useful to save memory!
MeshEntityContainer< ridge_Type > ridges_Type
Definition: RegionMesh.hpp:192
RegionMesh(commPtr_Type const &comm)
Constructor.
face_Type & addFace(face_Type const &f)
Adds a face.
UInt maxNumElements() const
Current capacity of the container of Elements.
UInt numElements() const
Number of elements in mesh.
void set_switches_for_regionmesh(Switch &sw)
Definition: RegionMesh.cpp:42