Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / INTERP_KERNEL / UnitTetraIntersectionBary.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 // File      : UnitTetraIntersectionBary.hxx
20 // Created   : Tue Dec  9 16:06:33 2008
21 // Author    : Edward AGAPOV (eap)
22 #ifndef __UNITTETRAINTERSECTIONBARY_HXX__
23 #define __UNITTETRAINTERSECTIONBARY_HXX__
24
25 #include "TransformedTriangle.hxx"
26 #include "INTERPKERNELDefines.hxx"
27
28 #include <vector>
29 #include <list>
30
31 namespace INTERP_KERNEL
32 {
33   class INTERPKERNEL_EXPORT UnitTetraIntersectionBary : protected TransformedTriangle
34   {
35   public:
36     UnitTetraIntersectionBary();
37
38     void init();
39     /*!
40      * \brief Stores a part of triangle common with the unit tetrahedron
41      *  \param triangle - triangle side of other cell, whose calculateIntersectionVolume()
42      *                    must have already been called
43      */
44     void addSide(const TransformedTriangle& triangle);
45
46     /*!
47      * \brief Computes and return coordinates of barycentre
48      */
49     bool getBary(double* baryCenter);
50
51     /*!
52      * \brief Returns volume of intersection
53      *  \retval double - 
54      */
55     inline double getVolume() const { return _int_volume; }
56
57     virtual ~UnitTetraIntersectionBary();
58
59   private:
60
61     int addSideFaces();
62
63     void setTriangleOnSide(int i);
64
65     void clearPolygons(bool andFaces=false);
66
67     /// volume of intersection
68     double  _int_volume;
69
70     /// faces of intersection polyhedron
71     std::list< std::vector< double* > > _faces;
72   };
73
74 }
75
76 #endif