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
18 #ifndef __PLANARINTERSECTORP0P0_TXX__
19 #define __PLANARINTERSECTORP0P0_TXX__
21 #include "PlanarIntersectorP0P0.hxx"
23 namespace INTERP_KERNEL
25 template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
26 PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::PlanarIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS,
27 double dimCaracteristic, double precision, double medianPlane,
28 bool doRotate, int orientation, int printLevel):
29 PlanarIntersector<MyMeshType,MyMatrix>(meshT,meshS,dimCaracteristic,precision,medianPlane,doRotate,orientation,printLevel)
33 template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
34 int PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfRowsOfResMatrix() const
36 return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfElements();
39 template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
40 int PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::getNumberOfColsOfResMatrix() const
42 return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfElements();
45 template<class MyMeshType, class MyMatrix, class ConcreteP0P0Intersector>
46 void PlanarIntersectorP0P0<MyMeshType,MyMatrix,ConcreteP0P0Intersector>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
48 int nbNodesT=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT];
49 typename MyMatrix::value_type& resRow=res[icellT];
50 for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
53 int nbNodesS=PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS+1]-PlanarIntersector<MyMeshType,MyMatrix>::_connIndexS[iS];
54 double surf=intersectGeometry(OTT<ConnType,numPol>::indFC(icellT),OTT<ConnType,numPol>::indFC(iS),nbNodesT,nbNodesS);
55 //filtering out zero surfaces and badly oriented surfaces
56 // _orientation = -1,0,1
57 // -1 : the intersection is taken into account if target and cells have different orientation
58 // 0 : the intersection is always taken into account
59 // 1 : the intersection is taken into account if target and cells have the same orientation
60 if (( surf > 0.0 && PlanarIntersector<MyMeshType,MyMatrix>::_orientation >=0 ) || ( surf < 0.0 && PlanarIntersector<MyMeshType,MyMatrix>::_orientation <=0 ))
61 resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(iS),surf));