[cig-commits] r15122 - in short/3D/PyLith/trunk: libsrc/bc unittests/libtests/bc

brad at geodynamics.org brad at geodynamics.org
Thu Jun 4 16:51:42 PDT 2009


Author: brad
Date: 2009-06-04 16:51:42 -0700 (Thu, 04 Jun 2009)
New Revision: 15122

Modified:
   short/3D/PyLith/trunk/libsrc/bc/DirichletBC.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc
Log:
Updated field split stuff (awaiting stuff in Sieve).

Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBC.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBC.cc	2009-06-04 21:04:33 UTC (rev 15121)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBC.cc	2009-06-04 23:51:42 UTC (rev 15122)
@@ -85,6 +85,8 @@
   const ALE::Obj<RealSection>& section = field.section();
   assert(!section.isNull());
 
+  const int fibration = (section->getNumSpaces() > 0) ? 0 : -1;
+
   // Set constraints in field
   const int numPoints = _points.size();
   _offsetLocal.resize(numPoints);
@@ -104,21 +106,15 @@
     } // if
     _offsetLocal[iPoint] = curNumConstraints;
     section->addConstraintDimension(_points[iPoint], numFixedDOF);
+#if 0 // WAITING FOR MATT TO IMPLEMENT IN SIEVE
+    if (fibration >= 0) {
+      assert(fiberDim == section->getFiberDimension(_points[iPoint],
+						    fibration));
+      section->addConstraintDimension(_points[iPoint], numFixedDOF, 
+				      fibration);
+    } // if
+#endif
   } // for
-
-  // Set constraints in fibration 0 (split field) if it exists.
-  if (section->getNumSpaces() > 0) {
-    const int fibration = 0;
-    const ALE::Obj<RealSection>& splitSection =
-      section->getFibration(fibration);
-    for (int iPoint=0; iPoint < numPoints; ++iPoint) {
-      const int fiberDim = splitSection->getFiberDimension(_points[iPoint]);
-      const int curNumConstraints = 
-	splitSection->getConstraintDimension(_points[iPoint]);
-      assert(curNumConstraints + numFixedDOF <= fiberDim);
-      splitSection->addConstraintDimension(_points[iPoint], numFixedDOF);
-    } // for
-  } // if
 } // setConstraintSizes
 
 // ----------------------------------------------------------------------
@@ -134,8 +130,6 @@
   assert(!section.isNull());
 
   const int fibration = (section->getNumSpaces() > 0) ? 0 : -1;
-  const ALE::Obj<RealSection>& splitSection = (section->getNumSpaces() > 0) ?
-    section->getFibration(fibration) : 0;
 
   const int numPoints = _points.size();
   for (int iPoint=0; iPoint < numPoints; ++iPoint) {
@@ -184,8 +178,10 @@
     // Update list of constrained DOF
     section->setConstraintDof(point, &allFixedDOF[0]);
 
+#if 0 // WAITING FOR MATT TO IMPLEMENT IN SIEVE
     if (fibration >= 0)
-      splitSection->setConstraintDof(point, &allFixedDOF[0]);
+      section->setConstraintDof(point, &allFixedDOF[0], fibration);
+#endif
   } // for
 } // setConstraints
 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc	2009-06-04 21:04:33 UTC (rev 15121)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc	2009-06-04 23:51:42 UTC (rev 15122)
@@ -132,6 +132,7 @@
   const int fiberDim = _data->numDOF;
   topology::Field<topology::Mesh> field(mesh);
   field.newSection(vertices, fiberDim);
+  field.splitDefault();
   const ALE::Obj<RealSection>& fieldSection = field.section();
   CPPUNIT_ASSERT(!fieldSection.isNull());
 
@@ -139,6 +140,7 @@
 
   const int numCells = sieveMesh->heightStratum(0)->size();
   const int offset = numCells;
+  const int fibration = 0;
   int iConstraint = 0;
   for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
        v_iter != vertices->end();
@@ -148,11 +150,23 @@
 			   fieldSection->getFiberDimension(*v_iter));
       CPPUNIT_ASSERT_EQUAL(0,
 			   fieldSection->getConstraintDimension(*v_iter));
+      CPPUNIT_ASSERT_EQUAL(_data->numDOF,
+			   fieldSection->getFiberDimension(*v_iter,
+							   fibration));
+      CPPUNIT_ASSERT_EQUAL(0,
+			   fieldSection->getConstraintDimension(*v_iter,
+								fibration));
     } else {
       CPPUNIT_ASSERT_EQUAL(_data->numDOF,
 			   fieldSection->getFiberDimension(*v_iter));
       CPPUNIT_ASSERT_EQUAL(_data->numFixedDOF, 
 			   fieldSection->getConstraintDimension(*v_iter));
+      CPPUNIT_ASSERT_EQUAL(_data->numDOF,
+			   fieldSection->getFiberDimension(*v_iter,
+							   fibration));
+      CPPUNIT_ASSERT_EQUAL(_data->numFixedDOF, 
+			   fieldSection->getConstraintDimension(*v_iter,
+								fibration));
       ++iConstraint;
     } // if/else
   } // for
@@ -177,6 +191,7 @@
   const int fiberDim = _data->numDOF;
   topology::Field<topology::Mesh> field(mesh);
   field.newSection(vertices, fiberDim);
+  field.splitDefault();
   const ALE::Obj<RealSection>& fieldSection = field.section();
   CPPUNIT_ASSERT(!fieldSection.isNull());
 
@@ -203,6 +218,31 @@
       ++iConstraint;
     } // if/else
   } // for
+
+#if 0 // WAITING FOR MATT TO IMPLEMENT IN SIEVE
+  // Check fibration 0
+  const int fibration = 0;
+  iConstraint = 0;
+  for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter) {
+    const int* fixedDOF = fieldSection->getConstraintDof(*v_iter, fibration);
+    if (*v_iter != _data->constrainedPoints[iConstraint] + offset) {
+      CPPUNIT_ASSERT_EQUAL(0,
+			   fieldSection->getConstraintDimension(*v_iter,
+								fibration));
+      //CPPUNIT_ASSERT(0 == fixedDOF);
+    } else {
+      CPPUNIT_ASSERT(0 != fixedDOF);
+      CPPUNIT_ASSERT_EQUAL(_data->numFixedDOF, 
+			   fieldSection->getConstraintDimension(*v_iter,
+								fibration));
+      for (int iDOF=0; iDOF < _data->numFixedDOF; ++iDOF)
+	CPPUNIT_ASSERT_EQUAL(_data->fixedDOF[iDOF], fixedDOF[iDOF]);
+      ++iConstraint;
+    } // if/else
+  } // for
+#endif
 } // testSetConstraints
 
 // ----------------------------------------------------------------------



More information about the CIG-COMMITS mailing list