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
19 #ifndef __POLYHEDRONINTERSECTORP0P0_TXX__
20 #define __POLYHEDRONINTERSECTORP0P0_TXX__
22 #include "PolyhedronIntersectorP0P0.hxx"
23 #include "Intersector3DP0P0.txx"
24 #include "MeshUtils.hxx"
26 #include "SplitterTetra.txx"
28 namespace INTERP_KERNEL
32 * Constructor creating object from target cell global number
33 * The constructor first calculates the necessary nodes,
34 * (depending on the splitting policy) and then splits the hexahedron into
35 * tetrahedra, placing these in the internal vector _tetra.
37 * @param targetMesh mesh containing the target elements
38 * @param srcMesh mesh containing the source elements
39 * @param policy splitting policy to be used
41 template<class MyMeshType, class MyMatrix>
42 PolyhedronIntersectorP0P0<MyMeshType,MyMatrix>::PolyhedronIntersectorP0P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy):Intersector3DP0P0<MyMeshType,MyMatrix>(targetMesh,srcMesh),_split(targetMesh,srcMesh,policy)
48 * Liberates the SplitterTetra objects and potential sub-node points that have been allocated.
51 template<class MyMeshType, class MyMatrix>
52 PolyhedronIntersectorP0P0<MyMeshType,MyMatrix>::~PolyhedronIntersectorP0P0()
57 template<class MyMeshType, class MyMatrix>
58 void PolyhedronIntersectorP0P0<MyMeshType,MyMatrix>::releaseArrays()
60 for(typename std::vector< SplitterTetra<MyMeshType>* >::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
62 _split.releaseArrays();
67 * Calculates the volume of intersection of an element in the source mesh and the target element
68 * represented by the object.
69 * The calculation is performed by calling the corresponding method for
70 * each SplitterTetra object created by the splitting.
72 * @param targetCell in C mode.
73 * @param srcCells in C mode.
76 template<class MyMeshType, class MyMatrix>
77 void PolyhedronIntersectorP0P0<MyMeshType,MyMatrix>::intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res)
79 int nbOfNodesT=Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell));
81 _split.splitTargetCell(targetCell,nbOfNodesT,_tetra);
82 for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
85 for(typename std::vector<SplitterTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
86 volume += (*iter)->intersectSourceCell(*iterCellS);
88 res[targetCell].insert(std::make_pair(OTT<ConnType,numPol>::indFC(*iterCellS), volume));
90 _split.releaseArrays();