00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PARAMEDMEM_MEDCOUPLINGMEMARRAY_HXX__
00021 #define __PARAMEDMEM_MEDCOUPLINGMEMARRAY_HXX__
00022
00023 #include "MEDCoupling.hxx"
00024 #include "MEDCouplingTimeLabel.hxx"
00025 #include "MEDCouplingRefCountObject.hxx"
00026 #include "InterpKernelException.hxx"
00027
00028 #include <set>
00029 #include <string>
00030 #include <vector>
00031 #include <iterator>
00032
00033 namespace ParaMEDMEM
00034 {
00035 template<class T>
00036 class MEDCouplingPointer
00037 {
00038 public:
00039 MEDCouplingPointer():_internal(0),_external(0) { }
00040 void null() { _internal=0; _external=0; }
00041 bool isNull() const { return _internal==0 && _external==0; }
00042 void setInternal(T *pointer);
00043 void setExternal(const T *pointer);
00044 const T *getConstPointer() const { if(_internal) return _internal; else return _external; }
00045 const T *getConstPointerLoc(int offset) const { if(_internal) return _internal+offset; else return _external+offset; }
00046 T *getPointer() const { if(_internal) return _internal; if(_external) throw INTERP_KERNEL::Exception("Trying to write on an external pointer."); else return 0; }
00047 private:
00048 T *_internal;
00049 const T *_external;
00050 };
00051
00052 template<class T>
00053 class MemArray
00054 {
00055 public:
00056 MemArray():_nb_of_elem(-1),_ownership(false),_dealloc(CPP_DEALLOC) { }
00057 MemArray(const MemArray<T>& other);
00058 bool isNull() const { return _pointer.isNull(); }
00059 const T *getConstPointerLoc(int offset) const { return _pointer.getConstPointerLoc(offset); }
00060 const T *getConstPointer() const { return _pointer.getConstPointer(); }
00061 T *getPointer() const { return _pointer.getPointer(); }
00062 MemArray<T> &operator=(const MemArray<T>& other);
00063 T operator[](int id) const { return _pointer.getConstPointer()[id]; }
00064 T& operator[](int id) { return _pointer.getPointer()[id]; }
00065 bool isEqual(const MemArray<T>& other, T prec) const;
00066 void repr(int sl, std::ostream& stream) const;
00067 void reprZip(int sl, std::ostream& stream) const;
00068 void fillWithValue(const T& val);
00069 T *fromNoInterlace(int nbOfComp) const;
00070 T *toNoInterlace(int nbOfComp) const;
00071 void sort();
00072 void alloc(int nbOfElements);
00073 void reAlloc(int newNbOfElements);
00074 void useArray(const T *array, bool ownership, DeallocType type, int nbOfElem);
00075 void writeOnPlace(int id, T element0, const T *others, int sizeOfOthers);
00076 ~MemArray() { destroy(); }
00077 private:
00078 void destroy();
00079 static void destroyPointer(T *pt, DeallocType type);
00080 private:
00081 int _nb_of_elem;
00082 bool _ownership;
00083 MEDCouplingPointer<T> _pointer;
00084 DeallocType _dealloc;
00085 };
00086
00087 class DataArray : public RefCountObject, public TimeLabel
00088 {
00089 public:
00090 MEDCOUPLING_EXPORT void setName(const char *name);
00091 MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
00092 MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
00093 MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
00094 MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const;
00095 MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
00096 MEDCOUPLING_EXPORT std::string getName() const { return _name; }
00097 MEDCOUPLING_EXPORT const std::vector<std::string> &getInfoOnComponent() const { return _info_on_compo; }
00098 MEDCOUPLING_EXPORT std::vector<std::string> getVarsOnComponent() const;
00099 MEDCOUPLING_EXPORT std::vector<std::string> getUnitsOnComponent() const;
00100 MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
00101 MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
00102 MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
00103 MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
00104 MEDCOUPLING_EXPORT int getNumberOfComponents() const { return _info_on_compo.size(); }
00105 MEDCOUPLING_EXPORT int getNumberOfTuples() const { return _nb_of_tuples; }
00106 MEDCOUPLING_EXPORT int getNbOfElems() const { return _info_on_compo.size()*_nb_of_tuples; }
00107 MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
00108 MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
00109 MEDCOUPLING_EXPORT void checkNbOfElems(int nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
00110 protected:
00111 DataArray():_nb_of_tuples(-1) { }
00112 protected:
00113 static void CheckValueInRange(int ref, int value, const char *msg) throw(INTERP_KERNEL::Exception);
00114 static void CheckClosingParInRange(int ref, int value, const char *msg) throw(INTERP_KERNEL::Exception);
00115 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
00116 protected:
00117 int _nb_of_tuples;
00118 std::string _name;
00119 std::vector<std::string> _info_on_compo;
00120 };
00121 }
00122
00123 #include "MEDCouplingMemArray.txx"
00124
00125 namespace ParaMEDMEM
00126 {
00127 class DataArrayInt;
00128 class DataArrayDouble : public DataArray
00129 {
00130 public:
00131 MEDCOUPLING_EXPORT static DataArrayDouble *New();
00132 MEDCOUPLING_EXPORT bool isAllocated() const;
00133 MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
00134 MEDCOUPLING_EXPORT DataArrayDouble *deepCpy() const;
00135 MEDCOUPLING_EXPORT DataArrayDouble *performCpy(bool deepCpy) const;
00136 MEDCOUPLING_EXPORT void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
00137 MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo);
00138 MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
00139 MEDCOUPLING_EXPORT void fillWithZero() throw(INTERP_KERNEL::Exception);
00140 MEDCOUPLING_EXPORT void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
00141 MEDCOUPLING_EXPORT void iota(double init=0.) throw(INTERP_KERNEL::Exception);
00142 MEDCOUPLING_EXPORT bool isUniform(double val, double eps) const;
00143 MEDCOUPLING_EXPORT void sort() throw(INTERP_KERNEL::Exception);
00144 MEDCOUPLING_EXPORT void checkMonotonic(double eps) const throw(INTERP_KERNEL::Exception);
00145 MEDCOUPLING_EXPORT bool isMonotonic(double eps) const throw(INTERP_KERNEL::Exception);
00146 MEDCOUPLING_EXPORT std::string repr() const;
00147 MEDCOUPLING_EXPORT std::string reprZip() const;
00148 MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
00149 MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
00150 MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
00151 MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
00152 MEDCOUPLING_EXPORT bool isEqual(const DataArrayDouble& other, double prec) const;
00153 MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const;
00155 MEDCOUPLING_EXPORT void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
00156 MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const;
00157 MEDCOUPLING_EXPORT DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
00158 MEDCOUPLING_EXPORT DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
00159 MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New);
00160 MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old);
00161 MEDCOUPLING_EXPORT DataArrayDouble *renumber(const int *old2New) const;
00162 MEDCOUPLING_EXPORT DataArrayDouble *renumberR(const int *new2Old) const;
00163 MEDCOUPLING_EXPORT DataArrayDouble *renumberAndReduce(const int *old2New, int newNbOfTuple) const;
00164 MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
00165 MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
00166 MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
00167 MEDCOUPLING_EXPORT DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
00168 MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
00169 MEDCOUPLING_EXPORT DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
00170 MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
00171 MEDCOUPLING_EXPORT void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
00172 MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
00173 MEDCOUPLING_EXPORT void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
00174 MEDCOUPLING_EXPORT void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
00175 MEDCOUPLING_EXPORT void setPartOfValues2(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
00176 MEDCOUPLING_EXPORT void setPartOfValuesSimple2(double a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
00177 MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
00178 MEDCOUPLING_EXPORT void setPartOfValuesSimple3(double a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
00179 MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
00180 MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
00181 MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
00182 MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, double newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
00183 MEDCOUPLING_EXPORT double *getPointer() const { return _mem.getPointer(); }
00184 MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayDouble *newArray, DataArrayDouble* &arrayToSet);
00185 MEDCOUPLING_EXPORT const double *getConstPointer() const { return _mem.getConstPointer(); }
00186 MEDCOUPLING_EXPORT void useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
00187 MEDCOUPLING_EXPORT void writeOnPlace(int id, double element0, const double *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
00188 MEDCOUPLING_EXPORT void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
00189 MEDCOUPLING_EXPORT double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
00190 MEDCOUPLING_EXPORT double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
00191 MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt*& tupleIds) const throw(INTERP_KERNEL::Exception);
00192 MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt*& tupleIds) const throw(INTERP_KERNEL::Exception);
00193 MEDCOUPLING_EXPORT double getAverageValue() const throw(INTERP_KERNEL::Exception);
00194 MEDCOUPLING_EXPORT void accumulate(double *res) const throw(INTERP_KERNEL::Exception);
00195 MEDCOUPLING_EXPORT double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
00196 MEDCOUPLING_EXPORT DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
00197 MEDCOUPLING_EXPORT DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
00198 MEDCOUPLING_EXPORT DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
00199 MEDCOUPLING_EXPORT DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
00200 MEDCOUPLING_EXPORT DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
00201 MEDCOUPLING_EXPORT DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
00202 MEDCOUPLING_EXPORT DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
00203 MEDCOUPLING_EXPORT DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
00204 MEDCOUPLING_EXPORT DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
00205 MEDCOUPLING_EXPORT DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
00206 MEDCOUPLING_EXPORT DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
00207 MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
00208 MEDCOUPLING_EXPORT void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
00209 MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
00210 MEDCOUPLING_EXPORT void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
00211 MEDCOUPLING_EXPORT void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
00212 MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
00213 MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
00214 MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
00215 MEDCOUPLING_EXPORT DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
00216 MEDCOUPLING_EXPORT DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
00217 MEDCOUPLING_EXPORT void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
00218 MEDCOUPLING_EXPORT void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
00219 MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
00220 MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00221 MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const std::vector<const DataArrayDouble *>& a) throw(INTERP_KERNEL::Exception);
00222 MEDCOUPLING_EXPORT static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00223 MEDCOUPLING_EXPORT static DataArrayDouble *Meld(const std::vector<const DataArrayDouble *>& a) throw(INTERP_KERNEL::Exception);
00224 MEDCOUPLING_EXPORT static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00225 MEDCOUPLING_EXPORT static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00226 MEDCOUPLING_EXPORT static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00227 MEDCOUPLING_EXPORT static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00228 MEDCOUPLING_EXPORT static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00229 MEDCOUPLING_EXPORT void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
00230 MEDCOUPLING_EXPORT static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00231 MEDCOUPLING_EXPORT void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
00232 MEDCOUPLING_EXPORT static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00233 MEDCOUPLING_EXPORT void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
00234 MEDCOUPLING_EXPORT static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
00235 MEDCOUPLING_EXPORT void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
00237 MEDCOUPLING_EXPORT void updateTime() const { }
00238 public:
00239 void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
00240 void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
00241 bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
00242 void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
00243 private:
00244 DataArrayDouble() { }
00245 private:
00246 MemArray<double> _mem;
00247 };
00248
00249 class DataArrayInt : public DataArray
00250 {
00251 public:
00252 MEDCOUPLING_EXPORT static DataArrayInt *New();
00253 MEDCOUPLING_EXPORT bool isAllocated() const;
00254 MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
00255 MEDCOUPLING_EXPORT DataArrayInt *deepCpy() const;
00256 MEDCOUPLING_EXPORT DataArrayInt *performCpy(bool deepCpy) const;
00257 MEDCOUPLING_EXPORT void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
00258 MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo);
00259 MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
00260 MEDCOUPLING_EXPORT bool isEqual(const DataArrayInt& other) const;
00261 MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayInt& other) const;
00262 MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
00263 MEDCOUPLING_EXPORT DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
00264 MEDCOUPLING_EXPORT void sort() throw(INTERP_KERNEL::Exception);
00265 MEDCOUPLING_EXPORT void fillWithZero();
00266 MEDCOUPLING_EXPORT void fillWithValue(int val);
00267 MEDCOUPLING_EXPORT void iota(int init=0) throw(INTERP_KERNEL::Exception);
00268 MEDCOUPLING_EXPORT std::string repr() const;
00269 MEDCOUPLING_EXPORT std::string reprZip() const;
00270 MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
00271 MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
00272 MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
00273 MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
00274 MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd) throw(INTERP_KERNEL::Exception);
00275 MEDCOUPLING_EXPORT DataArrayInt *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const throw(INTERP_KERNEL::Exception);
00276 MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd,
00277 DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const throw(INTERP_KERNEL::Exception);
00278 MEDCOUPLING_EXPORT DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const;
00279 MEDCOUPLING_EXPORT DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const;
00281 MEDCOUPLING_EXPORT void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
00282 MEDCOUPLING_EXPORT DataArrayDouble *convertToDblArr() const;
00283 MEDCOUPLING_EXPORT DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
00284 MEDCOUPLING_EXPORT DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
00285 MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New);
00286 MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old);
00287 MEDCOUPLING_EXPORT DataArrayInt *renumber(const int *old2New) const;
00288 MEDCOUPLING_EXPORT DataArrayInt *renumberR(const int *new2Old) const;
00289 MEDCOUPLING_EXPORT DataArrayInt *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const;
00290 MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
00291 MEDCOUPLING_EXPORT DataArrayInt *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
00292 MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
00293 MEDCOUPLING_EXPORT DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
00294 MEDCOUPLING_EXPORT void changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const throw(INTERP_KERNEL::Exception);
00295 MEDCOUPLING_EXPORT DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
00296 MEDCOUPLING_EXPORT bool isIdentity() const;
00297 MEDCOUPLING_EXPORT bool isUniform(int val) const;
00298 MEDCOUPLING_EXPORT DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
00299 MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
00300 MEDCOUPLING_EXPORT DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
00301 MEDCOUPLING_EXPORT DataArrayInt *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
00302 MEDCOUPLING_EXPORT void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
00303 MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayInt *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
00304 MEDCOUPLING_EXPORT void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
00305 MEDCOUPLING_EXPORT void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
00306 MEDCOUPLING_EXPORT void setPartOfValues2(const DataArrayInt *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
00307 MEDCOUPLING_EXPORT void setPartOfValuesSimple2(int a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
00308 MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayInt *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
00309 MEDCOUPLING_EXPORT void setPartOfValuesSimple3(int a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
00310 MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
00311 MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
00312 MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
00313 MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, int newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
00314 MEDCOUPLING_EXPORT int *getPointer() const { return _mem.getPointer(); }
00315 MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet);
00316 MEDCOUPLING_EXPORT const int *getConstPointer() const { return _mem.getConstPointer(); }
00317 MEDCOUPLING_EXPORT DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
00318 MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
00319 MEDCOUPLING_EXPORT DataArrayInt *getIdsEqualList(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
00320 MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqualList(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
00321 MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
00322 MEDCOUPLING_EXPORT int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
00323 MEDCOUPLING_EXPORT int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
00324 MEDCOUPLING_EXPORT void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
00325 MEDCOUPLING_EXPORT void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
00326 MEDCOUPLING_EXPORT void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
00327 MEDCOUPLING_EXPORT void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
00328 MEDCOUPLING_EXPORT void applyModulus(int val) throw(INTERP_KERNEL::Exception);
00329 MEDCOUPLING_EXPORT void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
00330 MEDCOUPLING_EXPORT static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2);
00331 MEDCOUPLING_EXPORT static DataArrayInt *Aggregate(const std::vector<const DataArrayInt *>& a) throw(INTERP_KERNEL::Exception);
00332 MEDCOUPLING_EXPORT static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
00333 MEDCOUPLING_EXPORT static DataArrayInt *Meld(const std::vector<const DataArrayInt *>& a) throw(INTERP_KERNEL::Exception);
00334 MEDCOUPLING_EXPORT static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups);
00335 MEDCOUPLING_EXPORT static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& a) throw(INTERP_KERNEL::Exception);
00336 MEDCOUPLING_EXPORT static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& a) throw(INTERP_KERNEL::Exception);
00337 MEDCOUPLING_EXPORT DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
00338 MEDCOUPLING_EXPORT DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
00339 MEDCOUPLING_EXPORT DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
00340 MEDCOUPLING_EXPORT DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
00341 MEDCOUPLING_EXPORT DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
00342 MEDCOUPLING_EXPORT void computeOffsets() throw(INTERP_KERNEL::Exception);
00343 MEDCOUPLING_EXPORT std::set<int> getDifferentValues() const throw(INTERP_KERNEL::Exception);
00344 MEDCOUPLING_EXPORT void useArray(const int *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
00345 MEDCOUPLING_EXPORT void writeOnPlace(int id, int element0, const int *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
00346 MEDCOUPLING_EXPORT static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
00347 MEDCOUPLING_EXPORT void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
00348 MEDCOUPLING_EXPORT static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
00349 MEDCOUPLING_EXPORT void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
00350 MEDCOUPLING_EXPORT static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
00351 MEDCOUPLING_EXPORT void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
00352 MEDCOUPLING_EXPORT static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
00353 MEDCOUPLING_EXPORT void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
00354 MEDCOUPLING_EXPORT static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
00355 MEDCOUPLING_EXPORT void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
00357 MEDCOUPLING_EXPORT void updateTime() const { }
00358 public:
00359 MEDCOUPLING_EXPORT static int *CheckAndPreparePermutation(const int *start, const int *end);
00360 public:
00361 void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
00362 void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
00363 bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
00364 void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
00365 private:
00366 DataArrayInt() { }
00367 private:
00368 MemArray<int> _mem;
00369 };
00370 }
00371
00372 #endif