00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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 deepCpy) 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 getWeightedAverageValue() const throw(INTERP_KERNEL::Exception);
00096 double normL1(int compId) const throw(INTERP_KERNEL::Exception);
00097 void normL1(double *res) const throw(INTERP_KERNEL::Exception);
00098 double normL2(int compId) const throw(INTERP_KERNEL::Exception);
00099 void normL2(double *res) const throw(INTERP_KERNEL::Exception);
00100 double integral(int compId, bool isWAbs) const throw(INTERP_KERNEL::Exception);
00101 void integral(bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception);
00102 void getValueOnPos(int i, int j, int k, double *res) const throw(INTERP_KERNEL::Exception);
00103 void getValueOn(const double *spaceLoc, double *res) const throw(INTERP_KERNEL::Exception);
00104 void getValueOn(const double *spaceLoc, double time, double *res) const throw(INTERP_KERNEL::Exception);
00105 DataArrayDouble *getValueOnMulti(const double *spaceLoc, int nbOfPoints) const throw(INTERP_KERNEL::Exception);
00107 void applyLin(double a, double b, int compoId);
00108 MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
00109 void fillFromAnalytic(int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
00110 void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00111 void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00112 void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
00113 void applyFunc(int nbOfComp, FunctionToEvaluate func);
00114 void applyFunc(int nbOfComp, double val);
00115 void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00116 void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
00117 void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
00118 void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
00119 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
00120 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
00121 int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
00122 int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
00123 int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
00124 void updateTime() const;
00125
00126 void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
00127 void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
00128 void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
00129 void resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays);
00130 void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
00131 void serialize(DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays) const;
00132
00133 void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
00134 void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
00135 bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
00136 bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
00137 bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
00138 bool zipConnectivity(int compType, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
00139 bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
00140 MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
00141 MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
00142 MEDCouplingFieldDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
00143 MEDCouplingFieldDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
00144 MEDCouplingFieldDouble *inverse() const throw(INTERP_KERNEL::Exception);
00145 MEDCouplingFieldDouble *trace() const throw(INTERP_KERNEL::Exception);
00146 MEDCouplingFieldDouble *deviator() const throw(INTERP_KERNEL::Exception);
00147 MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
00148 MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
00149 void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
00150 MEDCouplingFieldDouble *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
00151 void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
00152 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
00153 static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00154 static MEDCouplingFieldDouble *MergeFields(const std::vector<const MEDCouplingFieldDouble *>& a) throw(INTERP_KERNEL::Exception);
00155 static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00156 static MEDCouplingFieldDouble *DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00157 MEDCouplingFieldDouble *dot(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return DotFields(this,&other); }
00158 static MEDCouplingFieldDouble *CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00159 MEDCouplingFieldDouble *crossProduct(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return CrossProductFields(this,&other); }
00160 static MEDCouplingFieldDouble *MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00161 MEDCouplingFieldDouble *max(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return MaxFields(this,&other); }
00162 static MEDCouplingFieldDouble *MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00163 MEDCouplingFieldDouble *min(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return MinFields(this,&other); }
00164 MEDCouplingFieldDouble *operator+(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return AddFields(this,&other); }
00165 const MEDCouplingFieldDouble &operator+=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
00166 static MEDCouplingFieldDouble *AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00167 MEDCouplingFieldDouble *operator-(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return SubstractFields(this,&other); }
00168 const MEDCouplingFieldDouble &operator-=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
00169 static MEDCouplingFieldDouble *SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00170 MEDCouplingFieldDouble *operator*(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return MultiplyFields(this,&other); }
00171 const MEDCouplingFieldDouble &operator*=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
00172 static MEDCouplingFieldDouble *MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00173 MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return DivideFields(this,&other); }
00174 const MEDCouplingFieldDouble &operator/=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
00175 static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
00176 public:
00177 const MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() const { return _time_discr; }
00178 MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() { return _time_discr; }
00179 private:
00180 MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td);
00181 MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td);
00182 MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCpy);
00183 MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type);
00184 ~MEDCouplingFieldDouble();
00185 private:
00186 MEDCouplingTimeDiscretization *_time_discr;
00187 };
00188 }
00189
00190 #endif