X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingCommon.i;h=1fca14d4b4fcfadffd5abb6d42fa0d2abee28fef;hb=662a2a2393a25baef77e42f74204b11b70a9646c;hp=5aedce0e347c385a7519cb99097790f439409566;hpb=a0795e0da5be7c74b0de107025fad1d70c6843d6;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 5aedce0e3..1fca14d4b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2020 CEA/DEN, EDF R&D +// Copyright (C) 2017-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -37,7 +37,8 @@ #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingField.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingFieldInt.hxx" +#include "MEDCouplingFieldInt32.hxx" +#include "MEDCouplingFieldInt64.hxx" #include "MEDCouplingFieldFloat.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingGaussLocalization.hxx" @@ -46,6 +47,7 @@ #include "MEDCouplingFieldOverTime.hxx" #include "MEDCouplingDefinitionTime.hxx" #include "MEDCouplingFieldDiscretization.hxx" +#include "MEDCouplingFieldDiscretizationOnNodesFE.hxx" #include "MEDCouplingCartesianAMRMesh.hxx" #include "MEDCouplingAMRAttribute.hxx" #include "MEDCouplingMatrix.hxx" @@ -71,7 +73,7 @@ using namespace INTERP_KERNEL; typedef int mcIdType; typedef DataArrayInt32 DataArrayIdType; %template(ivec) std::vector; -%template(i64vec) std::vector; +%template(i64vec) std::vector; #else //typedef std::int64_t mcIdType; typedef DataArrayInt64 DataArrayIdType; @@ -84,7 +86,11 @@ typedef long int mcIdType; #endif %template(i32vec) std::vector; #endif - +#ifdef WIN32 +typedef long long mcPyPtrType; +#else +typedef long mcPyPtrType; +#endif //////////////////// %typemap(out) MEDCoupling::MEDCouplingMesh* @@ -212,6 +218,7 @@ typedef long int mcIdType; %feature("autodoc", "1"); %feature("docstring"); +%newobject MEDCoupling::MEDCouplingFieldDiscretizationOnNodesFE::getCooInRefElement; %newobject MEDCoupling::MEDCouplingField::buildMeasureField; %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr; %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds; @@ -270,15 +277,24 @@ typedef long int mcIdType; %newobject MEDCoupling::MEDCouplingFieldDouble::cellToNodeDiscretization; %newobject MEDCoupling::MEDCouplingFieldDouble::getValueOnMulti; %newobject MEDCoupling::MEDCouplingFieldDouble::computeVectorFieldCyl; -%newobject MEDCoupling::MEDCouplingFieldInt::New; -%newobject MEDCoupling::MEDCouplingFieldInt::convertToDblField; -%newobject MEDCoupling::MEDCouplingFieldInt::getArray; -%newobject MEDCoupling::MEDCouplingFieldInt::deepCopy; -%newobject MEDCoupling::MEDCouplingFieldInt::clone; -%newobject MEDCoupling::MEDCouplingFieldInt::cloneWithMesh; -%newobject MEDCoupling::MEDCouplingFieldInt::buildSubPart; -%newobject MEDCoupling::MEDCouplingFieldInt::buildSubPartRange; -%newobject MEDCoupling::MEDCouplingFieldInt::__getitem__; +%newobject MEDCoupling::MEDCouplingFieldInt32::New; +%newobject MEDCoupling::MEDCouplingFieldInt32::convertToDblField; +%newobject MEDCoupling::MEDCouplingFieldInt32::getArray; +%newobject MEDCoupling::MEDCouplingFieldInt32::deepCopy; +%newobject MEDCoupling::MEDCouplingFieldInt32::clone; +%newobject MEDCoupling::MEDCouplingFieldInt32::cloneWithMesh; +%newobject MEDCoupling::MEDCouplingFieldInt32::buildSubPart; +%newobject MEDCoupling::MEDCouplingFieldInt32::buildSubPartRange; +%newobject MEDCoupling::MEDCouplingFieldInt32::__getitem__; +%newobject MEDCoupling::MEDCouplingFieldInt64::New; +%newobject MEDCoupling::MEDCouplingFieldInt64::convertToDblField; +%newobject MEDCoupling::MEDCouplingFieldInt64::getArray; +%newobject MEDCoupling::MEDCouplingFieldInt64::deepCopy; +%newobject MEDCoupling::MEDCouplingFieldInt64::clone; +%newobject MEDCoupling::MEDCouplingFieldInt64::cloneWithMesh; +%newobject MEDCoupling::MEDCouplingFieldInt64::buildSubPart; +%newobject MEDCoupling::MEDCouplingFieldInt64::buildSubPartRange; +%newobject MEDCoupling::MEDCouplingFieldInt64::__getitem__; %newobject MEDCoupling::MEDCouplingFieldFloat::New; %newobject MEDCoupling::MEDCouplingFieldFloat::convertToDblField; %newobject MEDCoupling::MEDCouplingFieldFloat::getArray; @@ -299,6 +315,7 @@ typedef long int mcIdType; %newobject MEDCoupling::MEDCouplingMesh::buildPartRange; %newobject MEDCoupling::MEDCouplingMesh::giveCellsWithType; %newobject MEDCoupling::MEDCouplingMesh::getCoordinatesAndOwner; +%newobject MEDCoupling::MEDCouplingMesh::computeMeshCenterOfMass; %newobject MEDCoupling::MEDCouplingMesh::computeCellCenterOfMass; %newobject MEDCoupling::MEDCouplingMesh::computeIsoBarycenterOfNodesPerCell; %newobject MEDCoupling::MEDCouplingMesh::buildOrthogonalField; @@ -354,6 +371,7 @@ typedef long int mcIdType; %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForMEDFileFrmt; %newobject MEDCoupling::MEDCouplingUMesh::convertCellArrayPerGeoType; %newobject MEDCoupling::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec; +%newobject MEDCoupling::MEDCouplingUMesh::findNodesToDuplicate; %newobject MEDCoupling::MEDCouplingUMesh::buildDirectionVectorField; %newobject MEDCoupling::MEDCouplingUMesh::convertLinearCellsToQuadratic; %newobject MEDCoupling::MEDCouplingUMesh::getEdgeRatioField; @@ -395,6 +413,7 @@ typedef long int mcIdType; %newobject MEDCoupling::MEDCoupling1SGTUMesh::buildSetInstanceFromThis; %newobject MEDCoupling::MEDCoupling1SGTUMesh::computeDualMesh; %newobject MEDCoupling::MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4; +%newobject MEDCoupling::MEDCoupling1SGTUMesh::computeTriangleHeight; %newobject MEDCoupling::MEDCoupling1SGTUMesh::sortHexa8EachOther; %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshes; %newobject MEDCoupling::MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords; @@ -462,6 +481,9 @@ typedef long int mcIdType; %newobject MEDCoupling::DenseMatrix::__mul__; %newobject MEDCoupling::MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell; %newobject MEDCoupling::MEDCouplingGaussLocalization::buildRefCell; +%newobject MEDCoupling::MEDCouplingGaussLocalization::getShapeFunctionValues; +%newobject MEDCoupling::MEDCouplingGaussLocalization::getDerivativeOfShapeFunctionValues; +%newobject MEDCoupling::MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf; %newobject MEDCoupling::MEDCouplingSkyLineArray::BuildFromPolyhedronConn; %newobject MEDCoupling::MEDCouplingSkyLineArray::getSuperIndexArray; %newobject MEDCoupling::MEDCouplingSkyLineArray::getIndexArray; @@ -487,9 +509,11 @@ typedef long int mcIdType; %feature("unref") MEDCouplingFieldDiscretizationGauss "$this->decrRef();" %feature("unref") MEDCouplingFieldDiscretizationGaussNE "$this->decrRef();" %feature("unref") MEDCouplingFieldDiscretizationKriging "$this->decrRef();" +%feature("unref") MEDCouplingFieldDiscretizationOnNodesFE "$this->decrRef();" %feature("unref") MEDCouplingFieldDouble "$this->decrRef();" %feature("unref") MEDCouplingFieldFloat "$this->decrRef();" -%feature("unref") MEDCouplingFieldInt "$this->decrRef();" +%feature("unref") MEDCouplingFieldInt32 "$this->decrRef();" +%feature("unref") MEDCouplingFieldInt64 "$this->decrRef();" %feature("unref") MEDCouplingMultiFields "$this->decrRef();" %feature("unref") MEDCouplingFieldTemplate "$this->decrRef();" %feature("unref") MEDCouplingMultiFields "$this->decrRef();" @@ -619,7 +643,8 @@ namespace MEDCoupling ON_NODES = 1, ON_GAUSS_PT = 2, ON_GAUSS_NE = 3, - ON_NODES_KR = 4 + ON_NODES_KR = 4, + ON_NODES_FE = 5 } TypeOfField; typedef enum @@ -655,6 +680,14 @@ namespace MEDCoupling std::ostringstream oss; oss << "C++ Pointer address is : " << self; return oss.str(); } + + // Hack to allow retrieving of underlying C++ pointer whatever the situation + // This allows for example to mix different types of Python binding (SWIG and PyBind for example) + long long getHiddenCppPointerAsLongLong() const + { + return (long long) self; + } + } %extend MEDCouplingGaussLocalization @@ -739,6 +772,12 @@ namespace MEDCoupling { return self->simpleRepr(); } + + DataArrayDouble *computeMeshCenterOfMass() const + { + MCAuto ret(self->computeMeshCenterOfMass()); + return ret.retn(); + } PyObject *getTime() { @@ -1258,7 +1297,7 @@ namespace MEDCoupling const std::vector& getGaussCoords() const; double getGaussCoord(int gaussPtIdInCell, int comp) const; const std::vector& getWeights() const; - double getWeight(int gaussPtIdInCell, double newVal) const; + double getWeight(int gaussPtIdInCell) const; void setRefCoord(int ptIdInCell, int comp, double newVal); void setGaussCoord(int gaussPtIdInCell, int comp, double newVal); void setWeight(int gaussPtIdInCell, double newVal); @@ -1281,6 +1320,24 @@ namespace MEDCoupling MCAuto ret(self->buildRefCell()); return ret.retn(); } + + DataArrayDouble *getShapeFunctionValues() const + { + MCAuto ret(self->getShapeFunctionValues()); + return ret.retn(); + } + + DataArrayDouble *getDerivativeOfShapeFunctionValues() const + { + MCAuto ret(self->getDerivativeOfShapeFunctionValues()); + return ret.retn(); + } + + static DataArrayDouble *GetDefaultReferenceCoordinatesOf(INTERP_KERNEL::NormalizedCellType type) + { + MCAuto ret(MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf(type)); + return ret.retn(); + } } }; @@ -1420,6 +1477,16 @@ namespace MEDCoupling PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } + + PyObject *thresholdPerPack(mcIdType threshold) const + { + MCAuto left, right; + self->thresholdPerPack(threshold,left,right); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(left.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(right.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingSkyLineArray, SWIG_POINTER_OWN | 0 )); + return ret; + } } }; } @@ -2027,6 +2094,7 @@ namespace MEDCoupling static MEDCouplingUMesh *New(); static MEDCouplingUMesh *New(const char *meshName, int meshDim); void checkConsistencyLight() const; + void checkGeomConsistency(double eps=1e-12) const; void setMeshDimension(int meshDim); void allocateCells(int nbOfCells=0); void finishInsertingCells(); @@ -2088,6 +2156,7 @@ namespace MEDCoupling DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const; DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const; void changeOrientationOfCells(); + void orientCorrectly2DCells(const MEDCouplingUMesh *refFaces); DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps); int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0); static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da); @@ -2423,14 +2492,19 @@ namespace MEDCoupling return ret; } - PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const + DataArrayIdType *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const { - DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0; - self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2); - PyObject *ret=PyTuple_New(3); + DataArrayIdType *ret=self->findNodesToDuplicate(otherDimM1OnSameCoords); + return ret; + } + + PyObject *findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnSameCoords, const DataArrayIdType *dupNodes) const + { + DataArrayIdType *tmp0=0,*tmp1=0; + self->findCellsToRenumber(otherDimM1OnSameCoords,dupNodes->begin(), dupNodes->end(), tmp0,tmp1); + PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2668,6 +2742,19 @@ namespace MEDCoupling return ret; } + PyObject *explodeMeshTo(int targetDeltaLevel) const + { + MCAuto desc,descIndx,revDesc,revDescIndx; + MCAuto m=self->explodeMeshTo(targetDeltaLevel,desc,descIndx,revDesc,revDescIndx); + PyObject *ret=PyTuple_New(5); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndx.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + PyObject *explodeIntoEdges() const { MCAuto desc,descIndex,revDesc,revDescIndx; @@ -2981,6 +3068,7 @@ namespace MEDCoupling void convertExtrudedPolyhedra(); bool unPolyze(); void simplifyPolyhedra(double eps); + void colinearizeEdges(double eps); MEDCouplingUMesh *buildSpreadZonesWithPoly() const; MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy); }; @@ -3139,6 +3227,12 @@ namespace MEDCoupling return ret; } + DataArrayDouble *MEDCoupling1SGTUMesh::computeTriangleHeight() const + { + MCAuto ret = self->computeTriangleHeight(); + return ret.retn(); + } + static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li) { std::vector tmp; @@ -3875,7 +3969,8 @@ namespace MEDCoupling public: static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble& f); static MEDCouplingFieldTemplate *New(const MEDCouplingFieldFloat& f); - static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt& f); + static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt32& f); + static MEDCouplingFieldTemplate *New(const MEDCouplingFieldInt64& f); static MEDCouplingFieldTemplate *New(TypeOfField type); std::string simpleRepr() const; std::string advancedRepr() const; @@ -3893,7 +3988,12 @@ namespace MEDCoupling return MEDCouplingFieldTemplate::New(f); } - MEDCouplingFieldTemplate(const MEDCouplingFieldInt& f) + MEDCouplingFieldTemplate(const MEDCouplingFieldInt32& f) + { + return MEDCouplingFieldTemplate::New(f); + } + + MEDCouplingFieldTemplate(const MEDCouplingFieldInt64& f) { return MEDCouplingFieldTemplate::New(f); } @@ -3943,7 +4043,8 @@ namespace MEDCoupling %template(MEDCouplingFieldTfloat) MEDCoupling::MEDCouplingFieldT; %template(MEDCouplingFieldTint) MEDCoupling::MEDCouplingFieldT; - class MEDCouplingFieldInt; + class MEDCouplingFieldInt32; + class MEDCouplingFieldInt64; class MEDCouplingFieldFloat; class MEDCouplingFieldDouble : public MEDCouplingFieldT @@ -3961,7 +4062,7 @@ namespace MEDCoupling std::string simpleRepr() const; std::string advancedRepr() const; std::string writeVTK(const std::string& fileName, bool isBinary=true) const; - MEDCouplingFieldInt *convertToIntField() const; + MEDCouplingFieldInt32 *convertToIntField() const; MEDCouplingFieldFloat *convertToFloatField() const; MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; @@ -5155,34 +5256,34 @@ namespace MEDCoupling } }; - class MEDCouplingFieldInt : public MEDCouplingFieldT + class MEDCouplingFieldInt32 : public MEDCouplingFieldT { public: - static MEDCouplingFieldInt *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); - static MEDCouplingFieldInt *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); - bool isEqual(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const; - bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const; + static MEDCouplingFieldInt32 *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME); + static MEDCouplingFieldInt32 *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME); + bool isEqual(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const; + bool isEqualWithoutConsideringStr(const MEDCouplingFieldInt32 *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(DataArrayInt32 *array); - MEDCouplingFieldInt *deepCopy() const; - MEDCouplingFieldInt *clone(bool recDeepCpy) const; - MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const; + MEDCouplingFieldInt32 *deepCopy() const; + MEDCouplingFieldInt32 *clone(bool recDeepCpy) const; + MEDCouplingFieldInt32 *cloneWithMesh(bool recDeepCpy) const; MEDCouplingFieldDouble *convertToDblField() const; - MEDCouplingFieldInt *buildSubPartRange(int begin, int end, int step) const; + MEDCouplingFieldInt32 *buildSubPartRange(int begin, int end, int step) const; %extend { - MEDCouplingFieldInt(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME) + MEDCouplingFieldInt32(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME) { - return MEDCouplingFieldInt::New(type,td); + return MEDCouplingFieldInt32::New(type,td); } - MEDCouplingFieldInt(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME) + MEDCouplingFieldInt32(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME) { - return MEDCouplingFieldInt::New(ft,td); + return MEDCouplingFieldInt32::New(ft,td); } - PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt *other, double meshPrec, int valsPrec) const + PyObject *isEqualIfNotWhy(const MEDCouplingFieldInt32 *other, double meshPrec, int valsPrec) const { std::string ret1; bool ret0=self->isEqualIfNotWhy(other,meshPrec,valsPrec,ret1); @@ -5206,12 +5307,12 @@ namespace MEDCoupling return oss.str(); } - MEDCouplingFieldInt *buildSubPart(PyObject *li) const + MEDCouplingFieldInt32 *buildSubPart(PyObject *li) const { return fieldT_buildSubPart(self,li); } - MEDCouplingFieldInt *__getitem__(PyObject *li) const + MEDCouplingFieldInt32 *__getitem__(PyObject *li) const { return fieldT__getitem__(self,li); } @@ -5237,7 +5338,7 @@ namespace MEDCoupling PyObject *getTinySerializationInformation() const { - return field_getTinySerializationInformation(self); + return field_getTinySerializationInformation(self); } PyObject *serialize() const @@ -5247,7 +5348,7 @@ namespace MEDCoupling PyObject *__getstate__() const { - return field__getstate__(self,MEDCoupling_MEDCouplingFieldInt_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt_serialize); + return field__getstate__(self,MEDCoupling_MEDCouplingFieldInt32_getTinySerializationInformation,MEDCoupling_MEDCouplingFieldInt32_serialize); } void __setstate__(PyObject *inp) @@ -5257,6 +5358,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: @@ -5974,10 +6177,14 @@ def MEDCouplingFieldDoubleReduce(self): self.checkConsistencyLight() d=(self.getTypeOfField(),self.getTimeDiscretization()) return MEDCouplingStdReduceFunct,(MEDCouplingFieldDouble,(d,(self.__getstate__()),)) -def MEDCouplingFieldIntReduce(self): +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,(MEDCouplingFieldInt,(d,(self.__getstate__()),)) + return MEDCouplingStdReduceFunct,(MEDCouplingFieldInt64,(d,(self.__getstate__()),)) def MEDCouplingFieldFloatReduce(self): self.checkConsistencyLight() d=(self.getTypeOfField(),self.getTimeDiscretization()) @@ -6000,10 +6207,14 @@ 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 + +if MEDCouplingUse64BitIDs(): + MEDCouplingFieldID = MEDCouplingFieldInt64 +else: + MEDCouplingFieldID = MEDCouplingFieldInt32 %}