From: eap Date: Tue, 27 Jan 2009 07:07:21 +0000 (+0000) Subject: improve comments X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_ParaMEDMEM_INDUS_5_0;p=tools%2Fmedcoupling.git improve comments --- diff --git a/src/INTERP_KERNEL/DualMESH.cxx b/src/INTERP_KERNEL/DualMESH.cxx index 58130e293..e2d292078 100644 --- a/src/INTERP_KERNEL/DualMESH.cxx +++ b/src/INTERP_KERNEL/DualMESH.cxx @@ -67,11 +67,6 @@ struct TTriaFace: public vector // ================================================================================ /*! * \brief Creates a dual mesh from the given one - * - * The dual mesh consists of dual cells corresponding to nodes of the input mesh. - * The dual cell is a holygon in 2D space and a polyhedron in 3D space. The dual - * cell is bound by edges (2D) or triangles (3D) connecting barycentres of cells - * around the input node with middles of edges ending at the input node. */ DualMESH::DualMESH(const MESH & mesh ):MESH() { @@ -118,18 +113,18 @@ DualMESH::DualMESH(const MESH & mesh ):MESH() // Make dual nodal connectivity. // nodes of dual mesh are: // 1. nodes at bary centres of input cells - // 2. nodes at middles of input edges + // 2. nodes at middles of input edges (hereafter called "middle nodes") // 3. nodes at bary centres of side faces of tetrahedrons (3D only) - // 4. boundary nodes + // 4. nodes coincident with input boundary nodes - _connectivity = new CONNECTIVITY( /*numberOfTypes = */0 ); + _connectivity = new CONNECTIVITY( /*numberOfClassicTypes = */0 ); _connectivity->setEntityDimension( _spaceDimension ); list< pair< int, int > > bndNodes; // pairs of input and dual mesh boundary nodes int nbBndNodes = 0; // counter of bndNodes - set< TLink > edges; // links between nodes storing id of middle node - set< TTriaFace > triangles; // triangles storing bary centre node id (3D only) - typedef set::iterator TEdgeIt; + set< TLink > edges; // input edges storing id of middle node + set< TTriaFace > triangles; // input triangles storing bary centre node id (3D only) + typedef set::iterator TEdgeIt; typedef set::iterator TFaceIt; // -------------------------------------------------------------------------------- @@ -143,8 +138,9 @@ DualMESH::DualMESH(const MESH & mesh ):MESH() for ( iNode = 1; iNode <= nbDualCells; ++iNode ) { // to make connectivity of poly around an input node, use map of middle node - // of edge to TLink between the middle node and a neighbor middle node. - // Each TLink represents two edges of a polygon: middle1-bary and bary-middle2 + // to TLink between the middle node and a neighbor middle node. + // Each TLink between middle nodes represents two edges of a polygon: + // middle1-bary and bary-middle2 map< int, TLink > middle2BaryLink; typedef map< int, TLink >::iterator TMid2LinkIt; // loop on triangles around iNode @@ -165,7 +161,7 @@ DualMESH::DualMESH(const MESH & mesh ):MESH() else { node[0] = triaConn[0]; node[1] = triaConn[1]; } - // get middle nodes on edges iNode-node[0] and iNode-node[1] + // get middle nodes on two edges: 1) iNode-node[0] and 2) iNode-node[1] int middle[2]; for ( int i = 0; i < 2; ++i ) { int nextMiddle = nbCellBary + edges.size() + nbBndNodes + 1; // next free node id diff --git a/src/INTERP_KERNEL/DualMESH.hxx b/src/INTERP_KERNEL/DualMESH.hxx index 092f32f8e..870f4fd19 100644 --- a/src/INTERP_KERNEL/DualMESH.hxx +++ b/src/INTERP_KERNEL/DualMESH.hxx @@ -34,7 +34,7 @@ namespace INTERP_KERNEL * \brief Creates a dual mesh from the given one * * The dual mesh consists of dual cells corresponding to nodes of the input mesh. - * The dual cell is a holygon in 2D space and a polyhedron in 3D space. The dual + * The dual cell is a polygon in 2D space and a polyhedron in 3D space. The dual * cell is bound by edges (2D) or triangles (3D) connecting barycentres of cells * around the input node with middles of edges ending at the input node. */ diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index 004aff22c..9f1ffad55 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -227,9 +227,10 @@ namespace INTERP_KERNEL { bc[3]=0; // for no solution - // Find bc by solving system of 3 equations - // Equation for X: + // Find bc by solving system of 3 equations using Gaussian elimination algorithm // bc1*( x1 - x4 ) + bc2*( x2 - x4 ) + bc3*( x3 - x4 ) = px - x4 + // bc1*( y1 - y4 ) + bc2*( y2 - y4 ) + bc3*( y3 - y4 ) = px - y4 + // bc1*( z1 - z4 ) + bc2*( z2 - z4 ) + bc3*( z3 - z4 ) = px - z4 const int nbCol=4, nbRow=3; double T[nbRow][nbCol]= @@ -237,7 +238,7 @@ namespace INTERP_KERNEL { n[0][_Y]-n[3][_Y], n[1][_Y]-n[3][_Y], n[2][_Y]-n[3][_Y], p[_Y]-n[3][_Y] }, { n[0][_Z]-n[3][_Z], n[1][_Z]-n[3][_Z], n[2][_Z]-n[3][_Z], p[_Z]-n[3][_Z] }}; - // make upper triangular matrix + // make upper triangular matrix (forward elimination) int iR[nbRow] = { 0, 1, 2 }; @@ -271,7 +272,8 @@ namespace INTERP_KERNEL return; // no solution } tRow[ 3 ] /= tRow[ 2 ]; - // calculate solution: backward substitution + + // calculate solution (back substitution) bc[ 2 ] = tRow[ 3 ]; @@ -804,50 +806,50 @@ namespace INTERP_KERNEL else return false; } else - if(i2next == istart2) - return false; - else - { - if(distance2(L1,i1next*dim, L2,i2next*dim) > epsilon ) - return false; - else - { - i1 = i1next; - i2 = i2next; - i1next = ( i1 + 1 ) % size1; - i2next = ( i2 + sign + size2 ) % size2; - } - } + if(i2next == istart2) + return false; + else + { + if(distance2(L1,i1next*dim, L2,i2next*dim) > epsilon ) + return false; + else + { + i1 = i1next; + i2 = i2next; + i1next = ( i1 + 1 ) % size1; + i2next = ( i2 + sign + size2 ) % size2; + } + } } } - /*! Tests if two list of nodes (not necessarily distincts) describe the same polygon.*/ - /*! Existence of multiple points in the list is considered.*/ - template - bool checkEqualPolygons(T * L1, T * L2, double epsilon) - { - if(L1==NULL || L2==NULL) - { - std::cout << "Warning InterpolationUtils.hxx:checkEqualPolygonsPointer: Null pointer " << std::endl; - throw(Exception("big error: not closed polygon...")); - } - - int size1 = (*L1).size()/dim; - int size2 = (*L2).size()/dim; - int istart1 = 0; - int istart2 = 0; - - while( istart2 < size2 && distance2(L1,istart1*dim, L2,istart2*dim) > epsilon ) istart2++; - - if(istart2 == size2) - { - return (size1 == 0) && (size2 == 0); - } - else - return checkEqualPolygonsOneDirection( L1, L2, size1, size2, istart1, istart2, epsilon, 1) - || checkEqualPolygonsOneDirection( L1, L2, size1, size2, istart1, istart2, epsilon, -1); + /*! Tests if two list of nodes (not necessarily distincts) describe the same polygon.*/ + /*! Existence of multiple points in the list is considered.*/ + template + bool checkEqualPolygons(T * L1, T * L2, double epsilon) + { + if(L1==NULL || L2==NULL) + { + std::cout << "Warning InterpolationUtils.hxx:checkEqualPolygonsPointer: Null pointer " << std::endl; + throw(Exception("big error: not closed polygon...")); + } - } + int size1 = (*L1).size()/dim; + int size2 = (*L2).size()/dim; + int istart1 = 0; + int istart2 = 0; + + while( istart2 < size2 && distance2(L1,istart1*dim, L2,istart2*dim) > epsilon ) istart2++; + + if(istart2 == size2) + { + return (size1 == 0) && (size2 == 0); + } + else + return checkEqualPolygonsOneDirection( L1, L2, size1, size2, istart1, istart2, epsilon, 1) + || checkEqualPolygonsOneDirection( L1, L2, size1, size2, istart1, istart2, epsilon, -1); + + } } diff --git a/src/INTERP_KERNEL/Test/Makefile.am b/src/INTERP_KERNEL/Test/Makefile.am index de3d68f3c..63dd04db0 100644 --- a/src/INTERP_KERNEL/Test/Makefile.am +++ b/src/INTERP_KERNEL/Test/Makefile.am @@ -71,9 +71,11 @@ dist_libInterpKernelTest_la_SOURCES= \ DualMESHTests.cxx \ UnitTetraIntersectionBaryTest.cxx +# DO NOT define "OPTIMIZE" here (-DOPTIMIZE), else you may have problems +# due to different sizeof(TransformedTriangle) in different packages libInterpKernelTest_la_CPPFLAGS = @CPPUNIT_INCLUDES@ $(MED2_INCLUDES) $(HDF5_INCLUDES) \ -I$(srcdir)/.. -I$(srcdir)/../../MEDWrapper/V2_1/Core -I$(srcdir)/../../MEDMEM \ - -I$(srcdir)/../Geometric2D -DOPTIMIZE -DLOG_LEVEL=0 + -I$(srcdir)/../Geometric2D -DLOG_LEVEL=0 libInterpKernelTest_la_LDFLAGS = @CPPUNIT_LIBS@ ../../MEDWrapper/V2_1/Core/libmed_V2_1.la \ ../libinterpkernel.la ../Geometric2D/libInterpGeometric2DAlg.la \ diff --git a/src/INTERP_KERNEL/Test/MeshTestToolkit.hxx b/src/INTERP_KERNEL/Test/MeshTestToolkit.hxx index 8ee03a61f..aa1c23a30 100644 --- a/src/INTERP_KERNEL/Test/MeshTestToolkit.hxx +++ b/src/INTERP_KERNEL/Test/MeshTestToolkit.hxx @@ -4,15 +4,13 @@ #include "../Interpolation3D.hxx" #include "../Interpolation3D.txx" #include "../InterpolationPlanar.hxx" -#include "../IntersectionResult.hxx" #include #include #define ERR_TOL 1.0e-8 -typedef INTERP_KERNEL::IntersectionResult IntersectionMatrix; -// typedef std::vector > IntersectionMatrix; +typedef std::vector > IntersectionMatrix; namespace INTERP_KERNEL { diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index 435783751..719c91da3 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -9,7 +9,6 @@ #include "Interpolation3D.txx" #include "MEDNormalizedUnstructuredMesh.hxx" #include "InterpolationOptions.hxx" -#include "IntersectionResult.hxx" /*! \class InterpolationMatrix