-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// Author : Anthony Geay (EDF R&D)
-#ifndef __PARAMEDMEM_MEDCOUPLINGPARTDEFINITION_HXX__
-#define __PARAMEDMEM_MEDCOUPLINGPARTDEFINITION_HXX__
+#pragma once
#include "MEDCoupling.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
-namespace ParaMEDMEM
+namespace MEDCoupling
{
class PartDefinition : public RefCountObject, public TimeLabel
{
public:
- MEDCOUPLING_EXPORT static PartDefinition *New(int start, int stop, int step);
- MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayInt *listOfIds);
- MEDCOUPLING_EXPORT virtual DataArrayInt *toDAI() const = 0;
- MEDCOUPLING_EXPORT virtual int getNumberOfElems() const = 0;
+ MEDCOUPLING_EXPORT static PartDefinition *New(mcIdType start, mcIdType stop, mcIdType step);
+ MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayIdType *listOfIds);
+ MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
+ MEDCOUPLING_EXPORT virtual bool isEqual(const PartDefinition *other, std::string& what) const = 0;
+ MEDCOUPLING_EXPORT virtual PartDefinition *deepCopy() const = 0;
+ MEDCOUPLING_EXPORT virtual DataArrayIdType *toDAI() const = 0;
+ MEDCOUPLING_EXPORT virtual mcIdType getNumberOfElems() const = 0;
MEDCOUPLING_EXPORT virtual PartDefinition *operator+(const PartDefinition& other) const = 0;
MEDCOUPLING_EXPORT virtual std::string getRepr() const = 0;
MEDCOUPLING_EXPORT virtual PartDefinition *composeWith(const PartDefinition *other) const = 0;
- MEDCOUPLING_EXPORT virtual void checkCoherency() const = 0;
+ MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0;
MEDCOUPLING_EXPORT virtual PartDefinition *tryToSimplify() const = 0;
+ MEDCOUPLING_EXPORT virtual void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const = 0;
protected:
virtual ~PartDefinition();
};
class DataArrayPartDefinition : public PartDefinition
{
public:
- MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayInt *listOfIds);
- MEDCOUPLING_EXPORT DataArrayInt *toDAI() const;
- MEDCOUPLING_EXPORT int getNumberOfElems() const;
+ MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayIdType *listOfIds);
+ MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("DataArrayPartDefinition"); }
+ MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const;
+ MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const;
MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const;
MEDCOUPLING_EXPORT std::string getRepr() const;
MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const;
- MEDCOUPLING_EXPORT void checkCoherency() const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const;
+ MEDCOUPLING_EXPORT void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
private:
- DataArrayPartDefinition(DataArrayInt *listOfIds);
+ DataArrayPartDefinition(DataArrayIdType *listOfIds);
void checkInternalArrayOK() const;
- static void CheckInternalArrayOK(const DataArrayInt *listOfIds);
+ static void CheckInternalArrayOK(const DataArrayIdType *listOfIds);
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
DataArrayPartDefinition *add2(const SlicePartDefinition *other) const;
virtual ~DataArrayPartDefinition();
private:
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _arr;
+ MCAuto<DataArrayIdType> _arr;
};
class SlicePartDefinition : public PartDefinition
{
public:
- MEDCOUPLING_EXPORT static SlicePartDefinition *New(int start, int stop, int step);
- MEDCOUPLING_EXPORT DataArrayInt *toDAI() const;
- MEDCOUPLING_EXPORT int getNumberOfElems() const;
+ MEDCOUPLING_EXPORT static SlicePartDefinition *New(mcIdType start, mcIdType stop, mcIdType step);
+ MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("SlicePartDefinition"); }
+ MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const;
+ MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const;
+ MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const;
+ MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const;
MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const;
MEDCOUPLING_EXPORT std::string getRepr() const;
MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const;
- MEDCOUPLING_EXPORT void checkCoherency() const;
+ MEDCOUPLING_EXPORT void checkConsistencyLight() const;
MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const;
+ MEDCOUPLING_EXPORT void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
//specific method
- MEDCOUPLING_EXPORT int getEffectiveStop() const;
- MEDCOUPLING_EXPORT void getSlice(int& start, int& stop, int& step) const;
+ MEDCOUPLING_EXPORT mcIdType getEffectiveStop() const;
+ MEDCOUPLING_EXPORT void getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const;
private:
- SlicePartDefinition(int start, int stop, int step);
+ SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step);
MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
PartDefinition *add2(const SlicePartDefinition *other) const;
virtual ~SlicePartDefinition();
private:
- int _start;
- int _stop;
- int _step;
+ mcIdType _start;
+ mcIdType _stop;
+ mcIdType _step;
};
}
-
-#endif