+}
+
+namespace MEDCoupling
+{
+ template<class T>
+ class DataArrayDiscrete : public DataArrayTemplateClassic<T>
+ {
+ public:
+ using DataArrayType = typename Traits<T>::ArrayType;
+ public:
+ static DataArrayType *New();
+ T intValue() const;
+ bool isEqual(const DataArrayDiscrete<T>& other) const;
+ bool isEqualIfNotWhy(const DataArrayDiscrete<T>& other, std::string& reason) const;
+ bool isEqualWithoutConsideringStr(const DataArrayDiscrete<T>& other) const;
+ bool isEqualWithoutConsideringStrAndOrder(const typename Traits<T>::ArrayType& other) const;
+ void switchOnTupleEqualTo(T val, std::vector<bool>& vec) const;
+ void switchOnTupleNotEqualTo(T val, std::vector<bool>& vec) const;
+ DataArrayIdType *occurenceRankInThis() const;
+ DataArrayIdType *buildPermutationArr(const DataArrayDiscrete<T>& other) const;
+ DataArrayIdType *indicesOfSubPart(const DataArrayDiscrete<T>& partOfThis) const;
+ void checkMonotonic(bool increasing) const;
+ bool isMonotonic(bool increasing) const;
+ void checkStrictlyMonotonic(bool increasing) const;
+ bool isStrictlyMonotonic(bool increasing) const;
+ mcIdType getHashCode() const;
+ void reprCppStream(const std::string& varName, std::ostream& stream) const;
+ void reprQuickOverview(std::ostream& stream) const;
+ void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
+ void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const;
+ void transformWithIndArr(const T *indArrBg, const T *indArrEnd);
+ void transformWithIndArr(const MapKeyVal<T, T>& m);
+ DataArrayIdType *findIdsEqual(T val) const;
+ DataArrayIdType *transformWithIndArrR(const T *indArr2Bg, const T *indArrEnd) const;
+ void splitByValueRange(const T *arrBg, const T *arrEnd,
+ DataArrayType *& castArr, DataArrayType *& rankInsideCast, DataArrayType *& castsPresent) const;
+ bool isRange(T& strt, T& sttoopp, T& stteepp) const;
+ DataArrayIdType *invertArrayO2N2N2O(mcIdType newNbOfElem) const;
+ DataArrayIdType *invertArrayN2O2O2N(mcIdType oldNbOfElem) const;
+ DataArrayIdType *invertArrayO2N2N2OBis(mcIdType newNbOfElem) const;
+ MCAuto< MapKeyVal<T, mcIdType> > invertArrayN2O2O2NOptimized() const;
+ MCAuto< MapKeyVal<mcIdType, T> > giveN2OOptimized() const;
+ MCAuto<DataArrayIdType> findIdForEach(const T *valsBg, const T *valsEnd) const;
+ DataArrayIdType *checkAndPreparePermutation() const;
+ void changeSurjectiveFormat(T targetNb, DataArrayIdType *&arr, DataArrayIdType *&arrI) const;
+ DataArrayIdType *buildPermArrPerLevel() const;
+ bool isIota(mcIdType sizeExpected) const;
+ bool isUniform(T val) const;
+ T checkUniformAndGuess() const;
+ bool hasUniqueValues() const;
+ void setSelectedComponents(const DataArrayType *a, const std::vector<std::size_t>& compoIds);
+ DataArrayIdType *locateComponentId(const DataArrayType *valToSearchIntoTuples, const DataArrayIdType *tupleIdHint) const;
+ DataArrayIdType *findIdsNotEqual(T val) const;
+ DataArrayIdType *findIdsEqualTuple(const T *tupleBg, const T *tupleEnd) const;
+ DataArrayIdType *findIdsEqualList(const T *valsBg, const T *valsEnd) const;
+ DataArrayIdType *findIdsNotEqualList(const T *valsBg, const T *valsEnd) const;
+ mcIdType findIdFirstEqual(T value) const;
+ mcIdType findIdFirstEqual(const std::vector<T>& vals) const;
+ mcIdType findIdFirstEqualTuple(const std::vector<T>& tupl) const;
+ mcIdType findIdSequence(const std::vector<T>& vals) const;
+ mcIdType changeValue(T oldValue, T newValue);
+ mcIdType count(T value) const;
+ bool presenceOfTuple(const std::vector<T>& tupl) const;
+ bool presenceOfValue(T value) const;
+ bool presenceOfValue(const std::vector<T>& vals) const;
+ void accumulate(T *res) const;
+ T accumulate(std::size_t compId) const;
+ DataArrayType *accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const;
+ void getMinMaxValues(T& minValue, T& maxValue) const;
+ void applyInv(T numerator);
+ void applyDivideBy(T val);
+ void applyModulus(T val);
+ void applyRModulus(T val);
+ void applyPow(T val);
+ void applyRPow(T val);
+ DataArrayIdType *findIdsInRange(T vmin, T vmax) const;
+ DataArrayIdType *findIdsNotInRange(T vmin, T vmax) const;
+ bool checkAllIdsInRange(T vmin, T vmax) const;
+ static DataArrayType *Aggregate(const DataArrayType *a1, const DataArrayType *a2, T offsetA2);
+ static DataArrayType *Aggregate(const std::vector<const DataArrayType *>& arr);
+ static DataArrayType *AggregateIndexes(const std::vector<const DataArrayType *>& arrs);
+ static DataArrayType *BuildUnion(const std::vector<const DataArrayType *>& arr);
+ static DataArrayType *BuildIntersection(const std::vector<const DataArrayType *>& arr);
+ static void PutIntoToSkylineFrmt(const std::vector< std::vector<T> >& v, DataArrayType *& data, DataArrayIdType *& dataIndex);
+ DataArrayIdType *buildComplement(mcIdType nbOfElement) const;
+ DataArrayType *buildSubstraction(const DataArrayType *other) const;
+ DataArrayType *buildSubstractionOptimized(const DataArrayType *other) const;
+ DataArrayType *buildUnion(const DataArrayType *other) const;
+ DataArrayType *buildIntersection(const DataArrayType *other) const;
+ DataArrayIdType *indexOfSameConsecutiveValueGroups() const;
+ DataArrayType *buildUnique() const;
+ DataArrayType *buildUniqueNotSorted() const;
+ DataArrayType *deltaShiftIndex() const;
+ void computeOffsets();
+ void computeOffsetsFull();
+ void findIdsRangesInListOfIds(const DataArrayType *listOfIds, DataArrayIdType *& rangeIdsFetched, DataArrayType *& idsInInputListThatFetch) const;
+ DataArrayType *buildExplicitArrByRanges(const DataArrayType *offsets) const;
+ DataArrayType *buildExplicitArrOfSliceOnScaledArr(T begin, T stop, T step) const;
+ DataArrayIdType *findRangeIdForEachTuple(const DataArrayType *ranges) const;
+ DataArrayType *findIdInRangeForEachTuple(const DataArrayType *ranges) const;
+ void sortEachPairToMakeALinkedList();
+ void sortToHaveConsecutivePairs();
+ MCAuto<DataArrayType> fromLinkedListOfPairToList() const;
+ DataArrayType *getDifferentValues() const;
+ std::vector<DataArrayIdType *> partitionByDifferentValues(std::vector<T>& differentIds) const;
+ std::vector< std::pair<mcIdType,mcIdType> > splitInBalancedSlices(mcIdType nbOfSlices) const;
+ static DataArrayType *Modulus(const DataArrayType *a1, const DataArrayType *a2);
+ void modulusEqual(const DataArrayType *other);
+ static DataArrayType *Pow(const DataArrayType *a1, const DataArrayType *a2);
+ void powEqual(const DataArrayType *other);
+ //MemArray<T>& accessToMemArray() { return _mem; }
+ //const MemArray<T>& accessToMemArray() const { return _mem; }
+ public:
+ static DataArrayIdType *FindPermutationFromFirstToSecond(const DataArrayType *ids1, const DataArrayType *ids2);
+ static DataArrayIdType *FindPermutationFromFirstToSecondDuplicate(const DataArrayType *ids1, const DataArrayType *ids2);
+ static mcIdType *CheckAndPreparePermutation(const T *start, const T *end);
+ static DataArrayType *BuildListOfSwitchedOn(const std::vector<bool>& v);
+ static DataArrayType *BuildListOfSwitchedOff(const std::vector<bool>& v);
+ static DataArrayIdType *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const mcIdType *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples);
+ static DataArrayIdType *MakePartition(const std::vector<const DataArrayType *>& groups, mcIdType newNb, std::vector< std::vector<mcIdType> >& fidsOfGroups);
+ public:
+ static void ExtractFromIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut);
+ static void ExtractFromIndexedArraysSlice(mcIdType idsOfSelectStart, mcIdType idsOfSelectStop, mcIdType idsOfSelectStep,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut);
+ static void SetPartOfIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut);
+ static void SetPartOfIndexedArraysSlice(mcIdType start, mcIdType end, mcIdType step,
+ const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex,
+ DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut);
+ static void SetPartOfIndexedArraysSameIdx(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
+ DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex);
+ static void SetPartOfIndexedArraysSameIdxSlice(mcIdType start, mcIdType end, mcIdType step,
+ DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn,
+ const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex);
+ static bool RemoveIdsFromIndexedArrays(const T *idsToRemoveBg, const T *idsToRemoveEnd,
+ DataArrayType *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0);
+ static DataArrayType *Range(T begin, T end, T step);
+ public:
+ void getTinySerializationIntInformation(std::vector<mcIdType>& tinyInfo) const;
+ void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+ bool resizeForUnserialization(const std::vector<mcIdType>& tinyInfoI);
+ void finishUnserialization(const std::vector<mcIdType>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
+ protected:
+ template<class ALG>
+ void switchOnTupleAlg(T val, std::vector<bool>& vec, ALG algo) const;
+ protected:
+ ~DataArrayDiscrete() { }
+ };
+
+ template<class T>
+ class DataArrayDiscreteSigned : public DataArrayDiscrete<T>
+ {
+ public:
+ bool isFittingWith(const std::vector<bool>& v) const;
+ protected:
+ ~DataArrayDiscreteSigned() { }
+ };
+
+ class DataArrayInt32Iterator;