Version: 9.14.0
MEDCoupling::DataArrayDiscrete< T > Class Template Reference
Inheritance diagram for MEDCoupling::DataArrayDiscrete< T >:
Collaboration diagram for MEDCoupling::DataArrayDiscrete< T >:

Public Types

using DataArrayType = typename Traits< T >::ArrayType
 
- Public Types inherited from MEDCoupling::DataArrayTemplate< T >
typedef T Type
 

Public Member Functions

accumulate (std::size_t compId) const
 
void accumulate (T *res) const
 
DataArrayTypeaccumulatePerChunck (const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const
 
void applyDivideBy (T val)
 
void applyInv (T numerator)
 
void applyModulus (T val)
 
void applyPow (T val)
 
void applyRModulus (T val)
 
void applyRPow (T val)
 
DataArrayIdType * buildComplement (mcIdType nbOfElement) const
 
DataArrayTypebuildExplicitArrByRanges (const DataArrayType *offsets) const
 
DataArrayTypebuildExplicitArrOfSliceOnScaledArr (T begin, T stop, T step) const
 
DataArrayTypebuildIntersection (const DataArrayType *other) const
 
DataArrayIdType * buildPermArrPerLevel () const
 
DataArrayIdType * buildPermutationArr (const DataArrayDiscrete< T > &other) const
 
DataArrayTypebuildSubstraction (const DataArrayType *other) const
 
DataArrayTypebuildSubstractionOptimized (const DataArrayType *other) const
 
DataArrayTypebuildUnion (const DataArrayType *other) const
 
DataArrayTypebuildUnique () const
 
DataArrayTypebuildUniqueNotSorted () const
 
void changeSurjectiveFormat (T targetNb, DataArrayIdType *&arr, DataArrayIdType *&arrI) const
 
mcIdType changeValue (T oldValue, T newValue)
 
bool checkAllIdsInRange (T vmin, T vmax) const
 
DataArrayIdType * checkAndPreparePermutation () const
 
void checkMonotonic (bool increasing) const
 
void checkStrictlyMonotonic (bool increasing) const
 
checkUniformAndGuess () const
 
void computeOffsets ()
 
void computeOffsetsFull ()
 
mcIdType count (T value) const
 
DataArrayTypedeltaShiftIndex () const
 
void findCommonTuples (mcIdType limitTupleId, MCAuto< DataArrayIdType > &comm, MCAuto< DataArrayIdType > &commIndex) const
 
template<int SPACEDIM>
void findCommonTuplesAlg (const T *bbox, mcIdType nbNodes, mcIdType limitNodeId, DataArrayIdType *c, DataArrayIdType *cI) const
 
mcIdType findIdFirstEqual (const std::vector< T > &vals) const
 
mcIdType findIdFirstEqual (T value) const
 
mcIdType findIdFirstEqualTuple (const std::vector< T > &tupl) const
 
MCAuto< DataArrayIdType > findIdForEach (const T *valsBg, const T *valsEnd) const
 
DataArrayTypefindIdInRangeForEachTuple (const DataArrayType *ranges) const
 
DataArrayIdType * findIdsEqual (T val) const
 
DataArrayIdType * findIdsEqualList (const T *valsBg, const T *valsEnd) const
 
DataArrayIdType * findIdsEqualTuple (const T *tupleBg, const T *tupleEnd) const
 
mcIdType findIdSequence (const std::vector< T > &vals) const
 
DataArrayIdType * findIdsInRange (T vmin, T vmax) const
 
DataArrayIdType * findIdsNotEqual (T val) const
 
DataArrayIdType * findIdsNotEqualList (const T *valsBg, const T *valsEnd) const
 
DataArrayIdType * findIdsNotInRange (T vmin, T vmax) const
 
void findIdsRangesInListOfIds (const DataArrayType *listOfIds, DataArrayIdType *&rangeIdsFetched, DataArrayType *&idsInInputListThatFetch) const
 
DataArrayIdType * findRangeIdForEachTuple (const DataArrayType *ranges) const
 
void finishUnserialization (const std::vector< mcIdType > &tinyInfoI, const std::vector< std::string > &tinyInfoS)
 
MCAuto< DataArrayTypeforThisAsPartitionBuildReduction (const MCAuto< DataArrayIdType > &commonEntities, const MCAuto< DataArrayIdType > &commonEntitiesIndex, MCAuto< DataArrayType > &partitionsToBeModified, MCAuto< DataArrayIdType > &partitionsToBeModifiedIndex) const
 
MCAuto< DataArrayTypefromLinkedListOfPairToList () const
 
void fromListOfPairsToIndexArray (MCAuto< DataArrayType > &arrOut, MCAuto< DataArrayIdType > &arrIndexOut) const
 
DataArrayTypegetDifferentValues () const
 
mcIdType getHashCode () const
 
void getMinMaxValues (T &minValue, T &maxValue) const
 
void getTinySerializationIntInformation (std::vector< mcIdType > &tinyInfo) const
 
void getTinySerializationStrInformation (std::vector< std::string > &tinyInfo) const
 
MCAuto< MapKeyVal< mcIdType, T > > giveN2OOptimized () const
 
bool hasUniqueValues () const
 
DataArrayIdType * indexOfSameConsecutiveValueGroups () const
 
DataArrayIdType * indicesOfSubPart (const DataArrayDiscrete< T > &partOfThis) const
 
intValue () const
 
DataArrayIdType * invertArrayN2O2O2N (mcIdType oldNbOfElem) const
 
MCAuto< MapKeyVal< T, mcIdType > > invertArrayN2O2O2NOptimized () const
 
DataArrayIdType * invertArrayO2N2N2O (mcIdType newNbOfElem) const
 
DataArrayIdType * invertArrayO2N2N2OBis (mcIdType newNbOfElem) 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
 
bool isIota (mcIdType sizeExpected) const
 
bool isMonotonic (bool increasing) const
 
bool isRange (T &strt, T &sttoopp, T &stteepp) const
 
bool isStrictlyMonotonic (bool increasing) const
 
bool isUniform (T val) const
 
DataArrayIdType * locateComponentId (const DataArrayType *valToSearchIntoTuples, const DataArrayIdType *tupleIdHint) const
 
void modulusEqual (const DataArrayType *other)
 
DataArrayIdType * occurenceRankInThis () const
 
std::vector< DataArrayIdType * > partitionByDifferentValues (std::vector< T > &differentIds) const
 
void powEqual (const DataArrayType *other)
 
bool presenceOfTuple (const std::vector< T > &tupl) const
 
bool presenceOfValue (const std::vector< T > &vals) const
 
bool presenceOfValue (T value) 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
 
bool resizeForUnserialization (const std::vector< mcIdType > &tinyInfoI)
 
void setSelectedComponents (const DataArrayType *a, const std::vector< std::size_t > &compoIds)
 
void sortEachPairToMakeALinkedList ()
 
void sortToHaveConsecutivePairs ()
 
void splitByValueRange (const T *arrBg, const T *arrEnd, DataArrayType *&castArr, DataArrayType *&rankInsideCast, DataArrayType *&castsPresent) const
 
std::vector< std::pair< mcIdType, mcIdType > > splitInBalancedSlices (mcIdType nbOfSlices) const
 
void switchOnTupleEqualTo (T val, std::vector< bool > &vec) const
 
void switchOnTupleNotEqualTo (T val, std::vector< bool > &vec) const
 
void transformWithIndArr (const MapKeyVal< T, T > &m)
 
void transformWithIndArr (const T *indArrBg, const T *indArrEnd)
 
DataArrayIdType * transformWithIndArrR (const T *indArr2Bg, const T *indArrEnd) const
 
void writeVTK (std::ostream &ofs, mcIdType indent, const std::string &type, const std::string &nameInFile, DataArrayByte *byteArr) const
 
- Public Member Functions inherited from MEDCoupling::DataArrayTemplateClassic< T >
void abs ()
 
void addEqual (const typename Traits< T >::ArrayType *other)
 
void aggregate (const typename Traits< T >::ArrayType *other)
 
void applyLin (T a, T b)
 
void applyLin (T a, T b, std::size_t compoId)
 
Traits< T >::ArrayType * computeAbs () const
 
MCAuto< DataArrayDoubleconvertToDblArr () const
 
MCAuto< DataArrayFloatconvertToFloatArr () const
 
MCAuto< DataArrayInt64convertToInt64Arr () const
 
MCAuto< DataArrayInt > convertToIntArr () const
 
template<class U >
MCAuto< typename Traits< U >::ArrayType > convertToOtherTypeOfArr () const
 
void divideEqual (const typename Traits< T >::ArrayType *other)
 
Traits< T >::ArrayType * duplicateEachTupleNTimes (mcIdType nbTimes) const
 
MCAuto< typename Traits< T >::ArrayType > duplicateNTimes (mcIdType nbTimes) const
 
MCAuto< DataArrayIdType > findIdsGreaterOrEqualTo (T val) const
 
MCAuto< DataArrayIdType > findIdsGreaterThan (T val) const
 
MCAuto< DataArrayIdType > findIdsLowerOrEqualTo (T val) const
 
MCAuto< DataArrayIdType > findIdsLowerThan (T val) const
 
DataArrayIdType * findIdsStrictlyNegative () const
 
Traits< T >::ArrayType * fromNoInterlace () const
 
void iota (T init=(T) 0)
 
void meldWith (const typename Traits< T >::ArrayType *other)
 
void multiplyEqual (const typename Traits< T >::ArrayType *other)
 
Traits< T >::ArrayType * negate () const
 
Traits< T >::ArrayType * performCopyOrIncrRef (bool dCpy) const
 
std::string repr () const
 
std::string reprNotTooLong () const
 
void reprNotTooLongStream (std::ostream &stream) const
 
void reprNotTooLongWithoutNameStream (std::ostream &stream) const
 
void reprStream (std::ostream &stream) const
 
void reprWithoutNameStream (std::ostream &stream) const
 
std::string reprZip () const
 
void reprZipStream (std::ostream &stream) const
 
void reprZipWithoutNameStream (std::ostream &stream) const
 
void substractEqual (const typename Traits< T >::ArrayType *other)
 
Traits< T >::ArrayType * sumPerTuple () const
 
Traits< T >::ArrayType * toNoInterlace () const
 
- Public Member Functions inherited from MEDCoupling::DataArrayTemplate< T >
MemArray< T > & accessToMemArray ()
 
const MemArray< T > & accessToMemArray () const
 
void alloc (std::size_t nbOfTuple, std::size_t nbOfCompo=1)
 
void allocIfNecessary (std::size_t nbOfTuple, std::size_t nbOfCompo)
 
back () const
 
const T * begin () const
 
Traits< T >::ArrayType * changeNbOfComponents (std::size_t newNbOfComp, T dftValue) const
 
void checkAllocated () const
 
void circularPermutation (mcIdType nbOfShift=1)
 
void circularPermutationPerTuple (mcIdType nbOfShift=1)
 
void deepCopyFrom (const DataArrayTemplate< T > &other)
 
void desallocate ()
 
bool empty () const
 
const T * end () const
 
std::vector< MCAuto< typename Traits< T >::ArrayTypeCh > > explodeComponents () const
 
void fillWithValue (T val)
 
void fillWithZero ()
 
front () const
 
const T * getConstPointer () const
 
std::size_t getHeapMemorySizeWithoutChildren () const
 
getIJ (std::size_t tupleId, std::size_t compoId) const
 
getIJSafe (std::size_t tupleId, std::size_t compoId) const
 
getMaxAbsValue (std::size_t &tupleId) const
 
getMaxAbsValueInArray () const
 
getMaxValue (mcIdType &tupleId) const
 
getMaxValueInArray () const
 
getMinValue (mcIdType &tupleId) const
 
getMinValueInArray () const
 
std::size_t getNbOfElemAllocated () const
 
mcIdType getNbOfElems () const
 
mcIdType getNumberOfTuples () const
 
T * getPointer ()
 
T * getPointerSilent ()
 
void getTuple (mcIdType tupleId, T *res) const
 
void * getVoidStarPointer ()
 
template<class InputIterator >
void insertAtTheEnd (InputIterator first, InputIterator last)
 
bool isAllocated () const override
 
void pack () const
 
popBackSilent ()
 
void printForDebug (std::ostream &oss) const
 
void pushBackSilent (T val)
 
template<class InputIterator >
void pushBackValsSilent (InputIterator valsBg, InputIterator valsEnd)
 
void reAlloc (std::size_t newNbOfTuple)
 
void rearrange (std::size_t newNbOfCompo)
 
Traits< T >::ArrayType * renumber (const mcIdType *old2New) const
 
Traits< T >::ArrayType * renumberAndReduce (const mcIdType *old2New, mcIdType newNbOfTuple) const
 
void renumberInPlace (const mcIdType *old2New)
 
void renumberInPlaceR (const mcIdType *new2Old)
 
Traits< T >::ArrayType * renumberR (const mcIdType *new2Old) const
 
void reserve (std::size_t nbOfElems)
 
void reverse ()
 
void reversePerTuple ()
 
T * rwBegin ()
 
T * rwEnd ()
 
MCAuto< typename Traits< T >::ArrayTypeCh > selectPartDef (const PartDefinition *pd) const
 
void setContigPartOfSelectedValues (mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec)
 
void setContigPartOfSelectedValuesSlice (mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step)
 
void setIJ (std::size_t tupleId, std::size_t compoId, T newVal)
 
void setIJSilent (std::size_t tupleId, std::size_t compoId, T newVal)
 
void setPartOfValues1 (const typename Traits< T >::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true)
 
void setPartOfValues2 (const typename Traits< T >::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true)
 
void setPartOfValues3 (const typename Traits< T >::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true)
 
void setPartOfValues4 (const typename Traits< T >::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true)
 
void setPartOfValuesAdv (const typename Traits< T >::ArrayType *a, const DataArrayIdType *tuplesSelec)
 
void setPartOfValuesSimple1 (T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp)
 
void setPartOfValuesSimple2 (T a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp)
 
void setPartOfValuesSimple3 (T a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp)
 
void setPartOfValuesSimple4 (T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp)
 
void sort (bool asc=true)
 
void sortPerTuple (bool asc)
 
Traits< T >::ArrayType * subArray (mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const
 
void transpose ()
 
void updateTime () const
 
void useArray (const T *array, bool ownership, DeallocType type, std::size_t nbOfTuple, std::size_t nbOfCompo)
 
void useExternalArrayWithRWAccess (const T *array, std::size_t nbOfTuple, std::size_t nbOfCompo)
 
void writeForDbg (const std::string &fileName) const
 
void writeOnPlace (std::size_t id, T element0, const T *others, mcIdType sizeOfOthers)
 
- Public Member Functions inherited from MEDCoupling::DataArray
bool areInfoEquals (const DataArray &other) const
 
bool areInfoEqualsIfNotWhy (const DataArray &other, std::string &reason) const
 
virtual DataArraybuildNewEmptyInstance () const =0
 
void checkNbOfComps (std::size_t nbOfCompo, const std::string &msg) const
 
void checkNbOfElems (mcIdType nbOfElems, const std::string &msg) const
 
void checkNbOfTuples (mcIdType nbOfTuples, const std::string &msg) const
 
void checkNbOfTuplesAndComp (const DataArray &other, const std::string &msg) const
 
void checkNbOfTuplesAndComp (mcIdType nbOfTuples, std::size_t nbOfCompo, const std::string &msg) const
 
void copyPartOfStringInfoFrom (const DataArray &other, const std::vector< std::size_t > &compoIds)
 
void copyPartOfStringInfoFrom2 (const std::vector< std::size_t > &compoIds, const DataArray &other)
 
virtual DataArraycopySorted (bool asc=true) const =0
 
void copyStringInfoFrom (const DataArray &other)
 
std::string cppRepr (const std::string &varName) const
 
virtual DataArraydeepCopy () const =0
 
std::vector< const BigMemoryObject * > getDirectChildrenWithNull () const
 
std::string getInfoOnComponent (std::size_t i) const
 
std::vector< std::string > & getInfoOnComponents ()
 
const std::vector< std::string > & getInfoOnComponents () const
 
std::string getName () const
 
std::size_t getNumberOfComponents () const
 
std::string getUnitOnComponent (std::size_t i) const
 
std::vector< std::string > getUnitsOnComponent () const
 
std::string getVarOnComponent (std::size_t i) const
 
std::vector< std::string > getVarsOnComponent () const
 
virtual DataArraykeepSelectedComponents (const std::vector< std::size_t > &compoIds) const =0
 
virtual DataArrayselectByTupleId (const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const =0
 
virtual DataArrayselectByTupleIdSafe (const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const =0
 
virtual DataArrayselectByTupleIdSafeSlice (mcIdType bg, mcIdType end2, mcIdType step) const =0
 
virtual DataArrayselectByTupleRanges (const std::vector< std::pair< mcIdType, mcIdType > > &ranges) const =0
 
void setInfoAndChangeNbOfCompo (const std::vector< std::string > &info)
 
void setInfoOnComponent (std::size_t i, const std::string &info)
 
void setInfoOnComponents (const std::vector< std::string > &info)
 
void setName (const std::string &name)
 
void setPartOfValuesBase3 (const DataArray *aBase, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true)
 
- Public Member Functions inherited from MEDCoupling::RefCountObjectOnly
bool decrRef () const
 
int getRCValue () const
 
void incrRef () const
 
RefCountObjectOnlyoperator= (const RefCountObjectOnly &other)
 
- Public Member Functions inherited from MEDCoupling::BigMemoryObject
std::string debugHeapMemorySize () const
 
std::vector< const BigMemoryObject * > getAllTheProgeny () const
 
virtual std::string getClassName () const
 
std::vector< const BigMemoryObject * > getDirectChildren () const
 
std::size_t getHeapMemorySize () const
 
std::string getHeapMemorySizeStr () const
 
bool isObjectInTheProgeny (const BigMemoryObject *obj) const
 
virtual ~BigMemoryObject ()
 
- Public Member Functions inherited from MEDCoupling::TimeLabel
void declareAsNew () const
 
std::size_t getTimeOfThis () const
 
TimeLabeloperator= (const TimeLabel &other)
 
 TimeLabel (const TimeLabel &other)=default
 

Static Public Member Functions

static DataArrayTypeAggregate (const DataArrayType *a1, const DataArrayType *a2, T offsetA2)
 
static DataArrayTypeAggregate (const std::vector< const DataArrayType * > &arr)
 
static DataArrayTypeAggregateIndexes (const std::vector< const DataArrayType * > &arrs)
 
static DataArrayTypeBuildIntersection (const std::vector< const DataArrayType * > &arr)
 
static DataArrayTypeBuildListOfSwitchedOff (const std::vector< bool > &v)
 
static DataArrayTypeBuildListOfSwitchedOn (const std::vector< bool > &v)
 
static DataArrayTypeBuildUnion (const std::vector< const DataArrayType * > &arr)
 
static mcIdType * CheckAndPreparePermutation (const T *start, const T *end)
 
static DataArrayIdType * ConvertIndexArrayToO2N (mcIdType nbOfOldTuples, const mcIdType *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples)
 
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 DataArrayIdType * FindPermutationFromFirstToSecond (const DataArrayType *ids1, const DataArrayType *ids2)
 
static DataArrayIdType * FindPermutationFromFirstToSecondDuplicate (const DataArrayType *ids1, const DataArrayType *ids2)
 
static void FromVTK93To94FacesInternaReprOfPolyedra (const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, MCAuto< DataArrayType > &arrOut, MCAuto< DataArrayIdType > &arrIndexOut)
 
static void FromVTK94InternalReprOfPolyedra (const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, const DataArrayIdType *arrIndxIn2, MCAuto< DataArrayType > &arrOut, MCAuto< DataArrayIdType > &arrIndexOut)
 
static void FromVTKInternalReprOfPolyedra (const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, MCAuto< DataArrayType > &arrOut, MCAuto< DataArrayIdType > &arrIndexOut)
 
static DataArrayIdType * MakePartition (const std::vector< const DataArrayType * > &groups, mcIdType newNb, std::vector< std::vector< mcIdType > > &fidsOfGroups)
 
static DataArrayTypeModulus (const DataArrayType *a1, const DataArrayType *a2)
 
static DataArrayTypeNew ()
 
static DataArrayTypePow (const DataArrayType *a1, const DataArrayType *a2)
 
static void PutIntoToSkylineFrmt (const std::vector< std::vector< T > > &v, DataArrayType *&data, DataArrayIdType *&dataIndex)
 
static DataArrayTypeRange (T begin, T end, T step)
 
static bool RemoveIdsFromIndexedArrays (const T *idsToRemoveBg, const T *idsToRemoveEnd, DataArrayType *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0)
 
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 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 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 Public Member Functions inherited from MEDCoupling::DataArrayTemplateClassic< T >
static Traits< T >::ArrayType * Add (const typename Traits< T >::ArrayType *a1, const typename Traits< T >::ArrayType *a2)
 
static Traits< T >::ArrayType * Divide (const typename Traits< T >::ArrayType *a1, const typename Traits< T >::ArrayType *a2)
 
static Traits< T >::ArrayType * Meld (const std::vector< const typename Traits< T >::ArrayType * > &arr)
 
static Traits< T >::ArrayType * Meld (const typename Traits< T >::ArrayType *a1, const typename Traits< T >::ArrayType *a2)
 
static Traits< T >::ArrayType * Multiply (const typename Traits< T >::ArrayType *a1, const typename Traits< T >::ArrayType *a2)
 
static Traits< T >::ArrayType * Substract (const typename Traits< T >::ArrayType *a1, const typename Traits< T >::ArrayType *a2)
 
- Static Public Member Functions inherited from MEDCoupling::DataArrayTemplate< T >
static MCAuto< typename Traits< T >::ArrayTypeCh > LoadForDbg (const std::string &fileName)
 
static MCAuto< typename Traits< T >::ArrayTypeCh > NewFromArray (const T *arrBegin, const T *arrEnd)
 
static MCAuto< typename Traits< T >::ArrayTypeCh > NewFromStdVector (const typename std::vector< T > &v)
 
static void SetArrayIn (typename Traits< T >::ArrayType *newArray, typename Traits< T >::ArrayType *&arrayToSet)
 
- Static Public Member Functions inherited from MEDCoupling::DataArray
static DataArrayAggregate (const std::vector< const DataArray * > &arrs)
 
static std::string BuildInfoFromVarAndUnit (const std::string &var, const std::string &unit)
 
static std::string GetAxisTypeRepr (MEDCouplingAxisType at)
 
static mcIdType GetNumberOfItemGivenBES (mcIdType begin, mcIdType end, mcIdType step, const std::string &msg)
 
static mcIdType GetNumberOfItemGivenBESRelative (mcIdType begin, mcIdType end, mcIdType step, const std::string &msg)
 
static mcIdType GetPosOfItemGivenBESRelativeNoThrow (mcIdType value, mcIdType begin, mcIdType end, mcIdType step)
 
static void GetSlice (mcIdType start, mcIdType stop, mcIdType step, mcIdType sliceId, mcIdType nbOfSlices, mcIdType &startSlice, mcIdType &stopSlice)
 
static std::string GetUnitFromInfo (const std::string &info)
 
static std::string GetVarNameFromInfo (const std::string &info)
 
static std::vector< std::string > SplitStringInChuncks (const std::string st, std::size_t sz)
 
- Static Public Member Functions inherited from MEDCoupling::BigMemoryObject
static std::size_t GetHeapMemorySizeOfObjs (const std::vector< const BigMemoryObject * > &objs)
 

Protected Member Functions

template<class ALG >
void switchOnTupleAlg (T val, std::vector< bool > &vec, ALG algo) const
 
 ~DataArrayDiscrete ()
 
- Protected Member Functions inherited from MEDCoupling::DataArrayTemplateClassic< T >
template<class OP >
MCAuto< DataArrayIdType > findIdsAdv (const OP &op) const
 
- Protected Member Functions inherited from MEDCoupling::DataArrayTemplate< T >
Traits< T >::ArrayTypeCh * copySortedImpl (bool asc) const
 
Traits< T >::ArrayType * myKeepSelectedComponents (const std::vector< std::size_t > &compoIds) const
 
Traits< T >::ArrayType * mySelectByTupleId (const DataArrayIdType &di) const
 
Traits< T >::ArrayType * mySelectByTupleId (const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const
 
Traits< T >::ArrayType * mySelectByTupleIdSafe (const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const
 
Traits< T >::ArrayType * mySelectByTupleIdSafeSlice (mcIdType bg, mcIdType end2, mcIdType step) const
 
Traits< T >::ArrayType * mySelectByTupleRanges (const std::vector< std::pair< mcIdType, mcIdType > > &ranges) const
 
- Protected Member Functions inherited from MEDCoupling::DataArray
 DataArray ()
 
 ~DataArray ()
 
- Protected Member Functions inherited from MEDCoupling::RefCountObject
 RefCountObject ()
 
 RefCountObject (const RefCountObject &other)
 
virtual ~RefCountObject ()
 
- Protected Member Functions inherited from MEDCoupling::RefCountObjectOnly
 RefCountObjectOnly ()
 
 RefCountObjectOnly (const RefCountObjectOnly &other)
 
virtual ~RefCountObjectOnly ()
 
- Protected Member Functions inherited from MEDCoupling::TimeLabel
void forceTimeOfThis (const TimeLabel &other) const
 
 TimeLabel ()
 
void updateTimeWith (const TimeLabel &other) const
 
virtual ~TimeLabel ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from MEDCoupling::DataArrayTemplateClassic< T >
static Traits< T >::ArrayType * PerformCopyOrIncrRef (bool dCpy, const typename Traits< T >::ArrayType &self)
 
- Static Protected Member Functions inherited from MEDCoupling::DataArray
static void CheckClosingParInRange (mcIdType ref, mcIdType value, const std::string &msg)
 
static void CheckValueInRange (mcIdType ref, mcIdType value, const std::string &msg)
 
static void CheckValueInRangeEx (mcIdType value, mcIdType start, mcIdType end, const std::string &msg)
 
static mcIdType EffectiveCircPerm (mcIdType nbOfShift, mcIdType nbOfTuples)
 
- Protected Attributes inherited from MEDCoupling::DataArrayTemplate< T >
MemArray< T > _mem
 
- Protected Attributes inherited from MEDCoupling::DataArray
std::vector< std::string > _info_on_compo
 
std::string _name
 

Member Typedef Documentation

◆ DataArrayType

template<class T >
using MEDCoupling::DataArrayDiscrete< T >::DataArrayType = typename Traits<T>::ArrayType

Constructor & Destructor Documentation

◆ ~DataArrayDiscrete()

template<class T >
MEDCoupling::DataArrayDiscrete< T >::~DataArrayDiscrete ( )
protected

Member Function Documentation

◆ New()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::New
static

◆ intValue()

template<class T >
T MEDCoupling::DataArrayDiscrete< T >::intValue

Returns the only one value in this, if and only if number of elements (nb of tuples * nb of components) is equal to 1, and that this is allocated.

Returns
double - the sole value stored in this array.
Exceptions
Ifat least one of conditions stated above is not fulfilled.

◆ isEqual()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isEqual ( const DataArrayDiscrete< T > &  other) const

Checks if this and another DataArrayInt are fully equal. For more info see Compare DataArrays.

Parameters
[in]other- an instance of DataArrayInt to compare with this one.
Returns
bool - true if the two arrays are equal, false else.

◆ isEqualIfNotWhy()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isEqualIfNotWhy ( const DataArrayDiscrete< T > &  other,
std::string &  reason 
) const

Equivalent to DataArrayInt::isEqual except that if false the reason of mismatch is given.

Parameters
[in]otherthe instance to be compared with this
[out]reasonIn case of inequality returns the reason.
See also
DataArrayInt::isEqual

References MEDCoupling::DataArrayTemplate< T >::_mem.

◆ isEqualWithoutConsideringStr()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isEqualWithoutConsideringStr ( const DataArrayDiscrete< T > &  other) const

Checks if values of this and another DataArrayInt are equal. For more info see Compare DataArrays.

Parameters
[in]other- an instance of DataArrayInt to compare with this one.
Returns
bool - true if the values of two arrays are equal, false else.

References MEDCoupling::DataArrayTemplate< T >::_mem.

◆ isEqualWithoutConsideringStrAndOrder()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isEqualWithoutConsideringStrAndOrder ( const typename Traits< T >::ArrayType &  other) const

Checks if values of this and another DataArrayInt are equal. Comparison is performed on sorted value sequences. For more info seeCompare DataArrays.

Parameters
[in]other- an instance of DataArrayInt to compare with this one.
Returns
bool - true if the sorted values of two arrays are equal, false else.

◆ switchOnTupleEqualTo()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::switchOnTupleEqualTo ( val,
std::vector< bool > &  vec 
) const

This method assumes that this has one component and is allocated. This method scans all tuples in this and for all tuple equal to val put True to the corresponding entry in vec. vec is expected to be with the same size than the number of tuples of this.

See also
DataArrayInt::switchOnTupleNotEqualTo.

◆ switchOnTupleNotEqualTo()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::switchOnTupleNotEqualTo ( val,
std::vector< bool > &  vec 
) const

This method assumes that this has one component and is allocated. This method scans all tuples in this and for all tuple different from val put True to the corresponding entry in vec. vec is expected to be with the same size than the number of tuples of this.

See also
DataArrayInt::switchOnTupleEqualTo.

◆ occurenceRankInThis()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::occurenceRankInThis

Compute for each element in this the occurence rank of that element. This method is typically useful of one-component array having a same element appearing several times. If each element in this appears once an 1 component array containing only 0 will be returned.

Example:

  • this : [5, 3, 2, 1, 4, 5, 2, 1, 0, 11, 5, 4]
  • return is : [0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 1] because at pos #0 of this (ie value 5) is the first occurrence ->0. At pos #10 of this (ie value 5 also) is the third occurrence of 5 -> 2.
Returns
DataArrayInt * - a new instance of DataArrayInt with same number of tuples than this. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifeither this not allocated or not with one component.
See also
DataArrayInt::FindPermutationFromFirstToSecond

◆ buildPermutationArr()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::buildPermutationArr ( const DataArrayDiscrete< T > &  other) const

Creates a new one-dimensional DataArrayInt of the same size as this and a given one-dimensional arrays that must be of the same length. The result array describes correspondence between this and other arrays, so that other.getIJ(i,0) == this->getIJ(ret->getIJ(i),0). If such a permutation is not possible because some element in other is not in this, an exception is thrown.

Parameters
[in]other- an array to compute permutation to.
Returns
DataArrayInt * - a new instance of DataArrayInt, which is a permutation array from this to other. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis->getNumberOfComponents() != 1.
Ifother->getNumberOfComponents() != 1.
Ifthis->getNumberOfTuples() != other->getNumberOfTuples().
Ifother includes a value which is not in this array.

Here is a C++ example.

Here is a Python example.

References MEDCoupling::DataArrayTemplate< T >::begin(), MEDCoupling::DataArrayTemplate< T >::checkAllocated(), MEDCoupling::DataArray::getNumberOfComponents(), and MEDCoupling::DataArrayTemplate< T >::getNumberOfTuples().

◆ indicesOfSubPart()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::indicesOfSubPart ( const DataArrayDiscrete< T > &  partOfThis) const

Elements of partOfThis are expected to be included in this. The returned array ret is so that this[ret]==partOfThis

For example, if this array contents are [9,10,0,6,4,11,3,8] and if partOfThis contains [6,0,11,8] the return array will contain [3,2,5,7].

this is expected to be a 1 compo allocated array.

Parameters
[in]partOfThis- A 1 compo allocated array
Returns
- A newly allocated array to be dealed by caller having the same number of tuples than partOfThis.
Exceptions
iftwo same element is present twice in this
ifan element in partOfThis is NOT in this.

References MEDCoupling::DataArrayTemplate< T >::begin(), MEDCoupling::DataArrayTemplate< T >::checkAllocated(), MEDCoupling::DataArray::getNumberOfComponents(), and MEDCoupling::DataArrayTemplate< T >::getNumberOfTuples().

◆ checkMonotonic()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::checkMonotonic ( bool  increasing) const

Checks that this array is consistently increasing or decreasing in value. If not an exception is thrown.

Parameters
[in]increasing- if true, the array values should be increasing.
Exceptions
Ifsequence of values is not strictly monotonic in agreement with increasing arg.
Ifthis->getNumberOfComponents() != 1.
Ifthis is not allocated.

◆ isMonotonic()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isMonotonic ( bool  increasing) const

Checks that this array is consistently increasing or decreasing in value.

Parameters
[in]increasing- if true, array values should be increasing.
Returns
bool - true if values change in accordance with increasing arg.
Exceptions
Ifthis->getNumberOfComponents() != 1.
Ifthis is not allocated.

◆ checkStrictlyMonotonic()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::checkStrictlyMonotonic ( bool  increasing) const

This method check that array consistently INCREASING or DECREASING in value.

◆ isStrictlyMonotonic()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isStrictlyMonotonic ( bool  increasing) const

This method check that array consistently INCREASING or DECREASING in value.

◆ getHashCode()

template<class T >
mcIdType MEDCoupling::DataArrayDiscrete< T >::getHashCode

Returns an integer value characterizing this array, which is useful for a quick comparison of many instances of DataArrayInt.

Returns
mcIdType - the hash value.
Exceptions
Ifthis is not allocated.

◆ reprCppStream()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::reprCppStream ( const std::string &  varName,
std::ostream &  stream 
) const
virtual

◆ reprQuickOverview()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::reprQuickOverview ( std::ostream &  stream) const
virtual

Method that gives a quick overvien of this for python.

Implements MEDCoupling::DataArray.

◆ reprQuickOverviewData()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::reprQuickOverviewData ( std::ostream &  stream,
std::size_t  maxNbOfByteInRepr 
) const
virtual

◆ writeVTK()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::writeVTK ( std::ostream &  ofs,
mcIdType  indent,
const std::string &  type,
const std::string &  nameInFile,
DataArrayByte byteArr 
) const

◆ transformWithIndArr() [1/2]

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::transformWithIndArr ( const T *  indArrBg,
const T *  indArrEnd 
)

Modifies in place this one-dimensional array so that each value v = indArrBg[ v ], i.e. a current value is used as in index to get a new value from indArrBg.

Parameters
[in]indArrBg- pointer to the first element of array of new values to assign to this array.
[in]indArrEnd- specifies the end of the array indArrBg, so that the last value of indArrBg is indArrEnd[ -1 ].
Exceptions
Ifthis->getNumberOfComponents() != 1
Ifany value of this can't be used as a valid index for [indArrBg, indArrEnd).
See also
changeValue, findIdForEach

◆ transformWithIndArr() [2/2]

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::transformWithIndArr ( const MapKeyVal< T, T > &  m)

◆ findCommonTuples()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::findCommonTuples ( mcIdType  limitTupleId,
MCAuto< DataArrayIdType > &  comm,
MCAuto< DataArrayIdType > &  commIndex 
) const

◆ findIdsEqual()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::findIdsEqual ( val) const

Creates a new DataArrayInt containing IDs (indices) of tuples holding value equal to a given one. The ids are sorted in the ascending order.

Parameters
[in]val- the value to find within this.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
See also
DataArrayInt::findIdsEqualTuple

◆ transformWithIndArrR()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::transformWithIndArrR ( const T *  indArrBg,
const T *  indArrEnd 
) const

Creates a one-dimensional DataArrayInt (res) whose contents are computed from values of this (a) and the given (indArr) arrays as follows: res[ indArr[ a[ i ]]] = i. I.e. for each value in place i v = a[ i ], new value in place indArr[ v ] is i.

Parameters
[in]indArrBg- the array holding indices within the result array to assign indices of values of this array pointing to values of indArrBg.
[in]indArrEnd- specifies the end of the array indArrBg, so that the last value of indArrBg is indArrEnd[ -1 ].
Returns
DataArrayInt * - the new instance of DataArrayInt. The caller is to delete this result array using decrRef() as it is no more needed.
Exceptions
Ifthis->getNumberOfComponents() != 1.
Ifany value of this array is not a valid index for indArrBg array.
Ifany value of indArrBg is not a valid index for this array.

◆ splitByValueRange()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::splitByValueRange ( const T *  arrBg,
const T *  arrEnd,
DataArrayType *&  castArr,
DataArrayType *&  rankInsideCast,
DataArrayType *&  castsPresent 
) const

Computes distribution of values of this one-dimensional array between given value ranges (casts). This method is typically useful for entity number splitting by types, for example.

Warning
The values contained in arrBg should be sorted ascendently. No check of this is be done. If not, the result is not warranted.
Parameters
[in]arrBg- the array of ascending values defining the value ranges. The i-th value of arrBg (arrBg[ i ]) gives the lowest value of the i-th range, and the greatest value of the i-th range equals to arrBg[ i+1 ] - 1. arrBg containing n values defines n-1 ranges. The last value of arrBg should be more than every value in this array.
[in]arrEnd- specifies the end of the array arrBg, so that the last value of arrBg is arrEnd[ -1 ].
[out]castArr- a new instance of DataArrayInt, of same size as this array (same number of tuples and components), the caller is to delete using decrRef() as it is no more needed. This array contains indices of ranges for every value of this array. I.e. the i-th value of castArr gives the index of range the i-th value of this belongs to. Or, in other words, this parameter contains for each tuple in this in which cast it holds.
[out]rankInsideCast- a new instance of DataArrayInt, of same size as this array, the caller is to delete using decrRef() as it is no more needed. This array contains ranks of values of this array within ranges they belongs to. I.e. the i-th value of rankInsideCast gives the rank of the i-th value of this array within the castArr[ i ]-th range, to which the i-th value of this belongs to. Or, in other words, this param contains for each tuple its rank inside its cast. The rank is computed as difference between the value and the lowest value of range.
[out]castsPresent- a new instance of DataArrayInt, containing indices of ranges (casts) to which at least one value of this array belongs. Or, in other words, this param contains the casts that this contains. The caller is to delete this array using decrRef() as it is no more needed.

Example: If this contains [6,5,0,3,2,7,8,1,4] and arrBg contains [0,4,9] then the output of this method will be :

  • castArr : [1,1,0,0,0,1,1,0,1]
  • rankInsideCast: [2,1,0,3,2,3,4,1,0]
  • castsPresent : [0,1]

I.e. values of this array belong to 2 ranges: #0 and #1. Value 6 belongs to the range #1 and its rank within this range is 2; etc.

Exceptions
Ifthis->getNumberOfComponents() != 1.
IfarrEnd - arrBg < 2.
Ifany value of this is not less than arrEnd[-1].

◆ isRange()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isRange ( T &  strt,
T &  sttoopp,
T &  stteepp 
) const

This method look at this if it can be considered as a range defined by the 3-tuple ( strt , sttoopp , stteepp ). If false is returned the tuple must be ignored. If true is returned this can be considered by a range( strt , sttoopp , stteepp ). This method works only if this is allocated and single component. If not an exception will be thrown.

Parameters
[out]strt- the start of the range (included) if true is returned.
[out]sttoopp- the end of the range (not included) if true is returned.
[out]stteepp- the step of the range if true is returned.
Returns
the verdict of the check.
See also
DataArray::GetNumberOfItemGivenBES

◆ invertArrayO2N2N2O()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::invertArrayO2N2N2O ( mcIdType  newNbOfElem) const

Creates a one-dimensional DataArrayInt of given length, whose contents are computed from values of this array, which is supposed to contain a renumbering map in "Old to New" mode. The result array contains a renumbering map in "New to Old" mode. To know how to use the renumbering maps see Array indexing and numbering.

Parameters
[in]newNbOfElem- the number of tuples in the result array.
Returns
DataArrayInt * - the new instance of DataArrayInt. The caller is to delete this result array using decrRef() as it is no more needed.

Here is a C++ example.
Here is a Python example.

◆ invertArrayN2O2O2N()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::invertArrayN2O2O2N ( mcIdType  oldNbOfElem) const

Creates a one-dimensional DataArrayInt of given length, whose contents are computed from values of this array, which is supposed to contain a renumbering map in "New to Old" mode. The result array contains a renumbering map in "Old to New" mode. To know how to use the renumbering maps see Array indexing and numbering.

Parameters
[in]oldNbOfElem- the number of tuples in the result array.
Returns
DataArrayInt * - the new instance of DataArrayInt. The caller is to delete this result array using decrRef() as it is no more needed.

Here is a C++ example.

Here is a Python example.

See also
invertArrayN2O2O2NOptimized

◆ invertArrayO2N2N2OBis()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::invertArrayO2N2N2OBis ( mcIdType  newNbOfElem) const

This method is similar to DataArrayInt::invertArrayO2N2N2O except that Example : If this contains [0,1,2,0,3,4,5,4,6,4] this method will return [0,1,2,4,5,6,8] whereas DataArrayInt::invertArrayO2N2N2O returns [3,1,2,4,9,6,8]

◆ invertArrayN2O2O2NOptimized()

template<class T >
MCAuto< MapKeyVal< T, mcIdType > > MEDCoupling::DataArrayDiscrete< T >::invertArrayN2O2O2NOptimized

Creates a map, whose contents are computed from values of this array, which is supposed to contain a renumbering map in "New to Old" mode. The result array contains a renumbering map in "Old to New" mode. To know how to use the renumbering maps see Array indexing and numbering.

Returns
MapII - the new instance of Map.

Here is a C++ example.

Here is a Python example.

See also
invertArrayN2O2O2N, giveN2OOptimized, MEDCouplingPointSet::renumberNodesInConn

◆ giveN2OOptimized()

template<class T >
MCAuto< MapKeyVal< mcIdType, T > > MEDCoupling::DataArrayDiscrete< T >::giveN2OOptimized

Creates a map, whose contents are computed from values of this array, which is supposed to contain a renumbering map in "New to Old" mode. The result array contains a renumbering map in "New to Old" mode as C++ map for performance reasons.

See also
invertArrayN2O2O2NOptimized, MEDCouplingPointSet::renumberNodesInConn

◆ findIdForEach()

template<class T >
MCAuto< DataArrayIdType > MEDCoupling::DataArrayDiscrete< T >::findIdForEach ( const T *  valsBg,
const T *  valsEnd 
) const

This method finds for each element ELT in [valsBg,valsEnd) elements in this equal to it. Associated to ELT this method will return the tuple id of last element found. If there is no element in this equal to ELT an exception will be thrown.

In case of success this[ret]==vals. Samely ret->transformWithIndArr(this->begin(),this->end())==vals. Where vals is the [valsBg,valsEnd) array and ret the array returned by this method. This method can be seen as an extension of FindPermutationFromFirstToSecond.
Example:

  • this: [17,27,2,10,-4,3,12,27,16]
  • val : [3,16,-4,27,17]
  • result: [5,8,4,7,0]
Returns
- An array of size std::distance(valsBg,valsEnd)
See also
DataArrayInt::FindPermutationFromFirstToSecond , DataArrayInt::FindPermutationFromFirstToSecondDuplicate

◆ checkAndPreparePermutation()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::checkAndPreparePermutation

Returns a new DataArrayInt containing a renumbering map in "Old to New" mode. This map, if applied to this array, would make it sorted. For example, if this array contents are [9,10,0,6,4,11,3,7] then the contents of the result array are [5,6,0,3,2,7,1,4]; if this result array (res) is used as an argument in call this->renumber(res) then the returned array contains [0,3,4,6,7,9,10,11]. This method is useful for renumbering (in MED file for example). For more info on renumbering see Array indexing and numbering.

Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
Ifthere are equal values in this array.

References MEDCoupling::C_DEALLOC.

◆ changeSurjectiveFormat()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::changeSurjectiveFormat ( targetNb,
DataArrayIdType *&  arr,
DataArrayIdType *&  arrI 
) const

Returns two arrays describing a surjective mapping from this set of values (A) onto a set of values of size targetNb (B). The surjective function is B[ A[ i ]] = i. That is to say that for each id in [0,targetNb), where targetNb < this->getNumberOfTuples(), there exists at least one tupleId (tid) so that this->getIJ( tid, 0 ) == id.
The first of out arrays returns indices of elements of this array, grouped by their place in the set B. The second out array is the index of the first one; it shows how many elements of A are mapped into each element of B.
For more info on mapping and its usage in renumbering see Array indexing and numbering.
Example:

  • this: [0,3,2,3,2,2,1,2]
  • targetNb: 4
  • arr: [0, 6, 2,4,5,7, 1,3]
  • arrI: [0,1,2,6,8]

This result means:
the element of B 0 encounters within A once (arrI[ 0+1 ] - arrI[ 0 ]) and its index within A is 0 ( arr[ 0:1 ] == arr[ arrI[ 0 ] : arrI[ 0+1 ]]);
the element of B 2 encounters within A 4 times (arrI[ 2+1 ] - arrI[ 2 ]) and its indices within A are [2,4,5,7] ( arr[ 2:6 ] == arr[ arrI[ 2 ] : arrI[ 2+1 ]]);
etc.

Parameters
[in]targetNb- the size of the set B. targetNb must be equal or more than the maximal value of A.
[out]arr- a new instance of DataArrayInt returning indices of elements of this, grouped by their place in the set B. The caller is to delete this array using decrRef() as it is no more needed.
[out]arrI- a new instance of DataArrayInt returning size of groups of equal elements of this. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
Ifany value in this is more or equal to targetNb.

◆ buildPermArrPerLevel()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::buildPermArrPerLevel

Returns a new DataArrayInt containing a renumbering map in "New to Old" mode, which if applied to this array would make it sorted ascendingly. For more info on renumbering see Array indexing and numbering.
Example:

  • this: [2,0,1,1,0,1,2,0,1,1,0,0]
  • result: [10,0,5,6,1,7,11,2,8,9,3,4]
  • after applying result to this: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2]

    Returns
    DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
    Exceptions
    Ifthis is not allocated.
    Ifthis->getNumberOfComponents() != 1.

◆ isIota()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isIota ( mcIdType  sizeExpected) const

Checks if this array has the given size, and if its contents is equal to an array filled with iota(). This method is particularly useful for DataArrayInt instances that represent a renumbering array, to check if there is a real need in renumbering. This method checks than this can be considered as an identity mapping of a set having sizeExpected elements into itself.

Parameters
[in]sizeExpected- The number of elements expected.
Returns
bool - true if this array contents == range( this->getNumberOfTuples())
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.

◆ isUniform()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::isUniform ( val) const

Checks if all values in this array are equal to val.

Parameters
[in]val- value to check equality of array values to.
Returns
bool - true if all values are val.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1
See also
DataArrayInt::checkUniformAndGuess

◆ checkUniformAndGuess()

template<class T >
T MEDCoupling::DataArrayDiscrete< T >::checkUniformAndGuess

This method checks that this is uniform. If not and exception will be thrown. In case of uniformity the corresponding value is returned.

Returns
mcIdType - the unique value contained in this
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1
Ifthis is not uniform.
See also
DataArrayInt::isUniform

◆ hasUniqueValues()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::hasUniqueValues

Checks if all values in this array are unique.

Returns
bool - true if condition above is true
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1

◆ setSelectedComponents()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::setSelectedComponents ( const DataArrayType a,
const std::vector< std::size_t > &  compoIds 
)

Copy all components in a specified order from another DataArrayInt. The specified components become the first ones in this array. Both numerical and textual data is copied. The number of tuples in this and the other array can be different.

Parameters
[in]a- the array to copy data from.
[in]compoIds- sequence of zero based indices of components, data of which is to be copied.
Exceptions
Ifa is NULL.
IfcompoIds.size() != a->getNumberOfComponents().
IfcompoIds[i] < 0 or compoIds[i] > this->getNumberOfComponents().

Here is a Python example.

◆ locateComponentId()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::locateComponentId ( const DataArrayType valToSearchIntoTuples,
const DataArrayIdType *  tupleIdHint 
) const

This method searches each value in valToSearchIntoTuples among values in this given the corresponding tuple to find into. If the value at the corresponding tuple is not found in the tuple an exception will be thrown. If the value is found the corresponding component id is returned.

Parameters
[in]valToSearchIntoTuples- a one component array containing the values to find in this
[in]tupleIdHint- a one component array having same size than valToSearchIntoTuples giving for each value the tuple to find into
Returns
DataArrayInt * - A newly allocated array having same size than valToSearchIntoTuples with one component

Example:

  • this: [(0, 1, 2), (3, 4, 5), (6, 2, 3), (7, 8, 9), (9, 0, 10), (11, 12, 13), (14, 5, 11), (15, 16, 17)]
  • valToSearchIntoTuples: [1, 4, 6, 8, 10, 12, 14, 16, 17]
  • tupleIdHint: [0, 1, 2, 3, 4, 5, 6, 7, 7]
  • result array: [1, 1, 0, 1, 2, 1, 0, 1, 2] ==

◆ findIdsNotEqual()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::findIdsNotEqual ( val) const

Creates a new DataArrayInt containing IDs (indices) of tuples holding value not equal to a given one.

Parameters
[in]val- the value to ignore within this.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.

◆ findIdsEqualTuple()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::findIdsEqualTuple ( const T *  tupleBg,
const T *  tupleEnd 
) const

Creates a new DataArrayInt containing IDs (indices) of tuples holding tuple equal to those defined by [ tupleBg , tupleEnd ) This method is an extension of DataArrayInt::findIdsEqual method.

Parameters
[in]tupleBg- the begin (included) of the input tuple to find within this.
[in]tupleEnd- the end (excluded) of the input tuple to find within this.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != std::distance(tupleBg,tupleEnd).
Ifthis->getNumberOfComponents() is equal to 0.
See also
DataArrayInt::findIdsEqual

◆ findIdsEqualList()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::findIdsEqualList ( const T *  valsBg,
const T *  valsEnd 
) const

Creates a new DataArrayInt containing IDs (indices) of tuples holding value equal to one of given values.

Parameters
[in]valsBg- an array of values to find within this array.
[in]valsEnd- specifies the end of the array valsBg, so that the last value of valsBg is valsEnd[ -1 ].
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis->getNumberOfComponents() != 1.

◆ findIdsNotEqualList()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::findIdsNotEqualList ( const T *  valsBg,
const T *  valsEnd 
) const

Creates a new DataArrayInt containing IDs (indices) of tuples holding values not equal to any of given values.

Parameters
[in]valsBg- an array of values to ignore within this array.
[in]valsEnd- specifies the end of the array valsBg, so that the last value of valsBg is valsEnd[ -1 ].
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis->getNumberOfComponents() != 1.

◆ findIdFirstEqual() [1/2]

template<class T >
mcIdType MEDCoupling::DataArrayDiscrete< T >::findIdFirstEqual ( value) const

This method expects to be called when number of components of this is equal to one. This method returns the tuple id, if it exists, of the first tuple equal to value. If not any tuple contains value -1 is returned.

See also
DataArrayInt::presenceOfValue

◆ findIdFirstEqual() [2/2]

template<class T >
mcIdType MEDCoupling::DataArrayDiscrete< T >::findIdFirstEqual ( const std::vector< T > &  vals) const

This method expects to be called when number of components of this is equal to one. This method returns the tuple id, if it exists, of the first tuple so that the value is contained in vals. If not any tuple contains one of the values contained in 'vals' -1 is returned.

See also
DataArrayInt::presenceOfValue

◆ findIdFirstEqualTuple()

template<class T >
mcIdType MEDCoupling::DataArrayDiscrete< T >::findIdFirstEqualTuple ( const std::vector< T > &  tupl) const

This method is an extension of DataArrayInt::findIdFirstEqual method because this method works for DataArrayInt with any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case). This method searches in this is there is a tuple that matched the input parameter tupl. If any the tuple id is returned. If not -1 is returned.

This method throws an INTERP_KERNEL::Exception if the number of components in this mismatches with the size of the input vector. An INTERP_KERNEL::Exception is thrown too if this is not allocated.

Returns
tuple id where tupl is. -1 if no such tuple exists in this.
See also
DataArrayInt::findIdSequence, DataArrayInt::presenceOfTuple.

◆ findIdSequence()

template<class T >
mcIdType MEDCoupling::DataArrayDiscrete< T >::findIdSequence ( const std::vector< T > &  vals) const

This method searches the sequence specified in input parameter vals in this. This works only for DataArrayInt having number of components equal to one (if not an INTERP_KERNEL::Exception will be thrown). This method differs from DataArrayInt::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayInt::findIdFirstEqualTuple.

See also
DataArrayInt::findIdFirstEqualTuple

◆ changeValue()

template<class T >
mcIdType MEDCoupling::DataArrayDiscrete< T >::changeValue ( oldValue,
newValue 
)

Assigns newValue to all elements holding oldValue within this one-dimensional array.

Parameters
[in]oldValue- the value to replace.
[in]newValue- the value to assign.
Returns
mcIdType - number of replacements performed.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.

◆ count()

template<class T >
mcIdType MEDCoupling::DataArrayDiscrete< T >::count ( value) const

This method returns the number of values in this that are equals to input parameter value. This method only works for single component array.

Returns
a value in [ 0, this->getNumberOfTuples() )
Exceptions
Ifthis is not allocated

◆ presenceOfTuple()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::presenceOfTuple ( const std::vector< T > &  tupl) const

This method is an extension of DataArrayInt::presenceOfValue method because this method works for DataArrayInt with any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case). This method searches in this is there is a tuple that matched the input parameter tupl. This method throws an INTERP_KERNEL::Exception if the number of components in this mismatches with the size of the input vector. An INTERP_KERNEL::Exception is thrown too if this is not allocated.

See also
DataArrayInt::findIdFirstEqualTuple

◆ presenceOfValue() [1/2]

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::presenceOfValue ( value) const

Returns true if a given value is present within this one-dimensional array.

Parameters
[in]value- the value to find within this array.
Returns
bool - true in case if value is present within this array.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
See also
findIdFirstEqual()

◆ presenceOfValue() [2/2]

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::presenceOfValue ( const std::vector< T > &  vals) const

This method expects to be called when number of components of this is equal to one. This method returns true if it exists a tuple so that the value is contained in vals. If not any tuple contains one of the values contained in 'vals' false is returned.

See also
DataArrayInt::findIdFirstEqual

◆ accumulate() [1/2]

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::accumulate ( T *  res) const

Accumulates values of each component of this array.

Parameters
[out]res- an array of length this->getNumberOfComponents(), allocated by the caller, that is filled by this method with sum value for each component.
Exceptions
Ifthis is not allocated.

◆ accumulate() [2/2]

template<class T >
T MEDCoupling::DataArrayDiscrete< T >::accumulate ( std::size_t  compId) const

◆ accumulatePerChunck()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::accumulatePerChunck ( const mcIdType *  bgOfIndex,
const mcIdType *  endOfIndex 
) const

This method accumulate using addition tuples in this using input index array [ bgOfIndex, endOfIndex ). The returned array will have same number of components than this and number of tuples equal to std::distance(bgOfIndex,endOfIndex) minus one.

The input index array is expected to be ascendingly sorted in which the all referenced ids should be in [0, this->getNumberOfTuples).

Parameters
[in]bgOfIndex- begin (included) of the input index array.
[in]endOfIndex- end (excluded) of the input index array.
Returns
DataArrayInt * - the new instance having the same number of components than this.
Exceptions
IfbgOfIndex or end is NULL.
Ifinput index array is not ascendingly sorted.
Ifthere is an id in [ bgOfIndex, endOfIndex ) not in [0, this->getNumberOfTuples).
Ifstd::distance(bgOfIndex,endOfIndex)==0.

◆ getMinMaxValues()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::getMinMaxValues ( T &  minValue,
T &  maxValue 
) const

Returns in a single walk in this the min value and the max value in this. this is expected to be single component array.

Parameters
[out]minValue- the min value in this.
[out]maxValue- the max value in this.
See also
getMinValueInArray, getMinValue, getMaxValueInArray, getMaxValue

◆ applyInv()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::applyInv ( numerator)

Modify all elements of this array, so that an element x becomes $ numerator / x $.

Warning
If an exception is thrown because of presence of 0 element in this array, all elements processed before detection of the zero element remain modified.
Parameters
[in]numerator- the numerator used to modify array elements.
Exceptions
Ifthis is not allocated.
Ifthere is an element equal to 0 in this array.

◆ applyDivideBy()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::applyDivideBy ( val)

Modify all elements of this array, so that an element x becomes $ x / val $.

Parameters
[in]val- the denominator used to modify array elements.
Exceptions
Ifthis is not allocated.
Ifval == 0.

◆ applyModulus()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::applyModulus ( val)

Modify all elements of this array, so that an element x becomes x % val .

Parameters
[in]val- the divisor used to modify array elements.
Exceptions
Ifthis is not allocated.
Ifval <= 0.

◆ applyRModulus()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::applyRModulus ( val)

Modify all elements of this array, so that an element x becomes val % x .

Warning
If an exception is thrown because of presence of an element <= 0 in this array, all elements processed before detection of the zero element remain modified.
Parameters
[in]val- the divident used to modify array elements.
Exceptions
Ifthis is not allocated.
Ifthere is an element equal to or less than 0 in this array.

◆ applyPow()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::applyPow ( val)

Modify all elements of this array, so that an element x becomes val ^ x .

Parameters
[in]val- the value used to apply pow on all array elements.
Exceptions
Ifthis is not allocated.
Ifval < 0.

◆ applyRPow()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::applyRPow ( val)

Modify all elements of this array, so that an element x becomes $ val ^ x $.

Parameters
[in]val- the value used to apply pow on all array elements.
Exceptions
Ifthis is not allocated.
Ifthere is an element < 0 in this array.
Warning
If an exception is thrown because of presence of 0 element in this array, all elements processed before detection of the zero element remain modified.

◆ findIdsInRange()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::findIdsInRange ( vmin,
vmax 
) const

This method works only on data array with one component. This method returns a newly allocated array storing stored ascendantly tuple ids in this so that this[*id] in [vmin,vmax)

Parameters
[in]vminbegin of range. This value is included in range (included).
[in]vmaxend of range. This value is not included in range (excluded).
Returns
a newly allocated data array that the caller should deal with.
See also
DataArrayInt::findIdsNotInRange , DataArrayInt::findIdsStricltyNegative

◆ findIdsNotInRange()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::findIdsNotInRange ( vmin,
vmax 
) const

This method works only on data array with one component. This method returns a newly allocated array storing stored ascendantly tuple ids in this so that this[*id] not in [vmin,vmax)

Parameters
[in]vminbegin of range. This value is not included in range (excluded).
[in]vmaxend of range. This value is included in range (included).
Returns
a newly allocated data array that the caller should deal with.
See also
DataArrayInt::findIdsInRange , DataArrayInt::findIdsStricltyNegative

◆ checkAllIdsInRange()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::checkAllIdsInRange ( vmin,
vmax 
) const

This method works only on data array with one component. This method checks that all ids in this are in [ vmin, vmax ). If there is at least one element in this not in [ vmin, vmax ) an exception will be thrown.

Parameters
[in]vminbegin of range. This value is included in range (included).
[in]vmaxend of range. This value is not included in range (excluded).
Returns
if all ids in this are so that (*this)[i]==i for all i in [ 0, this->getNumberOfTuples() ).

◆ Aggregate() [1/2]

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::Aggregate ( const DataArrayType a1,
const DataArrayType a2,
offsetA2 
)
static

Returns a new DataArrayInt by concatenating two given arrays, so that (1) the number of tuples in the result array is a1->getNumberOfTuples() + a2->getNumberOfTuples() - offsetA2 and (2) the number of component in the result array is same as that of each of given arrays. First offsetA2 tuples of a2 are skipped and thus are missing from the result array. Info on components is copied from the first of the given arrays. Number of components in the given arrays must be the same.

Parameters
[in]a1- an array to include in the result array.
[in]a2- another array to include in the result array.
[in]offsetA2- number of tuples of a2 to skip.
Returns
DataArrayInt * - the new instance of DataArrayInt. The caller is to delete this result array using decrRef() as it is no more needed.
Exceptions
Ifeither a1 or a2 is NULL.
Ifa1->getNumberOfComponents() != a2->getNumberOfComponents().

◆ Aggregate() [2/2]

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::Aggregate ( const std::vector< const DataArrayType * > &  arr)
static

Returns a new DataArrayInt by concatenating all given arrays, so that (1) the number of tuples in the result array is a sum of the number of tuples of given arrays and (2) the number of component in the result array is same as that of each of given arrays. Info on components is copied from the first of the given arrays. Number of components in the given arrays must be the same. If the number of non null of elements in arr is equal to one the returned object is a copy of it not the object itself.

Parameters
[in]arr- a sequence of arrays to include in the result array.
Returns
DataArrayInt * - the new instance of DataArrayInt. The caller is to delete this result array using decrRef() as it is no more needed.
Exceptions
Ifall arrays within arr are NULL.
IfgetNumberOfComponents() of arrays within arr.

◆ AggregateIndexes()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::AggregateIndexes ( const std::vector< const DataArrayType * > &  arrs)
static

This method takes as input a list of DataArrayInt instances arrs that represent each a packed index arrays. A packed index array is an allocated array with one component, and at least one tuple. The first element of each array in arrs must be 0. Each array in arrs is expected to be increasingly monotonic. This method is useful for users that want to aggregate a pair of DataArrayInt representing an indexed data (typically nodal connectivity index in unstructured meshes.

Returns
DataArrayInt * - a new object to be managed by the caller.

◆ BuildUnion()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::BuildUnion ( const std::vector< const DataArrayType * > &  arr)
static

Returns a new DataArrayInt which contains all elements of given one-dimensional arrays. The result array does not contain any duplicates and its values are sorted in ascending order.

Parameters
[in]arr- sequence of DataArrayInt's to unite.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifany arr[i] is not allocated.
Ifarr[i]->getNumberOfComponents() != 1.

Referenced by MEDCoupling::DataArrayDiscrete< T >::buildUnion().

◆ BuildIntersection()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::BuildIntersection ( const std::vector< const DataArrayType * > &  arr)
static

Returns a new DataArrayInt which contains elements present in each of given one-dimensional arrays. The result array does not contain any duplicates and its values are sorted in ascending order.

Parameters
[in]arr- sequence of DataArrayInt's to intersect.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifany arr[i] is not allocated.
Ifarr[i]->getNumberOfComponents() != 1.

Referenced by MEDCoupling::DataArrayDiscrete< T >::buildIntersection().

◆ PutIntoToSkylineFrmt()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::PutIntoToSkylineFrmt ( const std::vector< std::vector< T > > &  v,
DataArrayType *&  data,
DataArrayIdType *&  dataIndex 
)
static

This method allows to put a vector of vector of integer into a more compact data structure (skyline). This method is not available into python because no available optimized data structure available to map std::vector< std::vector<mcIdType> >.

Parameters
[in]vthe input data structure to be translate into skyline format.
[out]datathe first element of the skyline format. The user is expected to deal with newly allocated array.
[out]dataIndexthe second element of the skyline format.

◆ buildComplement()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::buildComplement ( mcIdType  nbOfElement) const

Returns a new DataArrayInt which contains a complement of elements of this one-dimensional array. I.e. the result array contains all elements from the range [0, nbOfElement) not present in this array.

Parameters
[in]nbOfElement- maximal size of the result array.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
Ifany element x of this array violates condition ( 0 <= x < nbOfElement ).

◆ buildSubstraction()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::buildSubstraction ( const DataArrayType other) const

Returns a new DataArrayInt containing elements of this one-dimensional missing from an other one-dimensional array.

Parameters
[in]other- a DataArrayInt containing elements not to include in the result array.
Returns
DataArrayInt * - a new instance of DataArrayInt with one component. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifother is NULL.
Ifother is not allocated.
Ifother->getNumberOfComponents() != 1.
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
See also
DataArrayInt::buildSubstractionOptimized()

◆ buildSubstractionOptimized()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::buildSubstractionOptimized ( const DataArrayType other) const

this is expected to have one component and to be sorted ascendingly (as for other). other is expected to be a part of this. If not DataArrayInt::buildSubstraction should be called instead.

Parameters
[in]otheran array with one component and expected to be sorted ascendingly. \ret list of ids in this but not in other.
See also
DataArrayInt::buildSubstraction

◆ buildUnion()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::buildUnion ( const DataArrayType other) const

Returns a new DataArrayInt which contains all elements of this and a given one-dimensional arrays. The result array does not contain any duplicates and its values are sorted in ascending order.

Parameters
[in]other- an array to unite with this one.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis or other is not allocated.
Ifthis->getNumberOfComponents() != 1.
Ifother->getNumberOfComponents() != 1.

References MEDCoupling::DataArrayDiscrete< T >::BuildUnion().

◆ buildIntersection()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::buildIntersection ( const DataArrayType other) const

Returns a new DataArrayInt which contains elements present in both this and a given one-dimensional arrays. The result array does not contain any duplicates and its values are sorted in ascending order.

Parameters
[in]other- an array to intersect with this one.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis or other is not allocated.
Ifthis->getNumberOfComponents() != 1.
Ifother->getNumberOfComponents() != 1.

References MEDCoupling::DataArrayDiscrete< T >::BuildIntersection().

◆ indexOfSameConsecutiveValueGroups()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::indexOfSameConsecutiveValueGroups

This method can be applied on allocated with one component DataArrayInt instance. Locate groups of all consecutive same values in this and return them into an indexed array of positions pointing to this starting with 0. Number of tuples of returned array is equal to size of this->buildUnique() + 1. Last value of returned array is equal to this->getNumberOfTuples()

Example:

  • this : [0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 5, 11]
  • return is : [0, 1, 3, 5, 6, 8, 11, 12]
Returns
a newly allocated array containing the indexed array format of groups by same consecutive value.
Exceptions
ifthis is not allocated or if this has not exactly one component.
See also
DataArrayInt::buildUnique, MEDCouplingSkyLineArray::groupPacks

◆ buildUnique()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::buildUnique

This method can be applied on allocated with one component DataArrayInt instance. This method is typically relevant for sorted arrays. All consecutive duplicated items in this will appear only once in returned DataArrayInt instance. Example : if this contains [1,2,2,3,3,3,3,4,5,5,7,7,7,19] the returned array will contain [1,2,3,4,5,7,19]

Returns
a newly allocated array that contain the result of the unique operation applied on this.
Exceptions
ifthis is not allocated or if this has not exactly one component.
See also
DataArrayInt::buildUniqueNotSorted, DataArrayInt::indexOfSameConsecutiveValueGroups

◆ buildUniqueNotSorted()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::buildUniqueNotSorted

This method can be applied on allocated with one component DataArrayInt instance. This method keep elements only once by keeping the same order in this that is not expected to be sorted.

Returns
a newly allocated array that contain the result of the unique operation applied on this.
Exceptions
ifthis is not allocated or if this has not exactly one component.
See also
DataArrayInt::buildUnique

◆ deltaShiftIndex()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::deltaShiftIndex

Returns a new DataArrayInt which contains size of every of groups described by this "index" array. Such "index" array is returned for example by MEDCouplingUMesh::buildDescendingConnectivity and MEDCouplingUMesh::getNodalConnectivityIndex etc. This method performs the reverse operation of DataArrayInt::computeOffsetsFull.

Returns
DataArrayInt * - a new instance of DataArrayInt, whose number of tuples equals to this->getNumberOfComponents() - 1, and number of components is 1. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
Ifthis->getNumberOfTuples() < 1.

Example:

  • this contains [1,3,6,7,7,9,15]
  • result array contains [2,3,1,0,2,6], where 2 = 3 - 1, 3 = 6 - 3, 1 = 7 - 6 etc.
See also
DataArrayInt::computeOffsetsFull

◆ computeOffsets()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::computeOffsets

Modifies this one-dimensional array so that value of each element x of this array (a) is computed as $ x_i = \sum_{j=0}^{i-1} a[ j ] $. Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number of tuples and components remains the same.
This method is useful for allToAllV in MPI with contiguous policy. This method differs from computeOffsetsFull() in that the number of tuples is not changed by this one.

Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.

Example:

  • Before this contains [3,5,1,2,0,8]
  • After this contains [0,3,8,9,11,11]
    Note that the last element 19 = 11 + 8 is missing because size of this array is retained and thus there is no space to store the last element.

◆ computeOffsetsFull()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::computeOffsetsFull

Modifies this one-dimensional array so that value of each element x of this array (a) is computed as $ x_i = \sum_{j=0}^{i-1} a[ j ] $. Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number components remains the same and number of tuples is inceamented by one.
This method is useful for allToAllV in MPI with contiguous policy. This method differs from computeOffsets() in that the number of tuples is changed by this one. This method performs the reverse operation of DataArrayInt::deltaShiftIndex.

Exceptions
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.

Example:

  • Before this contains [3,5,1,2,0,8]
  • After this contains [0,3,8,9,11,11,19]
    See also
    DataArrayInt::deltaShiftIndex

References MEDCoupling::C_DEALLOC.

◆ findIdsRangesInListOfIds()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::findIdsRangesInListOfIds ( const DataArrayType listOfIds,
DataArrayIdType *&  rangeIdsFetched,
DataArrayType *&  idsInInputListThatFetch 
) const

Returns two new DataArrayInt instances whose contents is computed from that of this and listOfIds arrays as follows. this is expected to be an offset format ( as returned by DataArrayInt::computeOffsetsFull ) that is to say with one component and ** sorted strictly increasingly **. listOfIds is expected to be sorted ascendingly (not strictly needed for listOfIds). This methods searches in this, considered as a set of contiguous this->getNumberOfComponents() ranges, all ids in listOfIds filling completely one of the ranges in this.

Parameters
[in]listOfIdsa list of ids that has to be sorted ascendingly.
[out]rangeIdsFetchedthe range ids fetched
[out]idsInInputListThatFetchcontains the list of ids in listOfIds that are fully included in a range in this. So idsInInputListThatFetch is a part of input listOfIds.
See also
DataArrayInt::computeOffsetsFull

Example:

  • this : [0,3,7,9,15,18]
  • listOfIds contains [0,1,2,3,7,8,15,16,17]
  • rangeIdsFetched result array: [0,2,4]
  • idsInInputListThatFetch result array: [0,1,2,7,8,15,16,17] In this example id 3 in input listOfIds is alone so it do not appear in output idsInInputListThatFetch.

◆ buildExplicitArrByRanges()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::buildExplicitArrByRanges ( const DataArrayType offsets) const

Returns a new DataArrayInt whose contents is computed from that of this and offsets arrays as follows. offsets is a one-dimensional array considered as an "index" array of a "iota" array, thus, whose each element gives an index of a group beginning within the "iota" array. And this is a one-dimensional array considered as a selector of groups described by offsets to include into the result array.

Exceptions
Ifoffsets is NULL.
Ifoffsets is not allocated.
Ifoffsets->getNumberOfComponents() != 1.
Ifoffsets is not monotonically increasing.
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
Ifany element of this is not a valid index for offsets array.

Example:

  • this: [0,2,3]
  • offsets: [0,3,6,10,14,20]
  • result array: [0,1,2,6,7,8,9,10,11,12,13] ==
    range(0,3) + range(6,10) + range(10,14) ==
    range( offsets[ this[0] ], offsets[ this[0]+1 ]) + range( offsets[ this[1] ], offsets[ this[1]+1 ]) + range( offsets[ this[2] ], offsets[ this[2]+1 ])

◆ buildExplicitArrOfSliceOnScaledArr()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::buildExplicitArrOfSliceOnScaledArr ( bg,
stop,
step 
) const

Returns a new DataArrayInt whose contents is computed using this that must be a scaled array (monotonically increasing). from that of this and offsets arrays as follows. offsets is a one-dimensional array considered as an "index" array of a "iota" array, thus, whose each element gives an index of a group beginning within the "iota" array. And this is a one-dimensional array considered as a selector of groups described by offsets to include into the result array.

Exceptions
Ifis NULL.
Ifthis is not allocated.
Ifthis->getNumberOfComponents() != 1.
Ifthis->getNumberOfTuples() == 0.
Ifthis is not monotonically increasing.
Ifany element of ids in ( bg stop step ) points outside the scale in this.

Example:

  • bg , stop and step : (0,5,2)
  • this: [0,3,6,10,14,20]
  • result array: [0,0,0, 2,2,2,2, 4,4,4,4,4,4] ==

References MEDCoupling::DataArrayTools< T >::GetNumberOfItemGivenBESRelative().

◆ findRangeIdForEachTuple()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::findRangeIdForEachTuple ( const DataArrayType ranges) const

Given in input ranges ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than this. For each tuple at place i in this it tells which is the first range in ranges that contains value this->getIJ(i,0) and put the result in tuple i of returned DataArrayInt. If ranges overlapped (in theory it should not) this method do not detect it and always returns the first range.

For example if this contains : [1,24,7,8,10,17] and ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)] The return DataArrayInt will contain : [0,4,1,2,2,3]

Parameters
[in]rangestypically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is for lower value included and 2nd component is the upper value of corresponding range excluded.
Exceptions
Ifoffsets is a null pointer or does not have 2 components or if this is not allocated or this do not have exactly one component. To finish an exception is thrown if no ranges in ranges contains value in this.
See also
DataArrayInt::findIdInRangeForEachTuple

◆ findIdInRangeForEachTuple()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::findIdInRangeForEachTuple ( const DataArrayType ranges) const

Given in input ranges ranges, it returns a newly allocated DataArrayInt instance having one component and the same number of tuples than this. For each tuple at place i in this it tells which is the sub position of the first range in ranges that contains value this->getIJ(i,0) and put the result in tuple i of returned DataArrayInt. If ranges overlapped (in theory it should not) this method do not detect it and always returns the sub position of the first range.

For example if this contains : [1,24,7,8,10,17] and ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)] The return DataArrayInt will contain : [1,2,4,0,2,2] This method is often called in pair with DataArrayInt::findRangeIdForEachTuple method.

Parameters
[in]rangestypically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is for lower value included and 2nd component is the upper value of corresponding range excluded.
Exceptions
Ifoffsets is a null pointer or does not have 2 components or if this is not allocated or this do not have exactly one component. To finish an exception is thrown if no ranges in ranges contains value in this.
See also
DataArrayInt::findRangeIdForEachTuple

◆ sortEachPairToMakeALinkedList()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::sortEachPairToMakeALinkedList

WARNING this method is a non const method. This method works tuple by tuple. Each tuple is expected to be pairs (number of components must be equal to 2). This method rearrange each pair in this so that, tuple with id tid will be after the call this->getIJ(tid,0)==this->getIJ(tid-1,1) and this->getIJ(tid,1)==this->getIJ(tid+1,0). If it is impossible to reach such condition an exception will be thrown ! WARNING In case of throw this can be partially modified ! If this method has correctly worked, this will be able to be considered as a linked list. This method does nothing if number of tuples is lower of equal to 1.

This method is useful for users having an unstructured mesh having only SEG2 to rearrange internally the connectivity without any coordinates consideration.

See also
MEDCouplingUMesh::orderConsecutiveCells1D, DataArrayInt::sortToHaveConsecutivePairs(), DataArrayInt::fromLinkedListOfPairToList

◆ sortToHaveConsecutivePairs()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::sortToHaveConsecutivePairs

This method is the improvement from the method sortEachPairToMakeALinkedList().

See also
MEDCouplingUMesh::orderConsecutiveCells1D, DataArrayInt::sortEachPairToMakeALinkedList(), DataArrayInt::fromLinkedListOfPairToList

◆ fromLinkedListOfPairToList()

template<class T >
MCAuto< typename Traits< T >::ArrayType > MEDCoupling::DataArrayDiscrete< T >::fromLinkedListOfPairToList

this is expected to be a correctly linked list of pairs.

See also
DataArrayInt::sortEachPairToMakeALinkedList

◆ getDifferentValues()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::getDifferentValues

This method returns all different values found in this. This method throws if this has not been allocated. But the number of components can be different from one.

Returns
a newly allocated array (that should be dealt by the caller) containing different values in this.

◆ forThisAsPartitionBuildReduction()

template<class T >
MCAuto< typename DataArrayDiscrete< T >::DataArrayType > MEDCoupling::DataArrayDiscrete< T >::forThisAsPartitionBuildReduction ( const MCAuto< DataArrayIdType > &  commonEntities,
const MCAuto< DataArrayIdType > &  commonEntitiesIndex,
MCAuto< DataArrayType > &  partitionsToBeModified,
MCAuto< DataArrayIdType > &  partitionsToBeModifiedIndex 
) const

this is considered as an array defining a partition. It means that values in this define partition-ids. All tuples in this with same value can be considered as partition. Typically MED stores families uses this compact storage method.

This method computes and returns the partition stored in this on reduced space using a reduction operation specified by pairs commonEntities and commonEntitiesIndex parameters. The reduction operation is the consequence of a fusion of enties. It explains the storage format defining reduction.

An another way to consider this method : This method can be seen as an interpolation on integer field (this). For fused entities it returns in compact way all combinations of partition configuration.

Parameters
[out]partitionsToBeModified- For all partitions impacted by the reduction a n-uplet is returned (n is deduced thanks to partitionsToBeModifiedIndex) Each n-uplet represents a list of partitions impacted by reduction. The first element of n-uplet represents the ID to locate entities (using for example findIdsEqual in returned array) Remaining IDs in n-uplet are Partition IDs impacted.
[out]partitionsToBeModifiedIndex- Index attached to partitionsToBeModified to interprete.
Returns
- The partition array that is the output of the reduction of this.
See also
MEDCouplingUMesh::findCommonCells, DataArrayDouble::findCommonTuples

References MEDCoupling::PartitionCfg< T >::getID(), and MEDCoupling::PartitionCfg< T >::setID().

◆ fromListOfPairsToIndexArray()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::fromListOfPairsToIndexArray ( MCAuto< DataArrayType > &  arrOut,
MCAuto< DataArrayIdType > &  arrIndexOut 
) const

This method constructs for a list of pairs of ids in this to a pair arr,arrIndex (typically followed by a ConvertIndexArrayToO2N call). This method is useful to convert in context of // computing to move to global ids approach.

this is expected to be a 2 components array.

Example:

  • this : [0,3, 5,4, 0,7]
  • arrOut : [ 0,3,7, 4,5 ]
  • arrIndexOut : [0,3,5]
See also
ConvertIndexArrayToO2N

◆ partitionByDifferentValues()

template<class T >
std::vector< DataArrayIdType * > MEDCoupling::DataArrayDiscrete< T >::partitionByDifferentValues ( std::vector< T > &  differentIds) const

This method is a refinement of DataArrayInt::getDifferentValues because it returns not only different values in this but also, for each of them it tells which tuple id have this id. This method works only on arrays with one component (if it is not the case call DataArrayInt::rearrange(1) ). This method returns two arrays having same size. The instances of DataArrayInt in the returned vector have be specially allocated and computed by this method. Each of them should be dealt by the caller of this method. Example : if this is equal to [1,0,1,2,0,2,2,-3,2] -> differentIds=[-3,0,1,2] and returned array will be equal to [[7],[1,4],[0,2],[3,5,6,8]]

◆ splitInBalancedSlices()

template<class T >
std::vector< std::pair< mcIdType, mcIdType > > MEDCoupling::DataArrayDiscrete< T >::splitInBalancedSlices ( mcIdType  nbOfSlices) const

This method split ids in [0, this->getNumberOfTuples() ) using this array as a field of weight (>=0 each). The aim of this method is to return a set of nbOfSlices chunk of contiguous ids as balanced as possible.

Parameters
[in]nbOfSlices- number of slices expected.
Returns
- a vector having a size equal to nbOfSlices giving the start (included) and the stop (excluded) of each chunks.
See also
DataArray::GetSlice
Exceptions
Ifthis is not allocated or not with exactly one component.
Ifan element in this if < 0.

◆ Modulus()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::Modulus ( const DataArrayType a1,
const DataArrayType a2 
)
static

Returns a new DataArrayInt that is a modulus of two given arrays. There are 3 valid cases.

  1. The arrays have same number of tuples and components. Then each value of the result array (a) is a division of the corresponding values of a1 and a2, i.e.: a [ i, j ] = a1 [ i, j ] % a2 [ i, j ].
  2. The arrays have same number of tuples and one array, say a2, has one component. Then a [ i, j ] = a1 [ i, j ] % a2 [ i, 0 ].
  3. The arrays have same number of components and one array, say a2, has one tuple. Then a [ i, j ] = a1 [ i, j ] % a2 [ 0, j ].

Info on components is copied either from the first array (in the first case) or from the array with maximal number of elements (getNbOfElems()).

Warning
No check of division by zero is performed!
Parameters
[in]a1- a dividend array.
[in]a2- a divisor array.
Returns
DataArrayInt * - the new instance of DataArrayInt. The caller is to delete this result array using decrRef() as it is no more needed.
Exceptions
Ifeither a1 or a2 is NULL.
Ifa1->getNumberOfTuples() != a2->getNumberOfTuples() and a1->getNumberOfComponents() != a2->getNumberOfComponents() and none of them has number of tuples or components equal to 1.

◆ modulusEqual()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::modulusEqual ( const DataArrayType other)

Modify this array so that each value becomes a modulus of division of this value by a value of another DataArrayInt. There are 3 valid cases.

  1. The arrays have same number of tuples and components. Then each value of this array is divided by the corresponding value of other one, i.e.: a [ i, j ] %= other [ i, j ].
  2. The arrays have same number of tuples and other array has one component. Then a [ i, j ] %= other [ i, 0 ].
  3. The arrays have same number of components and other array has one tuple. Then a [ i, j ] %= a2 [ 0, j ].

    Warning
    No check of division by zero is performed!
    Parameters
    [in]other- a divisor array.
    Exceptions
    Ifother is NULL.
    Ifthis->getNumberOfTuples() != other->getNumberOfTuples() and this->getNumberOfComponents() != other->getNumberOfComponents() and other has number of both tuples and components not equal to 1.

◆ Pow()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::Pow ( const DataArrayType a1,
const DataArrayType a2 
)
static

Returns a new DataArrayInt that is the result of pow of two given arrays. There are 3 valid cases.

Parameters
[in]a1- an array to pow up.
[in]a2- another array to sum up.
Returns
DataArrayInt * - the new instance of DataArrayInt. The caller is to delete this result array using decrRef() as it is no more needed.
Exceptions
Ifeither a1 or a2 is NULL.
Ifa1->getNumberOfTuples() != a2->getNumberOfTuples()
Ifa1->getNumberOfComponents() != 1 or a2->getNumberOfComponents() != 1.
Ifthere is a negative value in a2.

◆ powEqual()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::powEqual ( const DataArrayType other)

Apply pow on values of another DataArrayInt to values of this one.

Parameters
[in]other- an array to pow to this one.
Exceptions
Ifother is NULL.
Ifthis->getNumberOfTuples() != other->getNumberOfTuples()
Ifthis->getNumberOfComponents() != 1 or other->getNumberOfComponents() != 1
Ifthere is a negative value in other.

◆ findCommonTuplesAlg()

template<class T >
template<int SPACEDIM>
void MEDCoupling::DataArrayDiscrete< T >::findCommonTuplesAlg ( const T *  bbox,
mcIdType  nbNodes,
mcIdType  limitNodeId,
DataArrayIdType *  c,
DataArrayIdType *  cI 
) const

◆ FindPermutationFromFirstToSecond()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::FindPermutationFromFirstToSecond ( const DataArrayType ids1,
const DataArrayType ids2 
)
static

This method tries to find the permutation to apply to the first input ids1 to obtain the same array (without considering strings information) the second input array ids2. ids1 and ids2 are expected to be both a list of ids (both with number of components equal to one) not sorted and with values that can be negative. This method will throw an exception is no such permutation array can be obtained. It is typically the case if there is some ids in ids1 not in ids2 or inversely. In case of success both assertion will be true (no throw) : ids1->renumber(ret)->isEqual(ids2) where ret is the return of this method. ret->transformWithIndArr(ids2)->isEqual(ids1)

Example:

  • ids1 : [3,1,103,4,6,10,-7,205]
  • ids2 : [-7,1,205,10,6,3,103,4]
  • return is : [5,1,6,7,4,3,0,2] because ids2[5]==ids1[0], ids2[1]==ids1[1], ids2[6]==ids1[2]...
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifeither ids1 or ids2 is null not allocated or not with one components.
See also
DataArrayInt::findIdForEach, DataArrayInt::FindPermutationFromFirstToSecondDuplicate, DataArrayInt::rankOfElementInThis

◆ FindPermutationFromFirstToSecondDuplicate()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::FindPermutationFromFirstToSecondDuplicate ( const DataArrayType ids1,
const DataArrayType ids2 
)
static

This method tries to find the permutation to apply to the first input ids1 to obtain the same array (without considering strings information) the second input array ids2. ids1 and ids2 are expected to be both a list of ids (both with number of components equal to one) not sorted and with values that can be negative. This method will throw an exception is no such permutation array can be obtained. It is typically the case if there is some ids in ids1 not in ids2 or inversely. The difference with DataArrayInt::FindPermutationFromFirstToSecond is that this method supports multiple same values in ids1 and ids2 whereas DataArrayInt::FindPermutationFromFirstToSecond doesn't. It implies that this method my be slower than the DataArrayInt::FindPermutationFromFirstToSecond one.

In case of success both assertion will be true (no throw) : ids1->renumber(ret)->isEqual(ids2) where ret is the return of this method. ret->transformWithIndArr(ids2)->isEqual(ids1)

Example:

  • ids1 : [5, 3, 2, 1, 4, 5, 2, 1, 0, 11, 5, 4]
  • ids2 : [0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 5, 11]
  • return is : [8, 5, 3, 1, 6, 9, 4, 2, 0, 11, 10, 7] because ids2[8]==ids1[0], ids2[5]==ids1[1], ids2[3]==ids1[2], ids2[1]==ids1[3]...
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifeither ids1 or ids2 is null not allocated or not with one components.
See also
DataArrayInt::findIdForEach, DataArrayInt::FindPermutationFromFirstToSecond, DataArrayInt::occurenceRankInThis

◆ CheckAndPreparePermutation()

template<class T >
mcIdType * MEDCoupling::DataArrayDiscrete< T >::CheckAndPreparePermutation ( const T *  start,
const T *  end 
)
static

Returns a C array which is a renumbering map in "Old to New" mode for the input array. This map, if applied to start array, would make it sorted. For example, if start array contents are [9,10,0,6,4,11,3,7] then the contents of the result array is [5,6,0,3,2,7,1,4].

Parameters
[in]start- pointer to the first element of the array for which the permutation map is computed.
[in]end- pointer specifying the end of the array start, so that the last value of start is end[ -1 ].
Returns
mcIdType * - the result permutation array that the caller is to delete as it is no more needed.
Exceptions
Ifthere are equal values in the input array.

◆ BuildListOfSwitchedOn()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::BuildListOfSwitchedOn ( const std::vector< bool > &  v)
static

This method returns the list of ids in ascending mode so that v[id]==true.

◆ BuildListOfSwitchedOff()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::BuildListOfSwitchedOff ( const std::vector< bool > &  v)
static

This method returns the list of ids in ascending mode so that v[id]==false.

◆ ConvertIndexArrayToO2N()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::ConvertIndexArrayToO2N ( mcIdType  nbOfOldTuples,
const mcIdType *  arr,
const mcIdType *  arrIBg,
const mcIdType *  arrIEnd,
mcIdType &  newNbOfTuples 
)
static

Returns a new DataArrayInt containing a renumbering map in "Old to New" mode computed from a zip representation of a surjective format (returned e.g. by DataArrayDouble::findCommonTuples() for example). The result array minimizes the permutation.
For more info on renumbering see Array indexing and numbering.
Example:

  • nbOfOldTuples: 10
  • arr : [0,3, 5,7,9]
  • arrIBg : [0,2,5]
  • newNbOfTuples: 7
  • result array : [0,1,2,0,3,4,5,4,6,4]
Parameters
[in]nbOfOldTuples- number of tuples in the initial array arr.
[in]arr- the array of tuple indices grouped by arrIBg array.
[in]arrIBg- the array dividing all indices stored in arr into groups of (indices of) equal values. Its every element (except the last one) points to the first element of a group of equal values.
[in]arrIEnd- specifies the end of arrIBg, so that the last element of arrIBg is arrIEnd[ -1 ].
[out]newNbOfTuples- number of tuples after surjection application.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifany value of arr breaks condition ( 0 <= arr[ i ] < nbOfOldTuples ).

◆ MakePartition()

template<class T >
DataArrayIdType * MEDCoupling::DataArrayDiscrete< T >::MakePartition ( const std::vector< const DataArrayType * > &  groups,
mcIdType  newNb,
std::vector< std::vector< mcIdType > > &  fidsOfGroups 
)
static

Returns a new DataArrayInt which is a minimal partition of elements of groups. The i-th item of the result array is an ID of a set of elements belonging to a unique set of groups, which the i-th element is a part of. This set of elements belonging to a unique set of groups is called family, so the result array contains IDs of families each element belongs to.

Example: if we have two groups of elements: group1 [0,4] and group2 [ 0,1,2 ], then there are 3 families:

  • family1 (with ID 1) contains element [0] belonging to ( group1 + group2 ),
  • family2 (with ID 2) contains elements [4] belonging to ( group1 ),
  • family3 (with ID 3) contains element [1,2] belonging to ( group2 ),
    and the result array contains IDs of families [ 1,3,3,0,2 ].
    Note a family ID 0 which stands for the element #3 which is in none of groups.
Parameters
[in]groups- sequence of groups of element IDs.
[in]newNb- total number of elements; it must be more than max ID of element in groups.
[out]fidsOfGroups- IDs of families the elements of each group belong to.
Returns
DataArrayInt * - a new instance of DataArrayInt containing IDs of families each element with ID from range [0, newNb ) belongs to. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifany element ID in groups violates condition ( 0 <= ID < newNb ).

◆ ExtractFromIndexedArrays()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::ExtractFromIndexedArrays ( const mcIdType *  idsOfSelectBg,
const mcIdType *  idsOfSelectEnd,
const DataArrayType arrIn,
const DataArrayIdType *  arrIndxIn,
DataArrayType *&  arrOut,
DataArrayIdType *&  arrIndexOut 
)
static

This method works on a pair input (arrIn, arrIndxIn) where arrIn indexes is in arrIndxIn (Indirect indexing). This method returns the result of the extraction ( specified by a set of ids in [idsOfSelectBg , idsOfSelectEnd ) ). The selection of extraction is done standardly in new2old format. This method returns indexed arrays (Indirect indexing) using 2 arrays (arrOut,arrIndexOut).

Parameters
[in]idsOfSelectBgbegin of set of ids of the input extraction (included)
[in]idsOfSelectEndend of set of ids of the input extraction (excluded)
[in]arrInarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[out]arrOutthe resulting array
[out]arrIndexOutthe index array of the resulting array arrOut
See also
DataArrayInt::ExtractFromIndexedArraysSlice

◆ ExtractFromIndexedArraysSlice()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::ExtractFromIndexedArraysSlice ( mcIdType  idsOfSelectStart,
mcIdType  idsOfSelectStop,
mcIdType  idsOfSelectStep,
const DataArrayType arrIn,
const DataArrayIdType *  arrIndxIn,
DataArrayType *&  arrOut,
DataArrayIdType *&  arrIndexOut 
)
static

This method works on a pair input (arrIn, arrIndxIn) where arrIn indexes is in arrIndxIn (Indirect indexing). This method returns the result of the extraction ( specified by a set of ids with a slice given by idsOfSelectStart, idsOfSelectStop and idsOfSelectStep ). The selection of extraction is done standardly in new2old format. This method returns indexed arrays (Indirect indexing) using 2 arrays (arrOut,arrIndexOut).

Parameters
[in]idsOfSelectStartbegin of set of ids of the input extraction (included)
[in]idsOfSelectStopend of set of ids of the input extraction (excluded)
[in]idsOfSelectStepstep of set of ids of the input extraction
[in]arrInarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[out]arrOutthe resulting array
[out]arrIndexOutthe index array of the resulting array arrOut
See also
DataArrayInt::ExtractFromIndexedArrays

References MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative().

◆ SetPartOfIndexedArrays()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::SetPartOfIndexedArrays ( const mcIdType *  idsOfSelectBg,
const mcIdType *  idsOfSelectEnd,
const DataArrayType arrIn,
const DataArrayIdType *  arrIndxIn,
const DataArrayType srcArr,
const DataArrayIdType *  srcArrIndex,
DataArrayType *&  arrOut,
DataArrayIdType *&  arrIndexOut 
)
static

This method works on an input pair (arrIn, arrIndxIn) where arrIn indexes is in arrIndxIn. This method builds an output pair (arrOut,arrIndexOut) that is a copy from arrIn for all cell ids not in [ idsOfSelectBg , idsOfSelectEnd ) and for cellIds in [ idsOfSelectBg , idsOfSelectEnd ) a copy coming from the corresponding values in input pair (srcArr, srcArrIndex). This method is an generalization of MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx that performs the same thing but by without building explicitly a result output arrays.

Parameters
[in]idsOfSelectBgbegin of set of ids of the input extraction (included)
[in]idsOfSelectEndend of set of ids of the input extraction (excluded)
[in]arrInarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[in]srcArrinput array that will be used as source of copy for ids in [ idsOfSelectBg, idsOfSelectEnd )
[in]srcArrIndexindex array of srcArr
[out]arrOutthe resulting array
[out]arrIndexOutthe index array of the resulting array arrOut
See also
DataArrayInt::SetPartOfIndexedArraysSameIdx

◆ SetPartOfIndexedArraysSlice()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::SetPartOfIndexedArraysSlice ( mcIdType  start,
mcIdType  end,
mcIdType  step,
const DataArrayType arrIn,
const DataArrayIdType *  arrIndxIn,
const DataArrayType srcArr,
const DataArrayIdType *  srcArrIndex,
DataArrayType *&  arrOut,
DataArrayIdType *&  arrIndexOut 
)
static

This method works on an input pair (arrIn, arrIndxIn) where arrIn indexes is in arrIndxIn. This method builds an output pair (arrOut,arrIndexOut) that is a copy from arrIn for all cell ids not in [ idsOfSelectBg , idsOfSelectEnd ) and for cellIds in [idsOfSelectBg, idsOfSelectEnd) a copy coming from the corresponding values in input pair (srcArr, srcArrIndex). This method is an generalization of DataArrayInt::SetPartOfIndexedArraysSameIdx that performs the same thing but by without building explicitly a result output arrays.

Parameters
[in]startbegin of set of ids of the input extraction (included)
[in]endend of set of ids of the input extraction (excluded)
[in]stepstep of the set of ids in range mode.
[in]arrInarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[in]srcArrinput array that will be used as source of copy for ids in [idsOfSelectBg, idsOfSelectEnd)
[in]srcArrIndexindex array of srcArr
[out]arrOutthe resulting array
[out]arrIndexOutthe index array of the resulting array arrOut
See also
DataArrayInt::SetPartOfIndexedArraysSameIdx DataArrayInt::SetPartOfIndexedArrays

References MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(), and MEDCoupling::DataArray::GetPosOfItemGivenBESRelativeNoThrow().

◆ SetPartOfIndexedArraysSameIdx()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::SetPartOfIndexedArraysSameIdx ( const mcIdType *  idsOfSelectBg,
const mcIdType *  idsOfSelectEnd,
DataArrayType arrInOut,
const DataArrayIdType *  arrIndxIn,
const DataArrayType srcArr,
const DataArrayIdType *  srcArrIndex 
)
static

This method works on an input pair (arrIn, arrIndxIn) where arrIn indexes is in arrIndxIn. This method is an specialization of MEDCouplingUMesh::SetPartOfIndexedArrays in the case of assignment do not modify the index in arrIndxIn.

Parameters
[in]idsOfSelectBgbegin of set of ids of the input extraction (included)
[in]idsOfSelectEndend of set of ids of the input extraction (excluded)
[in,out]arrInOutarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[in]srcArrinput array that will be used as source of copy for ids in [ idsOfSelectBg , idsOfSelectEnd )
[in]srcArrIndexindex array of srcArr
See also
DataArrayInt::SetPartOfIndexedArrays

◆ SetPartOfIndexedArraysSameIdxSlice()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::SetPartOfIndexedArraysSameIdxSlice ( mcIdType  start,
mcIdType  end,
mcIdType  step,
DataArrayType arrInOut,
const DataArrayIdType *  arrIndxIn,
const DataArrayType srcArr,
const DataArrayIdType *  srcArrIndex 
)
static

This method works on an input pair (arrIn, arrIndxIn) where arrIn indexes is in arrIndxIn. This method is an specialization of MEDCouplingUMesh::SetPartOfIndexedArrays in the case of assignment do not modify the index in arrIndxIn.

Parameters
[in]startbegin of set of ids of the input extraction (included)
[in]endend of set of ids of the input extraction (excluded)
[in]stepstep of the set of ids in range mode.
[in,out]arrInOutarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[in]srcArrinput array that will be used as source of copy for ids in [idsOfSelectBg, idsOfSelectEnd)
[in]srcArrIndexindex array of srcArr
See also
DataArrayInt::SetPartOfIndexedArraysSlice DataArrayInt::SetPartOfIndexedArraysSameIdx

References MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative().

◆ RemoveIdsFromIndexedArrays()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::RemoveIdsFromIndexedArrays ( const T *  idsToRemoveBg,
const T *  idsToRemoveEnd,
DataArrayType arr,
DataArrayIdType *  arrIndx,
mcIdType  offsetForRemoval = 0 
)
static

This method works on an input pair (arr, arrIndx) where arr indexes is in arrIndx. This method will not impact the size of inout parameter arrIndx but the size of arr will be modified in case of suppression.

Parameters
[in]idsToRemoveBgbegin of set of ids to remove in arr (included)
[in]idsToRemoveEndend of set of ids to remove in arr (excluded)
[in,out]arrarray in which the remove operation will be done.
[in,out]arrIndxarray in the remove operation will modify
[in]offsetForRemoval(by default 0) offset so that for each i in [0,arrIndx->getNumberOfTuples()-1) removal process will be performed in the following range [arr+arrIndx[i]+offsetForRemoval,arr+arr[i+1])
Returns
true if arr and arrIndx have been modified, false if not.

◆ FromVTKInternalReprOfPolyedra()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::FromVTKInternalReprOfPolyedra ( const DataArrayType arrIn,
const DataArrayIdType *  arrIndxIn,
MCAuto< DataArrayType > &  arrOut,
MCAuto< DataArrayIdType > &  arrIndexOut 
)
static

This method converts from VTK <= 9.3 polyhedra nodal connectivity to MED.

Parameters
[in]arrInarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[out]arrOutthe resulting array
[out]arrIndexOutthe index array of the resulting array arrOut
See also
DataArrayDiscrete<T>::FromVTK93To94FacesInternaReprOfPolyedra

◆ FromVTK94InternalReprOfPolyedra()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::FromVTK94InternalReprOfPolyedra ( const DataArrayType arrIn,
const DataArrayIdType *  arrIndxIn,
const DataArrayIdType *  arrIndxIn2,
MCAuto< DataArrayType > &  arrOut,
MCAuto< DataArrayIdType > &  arrIndexOut 
)
static

This method converts from VTK >= 9.4 polyhedra nodal connectivity to MED.

Parameters
[in]arrInarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[in]arrIndxIn2is the input index array telling which is the faces id range in arrIndxIn of poly
[out]arrOutthe resulting array
[out]arrIndexOutthe index array of the resulting array arrOut
See also
DataArrayDiscrete<T>::FromVTK93To94FacesInternaReprOfPolyedra

◆ FromVTK93To94FacesInternaReprOfPolyedra()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::FromVTK93To94FacesInternaReprOfPolyedra ( const DataArrayType arrIn,
const DataArrayIdType *  arrIndxIn,
MCAuto< DataArrayType > &  arrOut,
MCAuto< DataArrayIdType > &  arrIndexOut 
)
static

This method converts from VTK 9.3 polyhedra nodal connectivity to faces connectivity compatible with MEDCoupling1DGTUMesh(NORM_POLYGON).

Parameters
[in]arrInarr origin array from which the extraction will be done.
[in]arrIndxInis the input index array allowing to walk into arrIn
[out]arrOutthe resulting array
[out]arrIndexOutthe index array of the resulting array arrOut
See also
DataArrayDiscrete<T>::FromVTKInternalReprOfPolyedra

◆ Range()

template<class T >
Traits< T >::ArrayType * MEDCoupling::DataArrayDiscrete< T >::Range ( begin,
end,
step 
)
static

Returns a new DataArrayInt containing an arithmetic progression that is equal to the sequence returned by Python range(begin,end,step ) function.

Parameters
[in]begin- the start value of the result sequence.
[in]end- limiting value, so that every value of the result array is less than end.
[in]step- specifies the increment or decrement.
Returns
DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this array using decrRef() as it is no more needed.
Exceptions
Ifstep == 0.
Ifend < begin && step > 0.
Ifend > begin && step < 0.

References MEDCoupling::DataArrayTools< T >::GetNumberOfItemGivenBESRelative().

◆ getTinySerializationIntInformation()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::getTinySerializationIntInformation ( std::vector< mcIdType > &  tinyInfo) const

Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. Server side.

◆ getTinySerializationStrInformation()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::getTinySerializationStrInformation ( std::vector< std::string > &  tinyInfo) const

Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. Server side.

◆ resizeForUnserialization()

template<class T >
bool MEDCoupling::DataArrayDiscrete< T >::resizeForUnserialization ( const std::vector< mcIdType > &  tinyInfoI)

Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. This method returns if a feeding is needed.

◆ finishUnserialization()

template<class T >
void MEDCoupling::DataArrayDiscrete< T >::finishUnserialization ( const std::vector< mcIdType > &  tinyInfoI,
const std::vector< std::string > &  tinyInfoS 
)

Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. This method returns if a feeding is needed.

◆ switchOnTupleAlg()

template<class T >
template<class ALG >
void MEDCoupling::DataArrayDiscrete< T >::switchOnTupleAlg ( val,
std::vector< bool > &  vec,
ALG  algo 
) const
protected