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 __CurveIntersectorP1P1_TXX__
20 #define __CurveIntersectorP1P1_TXX__
22 #include "CurveIntersectorP1P1.hxx"
23 #include "CurveIntersector.txx"
25 #define BASE_INTERSECTOR CurveIntersector<MyMeshType,MyMatrix>
27 namespace INTERP_KERNEL
29 template<class MyMeshType, class MyMatrix>
30 CurveIntersectorP1P1<MyMeshType,MyMatrix>
31 ::CurveIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS,
32 double precision, double tolerance,
33 double medianLine, int printLevel):
34 BASE_INTERSECTOR (meshT, meshS, precision, tolerance, medianLine, printLevel)
38 template<class MyMeshType, class MyMatrix>
39 int CurveIntersectorP1P1<MyMeshType,MyMatrix>
40 ::getNumberOfRowsOfResMatrix() const
42 return BASE_INTERSECTOR::_meshT.getNumberOfNodes();
45 template<class MyMeshType, class MyMatrix>
46 int CurveIntersectorP1P1<MyMeshType,MyMatrix>
47 ::getNumberOfColsOfResMatrix() const
49 return BASE_INTERSECTOR::_meshS.getNumberOfNodes();
52 template<class MyMeshType, class MyMatrix>
53 void CurveIntersectorP1P1<MyMeshType,MyMatrix>
54 ::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
56 std::vector<typename BASE_INTERSECTOR::TDualSegment> segmentsT, segmentsS;
57 BASE_INTERSECTOR::getDualSegments( icellT, BASE_INTERSECTOR::_meshT, segmentsT);
58 for ( int t = 0; t < (int)segmentsT.size(); ++t )
60 typename MyMatrix::value_type& resRow = res[ OTT<ConnType,numPol>::ind2C( segmentsT[t]._nodeId )];
61 for(typename std::vector<ConnType>::const_iterator
62 iter=icellsS.begin(); iter!=icellsS.end(); iter++)
65 BASE_INTERSECTOR::getDualSegments( OTT<ConnType,numPol>::ind2C(iS),
66 BASE_INTERSECTOR::_meshS, segmentsS);
67 for ( int s = 0; s < (int)segmentsS.size(); ++s )
69 double surf = BASE_INTERSECTOR::intersectSegments(&segmentsT[t]._coords[0],
70 &segmentsS[s]._coords[0]);
73 int nS = segmentsS[s]._nodeId;
74 typename MyMatrix::value_type::const_iterator iterRes=resRow.find(nS);
75 if(iterRes==resRow.end())
76 resRow.insert(std::make_pair(nS,surf));
79 surf+=(*iterRes).second;
81 resRow.insert(std::make_pair(nS,surf));
89 #undef BASE_INTERSECTOR