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

brad at geodynamics.org brad at geodynamics.org
Tue Dec 2 17:48:22 PST 2008


Author: brad
Date: 2008-12-02 17:48:22 -0800 (Tue, 02 Dec 2008)
New Revision: 13444

Added:
   short/3D/PyLith/trunk/libsrc/topology/FieldOps.cc
   short/3D/PyLith/trunk/libsrc/topology/FieldOps.hh
Log:
Added missing files.

Added: short/3D/PyLith/trunk/libsrc/topology/FieldOps.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/FieldOps.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/libsrc/topology/FieldOps.cc	2008-12-03 01:48:22 UTC (rev 13444)
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "FieldOps.hh" // implementation of class methods
+
+#include <stdexcept> // USES std::runtime_error
+#include <sstream> // USES std::ostringstream
+#include <cassert> // USES assert()
+
+// ----------------------------------------------------------------------
+// Copy values from one section to another.
+void
+pylith::topology::FieldOps::copyValues(const ALE::Obj<real_section_type>& dest,
+				       const ALE::Obj<real_section_type>& src)
+{ // copyValues
+  typedef real_section_type::chart_type chart_type;
+
+  assert(!dest.isNull());
+  assert(!src.isNull());
+
+  const chart_type& chartSrc = src->getChart();
+  const chart_type& chartDest = dest->getChart();
+  const chart_type::const_iterator chartEnd = chartSrc.end();
+  for (chart_type::const_iterator c_iter = chartSrc.begin();
+       c_iter != chartEnd;
+       ++c_iter) {
+    assert(dest->getFiberDimension(*c_iter) == 
+	   src->getFiberDimension(*c_iter));
+    dest->updatePoint(*c_iter, src->restrictPoint(*c_iter));
+  } // for
+} // copyValues
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/topology/FieldOps.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/FieldOps.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/libsrc/topology/FieldOps.hh	2008-12-03 01:48:22 UTC (rev 13444)
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/topology/FieldOps.hh
+ *
+ * @brief Temporary object for doing operations on a PETSc
+ * field. Object will be replaced by a PyLith Field object that inherits
+ * or templates over the PETSc Field object.
+ */
+
+#if !defined(pylith_topology_fieldops_hh)
+#define pylith_topology_fieldops_hh
+
+#include "pylith/utils/sievetypes.hh" // USES PETSc real_section_type
+
+namespace pylith {
+  namespace topology {
+    class FieldOps;
+    class TestFieldOps;
+  } // topology
+} // pylith
+
+class pylith::topology::FieldOps
+{ // MeshOps
+  friend class TestFieldOps; // unit testing
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+  /** Copy values from one section to another. Sections must be
+   * compatible in size and shape.
+   *
+   * @param dest Section to copy values into.
+   * @param src Section to copy values from.
+   */
+  static
+  void copyValues(const ALE::Obj<real_section_type>& dest,
+		  const ALE::Obj<real_section_type>& src);
+
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+  /// Not implemented
+  FieldOps(const FieldOps&);
+
+  /// Not implemented
+  const FieldOps& operator=(const FieldOps&);
+
+
+}; // FieldOps
+
+#endif // pylith_topology_fieldops_hh
+
+
+// End of file 



More information about the CIG-COMMITS mailing list