+
+ class DataArrayChar : public DataArray
+ {
+ public:
+ MEDCOUPLING_EXPORT virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT bool isAllocated() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
+ MEDCOUPLING_EXPORT int getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
+ MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
+ MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT int getHashCode() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool empty() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT char popBackSilent() throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT int getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
+ MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void fillWithZero() throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT std::string repr() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT std::string reprZip() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues1(const DataArrayChar *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple1(char a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues2(const DataArrayChar *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple2(char a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayChar *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple3(char a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues4(const DataArrayChar *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple4(char a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void getTuple(int tupleId, char *res) const { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
+ MEDCOUPLING_EXPORT char getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
+ MEDCOUPLING_EXPORT char getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT char back() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, char newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
+ MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, char newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
+ MEDCOUPLING_EXPORT char *getPointer() { return _mem.getPointer(); }
+ MEDCOUPLING_EXPORT const char *getConstPointer() const { return _mem.getConstPointer(); }
+ MEDCOUPLING_EXPORT const char *begin() const throw(INTERP_KERNEL::Exception) { return getConstPointer(); }
+ MEDCOUPLING_EXPORT const char *end() const throw(INTERP_KERNEL::Exception) { return getConstPointer()+getNbOfElems(); }
+ MEDCOUPLING_EXPORT DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT int search(const std::vector<char>& vals) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT int locateValue(char value) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT int locateValue(const std::vector<char>& vals) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool presenceOfValue(char value) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<char>& vals) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2);
+ MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const std::vector<const DataArrayChar *>& arr) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayChar *Meld(const std::vector<const DataArrayChar *>& arr) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void useArray(const char *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const char *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void updateTime() const { }
+ public:
+ //MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ //MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+ //MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
+ //MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
+ protected:
+ DataArrayChar() { }
+ protected:
+ MemArray<char> _mem;
+ };
+
+ class DataArrayByteIterator;
+
+ class DataArrayByte : public DataArrayChar
+ {
+ public:
+ MEDCOUPLING_EXPORT static DataArrayByte *New();
+ MEDCOUPLING_EXPORT DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayByteIterator *iterator();
+ MEDCOUPLING_EXPORT DataArrayByte *deepCpy() const;
+ MEDCOUPLING_EXPORT DataArrayByte *performCpy(bool deepCpy) const;
+ MEDCOUPLING_EXPORT char byteValue() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ private:
+ DataArrayByte() { }
+ };
+
+ class DataArrayByteTuple;
+
+ class MEDCOUPLING_EXPORT DataArrayByteIterator
+ {
+ public:
+ DataArrayByteIterator(DataArrayByte *da);
+ ~DataArrayByteIterator();
+ DataArrayByteTuple *nextt() throw(INTERP_KERNEL::Exception);
+ private:
+ DataArrayByte *_da;
+ char *_pt;
+ int _tuple_id;
+ int _nb_comp;
+ int _nb_tuple;
+ };
+
+ class MEDCOUPLING_EXPORT DataArrayByteTuple
+ {
+ public:
+ DataArrayByteTuple(char *pt, int nbOfComp);
+ std::string repr() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfCompo() const { return _nb_of_compo; }
+ const char *getConstPointer() const { return _pt; }
+ char *getPointer() { return _pt; }
+ char byteValue() const throw(INTERP_KERNEL::Exception);
+ DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
+ private:
+ char *_pt;
+ int _nb_of_compo;
+ };
+
+ class DataArrayAsciiCharIterator;
+
+ class DataArrayAsciiChar : public DataArrayChar
+ {
+ public:
+ MEDCOUPLING_EXPORT static DataArrayAsciiChar *New();
+ MEDCOUPLING_EXPORT static DataArrayAsciiChar *New(const std::string& st) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayAsciiChar *New(const std::vector<std::string>& vst, char defaultChar) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayAsciiCharIterator *iterator();
+ MEDCOUPLING_EXPORT DataArrayAsciiChar *deepCpy() const;
+ MEDCOUPLING_EXPORT DataArrayAsciiChar *performCpy(bool deepCpy) const;
+ MEDCOUPLING_EXPORT char asciiCharValue() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ private:
+ DataArrayAsciiChar() { }
+ DataArrayAsciiChar(const std::string& st) throw(INTERP_KERNEL::Exception);
+ DataArrayAsciiChar(const std::vector<std::string>& vst, char defaultChar) throw(INTERP_KERNEL::Exception);
+ };
+
+ class DataArrayAsciiCharTuple;
+
+ class MEDCOUPLING_EXPORT DataArrayAsciiCharIterator
+ {
+ public:
+ DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
+ ~DataArrayAsciiCharIterator();
+ DataArrayAsciiCharTuple *nextt() throw(INTERP_KERNEL::Exception);
+ private:
+ DataArrayAsciiChar *_da;
+ char *_pt;
+ int _tuple_id;
+ int _nb_comp;
+ int _nb_tuple;
+ };
+
+ class MEDCOUPLING_EXPORT DataArrayAsciiCharTuple
+ {
+ public:
+ DataArrayAsciiCharTuple(char *pt, int nbOfComp);
+ std::string repr() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfCompo() const { return _nb_of_compo; }
+ const char *getConstPointer() const { return _pt; }
+ char *getPointer() { return _pt; }
+ char asciiCharValue() const throw(INTERP_KERNEL::Exception);
+ DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
+ private:
+ char *_pt;
+ int _nb_of_compo;
+ };
+
+ template<class InputIterator>
+ void DataArrayDouble::insertAtTheEnd(InputIterator first, InputIterator last) throw(INTERP_KERNEL::Exception)
+ {
+ int nbCompo=getNumberOfComponents();
+ if(nbCompo==1)
+ _mem.insertAtTheEnd(first,last);
+ else if(nbCompo==0)
+ {
+ _info_on_compo.resize(1);
+ _mem.insertAtTheEnd(first,last);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayDouble::insertAtTheEnd : not available for DataArrayDouble with number of components different than 1 !");
+ }
+
+ template<class InputIterator>
+ void DataArrayInt::insertAtTheEnd(InputIterator first, InputIterator last) throw(INTERP_KERNEL::Exception)
+ {
+ int nbCompo=getNumberOfComponents();
+ if(nbCompo==1)
+ _mem.insertAtTheEnd(first,last);
+ else if(nbCompo==0)
+ {
+ _info_on_compo.resize(1);
+ _mem.insertAtTheEnd(first,last);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayInt::insertAtTheEnd : not available for DataArrayInt with number of components different than 1 !");
+ }