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

brad at geodynamics.org brad at geodynamics.org
Wed May 26 20:34:15 PDT 2010


Author: brad
Date: 2010-05-26 20:34:14 -0700 (Wed, 26 May 2010)
New Revision: 16800

Modified:
   short/3D/PyLith/trunk/libsrc/bc/PointForce.cc
   short/3D/PyLith/trunk/libsrc/bc/PointForce.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForce.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForce.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceHex8.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceLine2.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceQuad4.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceTet4.hh
   short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceTri3.hh
Log:
Improved PointForce::integrateResidual(). Account for overlap among processors using globalOrder->isLocal().

Modified: short/3D/PyLith/trunk/libsrc/bc/PointForce.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/PointForce.cc	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/libsrc/bc/PointForce.cc	2010-05-27 03:34:14 UTC (rev 16800)
@@ -16,6 +16,7 @@
 
 #include "pylith/topology/Field.hh" // USES Field
 #include "pylith/topology/Fields.hh" // USES Fields
+#include "pylith/topology/SolutionFields.hh" // USES SolutionFields
 #include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
 #include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
 
@@ -70,10 +71,9 @@
 } // initialize
 
 // ----------------------------------------------------------------------
-// Integrate contributions to residual term (r) for operator that
-// do not require assembly over cells, vertices, or processors.
+// Integrate contributions to residual term (r) for operator.
 void
-pylith::bc::PointForce::integrateResidualAssembled(
+pylith::bc::PointForce::integrateResidual(
 			   const topology::Field<topology::Mesh>& residual,
 			   const double t,
 			   topology::SolutionFields* const fields)
@@ -96,6 +96,14 @@
   const ALE::Obj<RealSection>& residualSection = residual.section();
   assert(!residualSection.isNull());
 
+  // Get global order
+  const ALE::Obj<SieveMesh>& sieveMesh = fields->mesh().sieveMesh();
+  assert(!sieveMesh.isNull());
+  const ALE::Obj<SieveMesh::order_type>& globalOrder =
+      sieveMesh->getFactory()->getGlobalOrder(sieveMesh, "default",
+        residualSection);
+  assert(!globalOrder.isNull());
+
   double_array valuesVertex(numBCDOF);
   const ALE::Obj<RealSection>& valueSection = 
     _parameters->get("value").section();
@@ -103,6 +111,11 @@
   
   for (int iPoint=0; iPoint < numPoints; ++iPoint) {
     const int p_bc = _points[iPoint]; // Get point label.
+
+    // Contribute to residual if point is local.
+    if (!globalOrder->isLocal(p_bc))
+      continue;
+
     residualVertex *= 0.0; // Reset residual contribution to zero.
     
     valueSection->restrictPoint(p_bc, &valuesVertex[0], valuesVertex.size());

Modified: short/3D/PyLith/trunk/libsrc/bc/PointForce.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/PointForce.hh	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/libsrc/bc/PointForce.hh	2010-05-27 03:34:14 UTC (rev 16800)
@@ -57,9 +57,9 @@
    * @param t Current time
    * @param fields Solution fields
    */
-  void integrateResidualAssembled(const topology::Field<topology::Mesh>& residual,
-				  const double t,
-				  topology::SolutionFields* const fields);
+  void integrateResidual(const topology::Field<topology::Mesh>& residual,
+			 const double t,
+			 topology::SolutionFields* const fields);
 
   /** Verify configuration is acceptable.
    *

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForce.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForce.cc	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForce.cc	2010-05-27 03:34:14 UTC (rev 16800)
@@ -131,10 +131,10 @@
 } // testInitialize
 
 // ----------------------------------------------------------------------
-// Test integrateResidualAssembled().
+// Test integrateResidual().
 void
-pylith::bc::TestPointForce::testIntegrateResidualAssembled(void)
-{ // testIntegrateResidualAssembled
+pylith::bc::TestPointForce::testIntegrateResidual(void)
+{ // testIntegrateResidual
   topology::Mesh mesh;
   PointForce bc;
   _initialize(&mesh, &bc);
@@ -150,7 +150,7 @@
   topology::SolutionFields fields(mesh);
 
   const double t = _data->tResidual;
-  bc.integrateResidualAssembled(residual, t, &fields);
+  bc.integrateResidual(residual, t, &fields);
 
   const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
   CPPUNIT_ASSERT(!sieveMesh.isNull());
@@ -174,7 +174,7 @@
       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/valsE[i], tolerance);
     else
       CPPUNIT_ASSERT_DOUBLES_EQUAL(valsE[i], vals[i], tolerance);
-} // testIntegrateResidualAssembled
+} // testIntegrateResidual
 
 // ----------------------------------------------------------------------
 // Test verifyConfiguration().

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForce.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForce.hh	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForce.hh	2010-05-27 03:34:14 UTC (rev 16800)
@@ -64,8 +64,8 @@
   /// Test initialize().
   void testInitialize(void);
 
-  /// Test integrateResidualAssembled().
-  void testIntegrateResidualAssembled(void);
+  /// Test integrateResidual().
+  void testIntegrateResidual(void);
 
   /// Test verifyConfiguration().
   void testVerifyConfiguration(void);

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceHex8.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceHex8.hh	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceHex8.hh	2010-05-27 03:34:14 UTC (rev 16800)
@@ -38,7 +38,7 @@
   CPPUNIT_TEST_SUB_SUITE( TestPointForceHex8, TestPointForce );
 
   CPPUNIT_TEST( testInitialize );
-  CPPUNIT_TEST( testIntegrateResidualAssembled );
+  CPPUNIT_TEST( testIntegrateResidual );
   CPPUNIT_TEST( testVerifyConfiguration );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceLine2.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceLine2.hh	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceLine2.hh	2010-05-27 03:34:14 UTC (rev 16800)
@@ -38,7 +38,7 @@
   CPPUNIT_TEST_SUB_SUITE( TestPointForceLine2, TestPointForce );
 
   CPPUNIT_TEST( testInitialize );
-  CPPUNIT_TEST( testIntegrateResidualAssembled );
+  CPPUNIT_TEST( testIntegrateResidual );
   CPPUNIT_TEST( testVerifyConfiguration );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceQuad4.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceQuad4.hh	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceQuad4.hh	2010-05-27 03:34:14 UTC (rev 16800)
@@ -38,7 +38,7 @@
   CPPUNIT_TEST_SUB_SUITE( TestPointForceQuad4, TestPointForce );
 
   CPPUNIT_TEST( testInitialize );
-  CPPUNIT_TEST( testIntegrateResidualAssembled );
+  CPPUNIT_TEST( testIntegrateResidual );
   CPPUNIT_TEST( testVerifyConfiguration );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceTet4.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceTet4.hh	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceTet4.hh	2010-05-27 03:34:14 UTC (rev 16800)
@@ -38,7 +38,7 @@
   CPPUNIT_TEST_SUB_SUITE( TestPointForceTet4, TestPointForce );
 
   CPPUNIT_TEST( testInitialize );
-  CPPUNIT_TEST( testIntegrateResidualAssembled );
+  CPPUNIT_TEST( testIntegrateResidual );
   CPPUNIT_TEST( testVerifyConfiguration );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceTri3.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceTri3.hh	2010-05-27 03:22:15 UTC (rev 16799)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestPointForceTri3.hh	2010-05-27 03:34:14 UTC (rev 16800)
@@ -38,7 +38,7 @@
   CPPUNIT_TEST_SUB_SUITE( TestPointForceTri3, TestPointForce );
 
   CPPUNIT_TEST( testInitialize );
-  CPPUNIT_TEST( testIntegrateResidualAssembled );
+  CPPUNIT_TEST( testIntegrateResidual );
   CPPUNIT_TEST( testVerifyConfiguration );
 
   CPPUNIT_TEST_SUITE_END();



More information about the CIG-COMMITS mailing list