From: ageay Date: Mon, 5 Aug 2013 09:53:19 +0000 (+0000) Subject: Debug on GENERAL_24 and GENERAL_48 X-Git-Tag: V7_3_1b1~231 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e215e6f76f706ca097b9fdca5665ec3f06237e69;p=tools%2Fmedcoupling.git Debug on GENERAL_24 and GENERAL_48 --- diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx index 1cddccdca..370b73c9a 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP0P0.txx @@ -77,9 +77,8 @@ namespace INTERP_KERNEL template void PolyhedronIntersectorP0P0::intersectCells(ConnType targetCell, const std::vector& srcCells, MyMatrix& res) { - int nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)); releaseArrays(); - _split.splitTargetCell(targetCell,nbOfNodesT,_tetra); + _split.splitTargetCell2(targetCell,_tetra); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) { double volume = 0.; diff --git a/src/INTERP_KERNEL/SplitterTetra.hxx b/src/INTERP_KERNEL/SplitterTetra.hxx index 9bf2cffb5..ccfa1d256 100644 --- a/src/INTERP_KERNEL/SplitterTetra.hxx +++ b/src/INTERP_KERNEL/SplitterTetra.hxx @@ -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* >& tetra); void splitTargetCell(typename MyMeshTypeT::MyConnType targetCell, typename MyMeshTypeT::MyConnType nbOfNodesT, - typename std::vector< SplitterTetra* >& tetra); - void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra); - void sixSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra); - void calculateGeneral24Tetra(typename std::vector< SplitterTetra* >& tetra); - void calculateGeneral48Tetra(typename std::vector< SplitterTetra* >& tetra); - void splitPyram5(typename std::vector< SplitterTetra* >& tetra); - void splitConvex(typename MyMeshTypeT::MyConnType targetCell, - typename std::vector< SplitterTetra* >& 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* >& tetra);//to suppress + void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra);//to suppress + void sixSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra);//to suppress + void calculateGeneral24Tetra(typename std::vector< SplitterTetra* >& tetra);//to suppress + void calculateGeneral48Tetra(typename std::vector< SplitterTetra* >& tetra);//to suppress + void splitPyram5(typename std::vector< SplitterTetra* >& tetra);//to suppress + void splitConvex(typename MyMeshTypeT::MyConnType targetCell,//to suppress + typename std::vector< SplitterTetra* >& 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 - 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; diff --git a/src/INTERP_KERNEL/SplitterTetra.txx b/src/INTERP_KERNEL/SplitterTetra.txx index 38aab3c23..4bc794ae6 100644 --- a/src/INTERP_KERNEL/SplitterTetra.txx +++ b/src/INTERP_KERNEL/SplitterTetra.txx @@ -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 + SplitterTetra::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 + void SplitterTetra2::splitTargetCell2(typename MyMeshTypeT::MyConnType targetCell, typename std::vector< SplitterTetra* >& 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 tetrasNodalConn; + std::vector 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=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(_src_mesh,tmp); + } + } /*! * @param targetCell in C mode. diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx index cd9a5dd83..c87396cf8 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx @@ -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; diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx index 9c50cdaf2..8e8ffb622 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx @@ -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; diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx index a1f52642f..95d74e589 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx @@ -66,19 +66,19 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingNormalizedUnstructuredMesh -unsigned char MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodesOfElement(int eltId) const +int MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodesOfElement(int eltId) const { return _mesh->getNumberOfNodesInCell(eltId); } template -unsigned long MEDCouplingNormalizedUnstructuredMesh::getNumberOfElements() const +int MEDCouplingNormalizedUnstructuredMesh::getNumberOfElements() const { return _mesh->getNumberOfCells(); } template -unsigned long MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodes() const +int MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodes() const { return _mesh->getNumberOfNodes(); } diff --git a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx index f62ee6832..662ad77a6 100644 --- a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx @@ -1311,7 +1311,7 @@ const double coordsTrgData[36]={-2,1.1547005383792521,264.85199999999998,-2,0.57 std::vector > 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(); }