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 __INTERSECTOR3D_TXX__
20 #define __INTERSECTOR3D_TXX__
22 #include "Intersector3D.hxx"
26 namespace INTERP_KERNEL
28 template<class MyMeshType, class MyMatrix>
29 Intersector3D<MyMeshType,MyMatrix>::Intersector3D(const MyMeshType& targetMesh, const MyMeshType& srcMesh):_target_mesh(targetMesh),_src_mesh(srcMesh)
34 * @param icellT in format of MyMeshType.
36 template<class MyMeshType, class MyMatrix>
37 void Intersector3D<MyMeshType,MyMatrix>::getRealTargetCoordinates(ConnType icellT, std::vector<double>& coordsT) const
39 int nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT);
40 coordsT.resize(SPACEDIM*nbNodesT);
41 std::vector<double>::iterator iter=coordsT.begin();
42 for (ConnType iT=0; iT<nbNodesT; iT++)
44 const double *coordsCur=getCoordsOfNode(iT,icellT,_target_mesh);
45 iter=std::copy(coordsCur,coordsCur+SPACEDIM,iter);
50 * @param icellT in format of MyMeshType.
52 template<class MyMeshType, class MyMatrix>
53 void Intersector3D<MyMeshType,MyMatrix>::getRealSourceCoordinates(ConnType icellS, std::vector<double>& coordsS) const
55 int nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS);
56 coordsS.resize(SPACEDIM*nbNodesS);
57 std::vector<double>::iterator iter=coordsS.begin();
58 for (ConnType iS=0; iS<nbNodesS; iS++)
60 const double *coordsCur=getCoordsOfNode(iS,icellS,_src_mesh);
61 iter=std::copy(coordsCur,coordsCur+SPACEDIM,iter);
66 * @param icellT in C format.
67 * @return is in format of MyMeshType
69 template<class MyMeshType, class MyMatrix>
70 const typename MyMeshType::MyConnType *Intersector3D<MyMeshType,MyMatrix>::getStartConnOfTargetCell(ConnType icellT) const
72 const ConnType *myConectT=_target_mesh.getConnectivityPtr();
73 const ConnType *myConIndexT=_target_mesh.getConnectivityIndexPtr();
74 return myConectT+OTT<ConnType,numPol>::conn2C(myConIndexT[icellT]);
78 * @param icellT in C format.
79 * @return is in format of MyMeshType
81 template<class MyMeshType, class MyMatrix>
82 const typename MyMeshType::MyConnType *Intersector3D<MyMeshType,MyMatrix>::getStartConnOfSourceCell(ConnType icellS) const
84 const ConnType *myConectS=_src_mesh.getConnectivityPtr();
85 const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
86 return myConectS+OTT<ConnType,numPol>::conn2C(myConIndexS[icellS]);
90 * @param icellS in format of MyMeshType.
91 * @param res ; out param in format of MyMeshType.
93 template<class MyMeshType, class MyMatrix>
94 void Intersector3D<MyMeshType,MyMatrix>::getConnOfSourceCell(ConnType icellS, typename std::vector<ConnType>& res) const
96 const ConnType *myConectS=_src_mesh.getConnectivityPtr();
97 const ConnType *myConIndexS=_src_mesh.getConnectivityIndexPtr();
98 ConnType start=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)];
99 ConnType end=myConIndexS[OTT<ConnType,numPol>::ind2C(icellS)+1];
100 int nbNodesS=end-start;
101 res.resize(nbNodesS);
102 std::copy(myConectS+OTT<ConnType,numPol>::conn2C(start),myConectS+OTT<ConnType,numPol>::conn2C(end),res.begin());