-#ifndef __SINGLE_ELEMENT_PLANAR_TESTS_CXX_
-#define __SINGLE_ELEMENT_PLANAR_TESTS_CXX_
-
#include "SingleElementPlanarTests.hxx"
#include "InterpolationUtils.hxx"
#include <deque>
+using namespace INTERP_KERNEL;
+
namespace INTERP_TEST
{
+ const double _Epsilon = 1.e-12;
+ const double _Precision = 1.e-12;
const double _losange1[8] = { 1,0, 0,1, -1,0, 0,-1 };
const double _losange2[8] = { 2,0, 1,1, 0,0, 1,-1 };
const double _losange3[8] = {2.5,0.5,1.5,1.5,0.5,0.5,1.5,-0.5 };
const double _parallel2[8]= {-0.5,1, 0,0, 1.,0, 0.5,1 };
const double _parallel3[8]= {-0.5,-1, 0,0, 1,0, 0.5,-1};
const double _triangle5[6]= { 0,0, 0,0.5, 0.5,0.5 };
- const double _triangle6[6]= { 0.333333,0.333333, 0.333333,0.666667, 0.666667,0.666667 };
-
+ const double _triangle6[6]= { 1./3,1./3, 1./3,2./3, 2./3,2./3 };
+ const double _triangle7[6]= {0.5,2, 1,1, 0,1 };
+ const double _triangle8[6]= {22.4601,35.2129, 13.9921,34.693, 18.2853,26.2812 };
+ const double _triangle9[6]= {13.9921,34.693, 22.4601,35.2129, 18.2785,42.3869 };
+ const double _triangle10[6]= {84.8575,98.2042, 80,100, 82.2601,95.7202};
+ const double _triangle11[6]= {80,100, 76.6659,91.9804, 85.3912,92.5061 };
// Two diamonds intersecting without degeneracy (two distinct crossing points)
// /\ /\
cerr<< "CPP_UNIT actual result= " << endl;
dequePrintOut(actual_result);
}
-
CPPUNIT_ASSERT_MESSAGE("Triangles tangency critical test failed(CONVEX)", checkDequesEqual(actual_result,expected_result, _Epsilon));
}
void SingleElementPlanarTests::trianglesTangencyCritical_Triangulation()
vector< double > expected_result;
expected_result.push_back(1./3);expected_result.push_back(1./2);
- expected_result.push_back(1./2);expected_result.push_back(1./2);
expected_result.push_back(1./3);expected_result.push_back(1./3);
-
+ expected_result.push_back(1./2);expected_result.push_back(1./2);
+
if(!checkVectorsEqual(actual_result,expected_result, _Epsilon))
{
cerr<< "CPP_UNIT expected result= " << endl;
cerr<< "CPP_UNIT actual result= " << endl;
vectPrintOut(actual_result);
}
-
CPPUNIT_ASSERT_MESSAGE("Triangles tangency critical test failed(TRIANGULATION)", checkVectorsEqual(actual_result,expected_result, _Epsilon));
+}
+
+// Two triangles with double starting point in an outer tangency configuration
+// /\
+// / \
+// / \
+// /______\
+// \ /
+// \ /
+// \ /
+// \/
+
+
+ // \brief Status : pass
+ void SingleElementPlanarTests::trianglesTangencyCritical2()
+ {
+ INTERP_KERNEL::PolygonAlgorithms<2> intersector (_Epsilon, _Precision);;
+ deque< double > actual_result = intersector.intersect_convex_polygons(_triangle1,_triangle7,3,3);
+ deque< double > expected_result;
+
+ if(!checkDequesEqual(actual_result,expected_result, _Epsilon))
+ {
+ cerr<< "CPP_UNIT expected result= " << endl;
+ dequePrintOut(expected_result);
+ cerr<< "CPP_UNIT actual result= " << endl;
+ dequePrintOut(actual_result);
+ }
+
+ CPPUNIT_ASSERT_MESSAGE("Triangles tangency critical (2) test failed(CONVEX)", checkDequesEqual(actual_result,expected_result, _Epsilon));
+ }
+ void SingleElementPlanarTests::trianglesTangencyCritical2_Triangulation()
+ {
+ vector< double > actual_result;
+ INTERP_KERNEL::intersec_de_polygone<2>(_triangle1,_triangle7,3,3,actual_result,_Epsilon/_Precision, _Precision );
+
+ vector< double > expected_result;
+ expected_result.push_back(1.);expected_result.push_back(1.);
+ expected_result.push_back(0.);expected_result.push_back(1.);
+
+ if(!checkVectorsEqual(actual_result,expected_result, _Epsilon))
+ {
+ cerr<< "CPP_UNIT expected result= " << endl;
+ vectPrintOut(expected_result);
+ cerr<< "CPP_UNIT actual result= " << endl;
+ vectPrintOut(actual_result);
+ }
+
+ CPPUNIT_ASSERT_MESSAGE("Triangles tangency critical (2) test failed(TRIANGULATION)", checkVectorsEqual(actual_result,expected_result, _Epsilon));
+ }
+ // \brief Status : pass
+ void SingleElementPlanarTests::trianglesTangencyCritical3()
+ {
+ INTERP_KERNEL::PolygonAlgorithms<2> intersector (_Epsilon, _Precision);;
+ deque< double > actual_result = intersector.intersect_convex_polygons(_triangle8,_triangle9,3,3);
+ deque< double > expected_result;
+
+ CPPUNIT_ASSERT_MESSAGE("Triangles tangency critical (3) test failed(CONVEX)", checkDequesEqual(actual_result,expected_result, _Epsilon));
+ }
+ void SingleElementPlanarTests::trianglesTangencyCritical3_Triangulation()
+ {
+ vector< double > actual_result;
+ INTERP_KERNEL::intersec_de_polygone<2>(_triangle8,_triangle9,3,3,actual_result,_Epsilon/_Precision, _Precision );
+
+ vector< double > expected_result;
+ expected_result.push_back(22.4601);expected_result.push_back(35.2129);
+ expected_result.push_back(13.9921);expected_result.push_back(34.693);
+
+ CPPUNIT_ASSERT_MESSAGE("Triangles tangency critical (3) test failed(TRIANGULATION)", checkVectorsEqual(actual_result,expected_result, _Epsilon));
+ }
+ void SingleElementPlanarTests::trianglesTangencyCritical4()
+ {
+ INTERP_KERNEL::PolygonAlgorithms<2> intersector (_Epsilon, _Precision);;
+ deque< double > actual_result = intersector.intersect_convex_polygons(_triangle10,_triangle11,3,3);
+
+ deque< double > expected_result;
+ expected_result.push_back(82.745193090443536);expected_result.push_back(96.184114390029166);
+ expected_result.push_back(82.260099999999994);expected_result.push_back(95.720200000000006);
+ expected_result.push_back(80);expected_result.push_back(100.);
+
+ if(!checkDequesEqual(actual_result,expected_result, _Epsilon))
+ {
+ cerr<< "CPP_UNIT expected result= " << endl;
+ dequePrintOut(expected_result);
+ cerr<< "CPP_UNIT actual result= " << endl;
+ dequePrintOut(actual_result);
+ }
+
+ CPPUNIT_ASSERT_MESSAGE("Triangles tangency critical (4) test failed(CONVEX)", checkDequesEqual(actual_result,expected_result, _Epsilon));
+ }
+ void SingleElementPlanarTests::trianglesTangencyCritical4_Triangulation()
+ {
+ vector< double > actual_result;
+ INTERP_KERNEL::intersec_de_polygone<2>(_triangle10,_triangle11,3,3,actual_result,_Epsilon/_Precision, _Precision );
+
+ vector< double > expected_result;
+ expected_result.push_back(80);expected_result.push_back(100.);
+ expected_result.push_back(82.745193090443536);expected_result.push_back(96.184114390029166);
+ expected_result.push_back(82.260099999999994);expected_result.push_back(95.720200000000006);
+
+ if(!checkVectorsEqual(actual_result,expected_result, _Epsilon))
+ {
+ cerr<< "CPP_UNIT expected result= " << endl;
+ vectPrintOut(expected_result);
+ cerr<< "CPP_UNIT actual result= " << endl;
+ vectPrintOut(actual_result);
+ }
+
+ CPPUNIT_ASSERT_MESSAGE("Triangles tangency critical (4) test failed(TRIANGULATION)", checkVectorsEqual(actual_result,expected_result, _Epsilon));
}
}
-#endif
#ifndef __SINGLE_ELEMENT_PLANAR_TESTS_HXX_
#define __SINGLE_ELEMENT_PLANAR_TESTS_HXX_
-#include "InterpolationPlanarTestSuite.hxx"
-#include "PolygonAlgorithms.txx"
-
+#include "InterpolationTestSuite.hxx"
namespace INTERP_TEST
{
* This serves mainly to verify that the volume calculations between elements is correct.
*
*/
- class SingleElementPlanarTests : public InterpolationPlanarTestSuite
+ class SingleElementPlanarTests : public InterpolationTestSuite<2,2>
{
CPPUNIT_TEST_SUITE( SingleElementPlanarTests );
CPPUNIT_TEST( trianglesCritical );
CPPUNIT_TEST( paralellogramsCritical1 );
CPPUNIT_TEST( paralellogramsCritical2 );
- CPPUNIT_TEST( trianglesTangencyCritical );
+ CPPUNIT_TEST( trianglesTangencyCritical );
+ CPPUNIT_TEST( trianglesTangencyCritical2 );
+ CPPUNIT_TEST( trianglesTangencyCritical3 );
+ CPPUNIT_TEST( trianglesTangencyCritical4 );
CPPUNIT_TEST( diamondsBasic_Triangulation );
CPPUNIT_TEST( tangentDiamonds_Triangulation );
CPPUNIT_TEST( tangentSquares_Triangulation );
CPPUNIT_TEST( paralellogramsCritical1_Triangulation );
CPPUNIT_TEST( paralellogramsCritical2_Triangulation );
CPPUNIT_TEST( trianglesTangencyCritical_Triangulation );
+ CPPUNIT_TEST( trianglesTangencyCritical2_Triangulation );
+ CPPUNIT_TEST( trianglesTangencyCritical3_Triangulation );
+ CPPUNIT_TEST( trianglesTangencyCritical4_Triangulation );
CPPUNIT_TEST_SUITE_END();
void paralellogramsCritical1();
void paralellogramsCritical2();
void trianglesTangencyCritical();
+ void trianglesTangencyCritical2();
+ void trianglesTangencyCritical3();
+ void trianglesTangencyCritical4();
void diamondsBasic_Triangulation();
void tangentDiamonds_Triangulation();
void tangentSquares_Triangulation();
void paralellogramsCritical1_Triangulation();
void paralellogramsCritical2_Triangulation();
void trianglesTangencyCritical_Triangulation();
+ void trianglesTangencyCritical2_Triangulation();
+ void trianglesTangencyCritical3_Triangulation();
+ void trianglesTangencyCritical4_Triangulation();
};
}
#endif