Back to index

salome-med  6.5.0
MEDCalculatorDBField.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __MEDCALCULATORDBFIELD_HXX__
00021 #define __MEDCALCULATORDBFIELD_HXX__
00022 
00023 #include "MedCalculatorDefines.hxx"
00024 #include "MEDCalculatorDBSliceField.hxx"
00025 #include "MEDCalculatorDBRangeSelection.hxx"
00026 
00027 #include "MEDCouplingRefCountObject.hxx"
00028 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
00029 
00030 #include "InterpKernelException.hxx"
00031 
00032 #include <string>
00033 #include <vector>
00034 
00035 namespace ParaMEDMEM
00036 {
00037   class MEDCalculatorBrowserField;
00038   class MEDCalculatorDBFieldReal;
00039   class MEDCalculatorDBFieldCst;
00040 
00041 
00042   class MEDCALCULATOR_EXPORT MEDCalculatorDBField : public RefCountObject
00043   {
00044   public:
00045     static MEDCalculatorDBFieldReal *New(const MEDCalculatorBrowserField& ls);
00046     static MEDCalculatorDBFieldCst *New(double val);
00047     virtual MEDCalculatorDBField *operator+(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception) = 0;
00048     MEDCalculatorDBField *operator+(double val) const throw(INTERP_KERNEL::Exception);
00049     virtual MEDCalculatorDBField *operator-(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception) = 0;
00050     MEDCalculatorDBField *operator-(double val) const throw(INTERP_KERNEL::Exception);
00051     virtual MEDCalculatorDBField *operator*(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception) = 0;
00052     MEDCalculatorDBField *operator*(double val) const throw(INTERP_KERNEL::Exception);
00053     virtual MEDCalculatorDBField *operator/(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception) = 0;
00054     MEDCalculatorDBField *operator/(double val) const throw(INTERP_KERNEL::Exception);
00055     virtual bool isEqual(const MEDCalculatorDBField& other, double precM, double precF) const = 0;
00056   };
00057 
00058   class MEDCALCULATOR_EXPORT MEDCalculatorDBFieldReal : public MEDCalculatorDBField
00059   {
00060   public:
00061     MEDCalculatorDBFieldReal(const MEDCalculatorBrowserField& ls);
00062     ~MEDCalculatorDBFieldReal();
00063     void setName(const char *name);
00064     void setDescription(const char *descr);
00065     void write(const char *fName, bool writeFromScratch) const throw(INTERP_KERNEL::Exception);
00066     void display() const throw(INTERP_KERNEL::Exception);
00067     std::string simpleRepr() const;
00068     MEDCalculatorDBFieldReal *operator()(const MEDCalculatorDBRangeSelection& t, const MEDCalculatorDBRangeSelection& p, const MEDCalculatorDBRangeSelection& c) throw(INTERP_KERNEL::Exception);
00069     const MEDCalculatorDBFieldReal& operator=(const MEDCalculatorDBFieldReal& other) throw(INTERP_KERNEL::Exception);
00070     const MEDCalculatorDBFieldReal& operator=(double val) throw(INTERP_KERNEL::Exception);
00071     MEDCalculatorDBField *operator+(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00072     MEDCalculatorDBField *add(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00073     MEDCalculatorDBField *operator-(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00074     MEDCalculatorDBField *substract(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00075     MEDCalculatorDBField *operator*(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00076     MEDCalculatorDBField *multiply(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00077     MEDCalculatorDBField *operator/(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00078     MEDCalculatorDBField *divide(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00079     MEDCalculatorDBField *operator^(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00080     MEDCalculatorDBField *dot(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00081     MEDCalculatorDBField *crossProduct(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00082     MEDCalculatorDBField *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
00083     MEDCalculatorDBField *determinant() const throw(INTERP_KERNEL::Exception);
00084     MEDCalculatorDBField *eigenValues() const throw(INTERP_KERNEL::Exception);
00085     MEDCalculatorDBField *eigenVectors() const throw(INTERP_KERNEL::Exception);
00086     MEDCalculatorDBField *inverse() const throw(INTERP_KERNEL::Exception);
00087     MEDCalculatorDBField *trace() const throw(INTERP_KERNEL::Exception);
00088     MEDCalculatorDBField *deviator() const throw(INTERP_KERNEL::Exception);
00089     MEDCalculatorDBField *magnitude() const throw(INTERP_KERNEL::Exception);
00090     void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
00091     bool isEqual(const MEDCalculatorDBField& other, double precM, double precF) const;
00092     bool isEqualSameType(const MEDCalculatorDBFieldReal& other, double precM, double precF) const;
00093     MEDCalculatorDBFieldReal *buildCstFieldFromThis(double val) const;
00094     void checkCoherency(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00095     void fetchData() const throw(INTERP_KERNEL::Exception);
00096     TypeOfField getType() const { return _type; }
00097     int getNumberOfSteps() const;
00098     int getNumberOfFetchedSteps() const;
00099     int getNumberOfComponents() const;
00100     std::vector<MEDCouplingFieldDouble *> getFields() const throw(INTERP_KERNEL::Exception);
00101     std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
00102     void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
00103   private:
00104     MEDCalculatorDBFieldReal(TypeOfField type);
00105   private:
00106     std::string _name;
00107     std::string _description;
00108     //
00109     std::string _file_name;
00110     std::string _mesh_name;
00111     std::string _field_name;
00112     TypeOfField _type;
00113     MEDCalculatorDBRangeSelection _t;
00114     MEDCalculatorDBRangeSelection _p;
00115     std::vector<std::string> _c_labels;
00116     MEDCalculatorDBRangeSelection _c;
00117     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCalculatorDBSliceField> > _time_steps;
00118   };
00119 
00120   class MEDCALCULATOR_EXPORT MEDCalculatorDBFieldCst : public MEDCalculatorDBField
00121   {
00122   public:
00123     MEDCalculatorDBFieldCst(double val);
00124     MEDCalculatorDBField *operator+(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00125     MEDCalculatorDBField *operator-(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00126     MEDCalculatorDBField *operator*(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00127     MEDCalculatorDBField *operator/(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00128     bool isEqual(const MEDCalculatorDBField& other, double precM, double precF) const;
00129     MEDCalculatorDBFieldReal *convertIntoReal(const MEDCalculatorDBFieldReal& ref) const;
00130     double getValue() const { return _val; }
00131   private:
00132     double _val;
00133   };
00134 }
00135 
00136 #endif