]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/INTERP_KERNEL/MeshRegion.hxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[tools/medcoupling.git] / src / INTERP_KERNEL / MeshRegion.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef __MESHREGION_HXX__
20 #define __MESHREGION_HXX__
21
22 #include "MeshElement.hxx"
23 #include "BoundingBox.hxx"
24 #include "NormalizedUnstructuredMesh.hxx"
25
26 #include <vector>
27
28 namespace INTERP_KERNEL
29 {
30   /**
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.
33    *
34    */
35   template<class ConnType>
36   class MeshRegion
37   {
38   public:
39     
40     MeshRegion();
41
42     ~MeshRegion();
43
44     template<class MyMeshType>
45     void addElement(MeshElement<ConnType>* const element, const MyMeshType& mesh);
46
47     template<class MyMeshType>
48     void split(MeshRegion<ConnType>& region1, MeshRegion<ConnType>& region2, BoundingBox::BoxCoord coord, const MyMeshType& mesh);
49
50     bool isDisjointWithElementBoundingBox(const MeshElement<ConnType>& elem) const;
51     /**
52      * Accessor to beginning of elements vector
53      *
54      * @return  constant iterator pointing at the beginning of the vector or elements
55      */
56     typename std::vector< MeshElement<ConnType>* >::const_iterator getBeginElements() const { return _elements.begin(); }
57
58     /**
59      * Accessor to end of elements vector
60      *
61      * @return  constant iterator pointing at the end of the vector or elements
62      */
63     typename std::vector< MeshElement<ConnType>* >::const_iterator getEndElements() const { return _elements.end(); }
64     
65     /**
66      * Gives information on how many elements are contained in the region.
67      *
68      * @return  the number of elements contained in the region
69      */
70     unsigned getNumberOfElements() const { return _elements.size(); }
71
72   private:
73
74     /// disallow copying
75     MeshRegion(const MeshRegion& m);
76
77     /// disallow assignment
78     MeshRegion<ConnType>& operator=(const MeshRegion<ConnType>& m);
79
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;
84
85     /// BoundingBox containing all the nodes of all the elements in the region.
86     BoundingBox* _box;
87   
88   };
89
90 }
91
92 #endif