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 __PLANARINTERSECTORP0P1PL_TXX__
20 #define __PLANARINTERSECTORP0P1PL_TXX__
22 #include "PlanarIntersectorP0P1PL.hxx"
23 #include "PlanarIntersector.txx"
24 #include "CellModel.hxx"
26 #include "PointLocatorAlgos.txx"
28 namespace INTERP_KERNEL
30 template<class MyMeshType, class MyMatrix>
31 PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::PlanarIntersectorP0P1PL(const MyMeshType& meshT, const MyMeshType& meshS,
32 double dimCaracteristic, double md3DSurf,
33 double medianPlane, double precision, int orientation):
34 PlanarIntersector<MyMeshType,MyMatrix>(meshT,meshS,dimCaracteristic,precision,md3DSurf,medianPlane,true,orientation,0)
38 template<class MyMeshType, class MyMatrix>
39 void PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
41 std::vector< std::vector<double> > coordsOfSources(icellsS.size());
43 for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++,ii++)
44 PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(*iter),coordsOfSources[ii]);
45 const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
46 std::vector<double> coordsTarget;
47 PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),coordsTarget);
48 int nbNodesT=coordsTarget.size()/SPACEDIM;
50 for(typename std::vector<ConnType>::const_iterator iter2=icellsS.begin();iter2!=icellsS.end();iter2++,ii++)
52 std::vector<double> tmpSource(coordsOfSources[ii]);
53 std::vector<double> tmpTarget(coordsTarget);
55 PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&tmpSource[0],&tmpTarget[0],tmpSource.size()/SPACEDIM,nbNodesT);
56 for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
58 if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],tmpSource.size()/SPACEDIM,PlanarIntersector<MyMeshType,MyMatrix>::_precision))
60 ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnT[nodeIdT]);
61 typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
62 typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT<ConnType,numPol>::indFC(*iter2));
63 if(iterRes==resRow.end())
64 resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(*iter2),1.));
70 template<class MyMeshType, class MyMatrix>
71 int PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::getNumberOfRowsOfResMatrix() const
73 return PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getNumberOfNodes();
76 template<class MyMeshType, class MyMatrix>
77 int PlanarIntersectorP0P1PL<MyMeshType,MyMatrix>::getNumberOfColsOfResMatrix() const
79 return PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getNumberOfElements();