[cig-commits] r14054 - in short/3D/PyLith/branches/pylith-swig: libsrc/topology unittests/libtests/topology

brad at geodynamics.org brad at geodynamics.org
Sat Feb 14 16:21:30 PST 2009


Author: brad
Date: 2009-02-14 16:21:30 -0800 (Sat, 14 Feb 2009)
New Revision: 14054

Modified:
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.hh
   short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.icc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.hh
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsSubMesh.cc
Log:
Updated C++ tests for Fields.

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.hh	2009-02-14 23:46:55 UTC (rev 14053)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.hh	2009-02-15 00:21:30 UTC (rev 14054)
@@ -22,8 +22,6 @@
 // Include directives ---------------------------------------------------
 #include "topologyfwd.hh" // forward declarations
 
-#include "FieldBase.hh" // USES FieldBase::DomainEnum
-
 // Fields ---------------------------------------------------------------
 template<typename field_type>
 class pylith::topology::Fields
@@ -56,7 +54,7 @@
    * @param fiberDim Fiber dimension for field.
    */
   void add(const char* name,
-	   const FieldBase::DomainEnum domain,
+	   const typename field_type::DomainEnum domain,
 	   const int fiberDim);
 
   /** Delete field.

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.icc	2009-02-14 23:46:55 UTC (rev 14053)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Fields.icc	2009-02-15 00:21:30 UTC (rev 14054)
@@ -18,7 +18,7 @@
 // ----------------------------------------------------------------------
 // Default constructor.
 template<typename field_type>
-pylith::topology::Fields<field_type>::Fields(const field_type::Mesh& mesh) :
+pylith::topology::Fields<field_type>::Fields(const typename field_type::Mesh& mesh) :
   _mesh(mesh)
 { // constructor
 } // constructor
@@ -51,9 +51,10 @@
 // Add field.
 template<typename field_type>
 void 
-pylith::topology::Fields<field_type>::add(const char* name,
-						     const FieldBase::DomainEnum domain,
-						     const int fiberDim)
+pylith::topology::Fields<field_type>::add(
+			       const char* name,
+			       const typename field_type::DomainEnum domain,
+			       const int fiberDim)
 { // add
   typename map_type::iterator iter = _fields.find(name);
   if (iter != _fields.end()) {

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am	2009-02-14 23:46:55 UTC (rev 14053)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am	2009-02-15 00:21:30 UTC (rev 14054)
@@ -26,10 +26,10 @@
 	TestSubMesh.cc \
 	TestFieldMesh.cc \
 	TestFieldSubMesh.cc \
+	TestFieldsMesh.cc \
+	TestFieldsSubMesh.cc \
 	test_topology.cc
 
-#	TestFieldsMesh.cc \
-#	TestFieldsSubMesh.cc
 
 noinst_HEADERS = \
 	TestMesh.hh \

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.cc	2009-02-14 23:46:55 UTC (rev 14053)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.cc	2009-02-15 00:21:30 UTC (rev 14054)
@@ -14,19 +14,21 @@
 
 #include "TestFieldsMesh.hh" // Implementation of class methods
 
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Field.hh" // USES Field
 #include "pylith/topology/Fields.hh" // USES Fields
 
-#include "pylith/topology/Field.hh" // USES Field
-#include "pylith/topology/Mesh.hh" // USES Mesh
 #include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
 
-typedef pylith::topology::Fields<pylith::topology::Field,
-				 pylith::topology::Mesh> FieldsMesh;
-
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestFieldsMesh );
 
 // ----------------------------------------------------------------------
+typedef pylith::topology::Fields<pylith::topology::Field<pylith::topology::Mesh> > FieldsMesh;
+typedef pylith::topology::Mesh::RealSection RealSection;
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+
+// ----------------------------------------------------------------------
 void
 pylith::topology::TestFieldsMesh::setUp(void)
 { // setUp
@@ -77,12 +79,12 @@
   FieldsMesh fields(*_mesh);
   
   const char* label = "field";
-  fields.add(label, Field::VERTICES_FIELD, fiberDim);
+  fields.add(label, Field<Mesh>::VERTICES_FIELD, fiberDim);
   const size_t size = 1;
   CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
 
-  Field& field = fields.get(label);
-  const ALE::Obj<MeshRealSection>& section = field.section();
+  Field<Mesh>& field = fields.get(label);
+  const ALE::Obj<RealSection>& section = field.section();
   CPPUNIT_ASSERT(!section.isNull());
   const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
   CPPUNIT_ASSERT(!sieveMesh.isNull());
@@ -115,7 +117,7 @@
   fields.del(labelA);
   size = 1;
   CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
-  const Field& field = fields.get(labelB);
+  const Field<Mesh>& field = fields.get(labelB);
 } // testDelete
 
 // ----------------------------------------------------------------------
@@ -128,7 +130,7 @@
 
   const char* label = "field";
   fields.add(label);
-  const Field& field = fields.get(label);
+  const Field<Mesh>& field = fields.get(label);
 } // testGet
 
 // ----------------------------------------------------------------------
@@ -144,7 +146,7 @@
 
   const FieldsMesh* fieldsPtr = &fields;
   CPPUNIT_ASSERT(0 != fieldsPtr);
-  const Field& field = fieldsPtr->get(label);
+  const Field<Mesh>& field = fieldsPtr->get(label);
 } // testGetConst
 
 // ----------------------------------------------------------------------
@@ -158,19 +160,19 @@
   FieldsMesh fields(*_mesh);
   
   const char* labelA = "field A";
-  fields.add(labelA, Field::VERTICES_FIELD, fiberDim);
+  fields.add(labelA, Field<Mesh>::VERTICES_FIELD, fiberDim);
 
   const char* labelB = "field B";
   fields.add(labelB);
-  Field& fieldA = fields.get(labelA);
+  Field<Mesh>& fieldA = fields.get(labelA);
   fieldA.allocate();
 
   fields.copyLayout(labelA);
 
   const size_t size = 2;
   CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
-  const Field& field = fields.get(labelB);
-  const ALE::Obj<MeshRealSection>& section = field.section();
+  const Field<Mesh>& field = fields.get(labelB);
+  const ALE::Obj<RealSection>& section = field.section();
   CPPUNIT_ASSERT(!section.isNull());
   const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
   CPPUNIT_ASSERT(!sieveMesh.isNull());

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.hh	2009-02-14 23:46:55 UTC (rev 14053)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsMesh.hh	2009-02-15 00:21:30 UTC (rev 14054)
@@ -22,13 +22,13 @@
 // Include directives ---------------------------------------------------
 #include <cppunit/extensions/HelperMacros.h>
 
+#include "pylith/topology/topologyfwd.hh" // forward declarations
+
 // Forward declarations -------------------------------------------------
 /// Namespace for pylith package
 namespace pylith {
   namespace topology {
     class TestFieldsMesh;
-
-    class Mesh;
   } // topology
 } // pylith
 

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsSubMesh.cc	2009-02-14 23:46:55 UTC (rev 14053)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestFieldsSubMesh.cc	2009-02-15 00:21:30 UTC (rev 14054)
@@ -14,20 +14,21 @@
 
 #include "TestFieldsSubMesh.hh" // Implementation of class methods
 
+#include "pylith/topology/SubMesh.hh" // USES SubMesh
+#include "pylith/topology/Field.hh" // USES Field
 #include "pylith/topology/Fields.hh" // USES Fields
 
-#include "pylith/topology/Mesh.hh" // USES Mesh
-#include "pylith/topology/SubMesh.hh" // USES SubMesh
-#include "pylith/topology/FieldSubMesh.hh" // USES FieldSubMesh
 #include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
 
-typedef pylith::topology::Fields<pylith::topology::FieldSubMesh,
-				 pylith::topology::SubMesh> FieldsSubMesh;
-
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestFieldsSubMesh );
 
 // ----------------------------------------------------------------------
+typedef pylith::topology::Fields<pylith::topology::Field<pylith::topology::SubMesh> > FieldsSubMesh;
+typedef pylith::topology::SubMesh::RealSection RealSection;
+typedef pylith::topology::SubMesh::SieveMesh SieveMesh;
+
+// ----------------------------------------------------------------------
 void
 pylith::topology::TestFieldsSubMesh::setUp(void)
 { // setUp
@@ -81,12 +82,12 @@
   FieldsSubMesh fields(*_submesh);
   
   const char* label = "field";
-  fields.add(label, FieldSubMesh::VERTICES_FIELD, fiberDim);
+  fields.add(label, Field<SubMesh>::VERTICES_FIELD, fiberDim);
   const size_t size = 1;
   CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
 
-  FieldSubMesh& field = fields.get(label);
-  const ALE::Obj<MeshRealSection>& section = field.section();
+  Field<SubMesh>& field = fields.get(label);
+  const ALE::Obj<RealSection>& section = field.section();
   CPPUNIT_ASSERT(!section.isNull());
   const ALE::Obj<SieveMesh>& sieveMesh = _submesh->sieveMesh();
   CPPUNIT_ASSERT(!sieveMesh.isNull());
@@ -119,7 +120,7 @@
   fields.del(labelA);
   size = 1;
   CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
-  const FieldSubMesh& field = fields.get(labelB);
+  const Field<SubMesh>& field = fields.get(labelB);
 } // testDelete
 
 // ----------------------------------------------------------------------
@@ -132,7 +133,7 @@
 
   const char* label = "field";
   fields.add(label);
-  const FieldSubMesh& field = fields.get(label);
+  const Field<SubMesh>& field = fields.get(label);
 } // testGet
 
 // ----------------------------------------------------------------------
@@ -148,7 +149,7 @@
 
   const FieldsSubMesh* fieldsPtr = &fields;
   CPPUNIT_ASSERT(0 != fieldsPtr);
-  const FieldSubMesh& field = fieldsPtr->get(label);
+  const Field<SubMesh>& field = fieldsPtr->get(label);
 } // testGetConst
 
 // ----------------------------------------------------------------------
@@ -162,19 +163,19 @@
   FieldsSubMesh fields(*_submesh);
   
   const char* labelA = "field A";
-  fields.add(labelA, FieldSubMesh::VERTICES_FIELD, fiberDim);
+  fields.add(labelA, Field<SubMesh>::VERTICES_FIELD, fiberDim);
 
   const char* labelB = "field B";
   fields.add(labelB);
-  FieldSubMesh& fieldA = fields.get(labelA);
+  Field<SubMesh>& fieldA = fields.get(labelA);
   fieldA.allocate();
 
   fields.copyLayout(labelA);
 
   const size_t size = 2;
   CPPUNIT_ASSERT_EQUAL(size, fields._fields.size());
-  const FieldSubMesh& field = fields.get(labelB);
-  const ALE::Obj<MeshRealSection>& section = field.section();
+  const Field<SubMesh>& field = fields.get(labelB);
+  const ALE::Obj<RealSection>& section = field.section();
   CPPUNIT_ASSERT(!section.isNull());
   const ALE::Obj<SieveMesh>& sieveMesh = _submesh->sieveMesh();
   CPPUNIT_ASSERT(!sieveMesh.isNull());



More information about the CIG-COMMITS mailing list