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 __CurveIntersectorP1P0_TXX__
21 #define __CurveIntersectorP1P0_TXX__
23 #include "CurveIntersectorP1P0.hxx"
24 #include "CurveIntersector.txx"
26 #define BASE_INTERSECTOR CurveIntersector<MyMeshType,MyMatrix>
28 namespace INTERP_KERNEL
30 template<class MyMeshType, class MyMatrix>
31 CurveIntersectorP1P0<MyMeshType,MyMatrix>
32 ::CurveIntersectorP1P0(const MyMeshType& meshT, const MyMeshType& meshS,
33 double precision, double tolerance,
34 double medianLine, int printLevel):
35 BASE_INTERSECTOR (meshT, meshS, precision, tolerance, medianLine, printLevel)
39 template<class MyMeshType, class MyMatrix>
40 int CurveIntersectorP1P0<MyMeshType,MyMatrix>
41 ::getNumberOfRowsOfResMatrix() const
43 return BASE_INTERSECTOR::_meshT.getNumberOfElements();
46 template<class MyMeshType, class MyMatrix>
47 int CurveIntersectorP1P0<MyMeshType,MyMatrix>
48 ::getNumberOfColsOfResMatrix() const
50 return BASE_INTERSECTOR::_meshS.getNumberOfNodes();
53 //================================================================================
55 * \brief Project from source nodes to target segments
57 //================================================================================
59 template<class MyMeshType, class MyMatrix>
60 void CurveIntersectorP1P0<MyMeshType,MyMatrix>
61 ::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
63 typename MyMatrix::value_type& resRow = res[ icellT ];
64 std::vector<typename BASE_INTERSECTOR::TDualSegment> segmentsS;
65 std::vector<double> coordsT;
66 int t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT);
67 for ( t = 0; t < nbSegT; ++t )
68 for(typename std::vector<ConnType>::const_iterator
69 iter=icellsS.begin(); iter!=icellsS.end(); iter++)
72 BASE_INTERSECTOR::getDualSegments( OTT<ConnType,numPol>::ind2C(iS),
73 BASE_INTERSECTOR::_meshS, segmentsS);
74 for ( int s = 0; s < (int)segmentsS.size(); ++s )
76 double surf = BASE_INTERSECTOR::intersectSegments(&segmentsS[s]._coords[0],
77 &coordsT[0] + t*SPACEDIM);
80 int nS = segmentsS[s]._nodeId;
81 typename MyMatrix::value_type::const_iterator iterRes=resRow.find(nS);
82 if(iterRes==resRow.end())
83 resRow.insert(std::make_pair(nS,surf));
86 surf+=(*iterRes).second;
88 resRow.insert(std::make_pair(nS,surf));
95 #undef BASE_INTERSECTOR