Salome HOME
1st step.
[modules/med.git] / src / MEDCalculator / MEDCalculatorDBSliceField.hxx
1 // Copyright (C) 2007-2015  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 __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 MEDCoupling
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 getHeapMemorySizeWithoutChildren() const;
44     std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
45     bool isFetched() const { return _field!=0; }
46     void getDtIt(int& it, int& order) const { it=_iteration;  order=_order; }
47     void setField(MEDCouplingFieldDouble *f) const;
48     void setName(const char *name);
49     void setDescription(const char *descr);
50     void write(const char *fName, const std::string& n, const std::string& d) const throw(INTERP_KERNEL::Exception);
51     const MEDCouplingMesh *getMesh(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const;
52     MEDCouplingFieldDouble *getField(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const;
53     MEDCouplingFieldDouble *getFieldWithoutQuestion(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
54     MEDCouplingFieldDouble *getFieldAttribute() const { return _field; }
55     MEDCouplingFieldDouble *buildCstFromThis(double val, int nbOfComp, const MEDCouplingFieldDouble *m) const;
56     //
57     void assign(const MEDCalculatorDBSliceField* other, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
58                 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC);
59     MEDCalculatorDBSliceField *add(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
60                                 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
61                                 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
62     MEDCalculatorDBSliceField *substract(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
63                                       int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
64                                       int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
65     MEDCalculatorDBSliceField *multiply(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
66                                      int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
67                                      int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
68     MEDCalculatorDBSliceField *divide(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
69                                    int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
70                                    int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
71     MEDCalculatorDBSliceField *dot(const MEDCalculatorDBSliceField* other,
72                                 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
73                                 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
74     MEDCalculatorDBSliceField *crossProduct(const MEDCalculatorDBSliceField* other,
75                                          int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
76                                          int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
77     MEDCalculatorDBSliceField *doublyContractedProduct(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
78     MEDCalculatorDBSliceField *determinant(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
79     MEDCalculatorDBSliceField *eigenValues(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
80     MEDCalculatorDBSliceField *eigenVectors(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
81     MEDCalculatorDBSliceField *inverse(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
82     MEDCalculatorDBSliceField *trace(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
83     MEDCalculatorDBSliceField *deviator(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
84     MEDCalculatorDBSliceField *magnitude(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception);
85     void applyFunc(const char *func, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC);
86     bool isEqual(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
87                  int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
88                  int sizeCOther, const MEDCalculatorDBRangeSelection& otherC, double prec) const;
89   private:
90     ~MEDCalculatorDBSliceField();
91   private:
92     int _iteration;
93     int _order;
94     mutable MEDCouplingFieldDouble *_field;
95     MEDCouplingFieldDouble *_work;
96   };
97 }
98
99 #endif