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 __INTERSECTOR3D_TXX__
21 #define __INTERSECTOR3D_TXX__
23 #include "Intersector3D.hxx"
27 namespace INTERP_KERNEL
29 template<class MyMeshType, class MyMatrix>
30 Intersector3D<MyMeshType,MyMatrix>::Intersector3D(const MyMeshType& targetMesh, const MyMeshType& srcMesh):_target_mesh(targetMesh),_src_mesh(srcMesh)
35 * @param icellT in format of MyMeshType.
37 template<class MyMeshType, class MyMatrix>
38 void Intersector3D<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT) const
40 int nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT);
41 coordsT.resize(SPACEDIM*nbNodesT);
42 std::vector<double>::iterator iter=coordsT.begin();
43 for (ConnType iT=0; iT<nbNodesT; iT++)
45 const double *coordsCur=getCoordsOfNode(iT,icellT,_target_mesh);
46 iter=std::copy(coordsCur,coordsCur+SPACEDIM,iter);
51 * @param icellT in format of MyMeshType.
53 template<class MyMeshType, class MyMatrix>
54 void Intersector3D<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS) const
56 int nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS);
57 coordsS.resize(SPACEDIM*nbNodesS);
58 std::vector<double>::iterator iter=coordsS.begin();
59 for (ConnType iS=0; iS<nbNodesS; iS++)
61 const double *coordsCur=getCoordsOfNode(iS,icellS,_src_mesh);
62 iter=std::copy(coordsCur,coordsCur+SPACEDIM,iter);
67 * @param icellT in C format.
68 * @return is in format of MyMeshType
70 template<class MyMeshType, class MyMatrix>
71 const typename MyMeshType::MyConnType *Intersector3D<MyMeshType,MyMatrix>::getStartConnOfTargetCell(ConnType icellT) const
73 const ConnType *myConectT=_target_mesh.getConnectivityPtr();
74 const ConnType *myConIndexT=_target_mesh.getConnectivityIndexPtr();
75 return myConectT+OTT<ConnType,numPol>::conn2C(myConIndexT[icellT]);
79 * @param icellT in C format.
80 * @return is in format of MyMeshType
82 template<class MyMeshType, class MyMatrix>
83 const typename MyMeshType::MyConnType *Intersector3D<MyMeshType,MyMatrix>::getStartConnOfSourceCell(ConnType icellS) const
85 const ConnType *myConectS=_src_mesh.getConnectivityPtr();
86 const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
87 return myConectS+OTT<ConnType,numPol>::conn2C(myConIndexS[icellS]);
91 * @param icellS in format of MyMeshType.
92 * @param res ; out param in format of MyMeshType.
94 template<class MyMeshType, class MyMatrix>
95 void Intersector3D<MyMeshType,MyMatrix>::getConnOfSourceCell(ConnType icellS, typename std::vector<ConnType>& res) const
97 const ConnType *myConectS=_src_mesh.getConnectivityPtr();
98 const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
99 ConnType start=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
100 ConnType end=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1];
101 int nbNodesS=end-start;
102 res.resize(nbNodesS);
103 std::copy(myConectS+OTT<ConnType,numPol>::conn2C(start),myConectS+OTT<ConnType,numPol>::conn2C(end),res.begin());