Salome HOME
Fix computation height of isocel triangle with base equal zero : NaN
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingCommon.i
index bfe61ebe1208ec962d7d448ff54fe83bc49df05d..1fca14d4b4fcfadffd5abb6d42fa0d2abee28fef 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2021  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<int>;
-%template(i64vec) std::vector<long>;
+%template(i64vec) std::vector<int64_t>;
 #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<double>& getGaussCoords() const;
     double getGaussCoord(int gaussPtIdInCell, int comp) const;
     const std::vector<double>& 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<MEDCouplingUMesh> ret(self->buildRefCell());
         return ret.retn();
       }
+      
+      DataArrayDouble *getShapeFunctionValues() const
+      {
+        MCAuto<DataArrayDouble> ret(self->getShapeFunctionValues());
+        return ret.retn();
+      }
+      
+      DataArrayDouble *getDerivativeOfShapeFunctionValues() const
+      {
+        MCAuto<DataArrayDouble> ret(self->getDerivativeOfShapeFunctionValues());
+        return ret.retn();
+      }
+
+      static DataArrayDouble *GetDefaultReferenceCoordinatesOf(INTERP_KERNEL::NormalizedCellType type)
+      {
+        MCAuto<DataArrayDouble> ret(MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf(type));
+        return ret.retn();
+      }
     }
   };
 
@@ -2122,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);
@@ -2707,6 +2742,19 @@ namespace MEDCoupling
         return ret;
       }
 
+      PyObject *explodeMeshTo(int targetDeltaLevel) const
+      {
+        MCAuto<DataArrayIdType> desc,descIndx,revDesc,revDescIndx;
+        MCAuto<MEDCouplingUMesh> 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<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+        PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+        return ret;
+      }
+
       PyObject *explodeIntoEdges() const
       {
         MCAuto<DataArrayIdType> desc,descIndex,revDesc,revDescIndx;
@@ -3020,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);
   };
@@ -3178,6 +3227,12 @@ namespace MEDCoupling
         return ret;
       }
 
+      DataArrayDouble *MEDCoupling1SGTUMesh::computeTriangleHeight() const
+      {
+        MCAuto<DataArrayDouble> ret = self->computeTriangleHeight();
+        return ret.retn();
+      }
+
       static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(PyObject *li)
       {
         std::vector<const MEDCoupling::MEDCoupling1SGTUMesh *> tmp;