Salome HOME
Get relevant changes from V7_dev branch (copyright update, adm files etc)
[tools/medcoupling.git] / src / INTERP_KERNEL / IntegralUniformIntersector.hxx
1 // Copyright (C) 2007-2016  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
21 #ifndef __INTEGRALUNIFORMINTERSECTOR_HXX__
22 #define __INTEGRALUNIFORMINTERSECTOR_HXX__
23
24 #include "TargetIntersector.hxx"
25
26 #include <cmath>
27
28 namespace INTERP_KERNEL
29 {
30   template<class MyMeshType, class MyMatrix>
31   class IntegralUniformIntersector : public TargetIntersector<MyMeshType,MyMatrix>
32   {
33   public:
34     typedef typename MyMeshType::MyConnType ConnType;
35   public:
36     IntegralUniformIntersector(const MyMeshType& mesh, bool isAbs);
37     double performNormalization(double val) const { if(_is_abs) return fabs(val); else return val; }
38     void setFromTo(bool val) { _from_to=val; }
39     void putValueIn(ConnType i, double val, MyMatrix& res) const;
40   protected:
41     const MyMeshType& _mesh;
42     //! if false means fromIntegralUniform if true means toIntegralUniform
43     bool _from_to;
44     bool _is_abs;
45   };
46
47   template<class MyMeshType, class MyMatrix>
48   class IntegralUniformIntersectorP0 : public IntegralUniformIntersector<MyMeshType,MyMatrix>
49   {
50   public:
51     typedef typename MyMeshType::MyConnType ConnType;
52   public:
53     IntegralUniformIntersectorP0(const MyMeshType& mesh, bool isAbs);
54     int getNumberOfRowsOfResMatrix() const;
55     int getNumberOfColsOfResMatrix() const;
56     void intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res);
57   };
58
59   template<class MyMeshType, class MyMatrix>
60   class IntegralUniformIntersectorP1 : public IntegralUniformIntersector<MyMeshType,MyMatrix>
61   {
62   public:
63     typedef typename MyMeshType::MyConnType ConnType;
64   public:
65     IntegralUniformIntersectorP1(const MyMeshType& mesh, bool isAbs);
66     int getNumberOfRowsOfResMatrix() const;
67     int getNumberOfColsOfResMatrix() const;
68     void intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res);
69   };
70 }
71
72 #endif