1 // Copyright (C) 2007-2013 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 __MESHELEMENT_TXX__
20 #define __MESHELEMENT_TXX__
22 #include "MeshElement.hxx"
24 #include "TetraAffineTransform.hxx"
25 #include "TransformedTriangle.hxx"
26 #include "MeshUtils.hxx"
27 #include "BoundingBox.hxx"
30 namespace INTERP_KERNEL
36 * @param index global number of element in the mesh in C mode.
37 * @param mesh mesh that the element belongs to
39 template<class ConnType>
40 template<class MyMeshType>
41 MeshElement<ConnType>::MeshElement(const ConnType index, const MyMeshType& mesh)
42 : _index(index), _number(mesh.getNumberOfNodesOfElement(OTT<typename MyMeshType::MyConnType,MyMeshType::My_numPol>::indFC(index))), _box(0)
44 const double**vertices = new const double*[_number];
46 for(unsigned char i = 0 ; i < _number ; ++i)
47 vertices[i] = getCoordsOfNode(i , OTT<typename MyMeshType::MyConnType,MyMeshType::My_numPol>::indFC(index), mesh);
49 // create bounding box
50 _box = new BoundingBox(vertices,_number);
58 template<class ConnType>
59 MeshElement<ConnType>::~MeshElement()
66 /////////////////////////////////////////////////////////////////////
67 /// ElementBBoxOrder /////////////
68 /////////////////////////////////////////////////////////////////////
71 * Comparison operator based on the bounding boxes of the elements
73 * @return true if the coordinate _coord of the bounding box of elem1 is
74 * strictly smaller than that of the bounding box of elem2
76 template<class ConnType>
77 bool ElementBBoxOrder::operator()( MeshElement<ConnType>* elem1, MeshElement<ConnType>* elem2)
79 const BoundingBox* box1 = elem1->getBoundingBox();
80 const BoundingBox* box2 = elem2->getBoundingBox();
87 const double coord1 = box1->getCoordinate(_coord);
88 const double coord2 = box2->getCoordinate(_coord);
90 return coord1 < coord2;