Back to index

salome-med  6.5.0
MEDCouplingFieldDouble.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 __PARAMEDMEM_MEDCOUPLINGFIELDDOUBLE_HXX__
00021 #define __PARAMEDMEM_MEDCOUPLINGFIELDDOUBLE_HXX__
00022 
00023 #include "MEDCoupling.hxx"
00024 #include "MEDCouplingField.hxx"
00025 #include "MEDCouplingTimeDiscretization.hxx"
00026 #include "MEDCouplingMemArray.hxx"
00027 
00028 namespace ParaMEDMEM
00029 {
00030   class MEDCouplingFieldTemplate;
00031 
00032   class MEDCOUPLING_EXPORT MEDCouplingFieldDouble : public MEDCouplingField
00033   {
00034   public:
00035     static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME);
00036     static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME);
00037     void setTimeUnit(const char *unit);
00038     const char *getTimeUnit() const;
00039     void copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
00040     void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
00041     std::string simpleRepr() const;
00042     std::string advancedRepr() const;
00043     bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
00044     bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
00045     bool areCompatibleForMerge(const MEDCouplingField *other) const;
00046     bool areStrictlyCompatible(const MEDCouplingField *other) const;
00047     bool areCompatibleForMul(const MEDCouplingField *other) const;
00048     bool areCompatibleForDiv(const MEDCouplingField *other) const;
00049     bool areCompatibleForMeld(const MEDCouplingFieldDouble *other) const;
00050     void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
00051     void renumberCellsWithoutMesh(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
00052     void renumberNodes(const int *old2NewBg) throw(INTERP_KERNEL::Exception);
00053     void renumberNodesWithoutMesh(const int *old2NewBg, double eps=1e-15) throw(INTERP_KERNEL::Exception);
00054     DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
00055     MEDCouplingFieldDouble *buildSubPart(const DataArrayInt *part) const throw(INTERP_KERNEL::Exception);
00056     MEDCouplingFieldDouble *buildSubPart(const int *partBg, const int *partEnd) const throw(INTERP_KERNEL::Exception);
00057     MEDCouplingFieldDouble *deepCpy() const;
00058     MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
00059     MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
00060     MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
00061     TypeOfTimeDiscretization getTimeDiscretization() const;
00062     void checkCoherency() const throw(INTERP_KERNEL::Exception);
00063     void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
00064     void setTimeTolerance(double val) { _time_discr->setTimeTolerance(val); }
00065     double getTimeTolerance() const { return _time_discr->getTimeTolerance(); }
00066     void setIteration(int it) throw(INTERP_KERNEL::Exception) { _time_discr->setIteration(it); }
00067     void setEndIteration(int it) throw(INTERP_KERNEL::Exception) { _time_discr->setEndIteration(it); }
00068     void setOrder(int order) throw(INTERP_KERNEL::Exception) { _time_discr->setOrder(order); }
00069     void setEndOrder(int order) throw(INTERP_KERNEL::Exception) { _time_discr->setEndOrder(order); }
00070     void setTimeValue(double val) throw(INTERP_KERNEL::Exception) { _time_discr->setTimeValue(val); }
00071     void setEndTimeValue(double val) throw(INTERP_KERNEL::Exception) { _time_discr->setEndTimeValue(val); }
00072     void setTime(double val, int iteration, int order) { _time_discr->setTime(val,iteration,order); }
00073     void setStartTime(double val, int iteration, int order) { _time_discr->setStartTime(val,iteration,order); }
00074     void setEndTime(double val, int iteration, int order) { _time_discr->setEndTime(val,iteration,order); }
00075     double getTime(int& iteration, int& order) const { return _time_discr->getTime(iteration,order); }
00076     double getStartTime(int& iteration, int& order) const { return _time_discr->getStartTime(iteration,order); }
00077     double getEndTime(int& iteration, int& order) const { return _time_discr->getEndTime(iteration,order); }
00078     double getIJ(int tupleId, int compoId) const { return getArray()->getIJ(tupleId,compoId); }
00079     double getIJK(int cellId, int nodeIdInCell, int compoId) const;
00080     void setArray(DataArrayDouble *array);
00081     void setEndArray(DataArrayDouble *array);
00082     void setArrays(const std::vector<DataArrayDouble *>& arrs) throw(INTERP_KERNEL::Exception);
00083     const DataArrayDouble *getArray() const { return _time_discr->getArray(); }
00084     DataArrayDouble *getArray() { return _time_discr->getArray(); }
00085     const DataArrayDouble *getEndArray() const { return _time_discr->getEndArray(); }
00086     DataArrayDouble *getEndArray() { return _time_discr->getEndArray(); }
00087     std::vector<DataArrayDouble *> getArrays() const { std::vector<DataArrayDouble *> ret; _time_discr->getArrays(ret); return ret; }
00088     double accumulate(int compId) const;
00089     void accumulate(double *res) const;
00090     double getMaxValue() const throw(INTERP_KERNEL::Exception);
00091     double getMaxValue2(DataArrayInt*& tupleIds) const throw(INTERP_KERNEL::Exception);
00092     double getMinValue() const throw(INTERP_KERNEL::Exception);
00093     double getMinValue2(DataArrayInt*& tupleIds) const throw(INTERP_KERNEL::Exception);
00094     double getAverageValue() const throw(INTERP_KERNEL::Exception);
00095     double norm2() const throw(INTERP_KERNEL::Exception);
00096     double normMax() const throw(INTERP_KERNEL::Exception);
00097     double getWeightedAverageValue() const throw(INTERP_KERNEL::Exception);
00098     double normL1(int compId) const throw(INTERP_KERNEL::Exception);
00099     void normL1(double *res) const throw(INTERP_KERNEL::Exception);
00100     double normL2(int compId) const throw(INTERP_KERNEL::Exception);
00101     void normL2(double *res) const throw(INTERP_KERNEL::Exception);
00102     double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
00103     void integral(bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception);
00104     void getValueOnPos(int i, int j, int k, double *res) const throw(INTERP_KERNEL::Exception);
00105     void getValueOn(const double *spaceLoc, double *res) const throw(INTERP_KERNEL::Exception);
00106     void getValueOn(const double *spaceLoc, double time, double *res) const throw(INTERP_KERNEL::Exception);
00107     DataArrayDouble *getValueOnMulti(const double *spaceLoc, int nbOfPoints) const throw(INTERP_KERNEL::Exception);
00109     void applyLin(double a, double b, int compoId);
00110     MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
00111     void fillFromAnalytic(int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
00112     void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00113     void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00114     void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
00115     void applyFunc(int nbOfComp, FunctionToEvaluate func);
00116     void applyFunc(int nbOfComp, double val);
00117     void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00118     void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00119     void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
00120     void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
00121     void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
00122     void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
00123     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
00124     int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
00125     int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
00126     void updateTime() const;
00127     //
00128     void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
00129     void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
00130     void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
00131     void resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays);
00132     void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
00133     void serialize(DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays) const;
00134     //
00135     void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
00136     void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
00137     bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
00138     bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
00139     bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
00140     bool zipConnectivity(int compType, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
00141     bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
00142     MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
00143     MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
00144     MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
00145     MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
00146     MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
00147     MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
00148     MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
00149     MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
00150     MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
00151     void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
00152     MEDCouplingFieldDouble *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
00153     void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
00154     void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
00155     static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00156     static MEDCouplingFieldDouble *MergeFields(const std::vector<const MEDCouplingFieldDouble *>& a) throw(INTERP_KERNEL::Exception);
00157     static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00158     static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00159     MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return DotFields(this,&other); }
00160     static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00161     MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return CrossProductFields(this,&other); }
00162     static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00163     MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return MaxFields(this,&other); }
00164     static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00165     MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return MinFields(this,&other); }
00166     MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return AddFields(this,&other); }
00167     const MEDCouplingFieldDouble &operator+=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
00168     static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00169     MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return SubstractFields(this,&other); }
00170     const MEDCouplingFieldDouble &operator-=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
00171     static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00172     MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return MultiplyFields(this,&other); }
00173     const MEDCouplingFieldDouble &operator*=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
00174     static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00175     MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return DivideFields(this,&other); }
00176     const MEDCouplingFieldDouble &operator/=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
00177     static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00178     static void WriteVTK(const char *fileName, const std::vector<const MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception);
00179   public:
00180     const MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() const { return _time_discr; }
00181     MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() { return _time_discr; }
00182   private:
00183     MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td);
00184     MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td);
00185     MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy);
00186     MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type);
00187     ~MEDCouplingFieldDouble();
00188   private:
00189     MEDCouplingTimeDiscretization *_time_discr;
00190   };
00191 }
00192 
00193 #endif