From: vbd Date: Tue, 12 Feb 2008 10:02:59 +0000 (+0000) Subject: adding a new test file X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=50a81f2ff16d97398ed52043c879b9cd963f8064;p=tools%2Fmedcoupling.git adding a new test file --- diff --git a/src/INTERP_KERNEL/Test/RemapperTest.cxx b/src/INTERP_KERNEL/Test/RemapperTest.cxx new file mode 100644 index 000000000..ee78c0ff6 --- /dev/null +++ b/src/INTERP_KERNEL/Test/RemapperTest.cxx @@ -0,0 +1,71 @@ +#include "RemapperTest.hxx" +#include "Remapper.hxx" + +#include +#include + +namespace INTERP_TEST +{ + + + void RemapperTest::setUp() + { + } + + + void RemapperTest::tearDown() + { + } + + /** + * Test that creates a tree in 2D and check that + * the results are correct in three + * cases : + * a non matching search + * a standard case + * a bbox overlapping the bboxes of the tree + */ + void RemapperTest::test_Remapper() { + string sourcename=getenv("MED_ROOT_DIR"); + sourcename +="/share/salome/resources/MedFiles/square1.med"; + MEDMEM::MESH source_mesh (MED_DRIVER,sourcename,"Mesh_2"); + + string targetname=getenv("MED_ROOT_DIR"); + targetname +="/share/salome/resources/MedFiles/square2.med"; + MEDMEM::MESH target_mesh (MED_DRIVER,targetname,"Mesh_3"); + + MEDMEM::SUPPORT source_support(&source_mesh,"on All support"); + MEDMEM::FIELD source_field(&source_support,1); + double* value=const_cast(source_field.getValue()); + for (int i=0; i target_field(&target_support,1); + double* targetvalue=const_cast(target_field.getValue()); + for (int i=0; i source_areas(&source_support,1); + MEDMEM::FIELD target_areas(&target_support,1); + source_areas.getArea(); + target_areas.getArea(); + MEDMEM::FIELD inv_source_areas=-(source_areas); + MEDMEM::FIELD inv_target_areas=-(target_areas); + + + //target square is in reverse order as compared to initial square + double source_integral=source_field.normL2(1,&source_areas); + double target_integral=target_field.normL2(1,&inv_target_areas); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(source_integral,target_integral,1e-10); + + } + + +} diff --git a/src/INTERP_KERNEL/Test/RemapperTest.hxx b/src/INTERP_KERNEL/Test/RemapperTest.hxx new file mode 100644 index 000000000..21367d83a --- /dev/null +++ b/src/INTERP_KERNEL/Test/RemapperTest.hxx @@ -0,0 +1,39 @@ +#ifndef __TU_REMAPPER_HXX__ +#define __TU_REMAPPER_HXX__ + +#include +#include "../Remapper.hxx" + +namespace INTERP_TEST +{ + + /** + * \brief Test suite testing some of the low level methods of TransformedTriangle. + * + */ + class RemapperTest : public CppUnit::TestFixture + { + + CPPUNIT_TEST_SUITE( RemapperTest ); + CPPUNIT_TEST( test_Remapper ); + CPPUNIT_TEST_SUITE_END(); + + + public: + void setUp(); + + void tearDown(); + + // tests + void test_Remapper(); + + }; + + + + +} + + + +#endif