]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Debug on GENERAL_24 and GENERAL_48
authorageay <ageay>
Mon, 5 Aug 2013 09:53:19 +0000 (09:53 +0000)
committerageay <ageay>
Mon, 5 Aug 2013 09:53:19 +0000 (09:53 +0000)
src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx
src/INTERP_KERNEL/SplitterTetra.hxx
src/INTERP_KERNEL/SplitterTetra.txx
src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx
src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx
src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx
src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx

index 1cddccdcae199969f359d8d679df96e3e03872e7..370b73c9a2fe4cc1472c365b758d9dffbeb7938c 100644 (file)
@@ -77,9 +77,8 @@ namespace INTERP_KERNEL
   template<class MyMeshType, class MyMatrix>
   void PolyhedronIntersectorP0P0<MyMeshType,MyMatrix>::intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res)
   {
-    int nbOfNodesT=Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell));
     releaseArrays();
-    _split.splitTargetCell(targetCell,nbOfNodesT,_tetra);
+    _split.splitTargetCell2(targetCell,_tetra);
     for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
       {
         double volume = 0.;
index 9bf2cffb5f07078e1589007cc16dd083946f3362..ccfa1d2563b19ff8dda4c2b8c8dadd0b459d2971 100644 (file)
@@ -363,6 +363,8 @@ namespace INTERP_KERNEL
     
     SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId);
 
+    SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12]);
+
     ~SplitterTetra();
 
     double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=0);
@@ -539,20 +541,21 @@ namespace INTERP_KERNEL
     SplitterTetra2(const MyMeshTypeT& targetMesh, const MyMeshTypeS& srcMesh, SplittingPolicy policy);
     ~SplitterTetra2();
     void releaseArrays();
+    void splitTargetCell2(typename MyMeshTypeT::MyConnType targetCell, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
     void splitTargetCell(typename MyMeshTypeT::MyConnType targetCell, typename MyMeshTypeT::MyConnType nbOfNodesT,
-                         typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
-    void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
-    void sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
-    void calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
-    void calculateGeneral48Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
-    void splitPyram5(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
-    void splitConvex(typename MyMeshTypeT::MyConnType                     targetCell,
-                     typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
-    void calculateSubNodes(const MyMeshTypeT& targetMesh, typename MyMeshTypeT::MyConnType targetCell);
-    inline const double* getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node);
-    inline const double* getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId);
+                         typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
+    void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
+    void sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
+    void calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
+    void calculateGeneral48Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
+    void splitPyram5(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
+    void splitConvex(typename MyMeshTypeT::MyConnType                     targetCell,//to suppress
+                     typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
+    void calculateSubNodes(const MyMeshTypeT& targetMesh, typename MyMeshTypeT::MyConnType targetCell);//to suppress
+    inline const double* getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node);//to suppress
+    inline const double* getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId);//to suppress
     //template<int n>
-    inline void calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts);
+    inline void calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts);//to suppress
   private:
     const MyMeshTypeT& _target_mesh;
     const MyMeshTypeS& _src_mesh;
index 38aab3c233bce06edbf49a475325afa7f9460575..4bc794ae6d45e58c16be404d3f68759c9c2e597f 100644 (file)
@@ -84,6 +84,29 @@ namespace INTERP_KERNEL
     // create the affine transform
     _t=new TetraAffineTransform(_coords);
   }
+
+  /**
+   * SplitterTetra class computes for a list of cell ids of a given mesh \a srcMesh (badly named) the intersection with a 
+   * single TETRA4 cell given by \a tetraCorners (of length 4) and \a nodesId (of length 4 too). \a nodedIds is given only to establish
+   * if a partial computation of a triangle has already been performed (to increase performance).
+   *
+   * The \a srcMesh can contain polyhedron cells.
+   * 
+   * 
+   * Constructor creating object from the four corners of the tetrahedron.
+   *
+   * \param [in] srcMesh       mesh containing the source elements
+   * \param [in] tetraCorners  array 4*3 doubles containing corners of input tetrahedron (P0X,P0Y,P0Y,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z).
+   */
+  template<class MyMeshType>
+  SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12]): _t(0),_src_mesh(srcMesh)
+  {
+    _conn[0]=0; _conn[1]=1; _conn[2]=2; _conn[3]=3;
+    _coords[0]=tetraCorners[0]; _coords[1]=tetraCorners[1]; _coords[2]=tetraCorners[2]; _coords[3]=tetraCorners[3]; _coords[4]=tetraCorners[4]; _coords[5]=tetraCorners[5];
+    _coords[6]=tetraCorners[6]; _coords[7]=tetraCorners[7]; _coords[8]=tetraCorners[8]; _coords[9]=tetraCorners[9]; _coords[10]=tetraCorners[10]; _coords[11]=tetraCorners[11];
+    // create the affine transform
+    _t=new TetraAffineTransform(_coords);
+  }
   
   /**
    * Destructor
@@ -898,6 +921,44 @@ namespace INTERP_KERNEL
       }
     _nodes.clear();
   }
+  
+  /*!
+   * \param [in] targetCell in C mode.
+   * \param [out] tetra is the output result tetra containers.
+   */
+  template<class MyMeshTypeT, class MyMeshTypeS>
+  void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::splitTargetCell2(typename MyMeshTypeT::MyConnType targetCell, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
+  {
+    const int *refConn(_target_mesh.getConnectivityPtr());
+    const int *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]);
+    INTERP_KERNEL::NormalizedCellType gt(_target_mesh.getTypeOfElement(targetCell));
+    std::vector<int> tetrasNodalConn;
+    std::vector<double> addCoords;
+    const double *coords(_target_mesh.getCoordinatesPtr());
+    SplitIntoTetras(_splitting_pol,gt,cellConn,refConn+_target_mesh.getConnectivityIndexPtr()[targetCell+1],coords,tetrasNodalConn,addCoords);
+    std::size_t nbTetras(tetrasNodalConn.size()/4); tetra.resize(nbTetras);
+    double tmp[12];
+    for(std::size_t i=0;i<nbTetras;i++)
+      {
+        for(int j=0;j<4;j++)
+          {
+            int cellId(tetrasNodalConn[4*i+j]);
+            if(cellId>=0)
+              {
+                tmp[j*3+0]=coords[3*cellId+0];
+                tmp[j*3+1]=coords[3*cellId+1];
+                tmp[j*3+2]=coords[3*cellId+2];
+              }
+            else
+              {
+                tmp[j*3+0]=addCoords[3*(-cellId-1)+0];
+                tmp[j*3+1]=addCoords[3*(-cellId-1)+1];
+                tmp[j*3+2]=addCoords[3*(-cellId-1)+2];
+              }
+          }
+        tetra[i]=new SplitterTetra<MyMeshTypeS>(_src_mesh,tmp);
+      }
+  }
 
   /*!
    * @param targetCell in C mode.
index cd9a5dd83181d7fcf1ada93814a05dc52776398b..c87396cf8f63cf8bd5dc68a428a35f6698fdeae4 100644 (file)
@@ -40,8 +40,8 @@ public:
   MEDCouplingNormalizedCartesianMesh(const ParaMEDMEM::MEDCouplingCMesh *mesh);
   //void getBoundingBox(double *boundingBox) const;
   //INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const;
-  //unsigned char getNumberOfNodesOfElement(int eltId) const;
-  //unsigned long getNumberOfNodes() const;
+  //int getNumberOfNodesOfElement(int eltId) const;
+  //int getNumberOfNodes() const;
   unsigned long getNumberOfElements() const;
   unsigned long nbCellsAlongAxis(int axis) const;
   const double * getCoordsAlongAxis(int axis) const;
index 9c50cdaf2583699368e1a881087358dfa752a65d..8e8ffb622b482c281b16671aaed500794feed834 100644 (file)
@@ -40,9 +40,9 @@ public:
   MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingUMesh *mesh);
   void getBoundingBox(double *boundingBox) const;
   INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const;
-  unsigned char getNumberOfNodesOfElement(int eltId) const;
-  unsigned long getNumberOfElements() const;
-  unsigned long getNumberOfNodes() const;
+  int getNumberOfNodesOfElement(int eltId) const;
+  int getNumberOfElements() const;
+  int getNumberOfNodes() const;
   const int *getConnectivityPtr() const;
   const double *getCoordinatesPtr() const;
   const int *getConnectivityIndexPtr() const;
index a1f52642f67be69a4081623097d4a272de0205fd..95d74e589ad0f580ce83a3f18b3e5e69f4a4854b 100644 (file)
@@ -66,19 +66,19 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingNormalizedUnstructuredMesh<SPACEDIM
 }
 
 template<int SPACEDIM,int MESHDIM>
-unsigned char MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodesOfElement(int eltId) const
+int MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodesOfElement(int eltId) const
 {
   return _mesh->getNumberOfNodesInCell(eltId);
 }
 
 template<int SPACEDIM,int MESHDIM>
-unsigned long MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfElements() const
+int MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfElements() const
 {
   return _mesh->getNumberOfCells();
 }
 
 template<int SPACEDIM,int MESHDIM>
-unsigned long MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodes() const
+int MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfNodes() const
 {
   return _mesh->getNumberOfNodes();
 }
index f62ee6832fdf45017802ed2ee6907a72efaa709e..662ad77a6a7be1a83e097530d1008a353d352d20 100644 (file)
@@ -1311,7 +1311,7 @@ const double coordsTrgData[36]={-2,1.1547005383792521,264.85199999999998,-2,0.57
  std::vector<std::map<int,double> > matrx(remapper.getCrudeMatrix());
  CPPUNIT_ASSERT_EQUAL(1,(int)matrx.size());
  CPPUNIT_ASSERT_EQUAL(1,(int)matrx[0].size());
std::cerr << std::endl << matrx[0][0] << std::endl;
CPPUNIT_ASSERT_DOUBLES_EQUAL(valExpected,matrx[0][0],1e-13);
  //
  srcMesh->decrRef(); trgMesh->decrRef();
 }