1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __MESHREGION_HXX__
21 #define __MESHREGION_HXX__
23 #include "MeshElement.hxx"
24 #include "BoundingBox.hxx"
25 #include "NormalizedUnstructuredMesh.hxx"
29 namespace INTERP_KERNEL
32 * \brief Class representing a set of elements in a mesh together with their bounding box.
33 * It permits to split itself in two, which is used in the depth-first search filtering process.
36 template<class ConnType>
45 template<class MyMeshType>
46 void addElement(MeshElement<ConnType>* const element, const MyMeshType& mesh);
48 template<class MyMeshType>
49 void split(MeshRegion<ConnType>& region1, MeshRegion<ConnType>& region2, BoundingBox::BoxCoord coord, const MyMeshType& mesh);
51 bool isDisjointWithElementBoundingBox(const MeshElement<ConnType>& elem) const;
53 * Accessor to beginning of elements vector
55 * @return constant iterator pointing at the beginning of the vector or elements
57 typename std::vector< MeshElement<ConnType>* >::const_iterator getBeginElements() const { return _elements.begin(); }
60 * Accessor to end of elements vector
62 * @return constant iterator pointing at the end of the vector or elements
64 typename std::vector< MeshElement<ConnType>* >::const_iterator getEndElements() const { return _elements.end(); }
67 * Gives information on how many elements are contained in the region.
69 * @return the number of elements contained in the region
71 unsigned getNumberOfElements() const { return _elements.size(); }
76 MeshRegion(const MeshRegion& m);
78 /// disallow assignment
79 MeshRegion<ConnType>& operator=(const MeshRegion<ConnType>& m);
81 /// Vector of pointers to contained MeshElements.
82 /// NB : these pointers are not owned by the region object, and are thus
83 /// neither allocated or liberated in this class. The elements must therefore be allocated and liberated outside the class.
84 std::vector< MeshElement<ConnType>* > _elements;
86 /// BoundingBox containing all the nodes of all the elements in the region.