Salome HOME
MED file mesh loading on demand.
[modules/med.git] / src / MEDCalculator / MEDCalculatorDBSliceField.hxx
1 // Copyright (C) 2007-2013  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.
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 __MEDCALCULATORDBSLICEFIELD_HXX__
22 #define __MEDCALCULATORDBSLICEFIELD_HXX__
23
24 #include "MedCalculatorDefines.hxx"
25 #include "MEDCouplingRefCountObject.hxx"
26
27 #include "InterpKernelException.hxx"
28
29 #include <string>
30
31 namespace ParaMEDMEM
32 {
33   class MEDCouplingFieldDouble;
34   class MEDCouplingMesh;
35   class DataArrayInt;
36   class MEDCalculatorDBRangeSelection;
37   
38   class MEDCALCULATOR_EXPORT MEDCalculatorDBSliceField : public RefCountObject
39   {
40   public:
41     MEDCalculatorDBSliceField(int iter, int order);
42     MEDCalculatorDBSliceField(MEDCouplingFieldDouble *f);
43     std::size_t getHeapMemorySize() const { return 0; }
44     bool isFetched() const { return _field!=0; }
45     void getDtIt(int& it, int& order) const { it=_iteration;  order=_order; }
46     void setField(MEDCouplingFieldDouble *f) const;
47     void setName(const char *name);
48     void setDescription(const char *descr);
49     void write(const char *fName, const std::string& n, const std::string& d) const throw(INTERP_KERNEL::Exception);
50     const MEDCouplingMesh *getMesh(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const;
51     MEDCouplingFieldDouble *getField(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const;
52     MEDCouplingFieldDouble *getFieldWithoutQuestion(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
53     MEDCouplingFieldDouble *getFieldAttribute() const { return _field; }
54     MEDCouplingFieldDouble *buildCstFromThis(double val, int nbOfComp, const MEDCouplingFieldDouble *m) const;
55     //
56     void assign(const MEDCalculatorDBSliceField* other, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
57                 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC);
58     MEDCalculatorDBSliceField *add(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
59                                 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
60                                 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
61     MEDCalculatorDBSliceField *substract(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
62                                       int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
63                                       int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
64     MEDCalculatorDBSliceField *multiply(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
65                                      int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
66                                      int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
67     MEDCalculatorDBSliceField *divide(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
68                                    int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
69                                    int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
70     MEDCalculatorDBSliceField *dot(const MEDCalculatorDBSliceField* other,
71                                 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
72                                 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
73     MEDCalculatorDBSliceField *crossProduct(const MEDCalculatorDBSliceField* other,
74                                          int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
75                                          int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
76     MEDCalculatorDBSliceField *doublyContractedProduct(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
77     MEDCalculatorDBSliceField *determinant(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
78     MEDCalculatorDBSliceField *eigenValues(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
79     MEDCalculatorDBSliceField *eigenVectors(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
80     MEDCalculatorDBSliceField *inverse(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
81     MEDCalculatorDBSliceField *trace(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
82     MEDCalculatorDBSliceField *deviator(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
83     MEDCalculatorDBSliceField *magnitude(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
84     void applyFunc(const char *func, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC);
85     bool isEqual(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
86                  int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
87                  int sizeCOther, const MEDCalculatorDBRangeSelection& otherC, double prec) const;
88   private:
89     ~MEDCalculatorDBSliceField();
90   private:
91     int _iteration;
92     int _order;
93     mutable MEDCouplingFieldDouble *_field;
94     MEDCouplingFieldDouble *_work;
95   };
96 }
97
98 #endif