Version: 6.3.1

src/MEDCalculator/MEDCalculatorDBField.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 "MEDCalculatorDBSliceField.hxx"
00024 #include "MEDCalculatorDBRangeSelection.hxx"
00025 
00026 #include "MEDCouplingRefCountObject.hxx"
00027 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
00028 
00029 #include "InterpKernelException.hxx"
00030 
00031 #include <string>
00032 #include <vector>
00033 
00034 namespace ParaMEDMEM
00035 {
00036   class MEDCalculatorBrowserField;
00037   class MEDCalculatorDBFieldReal;
00038   class MEDCalculatorDBFieldCst;
00039 
00040 
00041   class MEDCalculatorDBField : public RefCountObject
00042   {
00043   public:
00044     static MEDCalculatorDBFieldReal *New(const MEDCalculatorBrowserField& ls);
00045     static MEDCalculatorDBFieldCst *New(double val);
00046     virtual MEDCalculatorDBField *operator+(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception) = 0;
00047     MEDCalculatorDBField *operator+(double val) const throw(INTERP_KERNEL::Exception);
00048     virtual MEDCalculatorDBField *operator-(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception) = 0;
00049     MEDCalculatorDBField *operator-(double val) const throw(INTERP_KERNEL::Exception);
00050     virtual MEDCalculatorDBField *operator*(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception) = 0;
00051     MEDCalculatorDBField *operator*(double val) const throw(INTERP_KERNEL::Exception);
00052     virtual MEDCalculatorDBField *operator/(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception) = 0;
00053     MEDCalculatorDBField *operator/(double val) const throw(INTERP_KERNEL::Exception);
00054     virtual bool isEqual(const MEDCalculatorDBField& other, double precM, double precF) const = 0;
00055   };
00056 
00057   class MEDCalculatorDBFieldReal : public MEDCalculatorDBField
00058   {
00059   public:
00060     MEDCalculatorDBFieldReal(const MEDCalculatorBrowserField& ls);
00061     ~MEDCalculatorDBFieldReal();
00062     void setName(const char *name);
00063     void setDescription(const char *descr);
00064     void write(const char *fName, bool writeFromScratch) const throw(INTERP_KERNEL::Exception);
00065     void display() const throw(INTERP_KERNEL::Exception);
00066     std::string simpleRepr() const;
00067     MEDCalculatorDBFieldReal *operator()(const MEDCalculatorDBRangeSelection& t, const MEDCalculatorDBRangeSelection& p, const MEDCalculatorDBRangeSelection& c) throw(INTERP_KERNEL::Exception);
00068     const MEDCalculatorDBFieldReal& operator=(const MEDCalculatorDBFieldReal& other) throw(INTERP_KERNEL::Exception);
00069     const MEDCalculatorDBFieldReal& operator=(double val) throw(INTERP_KERNEL::Exception);
00070     MEDCalculatorDBField *operator+(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00071     MEDCalculatorDBField *add(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00072     MEDCalculatorDBField *operator-(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00073     MEDCalculatorDBField *substract(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00074     MEDCalculatorDBField *operator*(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00075     MEDCalculatorDBField *multiply(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00076     MEDCalculatorDBField *operator/(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
00077     MEDCalculatorDBField *divide(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00078     MEDCalculatorDBField *operator^(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00079     MEDCalculatorDBField *dot(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00080     MEDCalculatorDBField *crossProduct(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00081     MEDCalculatorDBField *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
00082     MEDCalculatorDBField *determinant() const throw(INTERP_KERNEL::Exception);
00083     MEDCalculatorDBField *eigenValues() const throw(INTERP_KERNEL::Exception);
00084     MEDCalculatorDBField *eigenVectors() const throw(INTERP_KERNEL::Exception);
00085     MEDCalculatorDBField *inverse() const throw(INTERP_KERNEL::Exception);
00086     MEDCalculatorDBField *trace() const throw(INTERP_KERNEL::Exception);
00087     MEDCalculatorDBField *deviator() const throw(INTERP_KERNEL::Exception);
00088     MEDCalculatorDBField *magnitude() const throw(INTERP_KERNEL::Exception);
00089     void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
00090     bool isEqual(const MEDCalculatorDBField& other, double precM, double precF) const;
00091     bool isEqualSameType(const MEDCalculatorDBFieldReal& other, double precM, double precF) const;
00092     MEDCalculatorDBFieldReal *buildCstFieldFromThis(double val) const;
00093     void checkCoherency(const MEDCalculatorDBFieldReal& other) const throw(INTERP_KERNEL::Exception);
00094     void fetchData() const throw(INTERP_KERNEL::Exception);
00095     TypeOfField getType() const { return _type; }
00096     int getNumberOfSteps() const;
00097     int getNumberOfFetchedSteps() const;
00098     int getNumberOfComponents() const;
00099     std::vector<MEDCouplingFieldDouble *> getFields() const throw(INTERP_KERNEL::Exception);
00100     std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
00101     void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
00102   private:
00103     MEDCalculatorDBFieldReal(TypeOfField type);
00104   private:
00105     std::string _name;
00106     std::string _description;
00107     //
00108     std::string _file_name;
00109     std::string _mesh_name;
00110     std::string _field_name;
00111     TypeOfField _type;
00112     MEDCalculatorDBRangeSelection _t;
00113     MEDCalculatorDBRangeSelection _p;
00114     std::vector<std::string> _c_labels;
00115     MEDCalculatorDBRangeSelection _c;
00116     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCalculatorDBSliceField> > _time_steps;
00117   };
00118 
00119   class MEDCalculatorDBFieldCst : public MEDCalculatorDBField
00120   {
00121   public:
00122     MEDCalculatorDBFieldCst(double val);
00123     MEDCalculatorDBField *operator+(const MEDCalculatorDBField& other) const throw(INTERP_KERNEL::Exception);
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     bool isEqual(const MEDCalculatorDBField& other, double precM, double precF) const;
00128     MEDCalculatorDBFieldReal *convertIntoReal(const MEDCalculatorDBFieldReal& ref) const;
00129     double getValue() const { return _val; }
00130   private:
00131     double _val;
00132   };
00133 }
00134 
00135 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS