Salome HOME
Revert "Synchronize adm files"
[modules/med.git] / src / INTERP_KERNEL / CurveIntersectorP0P0.txx
1 // Copyright (C) 2007-2014  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20 #ifndef __CURVEINTERSECTORP0P0_TXX__
21 #define __CURVEINTERSECTORP0P0_TXX__
22
23 #include "CurveIntersectorP0P0.hxx"
24 #include "CurveIntersector.txx"
25
26 #define BASE_INTERSECTOR CurveIntersector<MyMeshType,MyMatrix>
27
28 namespace INTERP_KERNEL
29 {
30   template<class MyMeshType, class MyMatrix>
31   CurveIntersectorP0P0<MyMeshType,MyMatrix>
32     ::CurveIntersectorP0P0(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)
36   {
37   }
38
39   template<class MyMeshType, class MyMatrix>
40   int CurveIntersectorP0P0<MyMeshType,MyMatrix>
41     ::getNumberOfRowsOfResMatrix() const
42   {
43     return BASE_INTERSECTOR::_meshT.getNumberOfElements();
44   }
45
46   template<class MyMeshType, class MyMatrix>
47   int CurveIntersectorP0P0<MyMeshType,MyMatrix>
48     ::getNumberOfColsOfResMatrix() const
49   {
50     return BASE_INTERSECTOR::_meshS.getNumberOfElements();
51   }
52
53   template<class MyMeshType, class MyMatrix>
54   void CurveIntersectorP0P0<MyMeshType,MyMatrix>
55   ::intersectCells(ConnType icellT, const std::vector<ConnType>& icellsS, MyMatrix& res)
56   {
57     typename MyMatrix::value_type& resRow = res[icellT];
58     std::vector<double> coordsT;
59     int t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT);
60     for ( t = 0; t < nbSegT; ++t )
61       for(typename std::vector<ConnType>::const_iterator
62             iter=icellsS.begin(); iter!=icellsS.end(); iter++)
63         {
64           int iS = *iter;
65           std::vector<double> coordsS;
66           int s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS);
67           for ( s = 0; s < nbSegS; ++s )
68             {
69               double surf = BASE_INTERSECTOR::intersectSegments(&coordsT[0] + t*SPACEDIM,
70                                                                 &coordsS[0] + s*SPACEDIM);
71               if(surf!=0.)
72                 resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(iS),surf));
73             }
74         }
75   }
76 }
77 #undef BASE_INTERSECTOR
78
79 #endif