X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingCommon.i;h=1fca14d4b4fcfadffd5abb6d42fa0d2abee28fef;hb=662a2a2393a25baef77e42f74204b11b70a9646c;hp=c760c94d2207a178fb7f9c8e6a76017291f5bf22;hpb=aafcf704892f03308a84407e898d9e8b19496a1c;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index c760c94d2..1fca14d4b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2022 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 @@ -47,6 +47,7 @@ #include "MEDCouplingFieldOverTime.hxx" #include "MEDCouplingDefinitionTime.hxx" #include "MEDCouplingFieldDiscretization.hxx" +#include "MEDCouplingFieldDiscretizationOnNodesFE.hxx" #include "MEDCouplingCartesianAMRMesh.hxx" #include "MEDCouplingAMRAttribute.hxx" #include "MEDCouplingMatrix.hxx" @@ -72,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; @@ -217,6 +218,7 @@ typedef long mcPyPtrType; %feature("autodoc", "1"); %feature("docstring"); +%newobject MEDCoupling::MEDCouplingFieldDiscretizationOnNodesFE::getCooInRefElement; %newobject MEDCoupling::MEDCouplingField::buildMeasureField; %newobject MEDCoupling::MEDCouplingField::getLocalizationOfDiscr; %newobject MEDCoupling::MEDCouplingField::computeTupleIdsToSelectFromCellIds; @@ -411,6 +413,7 @@ typedef long mcPyPtrType; %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; @@ -478,6 +481,9 @@ typedef long mcPyPtrType; %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; @@ -503,6 +509,7 @@ typedef long mcPyPtrType; %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") MEDCouplingFieldInt32 "$this->decrRef();" @@ -636,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 @@ -672,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 @@ -1281,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); @@ -1304,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(); + } } }; @@ -2708,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; @@ -3021,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); }; @@ -3179,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;