]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
adding tests
authorvbd <vbd>
Mon, 20 Oct 2008 07:37:39 +0000 (07:37 +0000)
committervbd <vbd>
Mon, 20 Oct 2008 07:37:39 +0000 (07:37 +0000)
src/INTERP_KERNEL/Test/InterpolationOptionsTest.cxx [new file with mode: 0644]
src/INTERP_KERNEL/Test/InterpolationOptionsTest.hxx [new file with mode: 0644]

diff --git a/src/INTERP_KERNEL/Test/InterpolationOptionsTest.cxx b/src/INTERP_KERNEL/Test/InterpolationOptionsTest.cxx
new file mode 100644 (file)
index 0000000..7db73d2
--- /dev/null
@@ -0,0 +1,61 @@
+#include "InterpolationOptionsTest.hxx"
+#include "MEDNormalizedUnstructuredMesh.hxx"
+#include "Interpolation2D.hxx"
+#include <iostream>
+#include <vector>
+
+namespace INTERP_TEST
+{
+
+
+  void InterpolationOptionsTest::setUp() 
+  {
+  }
+
+  void InterpolationOptionsTest::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 InterpolationOptionsTest::test_InterpolationOptions() {
+               string sourcename=getenv("MED_ROOT_DIR");
+               sourcename +="/share/salome/resources/med/square1.med";
+               MEDMEM::MESH source_mesh (MED_DRIVER,sourcename,"Mesh_2");
+
+               string targetname=getenv("MED_ROOT_DIR");
+               targetname +="/share/salome/resources/med/square2.med";
+               MEDMEM::MESH target_mesh (MED_DRIVER,targetname,"Mesh_3");
+
+               MEDMEM::SUPPORT source_support(&source_mesh,"on All support");
+               MEDMEM::FIELD<double> source_field(&source_support,1);
+               double* value=const_cast<double*>(source_field.getValue());
+               for (int i=0; i<source_support.getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
+                       value[i]=1.0;
+               
+               MEDMEM::SUPPORT target_support(&target_mesh,"on All support");
+               MEDMEM::FIELD<double> target_field(&target_support,1);
+               double* targetvalue=const_cast<double*>(target_field.getValue());
+               for (int i=0; i<target_support.getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
+                       targetvalue[i]=0.0;
+
+               // Ok at this point we have our mesh in MED-Memory format.
+               // Go to wrap med_source_mesh and med_target_mesh.
+               MEDNormalizedUnstructuredMesh<2,2> wrap_source_mesh(&source_mesh);
+               MEDNormalizedUnstructuredMesh<2,2> wrap_target_mesh(&target_mesh);
+               // Go for interpolation...
+               INTERP_KERNEL::Interpolation2D myInterpolator;
+               //optionnal call to parametrize your interpolation. First precision, tracelevel, intersector wanted.
+               myInterpolator.setPrecision(1e-7);
+               myInterpolator.setPrintLevel(1);
+  }
+
+
+}
diff --git a/src/INTERP_KERNEL/Test/InterpolationOptionsTest.hxx b/src/INTERP_KERNEL/Test/InterpolationOptionsTest.hxx
new file mode 100644 (file)
index 0000000..07b94eb
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __TU_INTERPOLATIONOPTIONS_HXX__
+#define __TU_INTERPOLATIONOPTIONS_HXX__
+
+#include <cppunit/extensions/HelperMacros.h>
+#include "../InterpolationOptions.hxx"
+#include "MEDMEM_Field.hxx"
+
+namespace INTERP_TEST
+{
+
+  /**
+   * \brief Test suite testing some of the low level methods of TransformedTriangle.
+   *
+   */
+  class InterpolationOptionsTest : public CppUnit::TestFixture
+  {
+
+    CPPUNIT_TEST_SUITE( InterpolationOptionsTest );
+    CPPUNIT_TEST( test_InterpolationOptions );
+    CPPUNIT_TEST_SUITE_END();
+
+   
+  public:
+    void setUp();
+
+    void tearDown();
+
+    // tests
+    void test_InterpolationOptions();
+
+       private:
+        
+  };
+
+
+
+
+}
+
+
+
+#endif