]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
wip
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 18 Aug 2022 15:21:16 +0000 (17:21 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 18 Aug 2022 15:21:16 +0000 (17:21 +0200)
src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx
src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx
src/MEDCoupling/MEDCouplingGaussLocalization.cxx
src/MEDCoupling/MEDCouplingGaussLocalization.hxx
src/MEDCoupling_Swig/MEDCouplingCommon.i

index f94be577d1d3249ff73206ae06a33a032989dfdf..f74d90f58d7b4d9da832a979c056b76bcb18418e 100644 (file)
@@ -462,6 +462,50 @@ std::vector<double> GaussInfo::NormalizeCoordinatesIfNecessary(NormalizedCellTyp
   return ret;
 }
 
+std::vector<double> GaussInfo::GetDefaultReferenceCoordinatesOf(NormalizedCellType ct)
+{
+  switch(ct)
+  {
+    case INTERP_KERNEL::NORM_SEG2:
+      return std::vector<double>(SEG2A_REF,SEG2A_REF+sizeof(SEG2A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_SEG3:
+      return std::vector<double>(SEG3_REF,SEG3_REF+sizeof(SEG3_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_TRI3:
+      return std::vector<double>(TRIA3A_REF,TRIA3A_REF+sizeof(TRIA3A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_TRI6:
+      return std::vector<double>(TRIA6A_REF,TRIA6A_REF+sizeof(TRIA6A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_TRI7:
+      return std::vector<double>(TRIA7A_REF,TRIA7A_REF+sizeof(TRIA7A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_QUAD4:
+      return std::vector<double>(QUAD4A_REF,QUAD4A_REF+sizeof(QUAD4A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_QUAD8:
+      return std::vector<double>(QUAD8A_REF,QUAD8A_REF+sizeof(QUAD8A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_QUAD9:
+      return std::vector<double>(QUAD9A_REF,QUAD9A_REF+sizeof(QUAD9A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_TETRA4:
+      return std::vector<double>(TETRA4A_REF,TETRA4A_REF+sizeof(TETRA4A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_TETRA10:
+      return std::vector<double>(TETRA10A_REF,TETRA10A_REF+sizeof(TETRA10A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_PYRA5:
+      return std::vector<double>(PYRA5A_REF,PYRA5A_REF+sizeof(PYRA5A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_PYRA13:
+      return std::vector<double>(PYRA13A_REF,PYRA13A_REF+sizeof(PYRA13A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_PENTA6:
+      return std::vector<double>(PENTA6A_REF,PENTA6A_REF+sizeof(PENTA6A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_PENTA15:
+      return std::vector<double>(PENTA15A_REF,PENTA15A_REF+sizeof(PENTA15A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_PENTA18:
+      return std::vector<double>(PENTA18A_REF,PENTA18A_REF+sizeof(PENTA18A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_HEXA8:
+      return std::vector<double>(HEXA8A_REF,HEXA8A_REF+sizeof(HEXA8A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_HEXA20:
+      return std::vector<double>(HEXA20A_REF,HEXA20A_REF+sizeof(HEXA20A_REF)/sizeof(double));
+    case INTERP_KERNEL::NORM_HEXA27:
+      return std::vector<double>(HEXA27A_REF,HEXA27A_REF+sizeof(HEXA27A_REF)/sizeof(double));
+  }
+  THROW_IK_EXCEPTION("Input type " << ct << "is not managed by GetDefaultReferenceCoordinatesOf")
+}
+
 typedef void (*MapToShapeFunction)(GaussInfo& obj);
 
 /*!
index 47070488ce801b4c70a1b258e03d8e38d9fb9cfd..4497180e21dc47656b744c25af6d86e6ac2aba4c 100644 (file)
@@ -63,7 +63,7 @@ namespace INTERP_KERNEL
     INTERPKERNEL_EXPORT void initLocalInfo();
     
     INTERPKERNEL_EXPORT static std::vector<double> NormalizeCoordinatesIfNecessary(NormalizedCellType ct, int inputDim, const std::vector<double>& inputArray);
-
+    INTERPKERNEL_EXPORT static std::vector<double> GetDefaultReferenceCoordinatesOf(NormalizedCellType ct);
   public:
     static const double SEG2A_REF[2];
     static const double SEG2B_REF[2];
index e533a8d6d4fbcf35a38b647fb32a42db38686f86..e59f547417cd00c1e1a8f506c794c8da6adbfad7 100644 (file)
@@ -360,3 +360,17 @@ bool MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector<double>& v1,
   std::transform(tmp.begin(),tmp.end(),tmp.begin(),[](double c){return fabs(c);});
   return *std::max_element(tmp.begin(),tmp.end())<eps;
 }
+
+MCAuto<DataArrayDouble> MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf(INTERP_KERNEL::NormalizedCellType type)
+{
+  std::vector<double> retCpp(INTERP_KERNEL::GaussInfo::GetDefaultReferenceCoordinatesOf(type));
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+  auto nbDim(cm.getDimension());
+  std::size_t sz(retCpp.size());
+  MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
+  if( sz%std::size_t(nbDim) != 0 )
+    THROW_IK_EXCEPTION("GetDefaultReferenceCoordinatesOf : unexpected size of defaut array : " << sz << " % " << nbDim << " != 0 !");
+  ret->alloc(sz/size_t(nbDim),nbDim);
+  std::copy(retCpp.begin(),retCpp.end(),ret->getPointer());
+  return ret;
+}
index 65fc265df12b133407d7afdbc274437213fdc9ab..49cb19da3ba1fd83fa7aafbe1b10b3ed8d04d6a6 100644 (file)
@@ -72,6 +72,7 @@ namespace MEDCoupling
     //
     MEDCOUPLING_EXPORT static MEDCouplingGaussLocalization BuildNewInstanceFromTinyInfo(mcIdType dim, const std::vector<mcIdType>& tinyData);
     MEDCOUPLING_EXPORT static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
+    MEDCOUPLING_EXPORT static MCAuto<DataArrayDouble> GetDefaultReferenceCoordinatesOf(INTERP_KERNEL::NormalizedCellType type);
   private:
     int checkCoherencyOfRequest(mcIdType gaussPtIdInCell, int comp) const;
   private:
index 1caf26e6c5d99c119d87b7eaf19359294bd9d103..282847b6541f47ce662a767d5142d4333f4f2b99 100644 (file)
@@ -480,6 +480,7 @@ typedef long mcPyPtrType;
 %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;
@@ -1318,6 +1319,12 @@ namespace MEDCoupling
         MCAuto<DataArrayDouble> ret(self->getDerivativeOfShapeFunctionValues());
         return ret.retn();
       }
+
+      static DataArrayDouble *GetDefaultReferenceCoordinatesOf(INTERP_KERNEL::NormalizedCellType type)
+      {
+        MCAuto<DataArrayDouble> ret(MEDCouplingGaussLocalization::GetDefaultReferenceCoordinatesOf(type));
+        return ret.retn();
+      }
     }
   };