1 // Copyright (C) 2007-2024 CEA, EDF
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.
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 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __MEDCALCULATORDBSLICEFIELD_HXX__
22 #define __MEDCALCULATORDBSLICEFIELD_HXX__
24 #include "MedCalculatorDefines.hxx"
26 #include "MEDCouplingRefCountObject.hxx"
28 #include "InterpKernelException.hxx"
34 class MEDCouplingFieldDouble;
35 class MEDCouplingMesh;
37 class MEDCalculatorDBRangeSelection;
39 class MEDCALCULATOR_EXPORT MEDCalculatorDBSliceField : public RefCountObject
42 MEDCalculatorDBSliceField(int iter, int order);
43 MEDCalculatorDBSliceField(MEDCouplingFieldDouble *f);
44 std::size_t getHeapMemorySizeWithoutChildren() const;
45 std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
46 bool isFetched() const { return _field!=0; }
47 void getDtIt(int& it, int& order) const { it=_iteration; order=_order; }
48 void setField(MEDCouplingFieldDouble *f) const;
49 void setName(const char *name);
50 void setDescription(const char *descr);
51 void write(const char *fName, const std::string& n, const std::string& d) const;
52 const MEDCouplingMesh *getMesh(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const;
53 MEDCouplingFieldDouble *getField(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const;
54 MEDCouplingFieldDouble *getFieldWithoutQuestion(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
55 MEDCouplingFieldDouble *getFieldAttribute() const { return _field; }
56 MEDCouplingFieldDouble *buildCstFromThis(double val, int nbOfComp, const MEDCouplingFieldDouble *m) const;
58 void assign(const MEDCalculatorDBSliceField* other, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
59 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC);
60 MEDCalculatorDBSliceField *add(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
61 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
62 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
63 MEDCalculatorDBSliceField *substract(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
64 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
65 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
66 MEDCalculatorDBSliceField *multiply(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
67 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
68 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
69 MEDCalculatorDBSliceField *divide(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
70 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
71 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
72 MEDCalculatorDBSliceField *dot(const MEDCalculatorDBSliceField* other,
73 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
74 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
75 MEDCalculatorDBSliceField *crossProduct(const MEDCalculatorDBSliceField* other,
76 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
77 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const;
78 MEDCalculatorDBSliceField *doublyContractedProduct(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
79 MEDCalculatorDBSliceField *determinant(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
80 MEDCalculatorDBSliceField *eigenValues(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
81 MEDCalculatorDBSliceField *eigenVectors(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
82 MEDCalculatorDBSliceField *inverse(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
83 MEDCalculatorDBSliceField *trace(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
84 MEDCalculatorDBSliceField *deviator(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
85 MEDCalculatorDBSliceField *magnitude(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const;
86 void applyFunc(const char *func, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC);
87 bool isEqual(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
88 int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
89 int sizeCOther, const MEDCalculatorDBRangeSelection& otherC, double prec) const;
91 ~MEDCalculatorDBSliceField();
95 mutable MEDCouplingFieldDouble *_field;
96 MEDCouplingFieldDouble *_work;