Salome HOME
Fix merge errors post 8.3.0
[tools/medcoupling.git] / src / INTERP_KERNEL / CellModel.cxx
index bd676e4248a46314c4e751dade3a960c92101e38..ed473f8de7cd945bbd9b8fa516ed72eff84d87de 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "InterpKernelException.hxx"
 #include "DiameterCalculator.hxx"
+#include "OrientationInverter.hxx"
 
 #include <algorithm>
 #include <sstream>
@@ -452,6 +453,28 @@ namespace INTERP_KERNEL
       return (lgth-std::count(conn,conn+lgth,-1))/2;
   }
   
+  /*!
+   * \sa fillMicroEdgeNodalConnectivity
+   */
+  unsigned CellModel::getNumberOfMicroEdges() const
+  {
+    unsigned mul(isQuadratic()?2:1);
+    if(!isDynamic())
+      {
+        switch(getDimension())
+          {
+          case 2:
+            return mul*getNumberOfSons();
+          case 3:
+            return mul*_nb_of_little_sons;
+          default:
+            throw INTERP_KERNEL::Exception("CellModel::getNumberOfMacroEdges : only 2D and 3D cells support this !");
+          }
+      }
+    else
+      throw INTERP_KERNEL::Exception("CellModel::getNumberOfMacroEdges : not supported by dynamic type !");
+  }
+  
   NormalizedCellType CellModel::getCorrespondingPolyType() const
   {
     switch(getDimension())
@@ -592,6 +615,50 @@ namespace INTERP_KERNEL
       throw INTERP_KERNEL::Exception("CellModel::fillSonEdgesNodalConnectivity3D : not implemented yet for NORM_POLYHED !");   
   }
 
+  /*!
+   * \sa getNumberOfMicroEdges
+   */
+  unsigned CellModel::fillMicroEdgeNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn, NormalizedCellType& typeOfSon) const
+  {
+    if(isQuadratic())
+      {
+        int edgeId(sonId/2),subEdgeId(sonId%2);
+        typeOfSon=NORM_SEG2;
+        const unsigned *sonConn(0);
+        switch(getDimension())
+          {
+          case 2:
+            {
+              sonConn=_sons_con[edgeId];
+              break;
+            }
+          case 3:
+            {
+              sonConn=_little_sons_con[edgeId];
+              break;
+            }
+          default:
+            throw INTERP_KERNEL::Exception("CellModel::fillMicroEdgeNodalConnectivity : only 2D and 3D cells support this !");
+          }
+        const unsigned tmp[3]={sonConn[0],sonConn[2],sonConn[1]};
+        sonNodalConn[0]=nodalConn[tmp[subEdgeId]];
+        sonNodalConn[1]=nodalConn[tmp[subEdgeId+1]];
+        return 2;
+      }
+    else
+      {
+        switch(getDimension())
+          {
+          case 2:
+            return fillSonCellNodalConnectivity2(sonId,nodalConn,0,sonNodalConn,typeOfSon);
+          case 3:
+            return fillSonEdgesNodalConnectivity3D(sonId,nodalConn,0,sonNodalConn,typeOfSon);
+          default:
+            throw INTERP_KERNEL::Exception("CellModel::fillMicroEdgeNodalConnectivity : only 2D and 3D cells support this #2 !");
+          }
+      }
+  }
+
   void CellModel::changeOrientationOf2D(int *nodalConn, unsigned int sz) const
   {
     if(sz<1)
@@ -886,4 +953,44 @@ namespace INTERP_KERNEL
         throw Exception("CellModel::buildInstanceOfDiameterCalulator : implemented only for TRI3, QUAD4, TETRA4, HEXA8, PENTA6, PYRA5 !");
       }
   }
+
+  OrientationInverter *CellModel::buildOrientationInverter() const
+  {
+    switch(_type)
+      {
+      case NORM_SEG2:
+        return new OrientationInverterSEG2;
+      case NORM_SEG3:
+        return new OrientationInverterSEG3;
+      case NORM_TRI3:
+      case NORM_QUAD4:
+        return new OrientationInverter2DLinear(getNumberOfNodes());
+      case NORM_TRI6:
+      case NORM_QUAD8:
+        return new OrientationInverter2DQuadratic(getNumberOfNodes());
+      case NORM_POLYGON:
+        return new OrientationInverterPolygon;
+      case NORM_QPOLYG:
+        return new OrientationInverterQPolygon;
+      case NORM_TETRA4:
+        return new OrientationInverterTetra4;
+      case NORM_PYRA5:
+        return new OrientationInverterPyra5;
+      case NORM_TETRA10:
+        return new OrientationInverterTetra10;
+      case NORM_PYRA13:
+        return new OrientationInverterPyra13;
+      case NORM_PENTA6:
+      case NORM_HEXA8:
+        return new OrientationInverter3DExtrusionLinear(getNumberOfNodes());
+      case NORM_PENTA15:
+      case NORM_HEXA20:
+        return new OrientationInverter3DExtrusionQuadratic(getNumberOfNodes());
+      default:
+        {
+          std::ostringstream oss; oss << "CellModel::buildOrientationInverter : not managed geometric type " << getRepr() << " yet !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+      }
+  }
 }