1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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 __POINTLOCATOR3DINTERSECTORP0P1_TXX__
21 #define __POINTLOCATOR3DINTERSECTORP0P1_TXX__
23 #include "PointLocator3DIntersectorP0P1.hxx"
24 #include "Intersector3DP0P1.txx"
25 #include "MeshUtils.hxx"
27 namespace INTERP_KERNEL
31 * @param targetMesh mesh containing the target elements
32 * @param srcMesh mesh containing the source elements
33 * @param policy splitting policy to be used
35 template<class MyMeshType, class MyMatrix>
36 PointLocator3DIntersectorP0P1<MyMeshType,MyMatrix>::PointLocator3DIntersectorP0P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, double precision):
37 Intersector3DP0P1<MyMeshType,MyMatrix>(targetMesh,srcMesh),_precision(precision)
41 template<class MyMeshType, class MyMatrix>
42 PointLocator3DIntersectorP0P1<MyMeshType,MyMatrix>::~PointLocator3DIntersectorP0P1()
48 * @param targetCell in C mode.
49 * @param srcCells in C mode.
52 template<class MyMeshType, class MyMatrix>
53 void PointLocator3DIntersectorP0P1<MyMeshType,MyMatrix>::intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res)
55 std::vector<double> coordsTarget;
56 Intersector3DP0P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),coordsTarget);
57 int nbNodesT=coordsTarget.size()/SPACEDIM;
58 const double *coordsS=Intersector3DP0P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
59 const ConnType *startOfCellNodeConnT=Intersector3DP0P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
60 for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
62 NormalizedCellType tS=Intersector3DP0P1<MyMeshType,MyMatrix>::_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
63 const CellModel& cmTypeS=CellModel::GetCellModel(tS);
64 std::vector<ConnType> connOfCurCellS;
65 Intersector3DP0P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
66 for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
68 if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision))
70 ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnT[nodeIdT]);
71 typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
72 typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT<ConnType,numPol>::indFC(*iterCellS));
73 if(iterRes==resRow.end())
74 resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(*iterCellS),1.));