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 // Author : Anthony Geay (CEA/DEN)
20 #ifndef __PLANARINTERSECTORP0P1PL_TXX__
21 #define __PLANARINTERSECTORP0P1PL_TXX__
23 #include "PlanarIntersectorP0P1PL.hxx"
24 #include "PlanarIntersector.txx"
25 #include "CellModel.hxx"
27 #include "PointLocatorAlgos.txx"
29 namespace INTERP_KERNEL
31 template<class MyMeshType, class MyMatrix>
32 PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::PlanarIntersectorP0P1PL(const MyMeshType& meshT, const MyMeshType& meshS,
33 double dimCaracteristic, double md3DSurf, double minDot3DSurf,
34 double medianPlane, double precision, int orientation):
35 PlanarIntersector<MyMeshType,MyMatrix>(meshT,meshS,dimCaracteristic,precision,md3DSurf,minDot3DSurf,medianPlane,true,orientation,0)
39 template<class MyMeshType, class MyMatrix>
40 void PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
42 std::vector< std::vector<double> > coordsOfSources(icellsS.size());
44 for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++,ii++)
45 PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(*iter),coordsOfSources[ii]);
46 const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
47 std::vector<double> coordsTarget;
48 PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),coordsTarget);
49 int nbNodesT=coordsTarget.size()/SPACEDIM;
51 for(typename std::vector<ConnType>::const_iterator iter2=icellsS.begin();iter2!=icellsS.end();iter2++,ii++)
53 std::vector<double> tmpSource(coordsOfSources[ii]);
54 std::vector<double> tmpTarget(coordsTarget);
56 PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&tmpSource[0],&tmpTarget[0],tmpSource.size()/SPACEDIM,nbNodesT);
57 for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
59 if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],tmpSource.size()/SPACEDIM,PlanarIntersector<MyMeshType,MyMatrix>::_precision))
61 ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnT[nodeIdT]);
62 typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
63 typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT<ConnType,numPol>::indFC(*iter2));
64 if(iterRes==resRow.end())
65 resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(*iter2),1.));
71 template<class MyMeshType, class MyMatrix>
72 int PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
74 return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
77 template<class MyMeshType, class MyMatrix>
78 int PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
80 return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfElements();