From 50d5fadd764dc6eaa6fd5f4b13c41797998369b2 Mon Sep 17 00:00:00 2001 From: vbd Date: Fri, 14 Sep 2007 10:06:17 +0000 Subject: [PATCH] staffan : * doc updates --- src/INTERP_KERNEL/Interpolation.hxx | 6 + src/INTERP_KERNEL/Intersector.hxx | 1 + src/INTERP_KERNEL/Intersector3D.hxx | 3 +- src/INTERP_KERNEL/IntersectorTetra.hxx | 4 +- src/INTERP_KERNEL/Log.hxx | 1 + src/INTERP_KERNEL/Test/CppUnitTest.hxx | 5 +- src/INTERP_KERNEL/Test/HexaTests.hxx | 10 +- .../Test/Interpolation3DTest.hxx | 7 +- .../Test/Interpolation3DTestSuite.hxx | 15 +- .../Test/MultiElementTetraTests.hxx | 30 +- .../Test/SingleElementTetraTests.hxx | 32 +- .../Test/TransformedTriangleIntersectTest.cxx | 490 ++++++++++-------- .../Test/TransformedTriangleIntersectTest.hxx | 3 - .../Test/TransformedTriangleTest.cxx | 16 +- .../Test/TransformedTriangleTest.hxx | 4 + 15 files changed, 349 insertions(+), 278 deletions(-) diff --git a/src/INTERP_KERNEL/Interpolation.hxx b/src/INTERP_KERNEL/Interpolation.hxx index 787a99982..ced640332 100644 --- a/src/INTERP_KERNEL/Interpolation.hxx +++ b/src/INTERP_KERNEL/Interpolation.hxx @@ -7,6 +7,12 @@ #include "MEDMEM_Mesh.hxx" +/** + * \mainpage + * Status : documentation of 3D - part of intersection matrix calculation more or less complete + * + * + */ namespace MEDMEM { diff --git a/src/INTERP_KERNEL/Intersector.hxx b/src/INTERP_KERNEL/Intersector.hxx index 55785eff5..558d6bf29 100644 --- a/src/INTERP_KERNEL/Intersector.hxx +++ b/src/INTERP_KERNEL/Intersector.hxx @@ -3,6 +3,7 @@ namespace MEDMEM { + /// \brief OBSOLETE class TargetIntersector { public: diff --git a/src/INTERP_KERNEL/Intersector3D.hxx b/src/INTERP_KERNEL/Intersector3D.hxx index d9b52d37f..dc8db25c6 100644 --- a/src/INTERP_KERNEL/Intersector3D.hxx +++ b/src/INTERP_KERNEL/Intersector3D.hxx @@ -16,7 +16,8 @@ namespace INTERP_UTILS namespace MEDMEM { - /* + /** + * \brief OBSOLETE * Class calculating the volume of intersection of individual 3D elements. * */ diff --git a/src/INTERP_KERNEL/IntersectorTetra.hxx b/src/INTERP_KERNEL/IntersectorTetra.hxx index fd06c51fe..33f687866 100644 --- a/src/INTERP_KERNEL/IntersectorTetra.hxx +++ b/src/INTERP_KERNEL/IntersectorTetra.hxx @@ -17,7 +17,7 @@ using __gnu_cxx::hash_map; namespace INTERP_UTILS { /** - * Class representing a triangular face, used as key in caching hash map in IntersectorTetra. + * \brief Class representing a triangular face, used as key in caching hash map in IntersectorTetra. * */ class TriangleFaceKey @@ -123,7 +123,7 @@ namespace __gnu_cxx { /** - * Template specialization of __gnu_cxx::hash function object for use with a __gnu_cxx::hash_map + * \brief Template specialization of __gnu_cxx::hash function object for use with a __gnu_cxx::hash_map * with TriangleFaceKey as key class. * */ diff --git a/src/INTERP_KERNEL/Log.hxx b/src/INTERP_KERNEL/Log.hxx index 8e609a532..706ea75f9 100644 --- a/src/INTERP_KERNEL/Log.hxx +++ b/src/INTERP_KERNEL/Log.hxx @@ -4,6 +4,7 @@ /** * \file Log.hxx * \brief Simple pre-processor logging utility. + * * Replaces LOG( lvl, x ) with "if(lvl <= LOG_LEVEL) std::cout << x << std::endl" when logging is active * (LOG_LEVEL > 0 is defined). x is the level at which the message should be logged - if it is smaller or equal to * LOG_LEVEL (which can be defined at compile-time for each file by passing option -DLOG_LEVEL=x to gcc) diff --git a/src/INTERP_KERNEL/Test/CppUnitTest.hxx b/src/INTERP_KERNEL/Test/CppUnitTest.hxx index ba0618ddd..f2ea8d868 100644 --- a/src/INTERP_KERNEL/Test/CppUnitTest.hxx +++ b/src/INTERP_KERNEL/Test/CppUnitTest.hxx @@ -15,7 +15,10 @@ private: double x; }; - +/** + * \brief Class to test CppUnit : not very useful + * + */ class TestBogusClass : public CppUnit::TestFixture { diff --git a/src/INTERP_KERNEL/Test/HexaTests.hxx b/src/INTERP_KERNEL/Test/HexaTests.hxx index 825551db0..19ff13edc 100644 --- a/src/INTERP_KERNEL/Test/HexaTests.hxx +++ b/src/INTERP_KERNEL/Test/HexaTests.hxx @@ -6,7 +6,7 @@ namespace INTERP_TEST { /** - * Class performing intersection tests on meshes with hexahedral elements. + * \brief Class performing intersection tests on meshes with hexahedral elements. * */ class HexaTests : public Interpolation3DTestSuite @@ -23,28 +23,28 @@ namespace INTERP_TEST public: /// Intersection between two boxes, aligned with the axes.One has 60 hexahedral elements and the other has 39 tetrahedral elements - /// Status : pass + /// \brief Status : pass void simpleHexaBox() { _testTools->intersectMeshes("BoxHexa1", "BoxTetra2", 65250, 1.0e-5); } /// Intersection of a box with 60 hexahedral elements with itself - /// Status : pass + /// \brief Status : pass void reflexiveHexaBox() { _testTools->intersectMeshes("BoxHexa1", "BoxHexa1", 204000); } /// Intersection between two boxes, aligned with the axes.Both have hexahedral elements : one 36, the other 60 - /// Status : pass + /// \brief Status : pass void hexaBoxes() { _testTools->intersectMeshes("BoxHexa1", "BoxHexa2", 65250); } /// Intersection between two boxes in general position with hexahedral elements. One has 200 elements and the other 420. - /// Staus : fails - reason unknown. The matrix does not fulfil the transpose requirement : that W_AB = W_BA^T + /// \brief Status : fails - reason unknown. The matrix does not fulfil the transpose requirement : that W_AB = W_BA^T void hexaBoxesMoved() { _testTools->intersectMeshes("MovedHexaBox1", "MovedHexaBox2", 65250); diff --git a/src/INTERP_KERNEL/Test/Interpolation3DTest.hxx b/src/INTERP_KERNEL/Test/Interpolation3DTest.hxx index 58b9afd6b..dc5a6b944 100644 --- a/src/INTERP_KERNEL/Test/Interpolation3DTest.hxx +++ b/src/INTERP_KERNEL/Test/Interpolation3DTest.hxx @@ -1,5 +1,5 @@ -#ifndef __TU_INTERPOLATION_3D_TEST_SUITE_HXX__ -#define __TU_INTERPOLATION_3D_TEST_SUITE_HXX__ +#ifndef __TU_INTERPOLATION_3D_TEST_HXX__ +#define __TU_INTERPOLATION_3D_TEST_HXX__ #include #include "../Interpolation3D.hxx" @@ -9,7 +9,8 @@ using MEDMEM::Interpolation3D; class MEDMEM::MESH; -class Interpolation3DTestSuite : public CppUnit::TestFixture +/// \brief OBSOLETE - renamed Interpolation3DTestSuite +class Interpolation3DTest : public CppUnit::TestFixture { public: diff --git a/src/INTERP_KERNEL/Test/Interpolation3DTestSuite.hxx b/src/INTERP_KERNEL/Test/Interpolation3DTestSuite.hxx index 7a80b2ef3..f790eba85 100644 --- a/src/INTERP_KERNEL/Test/Interpolation3DTestSuite.hxx +++ b/src/INTERP_KERNEL/Test/Interpolation3DTestSuite.hxx @@ -8,15 +8,28 @@ namespace INTERP_TEST { + /** + * \brief Base class for mesh intersection test suites. + * + */ class Interpolation3DTestSuite : public CppUnit::TestFixture { public: + /** + * Sets up the test suite. + * Creates the MeshTestToolkit object used by the tests. + * + */ void setUp() { _testTools = new MeshTestToolkit(); } + /** + * Cleans up after the test suite. + * Liberates the MeshTestToolkit object used by the tests. + */ void tearDown() { delete _testTools; @@ -25,7 +38,7 @@ namespace INTERP_TEST protected: - + /// MeshTestToolkit object to which the tests are delegated MeshTestToolkit* _testTools; }; diff --git a/src/INTERP_KERNEL/Test/MultiElementTetraTests.hxx b/src/INTERP_KERNEL/Test/MultiElementTetraTests.hxx index fcbc673f0..4da06f233 100644 --- a/src/INTERP_KERNEL/Test/MultiElementTetraTests.hxx +++ b/src/INTERP_KERNEL/Test/MultiElementTetraTests.hxx @@ -6,7 +6,7 @@ namespace INTERP_TEST { /** - * Class testing algorithm by intersecting meshes of several + * \brief Class testing algorithm by intersecting meshes of several * elements (all tetrahedra) - up to a few thousand. This serves to check the * filtering methods and the matrix assemblage, as well as verifying * that computation errors do not become unmanageable. It uses mehes of @@ -37,98 +37,98 @@ namespace INTERP_TEST public: /// Tetrahedron situated totally inside another - /// Status : pass + /// \brief Status : pass void tetraComplexIncluded() { _testTools->intersectMeshes("ComplexIncludedTetra", "ComplexIncludingTetra", 17.0156); } /// Unit tetrahedron divided in 4 elements intersecting itself. - /// Status : pass + /// \brief Status : pass void dividedUnitTetraSimplerReflexive() { _testTools->intersectMeshes("DividedUnitTetraSimpler", "DividedUnitTetraSimpler", 0.1666667); } /// Unit tetrahedron divided in 14 elements intersecting itself. - /// Status : pass + /// \brief Status : pass void dividedUnitTetraReflexive() { _testTools->intersectMeshes("DividedUnitTetra", "DividedUnitTetra", 0.1666667); } /// Unit tetrahedron divided in 4 elements intersecting slightly displaced version of itself. - /// Status : pass + /// \brief Status : pass void nudgedDividedUnitTetraSimpler() { _testTools->intersectMeshes("NudgedDividedUnitTetraSimpler", "DividedUnitTetraSimpler", 0.150191); } /// Unit tetrahedron divided in 14 elements intersecting slightly displaced version of itself. - /// Status : pass + /// \brief Status : pass void nudgedDividedUnitTetra() { _testTools->intersectMeshes("NudgedDividedUnitTetra", "DividedUnitTetra", 0.150191); } /// Two intersecting tetrahedra in general position, one with 23 elements, the other with 643 elements - /// Status : pass + /// \brief Status : pass void dividedGenTetra() { _testTools->intersectMeshes("DividedGenTetra1", "DividedGenTetra2", 0.546329); } /// Large box in general position with 12 elements intersecting itself - /// Status : pass + /// \brief Status : pass void tinyBoxReflexive() { _testTools->intersectMeshes("TinyBox", "TinyBox", 979200); } /// Small box in general position with 33 elements intersecting itself - /// Status : pass + /// \brief Status : pass void boxReflexive() { _testTools->intersectMeshes("Box3", "Box3", 13.9954); } /// Box in general position with 67 elements intersecting itself - /// Status : pass + /// \brief Status : pass void moderateBoxEvenSmallerReflexive() { _testTools->intersectMeshes("BoxEvenSmaller1", "BoxEvenSmaller1", 1.44018e6); } /// Box in general position with 544 elements intersecting itself - /// Status : pass + /// \brief Status : pass void moderateBoxSmallReflexive() { _testTools->intersectMeshes("BoxModSmall1", "BoxModSmall1", 1.44018e6); } /// Large box in general position with 2943 elements intersecting itself - /// Status : pass + /// \brief Status : pass void boxReflexiveModerate() { _testTools->intersectMeshes("Box1Moderate", "Box1Moderate", 1.0e6); } /// Two intersecting boxes in general position with 12 and 18 elements - /// Staus : pass + /// \brief Status : pass void tetraBoxes() { _testTools->intersectMeshes("Box1", "Box2", 124.197); } /// Two intersecting boxes in general position with 430 and 544 elements - /// Staus : pass + /// \brief Status : pass void moderateBoxesSmaller() { _testTools->intersectMeshes("BoxModSmall1", "BoxModSmall2", 321853); } /// Two intersecting boxes in general position with 2943 and 3068 elements - /// Staus : pass + /// \brief Status : pass void moderateBoxes() { _testTools->intersectMeshes("Box1Moderate", "Box2Moderate", 376856); diff --git a/src/INTERP_KERNEL/Test/SingleElementTetraTests.hxx b/src/INTERP_KERNEL/Test/SingleElementTetraTests.hxx index 3cc7d1668..e0a4b7d34 100644 --- a/src/INTERP_KERNEL/Test/SingleElementTetraTests.hxx +++ b/src/INTERP_KERNEL/Test/SingleElementTetraTests.hxx @@ -6,7 +6,7 @@ namespace INTERP_TEST { /** - * Class testing algorithm by intersecting simple meshes having only one element each. This serves mainly to verify that + * \brief Class testing algorithm by intersecting simple meshes having only one element each. This serves mainly to verify that * the volume calculations between elements is correct. * */ @@ -35,70 +35,70 @@ namespace INTERP_TEST public: /// Unit tetrahedron mesh intersecting itself - /// Status : pass + /// \brief Status : pass void tetraReflexiveUnit() { _testTools->intersectMeshes("UnitTetra", "UnitTetra", 1.0/6.0); } /// Tetrahedron mesh with itself - /// Status : pass + /// \brief Status : pass void tetraReflexiveGeneral() { _testTools->intersectMeshes("GeneralTetra", "GeneralTetra", 0.428559); } /// Unit tetrahedron mesh intersecting slightly displaced copy of itself - /// Status : pass + /// \brief Status : pass void tetraNudged() { _testTools->intersectMeshes("UnitTetra", "NudgedTetra", 0.142896); } /// Single-element unit tetrahedron mesh intersecting even slightly displaced (along one axis only) copy of itself - /// Status : pass + /// \brief Status : pass void tetraNudgedSimpler() { _testTools->intersectMeshes("UnitTetra", "NudgedSimpler", 0.152112); } /// Tetrahedron intersecting unit tetrahedron with in non-degenerate way around corner O - /// Status : pass + /// \brief Status : pass void tetraCorner() { _testTools->intersectMeshes("UnitTetra", "CornerTetra", 0.0135435); } /// Tetrahedron situated totally inside another - /// Status : pass + /// \brief Status : pass void tetraSimpleIncluded() { _testTools->intersectMeshes("SimpleIncludedTetra", "SimpleIncludingTetra", 17.0156); } /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares an edge - /// Status : pass + /// \brief Status : pass void tetraDegenEdge() { _testTools->intersectMeshes("UnitTetraDegenT", "DegenEdgeXY", 0.0); } /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares a face - /// Status : pass + /// \brief Status : pass void tetraDegenFace() { _testTools->intersectMeshes("UnitTetraDegenT", "DegenFaceXYZ", 0.0); } /// Displaced unit tetrahedron intersecting another unit tetrahedron with which it shares a part of the face XYZ - /// Status : pass + /// \brief Status : pass void tetraDegenTranslatedInPlane() { _testTools->intersectMeshes("UnitTetraDegenT", "DegenTranslatedInPlane", 0.0571667); } /// Tetrahedron having only half-strip intersections with the unit tetrahedron - /// Staus : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed. + /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed. void tetraHalfstripOnly() { // NB this test is not completely significant : we should also verify that @@ -107,7 +107,7 @@ namespace INTERP_TEST } /// Tetrahedron having only half-strip intersections with the unit tetrahedron - /// Staus : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed. + /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed. void tetraHalfstripOnly2() { // NB this test is not completely significant : we should also verify that @@ -116,7 +116,7 @@ namespace INTERP_TEST } /// Tetrahedron having only half-strip intersections with the unit tetrahedron - /// Staus : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed. + /// \brief Status : pass, but does not really test what it should - does not check that the intersections are detected. No longer needed. void tetraSimpleHalfstripOnly() { // NB this test is not completely significant : we should also verify that @@ -125,14 +125,14 @@ namespace INTERP_TEST } /// Two intersecting tetrahedra situated in a general position in space - /// Status : pass + /// \brief Status : pass void generalTetra() { _testTools->intersectMeshes("GenTetra1", "GenTetra2", 4.91393); } /// Tetrahedron which is in a tricky position relative to unit tetrahedron. - /// Status : pass + /// \brief Status : pass void trickyTetra1() { _testTools->intersectMeshes("UnitTetra", "TrickyTetra1", 0.0); @@ -140,7 +140,7 @@ namespace INTERP_TEST /// Two large tetrahedra which nearly share part of an edge and intersect at the origin. Created with goal of getting the as-of-yet uncovered "consistency" test /// part of the correction of double products covered. However, it does not succeed with this. - /// Status : fails, but is quite far-fetched as far as typical use cases are concerned + /// \brief Status : fails, but is quite far-fetched as far as typical use cases are concerned void inconsistentTetra() { _testTools->intersectMeshes("LargeUnitTetra.med", "LargeUnitTetra", "LargeInconsistentTetra.med", "LargeInconsistent", 7.86231e7); diff --git a/src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.cxx b/src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.cxx index 8b3d5a3ee..aee515900 100644 --- a/src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.cxx +++ b/src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.cxx @@ -4,12 +4,19 @@ #include "Log.hxx" #ifdef OPTIMIZE - +/// macro to test for zero double products outside the segment-edge intersection test method +/// as is done in TransformedTriangle when OPTIMIZE is defined #define TEST_ZERO_DP_EDGE(seg, edge) isZero[TT::NO_DP*int(seg) + int(DoubleProduct(edge))] + +/// macro to test for zero double products outside the segment-corner intersection test method +/// as is done in TransformedTriangle when OPTIMIZE is defined #define TEST_ZERO_DP_CORNER(seg, corner) \ isZero[DoubleProduct(TT::NO_DP*int(seg) + TT::EDGES_FOR_CORNER[3*corner] )] && \ isZero[DoubleProduct(TT::NO_DP*int(seg) + TT::EDGES_FOR_CORNER[3*corner+1] )] && \ isZero[DoubleProduct(TT::NO_DP*int(seg) + TT::EDGES_FOR_CORNER[3*corner+2] )] + +/// macro to test for zero double products outside the segment-ray intersection test method +/// as is done in TransformedTriangle when OPTIMIZE is defined #define TEST_ZERO_DP_RAY(seg, corner) isZero[TT::NO_DP*int(seg) + TT::DP_SEGMENT_RAY_INTERSECTION[7*(corner-1)]] #else @@ -19,96 +26,100 @@ isZero[DoubleProduct(TT::NO_DP*int(seg) + TT::EDGES_FOR_CORNER[3*corner+2] )] #define TEST_ZERO_DP_RAY(seg, corner) true #endif -//////////////////////////////////////////////////////////////////////////////////////////////////////// -/// \file TransformedTriangleIntersectTest.hxx -/// Contains unit tests for the intersection methods of the TransformedTriangle class. -/// -//////////////////////////////////////////////////////////////////////////////////////////////////////// -/// Intersection tests -/// Each method in this file runs all the intersection tests with some triangle. The goal is to cover all -/// the different types of intersections between a triangle and a tetrahedron. The table below gives a -/// a summary of what is being tested. Before each method, there is also a summary of what how the -/// triangle in the method intersects the unit tetrahedron. -/// -/// Since performing all tests would require a large number of triangles, we have limited our coverage to -/// be such that each column and each row in the table below has at least one entry for each type of -/// intersection. The intersection forumlae are totally symmetric with respect to changing the segment -/// (PQ, QR, or RP) of the triangle, so they only enter in a very simple way in the code. Testing -/// all these cases is therefore of low priority. -//////////////////////////////////////////////////////////////////////////////////////////////////////// -/// -//////////////////////////////////////////////////////////////////////////////////////////////////////// -// Intersections tested (number indicates first triangle which contains the intersection): -// ----------------------------------------------------------------------------------------------------- -// CI -> P: 3 Q: 4 R: 7 -// COH -> P: 9 Q: 8 R: 10 -// CAH -> P: 4 Q: 10 R: 9 -// ----------------------------------------------------------------------------------------------------- -// SF -> (PQ, OZX) : 1 (PQ, OYZ) : 2 (PQ, OXY) : 1 (PQ, XYZ) : 3 -// -> (QR, OZX) : 8 (QR, OYZ) : - (QR, OXY) : 4 (QR, XYZ) : 7 -// -> (RP, OZX) : 1 (RP, OYZ) : 3 (RP, OXY) : 7 (RP, XYZ) : 1 -// ----------------------------------------------------------------------------------------------------- -// SE -> (PQ, OX) : 11 (PQ, OY) : - (PQ, OZ) : 12 (PQ, XY) : 2 (PQ, ZX) : - (PQ, YZ) : 10 -// -> (QR, OX) : - (QR, OY) : - (QR, OZ) : - (QR, XY) : - (QR, ZX) : 9 (QR, YZ) : - -// -> (RP, OX) : - (RP, OY) : 12 (RP, OZ) : - (RP, XY) : - (RP, ZX) : - (RP, YZ) : - -// ----------------------------------------------------------------------------------------------------- -// SC -> (PQ, O) : - (PQ, X) : - (PQ, Y) : 8 (PQ, Z) : - -// -> (QR, O) : - (QR, X) : 2 (QR, Y) : - (QR, Z) : 13 -// -> (RP, O) : 11 (RP, X) : - (RP, Y) : - (RP, Z) : - -// ----------------------------------------------------------------------------------------------------- -// SHS -> (PQ, XY) : 3 (PQ, ZX) : - (PQ, YZ) : 13 -// -> (QR, XY) : 3 (QR, ZX) : 5 (QR, YZ) : 3 -// -> (RP, XY) : 1 (RP, ZX) : 4 (RP, YZ) : - -// ----------------------------------------------------------------------------------------------------- -// SR -> (PQ, X) : 6 (PQ, Y) : 5 (PQ, Z) : - -// -> (QR, X) : - (QR, Y) : - (QR, Z) : 6 -// -> (RP, X) : - (RP, Y) : - (RP, Z) : - -// ----------------------------------------------------------------------------------------------------- -// TE -> OX : 4 OY : 7 OZ : 8 XY : 1 ZX : 4 YZ : 3 -// ----------------------------------------------------------------------------------------------------- -// TR -> X : 7 Y : 6 Z : 5 -// ----------------------------------------------------------------------------------------------------- -//////////////////////////////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////////////////////////////// -// Key to triangle descriptions : -// CI = Triangle corner contained in tetrahedron -// COH = Triangle corner on h = 0 face of tetrahedron -// CAH = Triangle corner above h = 0 face of tetrahedron in z-direction -// SF = Segment - facet intersection -// SE = Segment - edge intersection -// SC = Segment - corner intersection -// SHS = Segment - halfstrip intersection -// SR = Segment - ray intersection -// TE = Tetrahedron edge intersects triangle (surface - edge intersection) -// TR = Surface - ray intersection -// -// In the descriptions for each triangle, square brackets indicate superfluous but allowed intersections -// that arise as by-products of for instance segment-corner intersections. -// E.g. A segment - corner intersection can imply three surface - edge intersections -// Since these "extra" intersections arise under special circumstances, they are not counted in the -// table above -//////////////////////////////////////////////////////////////////////////////////////////////////////// - using namespace INTERP_UTILS; namespace INTERP_TEST { //////////////////////////////////////////////////////////////////////////////////////////////////////// + /// \class TransformedTriangleIntersectTest + /// \brief Class testing the intersection detection methods of TransformedTriangle. + /// + /// This class contains unit tests for the intersection methods of the TransformedTriangle class. + //////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Each method in the class runs all the intersection tests with some triangle. The goal is to cover all + /// the different types of intersections between a triangle and a tetrahedron. The table below gives a + /// a summary of what is being tested. Before each method, there is also a summary of what how the + /// triangle in the method intersects the unit tetrahedron. + /// + /// Since performing all tests would require a large number of triangles, we have limited our coverage to + /// be such that each column and each row in the table below has at least one entry for each type of + /// intersection. The intersection forumlae are totally symmetric with respect to changing the segment + /// (PQ, QR, or RP) of the triangle, so they only enter in a very simple way in the code. Testing + /// all these cases is therefore of low priority. + //////////////////////////////////////////////////////////////////////////////////////////////////////// + /// + //////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Intersections tested (number indicates first triangle which contains the intersection): + ///
+  /// -----------------------------------------------------------------------------------------------------
+  /// CI  ->  P: 3      Q: 4     R: 7
+  /// COH ->  P: 9      Q: 8     R: 10
+  /// CAH ->  P: 4      Q: 10    R: 9
+  /// -----------------------------------------------------------------------------------------------------
+  /// SF  ->  (PQ, OZX) : 1   (PQ, OYZ) : 2   (PQ, OXY) : 1   (PQ, XYZ) : 3
+  ///     ->  (QR, OZX) : 8   (QR, OYZ) : -   (QR, OXY) : 4   (QR, XYZ) : 7
+  ///     ->  (RP, OZX) : 1   (RP, OYZ) : 3   (RP, OXY) : 7   (RP, XYZ) : 1
+  /// -----------------------------------------------------------------------------------------------------
+  /// SE  ->  (PQ, OX)  : 11  (PQ, OY)  : -   (PQ, OZ)  : 12  (PQ, XY)  : 2   (PQ, ZX)  : -  (PQ, YZ)  : 10
+  ///     ->  (QR, OX)  : -   (QR, OY)  : -   (QR, OZ)  : -   (QR, XY)  : -   (QR, ZX)  : 9  (QR, YZ)  : -
+  ///     ->  (RP, OX)  : -   (RP, OY)  : 12  (RP, OZ)  : -   (RP, XY)  : -   (RP, ZX)  : -  (RP, YZ)  : -
+  /// -----------------------------------------------------------------------------------------------------
+  /// SC  ->  (PQ, O)   : -   (PQ, X)   : -   (PQ, Y)   : 8   (PQ, Z)   : -
+  ///     ->  (QR, O)   : -   (QR, X)   : 2   (QR, Y)   : -   (QR, Z)   : 13
+  ///     ->  (RP, O)   : 11  (RP, X)   : -   (RP, Y)   : -   (RP, Z)   : -
+  /// -----------------------------------------------------------------------------------------------------
+  /// SHS ->  (PQ, XY)  : 3   (PQ, ZX)  : -   (PQ, YZ)  : 13
+  ///     ->  (QR, XY)  : 3   (QR, ZX)  : 5   (QR, YZ)  : 3
+  ///     ->  (RP, XY)  : 1   (RP, ZX)  : 4   (RP, YZ)  : -
+  /// -----------------------------------------------------------------------------------------------------
+  /// SR  ->  (PQ, X)   : 6   (PQ, Y)   : 5   (PQ, Z)   : -
+  ///     ->  (QR, X)   : -   (QR, Y)   : -   (QR, Z)   : 6
+  ///     ->  (RP, X)   : -   (RP, Y)   : -   (RP, Z)   : -
+  /// -----------------------------------------------------------------------------------------------------
+  /// TE  ->  OX : 4   OY : 7    OZ : 8     XY : 1     ZX : 4    YZ : 3
+  /// -----------------------------------------------------------------------------------------------------
+  /// TR  ->  X  : 7    Y : 6     Z : 5
+  /// -----------------------------------------------------------------------------------------------------
+  /// 
+ //////////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Key to triangle descriptions : + /// CI = Triangle corner contained in tetrahedron + /// COH = Triangle corner on h = 0 face of tetrahedron + /// CAH = Triangle corner above h = 0 face of tetrahedron in z-direction + /// SF = Segment - facet intersection + /// SE = Segment - edge intersection + /// SC = Segment - corner intersection + /// SHS = Segment - halfstrip intersection + /// SR = Segment - ray intersection + /// TE = Tetrahedron edge intersects triangle (surface - edge intersection) + /// TR = Surface - ray intersection + /// + /// In the descriptions for each triangle, square brackets indicate superfluous but allowed intersections + /// that arise as by-products of for instance segment-corner intersections. + /// E.g. A segment - corner intersection can imply three surface - edge intersections + /// Since these "extra" intersections arise under special circumstances, they are not counted in the + /// table above + //////////////////////////////////////////////////////////////////////////////////////////////////////// - // Triangle 1 has the following intersections - // CI - - // COH - - // CAH - - // SF (PQ, OXY), (PQ, OZX), (RP, XYZ), (RP, OZX) - // SE - - // SC - - // SHS (RP, XY) - // SR - - // TE XY - // TR - + //////////////////////////////////////////////////////////////////////////////////////////////////////// + /// Triangle 1 has the following intersections + ///
+  /// CI     -
+  /// COH    -
+  /// CAH    -
+  /// SF     (PQ, OXY), (PQ, OZX), (RP, XYZ), (RP, OZX)
+  /// SE     -
+  /// SC     - 
+  /// SHS    (RP, XY)
+  /// SR     - 
+  /// TE     XY
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle1() { LOG(1, "+++++++ Testing triangle 1" ); @@ -253,18 +264,20 @@ namespace INTERP_TEST } - // Triangle 2 has the following intersections - // CI - - // COH - - // CAH - - // SF (PQ, OYZ) - // SE (PQ, XY) - // SC (QR, X) - // SHS - - // SR - - // TE [OX, OZ, ZX] - // TR - - + /// Triangle 2 has the following intersections + ///
+  /// CI     -
+  /// COH    -
+  /// CAH    -
+  /// SF     (PQ, OYZ)
+  /// SE     (PQ, XY)
+  /// SC     (QR, X)
+  /// SHS    -
+  /// SR     - 
+  /// TE     [OX, OZ, ZX]
+  /// TR     - 
+  /// 
+ /// \brief Status: pass void TransformedTriangleIntersectTest::testTriangle2() { LOG(1, "+++++++ Testing triangle 2" ); @@ -406,18 +419,20 @@ namespace INTERP_TEST delete tri; } - // Triangle 3 has the following intersections - // CI P - // COH - - // CAH - - // SF (PQ, XYZ), (RP, OYZ) - // SE - - // SC - - // SHS (PQ, XY), (QR, YZ), (QR, XY) - // SR - - // TE YZ - // TR - - + /// Triangle 3 has the following intersections + ///
+  /// CI     P
+  /// COH    -
+  /// CAH    -
+  /// SF     (PQ, XYZ), (RP, OYZ)
+  /// SE     -
+  /// SC     -
+  /// SHS    (PQ, XY), (QR, YZ), (QR, XY)
+  /// SR     - 
+  /// TE     YZ
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle3() { LOG(1, "+++++++ Testing triangle 3" ); @@ -562,18 +577,20 @@ namespace INTERP_TEST delete tri; } - // Triangle 4 has the following intersections - // CI Q - // COH - - // CAH P - // SF (PQ, XYZ), (QR, OXY) - // SE - - // SC - - // SHS (RP, ZX) - // SR - - // TE (OX, ZX) - // TR - - + /// Triangle 4 has the following intersections + ///
+  /// CI     Q
+  /// COH    -
+  /// CAH    P
+  /// SF     (PQ, XYZ), (QR, OXY)
+  /// SE     -
+  /// SC     -
+  /// SHS    (RP, ZX)
+  /// SR     - 
+  /// TE     (OX, ZX)
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle4() { LOG(1, "+++++++ Testing triangle 4" ); @@ -717,18 +734,20 @@ namespace INTERP_TEST delete tri; } - // Triangle 5 has the following intersections - // CI - - // COH - - // CAH - - // SF - - // SE - - // SC - - // SHS (QR, ZX), (QR, XY) - // SR (PQ, Y) - // TE - - // TR Z - + /// Triangle 5 has the following intersections + ///
+  /// CI     -
+  /// COH    -
+  /// CAH    -
+  /// SF     -
+  /// SE     -
+  /// SC     -
+  /// SHS    (QR, ZX), (QR, XY)
+  /// SR     (PQ, Y)
+  /// TE     -
+  /// TR     Z
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle5() { LOG(1, "+++++++ Testing triangle 5" ); @@ -872,18 +891,20 @@ namespace INTERP_TEST delete tri; } - // Triangle 6 has the following intersections - // CI - - // COH - - // CAH - - // SF - - // SE - - // SC - - // SHS - - // SR (PQ, X), (QR, Z) - // TE - - // TR Y - + /// Triangle 6 has the following intersections + ///
+  /// CI     -
+  /// COH    -
+  /// CAH    -
+  /// SF     -
+  /// SE     -
+  /// SC     -
+  /// SHS    -
+  /// SR     (PQ, X), (QR, Z) 
+  /// TE     -
+  /// TR     Y 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle6() { LOG(1, "+++++++ Testing triangle 6" ); @@ -1027,18 +1048,20 @@ namespace INTERP_TEST delete tri; } - // Triangle 7 has the following intersections - // CI R - // COH - - // CAH - - // SF (RP, OXY),(QR,XYZ) - // SE - - // SC - - // SHS (QR, XY) - // SR - - // TE OX, ZX - // TR X - + /// Triangle 7 has the following intersections + ///
+  /// CI     R
+  /// COH    -
+  /// CAH    -
+  /// SF     (RP, OXY),(QR,XYZ)
+  /// SE     -
+  /// SC     -
+  /// SHS    (QR, XY)
+  /// SR     - 
+  /// TE     OX, ZX
+  /// TR     X 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle7() { @@ -1183,18 +1206,20 @@ namespace INTERP_TEST delete tri; } - // Triangle 8 has the following intersections - // CI [Q] - // COH Q - // CAH - - // SF (QR, OZX), [ (QR, XYZ) ] - // SE - - // SC (PQ,Y) - // SHS - - // SR - - // TE OZ, [YZ,OY,XY] - // TR - - + /// Triangle 8 has the following intersections + ///
+  /// CI     [Q] 
+  /// COH    Q
+  /// CAH    -
+  /// SF     (QR, OZX), [ (QR, XYZ) ]
+  /// SE     -
+  /// SC     (PQ,Y)
+  /// SHS    -
+  /// SR     - 
+  /// TE     OZ, [YZ,OY,XY]
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle8() { LOG(1, "+++++++ Testing triangle 8" ); @@ -1337,18 +1362,20 @@ namespace INTERP_TEST delete tri; } - // Triangle 9 has the following intersections - // CI [P] - // COH P - // CAH R - // SF (PQ, OZX), [(PQ, XYZ), (RP,XYZ)] - // SE (QR, ZX) - // SC - - // SHS - - // SR - - // TE [ZX] - // TR - - + /// Triangle 9 has the following intersections + ///
+  /// CI     [P]
+  /// COH    P
+  /// CAH    R
+  /// SF     (PQ, OZX), [(PQ, XYZ), (RP,XYZ)]
+  /// SE     (QR, ZX)
+  /// SC     -
+  /// SHS    -
+  /// SR     - 
+  /// TE     [ZX]
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle9() { LOG(1, "+++++++ Testing triangle 9" ); @@ -1491,18 +1518,21 @@ namespace INTERP_TEST delete tri; } - // Triangle 10 has the following intersections - // CI [R] - // COH R - // CAH Q - // SF (RP, OYZ), [ (RP, XYZ), (QR, XYZ) ] - // SE (PQ, YZ) - // SC - - // SHS - - // SR - - // TE [YZ] - // TR - - + + /// Triangle 10 has the following intersections + ///
+  /// CI     [R]
+  /// COH    R
+  /// CAH    Q
+  /// SF     (RP, OYZ), [ (RP, XYZ), (QR, XYZ) ]
+  /// SE     (PQ, YZ)
+  /// SC     -
+  /// SHS    -
+  /// SR     - 
+  /// TE     [YZ]
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle10() { LOG(1, "+++++++ Testing triangle 10" ); @@ -1645,18 +1675,20 @@ namespace INTERP_TEST delete tri; } - // Triangle 11 has the following intersections - // CI Q, R - // COH - - // CAH - - // SF - - // SE (PQ, OX) - // SC (RP, O) - // SHS - - // SR - - // TE [OY, OZ] - // TR - - + /// Triangle 11 has the following intersections + ///
+  /// CI     Q, R
+  /// COH    -
+  /// CAH    -
+  /// SF     -
+  /// SE     (PQ, OX)
+  /// SC     (RP, O)
+  /// SHS    -
+  /// SR     - 
+  /// TE     [OY, OZ]
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle11() { LOG(1, "+++++++ Testing triangle 11" ); @@ -1800,18 +1832,20 @@ namespace INTERP_TEST } - // Triangle 12 has the following intersections - // CI - - // COH - - // CAH - - // SF (QR, OXY), (QR, OZX) - // SE (RP, OY), (PQ, OZ) - // SC - - // SHS - - // SR - - // TE [OY], [OZ] - // TR - - + /// Triangle 12 has the following intersections + ///
+  /// CI     -
+  /// COH    -
+  /// CAH    -
+  /// SF     (QR, OXY), (QR, OZX)
+  /// SE     (RP, OY), (PQ, OZ)
+  /// SC     -
+  /// SHS    -
+  /// SR     - 
+  /// TE     [OY], [OZ]
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle12() { LOG(1, "+++++++ Testing triangle 12" ); @@ -1954,18 +1988,20 @@ namespace INTERP_TEST } - // Triangle 13 has the following intersections - // CI - - // COH - - // CAH - - // SF (QR, OYZ), (PQ, OXY), (PQ, XYZ) - // SE - - // SC (QR, Z) - // SHS (PQ, YZ) - // SR - - // TE [OZ, YZ, ZX] - // TR - - + /// Triangle 13 has the following intersections + ///
+  /// CI     -
+  /// COH    -
+  /// CAH    -
+  /// SF     (QR, OYZ), (PQ, OXY), (PQ, XYZ)
+  /// SE     -
+  /// SC     (QR, Z)
+  /// SHS    (PQ, YZ)
+  /// SR     - 
+  /// TE     [OZ, YZ, ZX]
+  /// TR     - 
+  /// 
+ /// \brief Status : pass void TransformedTriangleIntersectTest::testTriangle13() { LOG(1, "+++++++ Testing triangle 13" ); diff --git a/src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.hxx b/src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.hxx index 19060f42c..3e343ef67 100644 --- a/src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.hxx +++ b/src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.hxx @@ -32,9 +32,6 @@ namespace INTERP_TEST typedef INTERP_UTILS::TransformedTriangle::DoubleProduct DoubleProduct; public: - // void setUp(); - - // void tearDown(); void testTriangle1(); diff --git a/src/INTERP_KERNEL/Test/TransformedTriangleTest.cxx b/src/INTERP_KERNEL/Test/TransformedTriangleTest.cxx index 1146d61f0..a42b85551 100644 --- a/src/INTERP_KERNEL/Test/TransformedTriangleTest.cxx +++ b/src/INTERP_KERNEL/Test/TransformedTriangleTest.cxx @@ -7,6 +7,10 @@ using namespace INTERP_UTILS; namespace INTERP_TEST { + /** + * Creates the TransformedTriangle objects used by the tests. + * + */ void TransformedTriangleTest::setUp() { // tri1 -> no unstable double products - no changes brought about by preCalculateDoubleProducts @@ -54,6 +58,10 @@ namespace INTERP_TEST } + /** + * Liberates the transformed triangle objects used by the test suite + * + */ void TransformedTriangleTest::tearDown() { delete tri1; @@ -61,7 +69,7 @@ namespace INTERP_TEST } /// Tests that _coords has correct values after construction of object is finished - /// Status : pass + /// \brief Status : pass void TransformedTriangleTest::test_constructor() { // test that _coords has correct values after constructor is called @@ -91,7 +99,7 @@ namespace INTERP_TEST } /// Tests the calculation of double products (without the corrections) - /// Status : pass + /// \brief Status : pass void TransformedTriangleTest::test_calcUnstableC() { typedef TransformedTriangle::TriSegment TriSegment; @@ -147,7 +155,7 @@ namespace INTERP_TEST } /// Tests the calculation of triple products (without corrections) - /// Status : pass + /// \brief Status : pass void TransformedTriangleTest::test_calcUnstableT() { typedef TransformedTriangle::TetraCorner TetraCorner; @@ -188,7 +196,7 @@ namespace INTERP_TEST } /// Tests the consistency correction - /// Status : fails because it is not significant - the consistency correction is not brought into play + /// \brief Status : fails because it is not significant - the consistency correction is not brought into play void TransformedTriangleTest::test_calcStableC_Consistency() { diff --git a/src/INTERP_KERNEL/Test/TransformedTriangleTest.hxx b/src/INTERP_KERNEL/Test/TransformedTriangleTest.hxx index 648383482..7c36c085a 100644 --- a/src/INTERP_KERNEL/Test/TransformedTriangleTest.hxx +++ b/src/INTERP_KERNEL/Test/TransformedTriangleTest.hxx @@ -11,6 +11,10 @@ using INTERP_UTILS::TransformedTriangle; namespace INTERP_TEST { + /** + * \brief Test suite testing some of the low level methods of TransformedTriangle. + * + */ class TransformedTriangleTest : public CppUnit::TestFixture { -- 2.39.2