[cig-commits] r18385 - in short/3D/PyLith/trunk/libsrc: . meshio

brad at geodynamics.org brad at geodynamics.org
Mon May 16 19:25:48 PDT 2011


Author: brad
Date: 2011-05-16 19:25:48 -0700 (Mon, 16 May 2011)
New Revision: 18385

Added:
   short/3D/PyLith/trunk/libsrc/meshio/Xdmf.hh
Modified:
   short/3D/PyLith/trunk/libsrc/Makefile.am
   short/3D/PyLith/trunk/libsrc/meshio/Makefile.am
   short/3D/PyLith/trunk/libsrc/meshio/meshiofwd.hh
Log:
Started work on Xdmf object.

Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am	2011-05-17 02:15:39 UTC (rev 18384)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am	2011-05-17 02:25:48 UTC (rev 18385)
@@ -171,7 +171,8 @@
 
 if ENABLE_HDF5
   libpylith_la_SOURCES += \
-	meshio/HDF5.cc
+	meshio/HDF5.cc \
+	meshio/Xdmf.cc
   libpylith_la_LIBADD += -lhdf5
 endif
 

Modified: short/3D/PyLith/trunk/libsrc/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/Makefile.am	2011-05-17 02:15:39 UTC (rev 18384)
+++ short/3D/PyLith/trunk/libsrc/meshio/Makefile.am	2011-05-17 02:25:48 UTC (rev 18385)
@@ -51,6 +51,7 @@
 if ENABLE_HDF5
   subpkginclude_HEADERS += \
 	HDF5.hh \
+	Xdmf.hh \
 	DataWriterHDF5.hh \
 	DataWriterHDF5.icc \
 	DataWriterHDF5.cc \

Added: short/3D/PyLith/trunk/libsrc/meshio/Xdmf.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/Xdmf.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/libsrc/meshio/Xdmf.hh	2011-05-17 02:25:48 UTC (rev 18385)
@@ -0,0 +1,126 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+/*
+  domain/cells (/topology/cells) [ncells, ncorners]
+  domain/vertices (/geometry/vertices) [nvertices, spacedim]
+
+  time (uniform time step)
+    start, step, ntimesteps
+
+  Repeat for each time slice
+    topology (cell type, ncells, /Xdmf/Domain/DataItem[@Name="cells"])
+    geometry (type, /Xdmf/Domain/DataItem[@Name="vertices"]
+    Repeat for each field
+      attribute (name, scalar, center, ntimesteps, npts, fiberdim)
+      if 2-D vector, break up into components
+
+*/
+
+#if !defined(pylith_meshio_xdmf_hh)
+#define pylith_meshio_xdmf_hh
+
+// Include directives ---------------------------------------------------
+#include "meshiofwd.hh" // forward declarations
+
+#include <fstream> // HASA std::ofstream
+#include <string> // USES std::string
+
+// Xdmf -----------------------------------------------------------------
+/// Write Xdmf file associated with HDF5 file for use with VTK.
+class pylith::meshio::Xdmf
+{ // HDF5
+  friend class TestXdmf; // Unit testing
+
+// PUBLIC METHODS -------------------------------------------------------
+public :
+
+  /// Default constructor.
+  Xdmf(void);
+
+  /// Destructor
+  ~Xdmf(void);
+
+  /** Write Xdmf file associated with HDF5 file.
+   *
+   * @param filenameXdmf Name of Xdmf file.
+   * @param filenameHDF5 Name of HDF5 file.
+   */
+  void write(const char* filenameXdfm,
+	     const char* filenameHDF5);
+
+// PRIVATE METHODS ------------------------------------------------------
+private :
+
+  /** Write domain cell information.
+   *
+   * @param numCells Number of cells.
+   * @param numCorners Number of vertices in a cell.
+   */
+  void _writeDomainCells(const int numcells,
+			 const int numCorners);
+
+  /** Write domain vertices information.
+   *
+   * @param numVertices Number of vertices.
+   * @param spaceDim Spatial dimension.
+   */
+  void _writeDomainVertices(const int numVertices,
+			    const int spaceDim);
+
+  /** Write grid topology information.
+   *
+   * @param cellType Name for cell type.
+   * @param numCells Number of cells.
+   */
+  void _writeGridTopology(const char* cellType,
+			  const int numells);
+
+  /** Write Grid geometry.
+   *
+   * @param spaceDim Spatial dimension.
+   */
+  void _writeGridGeometry(const int spaceDim);
+
+  /** Write grid attribute.
+   * 
+   * @param name Name of attribute.
+   * @param center Vertex/Cell center.
+   * @param numTimeSteps Number of time steps.
+   * @param numPoints Number of vertices or cells.
+   * @param fiberDim Fiber dimension for attribute.
+   * @param iTime Index of time step.
+   */
+  void _writeGridAttribute(const char* name,
+			   const char* center,
+			   const int numTimeSteps,
+			   const int numPoints,
+			   const int fiberDim,
+			   const int iTime);
+
+// PRIVATE MEMBERS ------------------------------------------------------
+private :
+
+  std::ofstream _file; ///< Xdmf file
+
+}; // Xdmf
+
+#endif // pylith_meshio_xdmf_hh
+
+
+// End of file 

Modified: short/3D/PyLith/trunk/libsrc/meshio/meshiofwd.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/meshiofwd.hh	2011-05-17 02:15:39 UTC (rev 18384)
+++ short/3D/PyLith/trunk/libsrc/meshio/meshiofwd.hh	2011-05-17 02:25:48 UTC (rev 18385)
@@ -60,6 +60,7 @@
     class UCDFaultFile;
 
     class HDF5;
+    class Xdmf;
 
   } // meshio
 } // pylith



More information about the CIG-COMMITS mailing list