]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Tue, 15 Jul 2008 13:08:29 +0000 (13:08 +0000)
committerageay <ageay>
Tue, 15 Jul 2008 13:08:29 +0000 (13:08 +0000)
12 files changed:
src/INTERP_KERNEL/CellModel.cxx [new file with mode: 0644]
src/INTERP_KERNEL/CellModel.hxx [new file with mode: 0644]
src/INTERP_KERNEL/Interpolation3D.txx
src/INTERP_KERNEL/IntersectorHexa.hxx
src/INTERP_KERNEL/IntersectorHexa.txx
src/INTERP_KERNEL/IntersectorTetra.hxx
src/INTERP_KERNEL/IntersectorTetra.txx
src/INTERP_KERNEL/Makefile.am
src/INTERP_KERNEL/MeshUtils.hxx
src/INTERP_KERNEL/NormalizedUnstructuredMesh.hxx
src/INTERP_KERNEL/PointLocatorAlgos.txx
src/INTERP_KERNEL/PolygonAlgorithms.txx

diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx
new file mode 100644 (file)
index 0000000..8e28945
--- /dev/null
@@ -0,0 +1,182 @@
+#include "CellModel.hxx"
+
+#include "InterpolationUtils.hxx"
+
+#include <sstream>
+
+using namespace std;
+
+namespace INTERP_KERNEL
+{
+  std::map<NormalizedCellType,CellModel> CellModel::_mapOfUniqueInstance;
+
+  const CellModel& CellModel::getCellModel(NormalizedCellType type)
+  {
+    if(_mapOfUniqueInstance.empty())
+      buildUniqueInstance();
+    const map<NormalizedCellType,CellModel>::iterator iter=_mapOfUniqueInstance.find(type);
+    if(iter==_mapOfUniqueInstance.end())
+      {
+        ostringstream stream; stream << "no cellmodel for normalized type " << type;
+        throw Exception(stream.str().c_str());
+      }
+    return (*iter).second;
+  }
+
+  void CellModel::buildUniqueInstance()
+  {
+    _mapOfUniqueInstance.insert(make_pair(NORM_TRI3,CellModel(NORM_TRI3)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_QUAD4,CellModel(NORM_QUAD4)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_TRI6,CellModel(NORM_TRI6)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_QUAD8,CellModel(NORM_QUAD8)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_TETRA4,CellModel(NORM_TETRA4)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_HEXA8,CellModel(NORM_HEXA8)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_PYRA5,CellModel(NORM_PYRA5)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_PENTA6,CellModel(NORM_PENTA6)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_TETRA10,CellModel(NORM_TETRA10)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_PYRA13,CellModel(NORM_PYRA13)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_PENTA15,CellModel(NORM_PENTA15)));
+    _mapOfUniqueInstance.insert(make_pair(NORM_HEXA20,CellModel(NORM_HEXA20)));
+  }
+
+  CellModel::CellModel(NormalizedCellType type)
+  {
+    switch(type)
+      {
+      case NORM_TETRA4:
+        {
+          _nbOfPts=4; _nbOfSons=4; _dim=3;
+          _sonsType[0]=NORM_TRI3; _sonsType[1]=NORM_TRI3; _sonsType[2]=NORM_TRI3; _sonsType[3]=NORM_TRI3;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _nbOfSonsCon[0]=3;
+          _sonsCon[1][0]=0; _sonsCon[1][1]=3; _sonsCon[1][2]=1; _nbOfSonsCon[1]=3;
+          _sonsCon[2][0]=1; _sonsCon[2][1]=3; _sonsCon[2][2]=2; _nbOfSonsCon[2]=3;
+          _sonsCon[3][0]=2; _sonsCon[3][1]=3; _sonsCon[3][2]=0; _nbOfSonsCon[3]=3;
+        }
+        break;
+      case NORM_HEXA8:
+        {
+          _nbOfPts=8; _nbOfSons=6; _dim=3;
+          _sonsType[0]=NORM_QUAD4; _sonsType[1]=NORM_QUAD4; _sonsType[2]=NORM_QUAD4; _sonsType[3]=NORM_QUAD4; _sonsType[4]=NORM_QUAD4; _sonsType[5]=NORM_QUAD4;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=3; _nbOfSonsCon[0]=4;
+          _sonsCon[1][0]=4; _sonsCon[1][1]=7; _sonsCon[1][2]=6; _sonsCon[1][3]=5; _nbOfSonsCon[1]=4;
+          _sonsCon[2][0]=0; _sonsCon[2][1]=4; _sonsCon[2][2]=5; _sonsCon[2][3]=1; _nbOfSonsCon[2]=4;
+          _sonsCon[3][0]=1; _sonsCon[3][1]=5; _sonsCon[3][2]=6; _sonsCon[3][3]=2; _nbOfSonsCon[3]=4;
+          _sonsCon[4][0]=2; _sonsCon[4][1]=6; _sonsCon[4][2]=7; _sonsCon[4][3]=3; _nbOfSonsCon[4]=4;
+          _sonsCon[5][0]=3; _sonsCon[5][1]=7; _sonsCon[5][2]=4; _sonsCon[5][3]=0; _nbOfSonsCon[5]=4;
+        }
+        break;
+      case NORM_QUAD4:
+        {
+          _nbOfPts=4; _nbOfSons=4; _dim=2;
+          _sonsType[0]=NORM_SEG2; _sonsType[1]=NORM_SEG2; _sonsType[2]=NORM_SEG2; _sonsType[3]=NORM_SEG2;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _nbOfSonsCon[0]=2;
+          _sonsCon[1][0]=1; _sonsCon[1][1]=2; _nbOfSonsCon[1]=2;
+          _sonsCon[2][0]=2; _sonsCon[2][1]=3; _nbOfSonsCon[2]=2;
+          _sonsCon[3][0]=3; _sonsCon[3][1]=0; _nbOfSonsCon[3]=2;
+        }
+        break;
+      case NORM_TRI3:
+        {
+          _nbOfPts=3; _nbOfSons=3; _dim=2;
+          _sonsType[0]=NORM_SEG2; _sonsType[1]=NORM_SEG2; _sonsType[2]=NORM_SEG2;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _nbOfSonsCon[0]=2;
+          _sonsCon[1][0]=1; _sonsCon[1][1]=2; _nbOfSonsCon[1]=2;
+          _sonsCon[2][0]=2; _sonsCon[2][1]=0; _nbOfSonsCon[2]=2;
+        }
+        break;
+      case NORM_TRI6:
+        {
+          _nbOfPts=6; _nbOfSons=3; _dim=2;
+          _sonsType[0]=NORM_SEG3; _sonsType[1]=NORM_SEG3; _sonsType[2]=NORM_SEG3;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=3; _nbOfSonsCon[0]=3;
+          _sonsCon[1][0]=1; _sonsCon[1][1]=2; _sonsCon[1][2]=4; _nbOfSonsCon[1]=3;
+          _sonsCon[2][0]=2; _sonsCon[2][1]=0; _sonsCon[2][2]=5; _nbOfSonsCon[2]=3;
+        }
+        break;
+      case NORM_QUAD8:
+        {
+          _nbOfPts=8; _nbOfSons=4; _dim=2;
+          _sonsType[0]=NORM_SEG3; _sonsType[1]=NORM_SEG3; _sonsType[2]=NORM_SEG3; _sonsType[3]=NORM_SEG3;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=4; _nbOfSonsCon[0]=3;
+          _sonsCon[1][0]=1; _sonsCon[1][1]=2; _sonsCon[1][2]=5; _nbOfSonsCon[1]=3;
+          _sonsCon[2][0]=2; _sonsCon[2][1]=3; _sonsCon[2][2]=6; _nbOfSonsCon[2]=3;
+          _sonsCon[3][0]=3; _sonsCon[3][1]=0; _sonsCon[3][2]=7; _nbOfSonsCon[3]=3;
+        }
+        break;
+      case NORM_PYRA5:
+        {
+          _nbOfPts=5; _nbOfSons=5; _dim=3;
+          _sonsType[0]=NORM_QUAD4; _sonsType[1]=NORM_TRI3; _sonsType[2]=NORM_TRI3; _sonsType[3]=NORM_TRI3; _sonsType[4]=NORM_TRI3;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=3; _nbOfSonsCon[0]=4;
+          _sonsCon[1][0]=0; _sonsCon[1][1]=4; _sonsCon[1][2]=1; _nbOfSonsCon[1]=3;
+          _sonsCon[2][0]=1; _sonsCon[2][1]=4; _sonsCon[2][2]=2; _nbOfSonsCon[2]=3;
+          _sonsCon[3][0]=2; _sonsCon[3][1]=4; _sonsCon[3][2]=3; _nbOfSonsCon[3]=3;
+          _sonsCon[4][0]=3; _sonsCon[4][1]=4; _sonsCon[4][2]=0; _nbOfSonsCon[4]=3;
+        }
+        break;
+      case NORM_PENTA6:
+        {
+          _nbOfPts=6; _nbOfSons=5; _dim=3;
+          _sonsType[0]=NORM_TRI3; _sonsType[1]=NORM_TRI3; _sonsType[2]=NORM_QUAD4; _sonsType[3]=NORM_QUAD4; _sonsType[4]=NORM_QUAD4;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _nbOfSonsCon[0]=3;
+          _sonsCon[1][0]=3; _sonsCon[1][1]=5; _sonsCon[1][2]=4; _nbOfSonsCon[1]=3;
+          _sonsCon[2][0]=0; _sonsCon[2][1]=3; _sonsCon[2][2]=4; _sonsCon[2][3]=1; _nbOfSonsCon[2]=4;
+          _sonsCon[3][0]=1; _sonsCon[3][1]=4; _sonsCon[3][2]=5; _sonsCon[3][3]=2; _nbOfSonsCon[3]=4;
+          _sonsCon[4][0]=2; _sonsCon[4][1]=4; _sonsCon[4][2]=5; _sonsCon[4][3]=0; _nbOfSonsCon[4]=4;
+        }
+        break;
+      case NORM_TETRA10:
+        {
+          _nbOfPts=10; _nbOfSons=4; _dim=3;
+          _sonsType[0]=NORM_TRI6; _sonsType[1]=NORM_TRI6; _sonsType[2]=NORM_TRI6; _sonsType[3]=NORM_TRI6;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=4; _sonsCon[0][4]=5; _sonsCon[0][5]=6; _nbOfSonsCon[0]=6;
+          _sonsCon[1][0]=0; _sonsCon[1][1]=3; _sonsCon[1][2]=1; _sonsCon[1][3]=7; _sonsCon[1][4]=8; _sonsCon[1][5]=4; _nbOfSonsCon[1]=6;
+          _sonsCon[2][0]=1; _sonsCon[2][1]=3; _sonsCon[2][2]=2; _sonsCon[2][3]=8; _sonsCon[2][4]=9; _sonsCon[2][5]=5; _nbOfSonsCon[2]=6;
+          _sonsCon[3][0]=2; _sonsCon[3][1]=3; _sonsCon[3][2]=0; _sonsCon[3][3]=9; _sonsCon[3][4]=7; _sonsCon[3][5]=6; _nbOfSonsCon[3]=6;
+        }
+        break;
+      case NORM_PYRA13:
+        {
+          _nbOfPts=13; _nbOfSons=5; _dim=3;
+          _sonsType[0]=NORM_QUAD8; _sonsType[1]=NORM_TRI6; _sonsType[2]=NORM_TRI6; _sonsType[3]=NORM_TRI6; _sonsType[4]=NORM_TRI6;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=3; _sonsCon[0][4]=5; _sonsCon[0][5]=6; _sonsCon[0][6]=7; _sonsCon[0][7]=8; _nbOfSonsCon[0]=8;
+          _sonsCon[1][0]=0; _sonsCon[1][1]=4; _sonsCon[1][2]=1; _sonsCon[1][3]=9; _sonsCon[1][4]=10; _sonsCon[1][5]=5; _nbOfSonsCon[1]=6;
+          _sonsCon[2][0]=1; _sonsCon[2][1]=4; _sonsCon[2][2]=2; _sonsCon[2][3]=10; _sonsCon[2][4]=11; _sonsCon[2][5]=6; _nbOfSonsCon[2]=6;
+          _sonsCon[3][0]=2; _sonsCon[3][1]=4; _sonsCon[3][2]=3; _sonsCon[3][3]=11; _sonsCon[3][4]=12; _sonsCon[3][5]=7;  _nbOfSonsCon[3]=6;
+          _sonsCon[4][0]=3; _sonsCon[4][1]=4; _sonsCon[4][2]=0; _sonsCon[4][3]=12; _sonsCon[4][4]=9; _sonsCon[4][5]=8; _nbOfSonsCon[4]=6;
+        }
+        break;
+      case NORM_PENTA15:
+        {
+          _nbOfPts=15; _nbOfSons=5; _dim=3;
+          _sonsType[0]=NORM_TRI6; _sonsType[1]=NORM_TRI6; _sonsType[2]=NORM_QUAD8; _sonsType[3]=NORM_QUAD8; _sonsType[4]=NORM_QUAD8;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=6; _sonsCon[0][4]=7; _sonsCon[0][5]=8; _nbOfSonsCon[0]=6;
+          _sonsCon[1][0]=3; _sonsCon[1][1]=5; _sonsCon[1][2]=4; _sonsCon[1][3]=11; _sonsCon[1][4]=10; _sonsCon[1][5]=9; _nbOfSonsCon[1]=6;
+          _sonsCon[2][0]=0; _sonsCon[2][1]=3; _sonsCon[2][2]=4; _sonsCon[2][3]=1; _sonsCon[2][4]=12; _sonsCon[2][5]=9; _sonsCon[2][6]=13; _sonsCon[2][7]=6; _nbOfSonsCon[2]=8;
+          _sonsCon[3][0]=1; _sonsCon[3][1]=4; _sonsCon[3][2]=5; _sonsCon[3][3]=2; _sonsCon[3][4]=13; _sonsCon[3][5]=10; _sonsCon[3][6]=14; _sonsCon[3][7]=7; _nbOfSonsCon[3]=8;
+          _sonsCon[4][0]=2; _sonsCon[4][1]=4; _sonsCon[4][2]=5; _sonsCon[4][3]=0; _sonsCon[4][4]=14; _sonsCon[4][5]=11; _sonsCon[4][6]=12; _sonsCon[4][7]=8; _nbOfSonsCon[4]=8;
+        }
+        break;
+      case NORM_HEXA20:
+        {
+          _nbOfPts=20; _nbOfSons=6; _dim=3;
+          _sonsType[0]=NORM_QUAD8; _sonsType[1]=NORM_QUAD8; _sonsType[2]=NORM_QUAD8; _sonsType[3]=NORM_QUAD8; _sonsType[4]=NORM_QUAD8; _sonsType[5]=NORM_QUAD8;
+          _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=3; _sonsCon[0][4]=8; _sonsCon[0][5]=9; _sonsCon[0][6]=10; _sonsCon[0][7]=11; _nbOfSonsCon[0]=8;
+          _sonsCon[1][0]=4; _sonsCon[1][1]=7; _sonsCon[1][2]=6; _sonsCon[1][3]=5; _sonsCon[1][4]=15; _sonsCon[1][5]=14; _sonsCon[1][6]=13; _sonsCon[1][7]=12; _nbOfSonsCon[1]=8;
+          _sonsCon[2][0]=0; _sonsCon[2][1]=4; _sonsCon[2][2]=5; _sonsCon[2][3]=1; _sonsCon[2][4]=16; _sonsCon[2][5]=12; _sonsCon[2][6]=17; _sonsCon[2][7]=8; _nbOfSonsCon[2]=8;
+          _sonsCon[3][0]=1; _sonsCon[3][1]=5; _sonsCon[3][3]=6; _sonsCon[3][3]=2; _sonsCon[3][4]=17; _sonsCon[3][5]=13; _sonsCon[3][6]=18; _sonsCon[3][7]=9;_nbOfSonsCon[3]=8;
+          _sonsCon[4][0]=2; _sonsCon[4][1]=6; _sonsCon[4][3]=7; _sonsCon[4][3]=3; _sonsCon[4][4]=18; _sonsCon[4][5]=14; _sonsCon[4][6]=19; _sonsCon[4][7]=10; _nbOfSonsCon[4]=8;
+          _sonsCon[5][0]=3; _sonsCon[5][1]=7; _sonsCon[5][3]=4; _sonsCon[5][3]=0; _sonsCon[5][4]=19; _sonsCon[5][5]=15; _sonsCon[5][6]=16; _sonsCon[5][7]=11; _nbOfSonsCon[5]=8;
+        }
+        break;
+      }
+  }
+
+  void CellModel::fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const
+  {
+    unsigned nbOfTurnLoop=_nbOfSonsCon[sonId];
+    const unsigned *sonConn=_sonsCon[sonId];
+    for(unsigned i=0;i<nbOfTurnLoop;i++)
+      sonNodalConn[i]=nodalConn[sonConn[i]];
+  }
+}
diff --git a/src/INTERP_KERNEL/CellModel.hxx b/src/INTERP_KERNEL/CellModel.hxx
new file mode 100644 (file)
index 0000000..bbc524e
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __CELLMODEL_INTERP_KERNEL_HXX__
+#define __CELLMODEL_INTERP_KERNEL_HXX__
+
+#include "NormalizedUnstructuredMesh.hxx"
+
+#include <map>
+
+namespace INTERP_KERNEL
+{
+  /*!
+   * This class descibes all static elements (different from polygons and polyhedron) 3D, 2D and 1D.
+   */
+  class CellModel
+  {
+  public:
+    static const unsigned MAX_NB_OF_SONS=6;
+    static const unsigned MAX_NB_OF_NODES_PER_ELEM=30;
+  private:
+    CellModel(NormalizedCellType type);
+    static void buildUniqueInstance();
+  public:
+    static const CellModel& getCellModel(NormalizedCellType type);
+    //! sonId is in C format.
+    unsigned getDimension() const { return _dim; }
+    const unsigned *getNodesConstituentTheSon(unsigned sonId) const { return _sonsCon[sonId]; }
+    unsigned getNumberOfNodes() const { return _nbOfPts; }
+    unsigned getNumberOfSons() const { return _nbOfSons; }
+    unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nbOfSonsCon[sonId]; }
+    NormalizedCellType getSonType(unsigned sonId) const { return _sonsType[sonId]; }
+    void fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const;
+  private:
+    unsigned _dim;
+    unsigned _nbOfPts;
+    unsigned _nbOfSons;
+    unsigned _sonsCon[MAX_NB_OF_SONS][MAX_NB_OF_NODES_PER_ELEM];
+    unsigned _nbOfSonsCon[MAX_NB_OF_SONS];
+    NormalizedCellType _sonsType[MAX_NB_OF_SONS];
+    static std::map<NormalizedCellType,CellModel> _mapOfUniqueInstance;
+  };
+}
+
+#endif
index 96cdd36b662e5e84c4d7a341dd620b4f362f6004..135bd9d75e7d4a41ccb6653efd4f082942e1bc9b 100644 (file)
@@ -131,7 +131,7 @@ namespace INTERP_KERNEL
     // Continue until the source region contains only one element, at which point the intersection volumes are
     // calculated with all the remaining target mesh elements and stored in the matrix if they are non-zero.
 
-    stack< RegionNode<ConnType>* > nodes;
+    std::stack< RegionNode<ConnType>* > nodes;
     nodes.push(firstNode);
 
     while(!nodes.empty())
@@ -171,7 +171,7 @@ namespace INTERP_KERNEL
 
 
 
-            for(typename vector< MeshElement<ConnType>* >::const_iterator iter = currNode->getSrcRegion().getBeginElements() ; 
+            for(typename std::vector< MeshElement<ConnType>* >::const_iterator iter = currNode->getSrcRegion().getBeginElements() ; 
                 iter != currNode->getSrcRegion().getEndElements() ; ++iter)
               {
             
@@ -215,7 +215,7 @@ namespace INTERP_KERNEL
             LOG(5, " -- Adding source elements");
             int numLeftElements = 0;
             int numRightElements = 0;
-            for(typename vector<MeshElement<ConnType>*>::const_iterator iter = currNode->getSrcRegion().getBeginElements() ; 
+            for(typename std::vector<MeshElement<ConnType>*>::const_iterator iter = currNode->getSrcRegion().getBeginElements() ; 
                 iter != currNode->getSrcRegion().getEndElements() ; ++iter)
               {
                 LOG(6, " --- New target node");
index 5f65c6d78556dda462ef9c5a07d33699e87b421a..9105dafbc40c701b8217485197a68048bf052553 100644 (file)
@@ -50,11 +50,11 @@ namespace INTERP_KERNEL
 
     /// pointers to the IntersectorTetra objects representing the tetrahedra 
     /// that result from the splitting of the hexahedron
-    vector< IntersectorTetra<MyMeshType>* > _tetra;
+    std::vector< IntersectorTetra<MyMeshType>* > _tetra;
     
     /// vector of pointers to double[3] containing the coordinates of the
     /// (sub) - nodes
-    vector<const double*> _nodes;
+    std::vector<const double*> _nodes;
     
   };
 
index b984b480c6749412615a2ab2059fc2b26fd4dee8..e671b13188eec5c67908ca56ccab9a186d602bee 100644 (file)
@@ -7,9 +7,6 @@
 
 #include "IntersectorTetra.hxx"
 
-using namespace MED_EN;
-using namespace MEDMEM;
-
 namespace INTERP_KERNEL
 {
 
@@ -76,11 +73,11 @@ namespace INTERP_KERNEL
   template<class MyMeshType>
   IntersectorHexa<MyMeshType>::~IntersectorHexa()
   {
-    for(typename vector< IntersectorTetra<MyMeshType>* >::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
+    for(typename std::vector< IntersectorTetra<MyMeshType>* >::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
       delete *iter;
     
     // free potential sub-mesh nodes that have been allocated
-    vector<const double*>::iterator iter = _nodes.begin() + 8;
+    std::vector<const double*>::iterator iter = _nodes.begin() + 8;
     while(iter != _nodes.end())
       {
         delete[] *iter;
@@ -392,7 +389,7 @@ namespace INTERP_KERNEL
   double IntersectorHexa<MyMeshType>::intersectSourceCell(typename MyMeshType::MyConnType srcCell)
   {
     double volume = 0.0;
-    for(typename vector<IntersectorTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
+    for(typename std::vector<IntersectorTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
       volume += (*iter)->intersectSourceCell(srcCell);
     return volume;
   }
index 2f8753a51aad64a275f4da18307992bb59d886b7..c0ddd6656e1d5376319f72511b0143bf6711d9d7 100644 (file)
@@ -11,9 +11,6 @@
 #include <map>
 #include <ext/hash_map>
 
-#include "MEDMEM_define.hxx"
-#include "MEDMEM_CellModel.hxx"
-
 using __gnu_cxx::hash_map;
 
 namespace INTERP_KERNEL
index e402f5b03f1c4d34aa8c896fe9dcce6e889b77f4..b501cec4586a2b2716c110450f95da18b0b864dd 100644 (file)
@@ -7,6 +7,7 @@
 #include "TransformedTriangle.hxx"
 #include "MeshUtils.hxx"
 #include "VectorUtils.hxx"
+#include "CellModel.hxx"
 #include "Log.hxx"
 
 #include <cmath>
@@ -14,9 +15,6 @@
 #include <string>
 #include <sstream>
 
-using namespace MEDMEM;
-using namespace MED_EN;
-
 /// Smallest volume of the intersecting elements in the transformed space that will be returned as non-zero. 
 /// Since the scale is always the same in the transformed space (the target tetrahedron is unitary), this number is independent of the scale of the meshes.
 #define SPARSE_TRUNCATION_LIMIT 1.0e-14
@@ -100,30 +98,20 @@ namespace INTERP_KERNEL
       }
 
     // get type of cell
-    unsigned char nbOfNodes4Type = _srcMesh.getNumberOfNodesOfElement(element);
-    // hack tony for the moment
-    
-    medGeometryElement type;
-    if(nbOfNodes4Type==4)
-      type=MED_EN::MED_TETRA4;
-    else if(nbOfNodes4Type==8)
-      type=MED_EN::MED_HEXA8;
-    else
-      std::cerr << "ca merde sec" << std::endl;
-    ////const medGeometryElement type = _srcMesh.getNumberOfNodesOfElement(element);
-    
-    // get cell model for the element
-    const CELLMODEL& cellModel= CELLMODEL_Map::retrieveCellModel(type);
-
+    NormalizedCellType normCellType=_srcMesh.getTypeOfElement(element);
+    const CellModel& cellModelCell=CellModel::getCellModel(normCellType);
+    unsigned nbOfNodes4Type=cellModelCell.getNumberOfNodes();
     // halfspace filtering
     bool isOutside[8] = {true, true, true, true, true, true, true, true};
     bool isTargetOutside = false;
 
     // calculate the coordinates of the nodes
+    int *cellNodes=new int[nbOfNodes4Type];
     for(int i = 0;i<nbOfNodes4Type;++i)
       {
         // we could store mapping local -> global numbers too, but not sure it is worth it
         const int globalNodeNum = getGlobalNumberOfNode(i, element, _srcMesh);
+        cellNodes[i]=globalNodeNum;
         if(_nodes.find(globalNodeNum) == _nodes.end()) 
           {
             calculateNode(globalNodeNum);
@@ -146,28 +134,16 @@ namespace INTERP_KERNEL
     
     if(!isTargetOutside)
       {
-        for(int i = 1 ; i <= cellModel.getNumberOfConstituents(1) ; ++i)
+        for(unsigned ii = 0 ; ii < cellModelCell.getNumberOfSons() ; ++ii)
           {
-            const medGeometryElement faceType = cellModel.getConstituentType(1, i);
-            const CELLMODEL&  faceModel= CELLMODEL_Map::retrieveCellModel(faceType);
-       
+            NormalizedCellType faceType = cellModelCell.getSonType(ii);
+            const CellModel& faceModel=CellModel::getCellModel(faceType);
             assert(faceModel.getDimension() == 2);
-
-            int faceNodes[faceModel.getNumberOfNodes()];
-
-            // get the nodes of the face
-            for(int j = 1; j <= faceModel.getNumberOfNodes(); ++j)
-              {
-                const int locNodeNum = cellModel.getNodeConstituent(1, i, j);
-                assert(locNodeNum >= 1);
-                assert(locNodeNum <= cellModel.getNumberOfNodes());
-
-                faceNodes[j-1] = getGlobalNumberOfNode(locNodeNum-1, element, _srcMesh);
-              }
-
+            int *faceNodes=new int[faceModel.getNumberOfNodes()];      
+            cellModelCell.fillSonCellNodalConnectivity(ii,cellNodes,faceNodes);
             switch(faceType)
               {
-              case MED_EN::MED_TRIA3:
+              case NORM_TRI3:
                 {
                   // create the face key
                   TriangleFaceKey key = TriangleFaceKey(faceNodes[0], faceNodes[1], faceNodes[2]);
@@ -185,7 +161,7 @@ namespace INTERP_KERNEL
                 }
                 break;
 
-              case MED_EN::MED_QUAD4:
+              case NORM_QUAD4:
 
                 // simple triangulation of faces along a diagonal :
                 // 
@@ -234,9 +210,10 @@ namespace INTERP_KERNEL
                 std::cout << "+++ Error : Only elements with triangular and quadratilateral faces are supported at the moment." << std::endl;
                 assert(false);
               }
+            delete [] faceNodes;
           }
       }
-
+    delete [] cellNodes;
     // reset if it is very small to keep the matrix sparse
     // is this a good idea?
     if(epsilonEqual(totalVolume, 0.0, SPARSE_TRUNCATION_LIMIT))
index 9b7306807ad334c0165b163d6802ac148b6f716e..a2c9f5684c1b6e3acf6be0f62169e88a69e22bfd 100644 (file)
@@ -55,6 +55,7 @@ TransformedTriangle_intersect.cxx\
 TransformedTriangle_math.cxx\
 BoundingBox.cxx\
 TetraAffineTransform.cxx\
+CellModel.cxx \
 Remapper.cxx \
 PointLocator.cxx
 
index 596dd33f23f45eaceaba3e61d31b39fa391534d6..d3a151b79b57dbe421035bccd1d07306a3560d26 100644 (file)
@@ -9,7 +9,7 @@ namespace INTERP_KERNEL
    * Returns the global number of the node of an element.
    * (1 <= node <= no. nodes of element)
    *
-   * @param      node       the node for which the global number is sought (in numPol policy)
+   * @param      node       the node for which the global number is sought (ALWAYS in C mode)
    * @param      element    an element of the mesh (in numPol policy)
    * @param      mesh       a mesh
    * @return    the node's global number so that (its coordinates in the coordinates array are at [SPACEDIM*globalNumber, SPACEDIM*globalNumber + 2]
index ab2673f77d2c5dd71043a9475fea6b94adc9eff2..5d758a844839861bacb8aa1b47c24a941551388d 100644 (file)
@@ -12,6 +12,8 @@ namespace INTERP_KERNEL
 
   typedef enum
     {
+      NORM_SEG2    =  1,
+      NORM_SEG3    =  2,
       NORM_TRI3    =  3,
       NORM_QUAD4   =  4,
       NORM_POLYGON =  5,
@@ -21,7 +23,12 @@ namespace INTERP_KERNEL
       NORM_TETRA4  = 14,
       NORM_PYRA5   = 15,
       NORM_PENTA6  = 16,
-      NORM_HEXA8   = 18
+      NORM_HEXA8   = 18,
+      NORM_TETRA10 = 20,
+      NORM_PYRA13  = 23,
+      NORM_PENTA15 = 25,
+      NORM_HEXA20  = 30,
+      NORM_POLYHED = 31
     } NormalizedCellType;
 
   class GenericMesh
index 32eceac2610cfbc1f6b3bc43569da0f1d8d2006a..ffe41b600c2f749e8f358cbf92f9df356c45ca72 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef _POINT_LOCATOR_ALGOS_TXX_
 #define _POINT_LOCATOR_ALGOS_TXX_
 
-#include "MEDMEM_Exception.hxx"
 #include "InterpolationUtils.hxx"
-#include "MEDMEM_CellModel.hxx"
+#include "CellModel.hxx"
 #include "BBTree.txx"
 #include <list>
 
@@ -71,10 +70,10 @@ namespace INTERP_KERNEL{
     {
       typedef typename MyMeshType::MyConnType ConnType;
       const NumberingPolicy numPol=MyMeshType::My_numPol;
-      vector<ConnType> candidates;
+      std::vector<ConnType> candidates;
       _tree->getElementsAroundPoint(x,candidates);
-      list<ConnType> retlist;
-      for (int i=0; i< candidates.size(); i++)
+      std::list<ConnType> retlist;
+      for(int i=0; i< candidates.size(); i++)
         {
           int ielem=candidates[i];
           if (elementContainsPoint(ielem,x))
@@ -95,9 +94,10 @@ namespace INTERP_KERNEL{
       const ConnType* conn=_mesh.getConnectivityPtr();
       const ConnType* conn_index= _mesh.getConnectivityIndexPtr();
       const ConnType* conn_elem=conn+OTT<ConnType,numPol>::ind2C(conn_index[i]);
+      NormalizedCellType type=_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(i));
+      const CellModel& cmType=CellModel::getCellModel(type);
 
-                
-      int nbnodes = conn_index[i+1]-conn_index[i];
+      int nbnodes = cmType.getNumberOfNodes();//conn_index[i+1]-conn_index[i];
                 
       // with dimension 2, it suffices to check all the edges
       // and see if the sign of double products from the point
@@ -137,32 +137,14 @@ namespace INTERP_KERNEL{
                         
       if (SPACEDIM==3)
         {
-          MED_EN::medGeometryElement elem_type;
-          switch (nbnodes) {
-          case 4 :
-            elem_type=MED_EN::MED_TETRA4;
-            break;
-          case 5:
-            elem_type=MED_EN::MED_PYRA5;
-            break;
-          case 6 :
-            elem_type=MED_EN::MED_PENTA6;
-            break;
-          case 8: 
-            elem_type=MED_EN::MED_HEXA8;
-            break;
-          default:
-            throw MEDMEM::MEDEXCEPTION("PointLocatorAlgos : bad number of nodes in 3D locator");
-          }
-          const MEDMEM::CELLMODEL& model=MEDMEM::CELLMODEL_Map::retrieveCellModel(elem_type);
-          int nbfaces = model.getNumberOfConstituents(1);
+          int nbfaces = cmType.getNumberOfSons();
           int sign[nbfaces];
           for (int iface=0; iface<nbfaces; iface++)
             {
-              int* connface=model.getNodesConstituent(1,iface+1);
-              const double* AA=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[0]-1]));
-              const double* BB=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[1]-1]));
-              const double* CC=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[2]-1]));
+              const unsigned* connface=cmType.getNodesConstituentTheSon(iface);
+              const double* AA=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[0]]));
+              const double* BB=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[1]]));
+              const double* CC=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[2]]));
                                                         
               double Vol=triple_product(AA,BB,CC,x);
               if (Vol<-1e-12)
@@ -172,7 +154,7 @@ namespace INTERP_KERNEL{
               else
                 sign[iface]=0;
             }
-          return  decide_from_sign(sign, nbfaces);
+          return decide_from_sign(sign, nbfaces);
         }
                         
     }
@@ -186,10 +168,7 @@ namespace INTERP_KERNEL{
           min_sign=(sign[i]<min_sign)?sign[i]:min_sign;
           max_sign=(sign[i]>max_sign)?sign[i]:max_sign;
         }
-      if (min_sign==-1 && max_sign==1)
-        return false;
-      else
-        return true;        
+      return (min_sign!=-1 || max_sign!=1);     
     }
   };
 }
index 1942b0997a29c03c3c83e5033e540256cbab60b1..fbdd36cef2f96ecbfa80bf8484af09abe6de2e52 100644 (file)
@@ -7,8 +7,6 @@
 #include <map>
 #include <iostream>
 
-using namespace std;
-
 namespace INTERP_KERNEL
 {
   template<int DIM>