[cig-commits] r15294 - short/3D/PyLith/trunk/libsrc/topology

brad at geodynamics.org brad at geodynamics.org
Mon Jun 15 21:28:52 PDT 2009


Author: brad
Date: 2009-06-15 21:28:52 -0700 (Mon, 15 Jun 2009)
New Revision: 15294

Modified:
   short/3D/PyLith/trunk/libsrc/topology/Field.cc
   short/3D/PyLith/trunk/libsrc/topology/Field.hh
Log:
Fixed Field::zero(). Want constrained and unconstrained values set to zero.

Modified: short/3D/PyLith/trunk/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.cc	2009-06-16 02:30:06 UTC (rev 15293)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.cc	2009-06-16 04:28:52 UTC (rev 15294)
@@ -315,8 +315,31 @@
 void
 pylith::topology::Field<mesh_type>::zero(void)
 { // zero
-  if (!_section.isNull())
-    _section->zero();
+  if (!_section.isNull()) {
+#if 0 
+    _section->zero(); // Does not zero BC.
+#else
+    // Add values from field
+    const chart_type& chart = _section->getChart();
+    const typename chart_type::const_iterator chartBegin = chart.begin();
+    const typename chart_type::const_iterator chartEnd = chart.end();
+
+    // Assume fiber dimension is uniform
+    const int fiberDim = (chart.size() > 0) ? 
+      _section->getFiberDimension(*chartBegin) : 0;
+    double_array values(fiberDim);
+    values *= 0.0;
+
+    for (typename chart_type::const_iterator c_iter = chartBegin;
+	 c_iter != chartEnd;
+	 ++c_iter) {
+      if (0 != _section->getFiberDimension(*c_iter)) {
+	assert(fiberDim == _section->getFiberDimension(*c_iter));
+	_section->updatePointAll(*c_iter, &values[0]);
+      } // if
+    } // for
+#endif
+  } // if
 } // zero
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.hh	2009-06-16 02:30:06 UTC (rev 15293)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.hh	2009-06-16 04:28:52 UTC (rev 15294)
@@ -199,7 +199,7 @@
   /// Allocate field.
   void allocate(void);
 
-  /// Zero section values.
+  /// Zero section values (including constrained values).
   void zero(void);
 
   /// Complete section by assembling across processors.



More information about the CIG-COMMITS mailing list