From: Anthony GEAY Date: Wed, 23 Sep 2020 20:23:59 +0000 (+0200) Subject: WIP X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3ca51807786a3616e932f5ef90fc1ecac2052c1c;p=tools%2Fmedcoupling.git WIP --- diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index f671fa41b..b7b634fdb 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -3971,6 +3971,7 @@ namespace MEDCoupling %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT; class MEDCouplingFieldInt32; + class MEDCouplingFieldInt64; class MEDCouplingFieldFloat; class MEDCouplingFieldDouble : public MEDCouplingFieldT @@ -5284,6 +5285,108 @@ namespace MEDCoupling } }; + class MEDCouplingFieldInt64 : public MEDCouplingFieldT + { + public: + static MEDCouplingFieldInt64 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); + static MEDCouplingFieldInt64 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); + bool isEqual(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const; + bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const; + void setTimeUnit(const std::string& unit); + std::string getTimeUnit() const; + void setTime(double val, int iteration, int order); + void setArray(DataArrayInt64 *array); + MEDCouplingFieldInt64 *deepCopy() const; + MEDCouplingFieldInt64 *clone(bool recDeepCpy) const; + MEDCouplingFieldInt64 *cloneWithMesh(bool recDeepCpy) const; + MEDCouplingFieldDouble *convertToDblField() const; + MEDCouplingFieldInt64 *buildSubPartRange(int begin, int end, int step) const; + %extend { + MEDCouplingFieldInt64(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME) + { + return MEDCouplingFieldInt64::New(type,td); + } + + MEDCouplingFieldInt64(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME) + { + return MEDCouplingFieldInt64::New(ft,td); + } + + PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt64 *other, double meshPrec, int valsPrec) const + { + std::string ret1; + bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1); + PyObject *ret=PyTuple_New(2); + PyObject *ret0Py=ret0?Py_True:Py_False; + Py_XINCREF(ret0Py); + PyTuple_SetItem(ret,0,ret0Py); + PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); + return ret; + } + + std::string __str__() const + { + return self->simpleRepr(); + } + + std::string __repr__() const + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } + + MEDCouplingFieldInt64 *buildSubPart(PyObject *li) const + { + return fieldT_buildSubPart(self,li); + } + + MEDCouplingFieldInt64 *__getitem__(PyObject *li) const + { + return fieldT__getitem__(self,li); + } + + DataArrayInt64 *getArray() + { + DataArrayInt64 *ret=self->getArray(); + if(ret) + ret->incrRef(); + return ret; + } + + PyObject *getTime() + { + int tmp1,tmp2; + double tmp0=self->getTime(tmp1,tmp2); + PyObject *res = PyList_New(3); + PyList_SetItem(res,0,SWIG_From_double(tmp0)); + PyList_SetItem(res,1,SWIG_From_int(tmp1)); + PyList_SetItem(res,2,SWIG_From_int(tmp2)); + return res; + } + + PyObject *getTinySerializationInformation() const + { + return field_getTinySerializationInformation(self); + } + + PyObject *serialize() const + { + return field_serialize(self); + } + + PyObject *__getstate__() const + { + return field__getstate__(self,MEDCoupling_MEDCouplingFieldInt64_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt64_serialize); + } + + void __setstate__(PyObject *inp) + { + field__setstate__(self,inp); + } + } + }; + class MEDCouplingFieldFloat : public MEDCouplingFieldT { public: @@ -6005,6 +6108,10 @@ def MEDCouplingFieldInt32Reduce(self): self.checkConsistencyLight() d=(self.getTypeOfField(),self.getTimeDiscretization()) return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt32,(d,(self.__getstate__()),)) +def MEDCouplingFieldInt64Reduce(self): + self.checkConsistencyLight() + d=(self.getTypeOfField(),self.getTimeDiscretization()) + return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt64,(d,(self.__getstate__()),)) def MEDCouplingFieldFloatReduce(self): self.checkConsistencyLight() d=(self.getTypeOfField(),self.getTimeDiscretization()) @@ -6027,10 +6134,9 @@ def MEDCouplingFieldTemplateReduce(self): MEDCouplingUMesh.ExtractFromIndexedArrays = DataArrayInt.ExtractFromIndexedArrays MEDCouplingUMesh.ExtractFromIndexedArraysSlice = DataArrayInt.ExtractFromIndexedArraysSlice MEDCouplingUMesh.SetPartOfIndexedArrays = DataArrayInt.SetPartOfIndexedArrays -##MEDCouplingUMesh.SetPartOfIndexedArraysSlice = DataArrayInt.SetPartOfIndexedArraysSlice MEDCouplingUMesh.SetPartOfIndexedArraysSameIdx = DataArrayInt.SetPartOfIndexedArraysSameIdx MEDCouplingUMesh.RemoveIdsFromIndexedArrays = DataArrayInt.RemoveIdsFromIndexedArrays -##MEDCouplingUMesh.SetPartOfIndexedArraysSameIdxSlice = DataArrayInt.SetPartOfIndexedArraysSameIdxSlice +MEDCouplingFieldInt = MEDCouplingFieldInt32 %} diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index c2f2f2f40..94c0ad0f8 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -136,6 +136,8 @@ static PyObject *convertField(MEDCoupling::MEDCouplingField *f, int owner) ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,owner); if(dynamic_cast(f)) ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldInt32,owner); + if(dynamic_cast(f)) + ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldInt64,owner); if(dynamic_cast(f)) ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldFloat,owner); if(!ret) diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index 085a6d6a8..6d723d614 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -2612,7 +2612,7 @@ std::vector< std::vector > MEDFileField1TS::getFieldSplitedBy //= MEDFileIntField1TS -MCAuto MEDFileIntField1TS::ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f) +MCAuto MEDFileIntField1TS::ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt32 *f) { if(!f) throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ConvertFieldIntToFieldDouble : null input field !"); diff --git a/src/MEDLoader/MEDFileField1TS.hxx b/src/MEDLoader/MEDFileField1TS.hxx index 5784c02aa..7f931f14b 100644 --- a/src/MEDLoader/MEDFileField1TS.hxx +++ b/src/MEDLoader/MEDFileField1TS.hxx @@ -431,7 +431,7 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileIntField1TS *shallowCpy() const { return new MEDFileIntField1TS(*this); } MEDLOADER_EXPORT std::string getClassName() const override { return std::string("MEDFileIntField1TS"); } public: - MEDLOADER_EXPORT static MCAuto ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt *f); + MEDLOADER_EXPORT static MCAuto ConvertFieldIntToFieldDouble(const MEDCouplingFieldInt32 *f); private: med_field_type getMEDFileFieldType() const { return MED_INT32; } private: