1 // Copyright (C) 2007-2008 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
19 #ifndef __MESHREGION_HXX__
20 #define __MESHREGION_HXX__
22 #include "MeshElement.hxx"
23 #include "BoundingBox.hxx"
24 #include "NormalizedUnstructuredMesh.hxx"
28 namespace INTERP_KERNEL
31 * \brief Class representing a set of elements in a mesh together with their bounding box.
32 * It permits to split itself in two, which is used in the depth-first search filtering process.
35 template<class ConnType>
44 template<class MyMeshType>
45 void addElement(MeshElement<ConnType>* const element, const MyMeshType& mesh);
47 template<class MyMeshType>
48 void split(MeshRegion<ConnType>& region1, MeshRegion<ConnType>& region2, BoundingBox::BoxCoord coord, const MyMeshType& mesh);
50 bool isDisjointWithElementBoundingBox(const MeshElement<ConnType>& elem) const;
52 * Accessor to beginning of elements vector
54 * @return constant iterator pointing at the beginning of the vector or elements
56 typename std::vector< MeshElement<ConnType>* >::const_iterator getBeginElements() const { return _elements.begin(); }
59 * Accessor to end of elements vector
61 * @return constant iterator pointing at the end of the vector or elements
63 typename std::vector< MeshElement<ConnType>* >::const_iterator getEndElements() const { return _elements.end(); }
66 * Gives information on how many elements are contained in the region.
68 * @return the number of elements contained in the region
70 unsigned getNumberOfElements() const { return _elements.size(); }
75 MeshRegion(const MeshRegion& m);
77 /// disallow assignment
78 MeshRegion<ConnType>& operator=(const MeshRegion<ConnType>& m);
80 /// Vector of pointers to contained MeshElements.
81 /// NB : these pointers are not owned by the region object, and are thus
82 /// neither allocated or liberated in this class. The elements must therefore be allocated and liberated outside the class.
83 std::vector< MeshElement<ConnType>* > _elements;
85 /// BoundingBox containing all the nodes of all the elements in the region.