[cig-commits] r4093 - in short/3D/PyLith/trunk: . playpen
playpen/meshio playpen/meshio/src playpen/meshio/test
baagaard at geodynamics.org
baagaard at geodynamics.org
Fri Jul 21 08:48:29 PDT 2006
Author: baagaard
Date: 2006-07-21 08:48:29 -0700 (Fri, 21 Jul 2006)
New Revision: 4093
Added:
short/3D/PyLith/trunk/playpen/
short/3D/PyLith/trunk/playpen/meshio/
short/3D/PyLith/trunk/playpen/meshio/Makefile.am
short/3D/PyLith/trunk/playpen/meshio/configure.ac
short/3D/PyLith/trunk/playpen/meshio/src/
short/3D/PyLith/trunk/playpen/meshio/src/Makefile.am
short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc
short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.hh
short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.icc
short/3D/PyLith/trunk/playpen/meshio/src/PetscMesh.cc
short/3D/PyLith/trunk/playpen/meshio/src/PetscMesh.hh
short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc
short/3D/PyLith/trunk/playpen/meshio/test/
short/3D/PyLith/trunk/playpen/meshio/test/.gdb_history
short/3D/PyLith/trunk/playpen/meshio/test/tri1.mesh
short/3D/PyLith/trunk/playpen/meshio/test/tri2.mesh
short/3D/PyLith/trunk/playpen/meshio/test/tri3.mesh
Log:
Added playpen dir for testing ideas, etc. Added meshio (read/write sieve info to various types of files; for use in getting mesh info from mesh generators) to playpen.
Added: short/3D/PyLith/trunk/playpen/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/Makefile.am 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/Makefile.am 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,20 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+ACLOCAL_AMFLAGS = -I ./m4
+
+SUBDIRS = src
+
+# version
+# $Id$
+
+# End of file
Added: short/3D/PyLith/trunk/playpen/meshio/configure.ac
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/configure.ac 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/configure.ac 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,45 @@
+# -*- autoconf -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([testsieve], [0.0], [])
+AC_CONFIG_AUX_DIR([./aux-config])
+AC_CONFIG_HEADER([portinfo])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([foreign])
+
+# ----------------------------------------------------------------------
+# C/C++/libtool/install
+AC_PROG_CXX
+AC_PROG_LIBTOOL
+AC_PROG_INSTALL
+
+# PYTHON
+#AM_PATH_PYTHON([2.3])
+#CIT_PYTHON_SYSCONFIG
+
+# MPI
+AC_LANG(C++)
+#CIT_HEADER_MPI
+#CIT_CHECK_LIB_MPI
+
+# PETSC
+CIT_PATH_PETSC([2.3])
+CIT_HEADER_PETSC
+CIT_CHECK_LIB_PETSC
+
+# ----------------------------------------------------------------------
+AC_CONFIG_FILES([Makefile
+ src/Makefile])
+AC_OUTPUT
+
+dnl end of configure.ac
Added: short/3D/PyLith/trunk/playpen/meshio/src/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/Makefile.am 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/src/Makefile.am 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,31 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+bin_PROGRAMS = testascii
+
+testascii_SOURCES = \
+ MeshIOAscii.cc \
+ PetscMesh.cc \
+ testascii.cc
+
+noinst_HEADERS = \
+ MeshIOAscii.hh \
+ PetscMesh.hh
+
+testascii_LDADD = $(PETSC_LIB)
+
+INCLUDES = $(PETSC_INCLUDE)
+
+# version
+# $Id$
+
+# End of file
Added: short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,426 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "MeshIOAscii.hh" // implementation of class methods
+
+#include "PetscMesh.hh"
+
+#include <fstream> // USES std::ifstream, std::ofstream
+#include <stdexcept> // USES std::runtime_error
+#include <sstream> // USES std::ostringstream
+#include <assert.h> // USES assert()
+#include <iomanip> // USES setw(), setiosflags(), resetiosflags()
+
+// ----------------------------------------------------------------------
+// Constructor
+MeshIOAscii::MeshIOAscii(void) :
+ _filename("")
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+MeshIOAscii::~MeshIOAscii(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Unpickle mesh
+void
+MeshIOAscii::read(ALE::Obj<ALE::PetscMesh>* pMesh) const
+{ // read
+ assert(0 != pMesh);
+
+ int meshDim = 0;
+ int numDims = 0;
+ int numVertices = 0;
+ int numElements = 0;
+ int numCorners = 0;
+ double* coordinates = 0;
+ int* elements = 0;
+
+ std::ifstream filein(_filename.c_str());
+ if (!filein.is_open() || !filein.good()) {
+ std::ostringstream msg;
+ msg << "Could not open mesh file '" << _filename
+ << "' for reading.\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ std::string token;
+ const int maxIgnore = 1024;
+ filein >> token;
+ if (0 != strcasecmp(token.c_str(), "mesh")) {
+ std::ostringstream msg;
+ msg << "Expected 'mesh' token but encountered '" << token << "'\n";
+ throw std::runtime_error(msg.str());
+ }
+
+ bool readDim = false;
+ bool readElements = false;
+ bool readVertices = false;
+ bool builtTopology = false;
+
+ filein.ignore(maxIgnore, '{');
+ filein >> token;
+ while (filein.good() && token != "}") {
+ if (0 == strcasecmp(token.c_str(), "dimension")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> meshDim;
+ readDim = true;
+ } else if (0 == strcasecmp(token.c_str(), "vertices")) {
+ filein.ignore(maxIgnore, '{');
+ _readVertices(filein, &coordinates, &numVertices, &numDims);
+ readVertices = true;
+ } else if (0 == strcasecmp(token.c_str(), "elements")) {
+ filein.ignore(maxIgnore, '{');
+ _readElements(filein, &elements, &numElements, &numCorners);
+ readElements = true;
+ } else if (0 == strcasecmp(token.c_str(), "chart")) {
+ if (!builtTopology)
+ throw std::runtime_error("Both 'vertices' and 'elements' must "
+ "precede any charts in mesh file.");
+ filein.ignore(maxIgnore, '{');
+ _readChart(filein, pMesh);
+ } else {
+ std::ostringstream msg;
+ msg << "Could not parse '" << token << "' into a mesh setting.";
+ throw std::runtime_error(msg.str());
+ } // else
+
+ if (readDim && readElements && readVertices && !builtTopology) {
+ // Can now build topology
+ *pMesh = ALE::PetscMesh(PETSC_COMM_WORLD, meshDim);
+ (*pMesh)->debug = true;
+ bool interpolate = false;
+
+#if 1
+// allow mesh to have different dimension than coordinates
+ ALE::Obj<ALE::PetscMesh::sieve_type> topology = (*pMesh)->getTopology();
+ topology->setStratification(false);
+ (*pMesh)->buildTopology(numElements, elements, numVertices,
+ interpolate, numCorners);
+ topology->stratify();
+ topology->setStratification(true);
+ (*pMesh)->createVertexBundle(numElements, elements, 0, numCorners);
+ (*pMesh)->createSerialCoordinates(numDims, numElements, coordinates);
+#else
+// require mesh to have same dimension as coordinates
+ (*pMesh)->populate(numElements, elements, numVertices, coordinates,
+ interpolate, numCorners);
+#endif
+ delete[] coordinates; coordinates = 0;
+ delete[] elements; elements = 0;
+ builtTopology = true;
+ } // if
+
+ filein >> token;
+ } // while
+ filein.close();
+} // read
+
+// ----------------------------------------------------------------------
+// Write mesh to file.
+void
+MeshIOAscii::write(const ALE::Obj<ALE::PetscMesh>& mesh) const
+{ // write
+ std::ofstream fileout(_filename.c_str());
+ if (!fileout.is_open() || !fileout.good()) {
+ std::ostringstream msg;
+ msg << "Could not open mesh file '" << _filename
+ << "' for writing.\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ const int dimension = mesh->getDimension();
+
+ fileout
+ << "mesh = {\n"
+ << " dimension = " << dimension << "\n";
+
+ _writeVertices(fileout, mesh);
+ _writeElements(fileout, mesh);
+
+ // Loop over charts
+ //_writeChart(fileout, mesh);
+
+ fileout << "}\n";
+ fileout.close();
+} // write
+
+// ----------------------------------------------------------------------
+// Read mesh vertices.
+void
+MeshIOAscii::_readVertices(std::istream& filein,
+ double** pCoordinates,
+ int* pNumVertices,
+ int* pNumDims) const
+{ // _readVertices
+ double* coordinates = 0;
+ int numDims = 0;
+ int numVertices = 0;
+
+ std::string token;
+ const int maxIgnore = 1024;
+ filein >> token;
+ while (filein.good() && token != "}") {
+ if (0 == strcasecmp(token.c_str(), "dimension")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> numDims;
+ } else if (0 == strcasecmp(token.c_str(), "count")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> numVertices;
+ } else if (0 == strcasecmp(token.c_str(), "coordinates")) {
+ const int size = numVertices*numDims;
+ if (0 == size) {
+ std::ostringstream msg;
+ msg << "Tokens 'dimension' and 'count' must precede 'coordinates'.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ filein.ignore(maxIgnore, '{');
+ delete[] coordinates; coordinates = new double[size];
+ assert(0 != coordinates);
+ for (int i=0; i < size; ++i)
+ filein >> coordinates[i];
+ filein.ignore(maxIgnore, '}');
+ } else {
+ std::ostringstream msg;
+ msg << "Could not parse '" << token << "' into a vertices setting.";
+ throw std::runtime_error(msg.str());
+ } // else
+ filein >> token;
+ } // while
+ if (!filein.good())
+ throw std::runtime_error("I/O error while parsing vertices settings.");
+
+ if (0 != pCoordinates)
+ *pCoordinates = coordinates;
+ if (0 != pNumVertices)
+ *pNumVertices = numVertices;
+ if (0 != pNumDims)
+ *pNumDims = numDims;
+} // _readVertices
+
+// ----------------------------------------------------------------------
+// Write mesh vertices.
+void
+MeshIOAscii::_writeVertices(std::ostream& fileout,
+ const ALE::Obj<ALE::PetscMesh>& mesh) const
+{ // _writeVertices
+ ALE::Obj<ALE::PetscMesh::field_type> coords_field = mesh->getCoordinates();
+ ALE::Obj<ALE::PetscMesh::bundle_type> vertexBundle = mesh->getBundle(0);
+ ALE::PetscMesh::field_type::patch_type patch;
+ const double* coordinates = coords_field->restrict(patch);
+ const int numVertices = (vertexBundle->getGlobalOffsets()) ?
+ vertexBundle->getGlobalOffsets()[mesh->commSize()] :
+ mesh->getTopology()->depthStratum(0)->size();
+ const int numDims = coords_field->getFiberDimension(patch,
+ *mesh->getTopology()->depthStratum(0)->begin());
+
+ fileout
+ << " vertices = {\n"
+ << " dimension = " << numDims << "\n"
+ << " count = " << numVertices << "\n"
+ << " coordinates = {\n";
+ for (int iVertex=0; iVertex < numVertices; ++iVertex) {
+ fileout << " ";
+
+ fileout
+ << std::resetiosflags(std::ios::fixed)
+ << std::setiosflags(std::ios::scientific)
+ << std::setprecision(6);
+ for (int iDim=0; iDim < numDims; ++iDim)
+ fileout << std::setw(18) << coordinates[numDims*iVertex+iDim];
+ fileout << "\n";
+ } // for
+ fileout
+ << " }\n"
+ << " }\n";
+} // _writeVertices
+
+// ----------------------------------------------------------------------
+// Read mesh elements.
+void
+MeshIOAscii::_readElements(std::istream& filein,
+ int** pElements,
+ int* pNumElements,
+ int* pNumCorners) const
+{ // _readElements
+ int* elements = 0;
+ int numElements = 0;
+ int numCorners = 0;
+ int dimension = 0;
+
+ std::string token;
+ const int maxIgnore = 1024;
+ filein >> token;
+ while (filein.good() && token != "}") {
+ if (0 == strcasecmp(token.c_str(), "num-corners")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> numCorners;
+ } else if (0 == strcasecmp(token.c_str(), "count")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> numElements;
+ } else if (0 == strcasecmp(token.c_str(), "simplices")) {
+ const int size = numElements*numCorners;
+ if (0 == size) {
+ std::ostringstream msg;
+ msg << "Tokens 'num-corners' and 'count' must precede 'elements'.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ filein.ignore(maxIgnore, '{');
+ delete[] elements; elements = new int[size];
+ assert(0 != elements);
+ for (int i=0; i < size; ++i)
+ filein >> elements[i];
+ filein.ignore(maxIgnore, '}');
+ } else {
+ std::ostringstream msg;
+ msg << "Could not parse '" << token << "' into an elements setting.";
+ throw std::runtime_error(msg.str());
+ } // else
+ filein >> token;
+ } // while
+ if (!filein.good())
+ throw std::runtime_error("I/O error while parsing elements settings.");
+
+ if (0 != pElements)
+ *pElements = elements;
+ if (0 != pNumElements)
+ *pNumElements = numElements;
+ if (0 != pNumCorners)
+ *pNumCorners = numCorners;
+} // _readElements
+
+// ----------------------------------------------------------------------
+// Write mesh elements.
+void
+MeshIOAscii::_writeElements(std::ostream& fileout,
+ const ALE::Obj<ALE::PetscMesh>& mesh) const
+{ // _writeElements
+ ALE::Obj<ALE::PetscMesh::sieve_type> topology = mesh->getTopology();
+ ALE::Obj<ALE::PetscMesh::sieve_type::traits::heightSequence> elements =
+ topology->heightStratum(0);
+ ALE::Obj<ALE::PetscMesh::bundle_type> vertexBundle = mesh->getBundle(0);
+ ALE::PetscMesh::bundle_type::patch_type patch;
+ std::string orderName("element");
+
+ assert(0 != topology);
+ assert(0 != elements);
+ assert(0 != vertexBundle);
+
+ int numCorners =
+ topology->nCone(*elements->begin(), topology->depth())->size();
+ const int numElements = mesh->getTopology()->heightStratum(0)->size();
+
+ fileout
+ << " elements = {\n"
+ << " count = " << numElements << "\n"
+ << " num-corners = " << numCorners << "\n"
+ << " simplices = {\n";
+
+ for(ALE::PetscMesh::sieve_type::traits::heightSequence::iterator e_itor =
+ elements->begin();
+ e_itor != elements->end();
+ ++e_itor) {
+ fileout << " ";
+ ALE::Obj<ALE::PetscMesh::bundle_type::order_type::coneSequence> cone =
+ vertexBundle->getPatch(orderName, *e_itor);
+ assert(0 != cone);
+ for(ALE::PetscMesh::bundle_type::order_type::coneSequence::iterator c_itor =
+ cone->begin();
+ c_itor != cone->end();
+ ++c_itor)
+ fileout << std::setw(8) << vertexBundle->getIndex(patch, *c_itor).prefix;
+ fileout << "\n";
+ } // for
+ fileout
+ << " }\n"
+ << " }\n";
+} // _writeElements
+
+// ----------------------------------------------------------------------
+// Read mesh charts.
+void
+MeshIOAscii::_readChart(std::istream& filein,
+ ALE::Obj<ALE::PetscMesh>* pMesh) const
+{ // _readChart
+ std::string name = ""; // Name of chart
+ int dimension = 0; // Topology dimension associated with chart
+ int count = 0; // Number of entities in chart
+ int* indices = 0; // Indices of entities in chart
+
+ std::string token;
+ const int maxIgnore = 1024;
+ filein >> token;
+ while (filein.good() && token != "}") {
+ if (0 == strcasecmp(token.c_str(), "name")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> name;
+ } else if (0 == strcasecmp(token.c_str(), "dimension")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> dimension;
+ } else if (0 == strcasecmp(token.c_str(), "count")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> count;
+ } else if (0 == strcasecmp(token.c_str(), "indices")) {
+ if (0 == count) {
+ std::ostringstream msg;
+ msg << "Tokens 'count' must precede 'indices'.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ filein.ignore(maxIgnore, '{');
+ delete[] indices; indices = new int[count];
+ assert(0 != indices);
+ for (int i=0; i < count; ++i)
+ filein >> indices[i];
+ filein.ignore(maxIgnore, '}');
+ } else {
+ std::ostringstream msg;
+ msg << "Could not parse '" << token << "' into a chart setting.";
+ throw std::runtime_error(msg.str());
+ } // else
+ filein >> token;
+ } // while
+ if (!filein.good())
+ throw std::runtime_error("I/O error while parsing chart settings.");
+
+ // ADD STUFF HERE
+} // _readChart
+
+// ----------------------------------------------------------------------
+// Write mesh chart.
+void
+MeshIOAscii::_writeChart(std::ostream& fileout,
+ const ALE::Obj<ALE::PetscMesh>& mesh,
+ const char* name) const
+{ // _writeChart
+ // ADD STUFF HERE
+ int count = 0; // TEMPORARY
+ int dimension = 0; // TEMPORARY
+
+ fileout
+ << " chart = {\n"
+ << " name = " << name << "\n"
+ << " dimension = " << dimension << "\n"
+ << " count = " << count << "\n"
+ << " indices = {\n";
+
+ fileout
+ << " }\n"
+ << " }\n";
+} // _writeChart
+
+// End of file
Added: short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.hh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.hh 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.hh 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(meshioascii_hh)
+#define meshioascii_hh
+
+#include <iosfwd> // USES std::istream, std::ostream
+#include <string> // HASA std::string
+
+namespace ALE {
+ template<typename T> class Obj;
+ class PetscMesh;
+}
+
+class MeshIOAscii
+{ // MeshIOAscii
+
+// PUBLIC METHODS -------------------------------------------------------
+public :
+
+ /// Constructor
+ MeshIOAscii(void);
+
+ /// Destructor
+ ~MeshIOAscii(void);
+
+ /** Set filename for ASCII file.
+ *
+ * @param filename Name of file
+ */
+ void filename(const char* name);
+
+ /** Get filename of ASCII file.
+ *
+ * @returns Name of file
+ */
+ const char* filename(void) const;
+
+ /** Read mesh from file.
+ *
+ * @param pMesh Pointer to PETSc mesh object
+ */
+ void read(ALE::Obj<ALE::PetscMesh>* pMesh) const;
+
+ /** Write mesh to file.
+ *
+ * @param mesh PETSc mesh object
+ */
+ void write(const ALE::Obj<ALE::PetscMesh>& mesh) const;
+
+// PRIVATE METHODS ------------------------------------------------------
+private :
+
+ /** Read mesh vertices.
+ *
+ * @param filein Input stream
+ * @param pCoordinates Pointer to array of vertex coordinates
+ * @param pNumVertices Pointer to number of vertices
+ * @param pNumDims Pointer to number of dimensions
+ */
+ void _readVertices(std::istream& filein,
+ double** pCoordinates,
+ int* pNumVertices,
+ int* pNumDims) const;
+
+ /** Write mesh vertices.
+ *
+ * @param fileout Output stream
+ * @param mesh PETSc mesh
+ */
+ void _writeVertices(std::ostream& fileout,
+ const ALE::Obj<ALE::PetscMesh>& mesh) const;
+
+ /** Read mesh elements.
+ *
+ * @param filein Input stream
+ * @param pElements Pointer to array of elements (vertices in each element)
+ * @param pNumElements Pointer to number of elements
+ * @param pNumCorners Pointer to number of corners in each element
+ */
+ void _readElements(std::istream& filein,
+ int** pElements,
+ int* pNumElements,
+ int* pNumCorners) const;
+
+ /** Write mesh elements.
+ *
+ * @param fileout Output stream
+ * @param mesh PETSc mesh
+ */
+ void _writeElements(std::ostream& fileout,
+ const ALE::Obj<ALE::PetscMesh>& mesh) const;
+
+ /** Read mesh chart.
+ *
+ * @param filein Output stream
+ * @param pMesh Pointer to PETSc mesh
+ */
+ void _readChart(std::istream& filein,
+ ALE::Obj<ALE::PetscMesh>* pMesh) const;
+
+ /** Write mesh chart.
+ *
+ * @param fileout Output stream
+ * @param mesh PETSc mesh
+ * @param name Name of chart
+ */
+ void _writeChart(std::ostream& fileout,
+ const ALE::Obj<ALE::PetscMesh>& mesh,
+ const char* name) const;
+
+// PRIVATE MEMBERS ------------------------------------------------------
+private :
+
+ std::string _filename; ///< Name of file
+
+}; // MeshIOAscii
+
+#include "MeshIOAscii.icc" // inline methods
+
+#endif // meshioascii_hh
+
+// version
+// $Id$
+
+// End of file
Added: short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.icc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.icc 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.icc 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(meshioascii_hh)
+#error "MeshIOAscii.icc must be included only from MeshIOAscii.icc"
+#else
+
+// Set filename for ASCII file.
+inline
+void
+MeshIOAscii::filename(const char* name) {
+ _filename = name;
+}
+
+// Get filename of ASCII file.
+inline
+const char*
+MeshIOAscii::filename(void) const {
+ return _filename.c_str();
+}
+
+#endif
+
+// End of file
Added: short/3D/PyLith/trunk/playpen/meshio/src/PetscMesh.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/PetscMesh.cc 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/src/PetscMesh.cc 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,416 @@
+#include "PetscMesh.hh"
+
+ALE::PetscMesh::PetscMesh(MPI_Comm comm,
+ int dimension,
+ int debug) : debug(debug), dim(dimension) {
+ this->setComm(comm);
+ this->topology = sieve_type(comm, debug);
+ this->coordinates = field_type(comm, debug);
+ this->boundary = field_type(comm, debug);
+ this->boundaries = foliation_type(comm, debug);
+ this->distributed = false;
+ this->coordinates->setTopology(this->topology);
+ this->boundary->setTopology(this->topology);
+ this->boundaries->setTopology(this->topology);
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::getBundle"
+ALE::Obj<ALE::PetscMesh::bundle_type>
+ALE::PetscMesh::getBundle(const int dim) {
+ ALE_LOG_EVENT_BEGIN;
+ if (this->bundles.find(dim) == this->bundles.end()) {
+ Obj<bundle_type> bundle = bundle_type(this->comm(), debug);
+
+ // Need to globalize indices (that is what we might use the value ints for)
+ std::cout << "Creating new bundle for dim " << dim << std::endl;
+ bundle->setTopology(this->topology);
+ bundle->setPatch(this->topology->leaves(), bundle_type::patch_type());
+ bundle->setFiberDimensionByDepth(bundle_type::patch_type(), dim, 1);
+ bundle->orderPatches();
+ if (this->distributed) {
+ bundle->createGlobalOrder();
+ }
+ // "element" reorder is in vertexBundle by default, and intermediate bundles could be handled by a cell tuple
+ this->bundles[dim] = bundle;
+ } else {
+ if (this->distributed && this->bundles[dim]->getGlobalOffsets() == NULL) {
+ this->bundles[dim]->createGlobalOrder();
+ }
+ }
+ ALE_LOG_EVENT_END;
+ return this->bundles[dim];
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::getField"
+ALE::Obj<ALE::PetscMesh::field_type>
+ALE::PetscMesh::getField(const std::string& name) {
+ if (this->fields.find(name) == this->fields.end()) {
+ Obj<field_type> field = field_type(this->comm(), debug);
+
+ std::cout << "Creating new field " << name << std::endl;
+ field->setTopology(this->topology);
+ this->fields[name] = field;
+ }
+ return this->fields[name];
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::hasField"
+bool
+ALE::PetscMesh::hasField(const std::string& name) {
+ return(this->fields.find(name) != this->fields.end());
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::getFields"
+ALE::Obj<std::set<std::string> >
+ALE::PetscMesh::getFields() {
+ Obj<std::set<std::string> > names = std::set<std::string>();
+
+ for(FieldContainer::iterator f_iter = this->fields.begin(); f_iter != this->fields.end(); ++f_iter) {
+ names->insert(f_iter->first);
+ }
+ return names;
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::buildHexFaces"
+// For a hex, there are 2d faces
+void
+ALE::PetscMesh::buildHexFaces(int dim, std::map<int, int*> *curSimplex, PointArray *boundary, point_type& simplex) {
+ PointArray *faces = NULL;
+
+ if (debug > 1) {std::cout << " Building hex faces for boundary of " << simplex << " (size " << boundary->size() << "), dim " << dim << std::endl;}
+ if (dim > 3) {
+ throw ALE::Exception("Cannot do hexes of dimension greater than three");
+ } else if (dim > 2) {
+ int nodes[24] = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 5, 4,
+ 1, 2, 6, 5, 2, 3, 7, 6, 3, 0, 4, 7};
+ faces = new PointArray();
+
+ for(int b = 0; b < 6; b++) {
+ PointArray faceBoundary = PointArray();
+ point_type face;
+
+ for(int c = 0; c < 4; c++) {
+ faceBoundary.push_back((*boundary)[nodes[b*4+c]]);
+ }
+ if (debug > 1) {std::cout << " boundary point " << (*boundary)[b] << std::endl;}
+ this->buildHexFaces(dim-1, curSimplex, &faceBoundary, face);
+ faces->push_back(face);
+ }
+ } else if (dim > 1) {
+ int boundarySize = (int) boundary->size();
+ faces = new PointArray();
+
+ for(int b = 0; b < boundarySize; b++) {
+ PointArray faceBoundary = PointArray();
+ point_type face;
+
+ for(int c = 0; c < 2; c++) {
+ faceBoundary.push_back((*boundary)[(b+c)%boundarySize]);
+ }
+ if (debug > 1) {std::cout << " boundary point " << (*boundary)[b] << std::endl;}
+ this->buildHexFaces(dim-1, curSimplex, &faceBoundary, face);
+ faces->push_back(face);
+ }
+ } else {
+ if (debug > 1) {std::cout << " Just set faces to boundary in 1d" << std::endl;}
+ faces = boundary;
+ }
+ if (debug > 1) {
+ for(PointArray::iterator f_itor = faces->begin(); f_itor != faces->end(); ++f_itor) {
+ std::cout << " face point " << *f_itor << std::endl;
+ }
+ }
+ // We always create the toplevel, so we could short circuit somehow
+ // Should not have to loop here since the meet of just 2 boundary elements is an element
+ PointArray::iterator f_itor = faces->begin();
+ point_type start = *f_itor;
+ f_itor++;
+ point_type next = *f_itor;
+ Obj<sieve_type::supportSet> preElement = this->topology->nJoin(start, next, 1);
+
+ if (preElement->size() > 0) {
+ simplex = *preElement->begin();
+ if (debug > 1) {std::cout << " Found old simplex " << simplex << std::endl;}
+ } else {
+ int color = 0;
+
+ simplex = point_type(0, (*(*curSimplex)[dim])++);
+ for(PointArray::iterator f_itor = faces->begin(); f_itor != faces->end(); ++f_itor) {
+ this->topology->addArrow(*f_itor, simplex, color++);
+ }
+ if (debug > 1) {std::cout << " Added simplex " << simplex << " dim " << dim << std::endl;}
+ }
+ if (dim > 1) {
+ delete faces;
+ }
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::buildFaces"
+void
+ALE::PetscMesh::buildFaces(int dim, std::map<int, int*> *curSimplex, PointArray *boundary, point_type& simplex) {
+ PointArray *faces = NULL;
+
+ if (debug > 1) {std::cout << " Building faces for boundary of " << simplex << " (size " << boundary->size() << "), dim " << dim << std::endl;}
+ if (dim > 1) {
+ faces = new PointArray();
+
+ // Use the cone construction
+ for(PointArray::iterator b_itor = boundary->begin(); b_itor != boundary->end(); ++b_itor) {
+ PointArray faceBoundary = PointArray();
+ point_type face;
+
+ for(PointArray::iterator i_itor = boundary->begin(); i_itor != boundary->end(); ++i_itor) {
+ if (i_itor != b_itor) {
+ faceBoundary.push_back(*i_itor);
+ }
+ }
+ if (debug > 1) {std::cout << " boundary point " << *b_itor << std::endl;}
+ this->buildFaces(dim-1, curSimplex, &faceBoundary, face);
+ faces->push_back(face);
+ }
+ } else {
+ if (debug > 1) {std::cout << " Just set faces to boundary in 1d" << std::endl;}
+ faces = boundary;
+ }
+ if (debug > 1) {
+ for(PointArray::iterator f_itor = faces->begin(); f_itor != faces->end(); ++f_itor) {
+ std::cout << " face point " << *f_itor << std::endl;
+ }
+ }
+ // We always create the toplevel, so we could short circuit somehow
+ // Should not have to loop here since the meet of just 2 boundary elements is an element
+ PointArray::iterator f_itor = faces->begin();
+ point_type start = *f_itor;
+ f_itor++;
+ point_type next = *f_itor;
+ Obj<sieve_type::supportSet> preElement = this->topology->nJoin(start, next, 1);
+
+ if (preElement->size() > 0) {
+ simplex = *preElement->begin();
+ if (debug > 1) {std::cout << " Found old simplex " << simplex << std::endl;}
+ } else {
+ int color = 0;
+
+ simplex = point_type(0, (*(*curSimplex)[dim])++);
+ for(PointArray::iterator f_itor = faces->begin(); f_itor != faces->end(); ++f_itor) {
+ this->topology->addArrow(*f_itor, simplex, color++);
+ }
+ if (debug > 1) {std::cout << " Added simplex " << simplex << " dim " << dim << std::endl;}
+ }
+ if (dim > 1) {
+ delete faces;
+ }
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::buildTopology"
+// Build a topology from a connectivity description
+// (0, 0) ... (0, numSimplices-1): dim-dimensional simplices
+// (0, numSimplices) ... (0, numVertices): vertices
+// The other simplices are numbered as they are requested
+void
+ALE::PetscMesh::buildTopology(int numSimplices,
+ int simplices[],
+ int numVertices,
+ bool interpolate,
+ int corners) {
+ ALE_LOG_EVENT_BEGIN;
+ if (this->commRank() != 0) {
+ ALE_LOG_EVENT_END;
+ return;
+ }
+ // Create a map from dimension to the current element number for that dimension
+ std::map<int,int*> curElement = std::map<int,int*>();
+ int curSimplex = 0;
+ int curVertex = numSimplices;
+ int newElement = numSimplices+numVertices;
+ PointArray boundary = PointArray();
+
+ if (corners < 0) corners = this->dim+1;
+ curElement[0] = &curVertex;
+ curElement[this->dim] = &curSimplex;
+ for(int d = 1; d < this->dim; d++) {
+ curElement[d] = &newElement;
+ }
+ for(int s = 0; s < numSimplices; s++) {
+ point_type simplex(0, s);
+
+ // Build the simplex
+ if (interpolate) {
+ boundary.clear();
+ for(int b = 0; b < corners; b++) {
+ point_type vertex(0, simplices[s*corners+b]+numSimplices);
+
+ if (debug > 1) {std::cout << "Adding boundary node " << vertex << std::endl;}
+ boundary.push_back(vertex);
+ }
+ if (debug) {std::cout << "simplex " << s << " boundary size " << boundary.size() << std::endl;}
+
+ if (corners != this->dim+1) {
+ this->buildHexFaces(this->dim, &curElement, &boundary, simplex);
+ } else {
+ this->buildFaces(this->dim, &curElement, &boundary, simplex);
+ }
+ } else {
+ for(int b = 0; b < corners; b++) {
+ point_type p(0, simplices[s*corners+b]+numSimplices);
+
+ this->topology->addArrow(p, simplex, b);
+ }
+ }
+ }
+ ALE_LOG_EVENT_END;
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::createVertBnd"
+void
+ALE::PetscMesh::createVertexBundle(int numSimplices,
+ int simplices[],
+ int elementOffset,
+ int corners) {
+ ALE_LOG_STAGE_BEGIN;
+ Obj<bundle_type> vertexBundle = this->getBundle(0);
+ Obj<sieve_type::traits::heightSequence> elements = this->topology->heightStratum(0);
+ std::string orderName("element");
+ int vertexOffset;
+
+ ALE_LOG_EVENT_BEGIN;
+ if (elementOffset) {
+ vertexOffset = 0;
+ } else {
+ vertexOffset = numSimplices;
+ }
+ if (corners < 0) corners = this->dim+1;
+ for(sieve_type::traits::heightSequence::iterator e_iter = elements->begin(); e_iter != elements->end(); ++e_iter) {
+ // setFiberDimensionByDepth() does not work here since we only want it to apply to the patch cone
+ // What we really need is the depthStratum relative to the patch
+ Obj<PointArray> patch = PointArray();
+
+ for(int b = 0; b < corners; b++) {
+ patch->push_back(point_type(0, simplices[((*e_iter).index - elementOffset)*corners+b]+vertexOffset));
+ }
+ vertexBundle->setPatch(orderName, patch, *e_iter);
+ for(PointArray::iterator p_iter = patch->begin(); p_iter != patch->end(); ++p_iter) {
+ vertexBundle->setFiberDimension(orderName, *e_iter, *p_iter, 1);
+ }
+ }
+ if (elements->size() == 0) {
+ vertexBundle->setPatch(orderName, elements, bundle_type::patch_type());
+ }
+ ALE_LOG_EVENT_END;
+ vertexBundle->orderPatches(orderName);
+ ALE_LOG_STAGE_END;
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::createSerCoords"
+void
+ALE::PetscMesh::createSerialCoordinates(int embedDim, int numSimplices, double coords[]) {
+ ALE_LOG_EVENT_BEGIN;
+ patch_type patch;
+
+ this->coordinates->setTopology(this->topology);
+ this->coordinates->setPatch(this->topology->leaves(), patch);
+ this->coordinates->setFiberDimensionByDepth(patch, 0, embedDim);
+ this->coordinates->orderPatches();
+ Obj<sieve_type::traits::depthSequence> vertices = this->topology->depthStratum(0);
+ for(sieve_type::traits::depthSequence::iterator v_itor = vertices->begin(); v_itor != vertices->end(); v_itor++) {
+ this->coordinates->update(patch, *v_itor, &coords[((*v_itor).index - numSimplices)*embedDim]);
+ }
+ Obj<bundle_type> vertexBundle = this->getBundle(0);
+ Obj<sieve_type::traits::heightSequence> elements = this->topology->heightStratum(0);
+ std::string orderName("element");
+
+ for(sieve_type::traits::heightSequence::iterator e_iter = elements->begin(); e_iter != elements->end(); e_iter++) {
+ // setFiberDimensionByDepth() does not work here since we only want it to apply to the patch cone
+ // What we really need is the depthStratum relative to the patch
+ Obj<bundle_type::order_type::coneSequence> cone = vertexBundle->getPatch(orderName, *e_iter);
+
+ this->coordinates->setPatch(orderName, cone, *e_iter);
+ for(bundle_type::order_type::coneSequence::iterator c_iter = cone->begin(); c_iter != cone->end(); ++c_iter) {
+ this->coordinates->setFiberDimension(orderName, *e_iter, *c_iter, embedDim);
+ }
+ }
+ if (elements->size() == 0) {
+ this->coordinates->setPatch(orderName, elements, field_type::patch_type());
+ }
+ this->coordinates->orderPatches(orderName);
+ ALE_LOG_EVENT_END;
+}
+
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::parVertReOrd"
+// This is not right, we should not have to copy everything to the new order first
+void
+ALE::PetscMesh::createParallelVertexReorder(Obj<bundle_type> serialVertexBundle) {
+ ALE_LOG_EVENT_BEGIN;
+ Obj<bundle_type> vertexBundle = this->getBundle(0);
+ std::string orderName("element");
+
+ if (!this->commRank()) {
+ Obj<bundle_type::order_type::baseSequence> patches = serialVertexBundle->getPatches(orderName);
+
+ for(bundle_type::order_type::baseSequence::iterator e_iter = patches->begin(); e_iter != patches->end(); ++e_iter) {
+ Obj<bundle_type::order_type::coneSequence> patch = serialVertexBundle->getPatch(orderName, *e_iter);
+
+ vertexBundle->setPatch(orderName, patch, *e_iter);
+ for(bundle_type::order_type::coneSequence::iterator p_iter = patch->begin(); p_iter != patch->end(); ++p_iter) {
+ vertexBundle->setFiberDimension(orderName, *e_iter, *p_iter, 1);
+ }
+ }
+ } else {
+ Obj<sieve_type::traits::heightSequence> elements = this->topology->heightStratum(0);
+ Obj<bundle_type::order_type> reorder = vertexBundle->__getOrder(orderName);
+
+ for(sieve_type::traits::heightSequence::iterator e_iter = elements->begin(); e_iter != elements->end(); e_iter++) {
+ reorder->addBasePoint(*e_iter);
+ }
+ }
+ vertexBundle->orderPatches(orderName);
+ vertexBundle->partitionOrder(orderName);
+ ALE_LOG_EVENT_END;
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::populate"
+// Create a serial mesh
+void
+ALE::PetscMesh::populate(int numSimplices,
+ int simplices[],
+ int numVertices,
+ double coords[],
+ bool interpolate,
+ int corners) {
+ this->topology->setStratification(false);
+ this->buildTopology(numSimplices, simplices, numVertices, interpolate, corners);
+ this->topology->stratify();
+ this->topology->setStratification(true);
+ this->createVertexBundle(numSimplices, simplices, 0, corners);
+ this->createSerialCoordinates(this->dim, numSimplices, coords);
+}
+
+#undef __FUNCT__
+#define __FUNCT__ "Mesh::populateBd"
+void
+ALE::PetscMesh::populateBd(int numSimplices,
+ int simplices[],
+ int numVertices,
+ double coords[],
+ bool interpolate,
+ int corners) {
+ this->topology->setStratification(false);
+ this->buildTopology(numSimplices, simplices, numVertices, interpolate, corners);
+ this->topology->stratify();
+ this->topology->setStratification(true);
+ this->createVertexBundle(numSimplices, simplices, 0, corners);
+ this->createSerialCoordinates(this->dim+1, numSimplices, coords);
+}
+
Added: short/3D/PyLith/trunk/playpen/meshio/src/PetscMesh.hh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/PetscMesh.hh 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/src/PetscMesh.hh 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,125 @@
+#ifndef included_ALE_Mesh_hh
+#define included_ALE_Mesh_hh
+
+#ifndef included_ALE_CoSifter_hh
+#include <CoSifter.hh>
+#endif
+#ifndef included_ALE_ParDelta_hh
+#include <ParDelta.hh>
+#endif
+#ifndef included_ALE_Partitioner_hh
+#include <Partitioner.hh>
+#endif
+
+#include <petscvec.h>
+
+namespace ALE {
+ class PetscMesh;
+} // namespace ALE
+
+class ALE::PetscMesh {
+public:
+ typedef ALE::Point point_type;
+ typedef std::vector<point_type> PointArray;
+ typedef ALE::Sieve<point_type,int,int> sieve_type;
+ typedef point_type patch_type;
+ typedef CoSifter<sieve_type, patch_type, point_type, int> bundle_type;
+ typedef CoSifter<sieve_type, patch_type, point_type, double> field_type;
+ typedef CoSifter<sieve_type, ALE::pair<patch_type,int>, point_type, double> foliation_type;
+ typedef std::map<std::string, Obj<field_type> > FieldContainer;
+ typedef std::map<int, Obj<bundle_type> > BundleContainer;
+ int debug;
+
+private:
+ Obj<sieve_type> topology;
+ Obj<field_type> coordinates;
+ Obj<field_type> boundary;
+ Obj<foliation_type> boundaries;
+ FieldContainer fields;
+ BundleContainer bundles;
+ MPI_Comm _comm;
+ int _commRank;
+ int _commSize;
+ int dim;
+
+ //FIX:
+public:
+ bool distributed;
+
+public:
+
+ PetscMesh(MPI_Comm comm,
+ int dimension,
+ int debug = 0);
+
+ MPI_Comm comm() const {return this->_comm;};
+ void setComm(MPI_Comm comm) {
+ this->_comm = comm;
+ MPI_Comm_rank(comm, &this->_commRank);
+ MPI_Comm_size(comm, &this->_commSize);
+ };
+ int commRank() const {return this->_commRank;};
+ int commSize() const {return this->_commSize;};
+ Obj<sieve_type> getTopology() const {return this->topology;};
+ void setTopology(const Obj<sieve_type>& topology) {this->topology = topology;};
+ int getDimension() const {return this->dim;};
+ void setDimension(int dim) {this->dim = dim;};
+ Obj<field_type> getCoordinates() const {return this->coordinates;};
+ void setCoordinates(const Obj<field_type>& coordinates) {this->coordinates = coordinates;};
+ Obj<field_type> getBoundary() const {return this->boundary;};
+ void setBoundary(const Obj<field_type>& boundary) {this->boundary = boundary;};
+ Obj<foliation_type> getBoundaries() const {return this->boundaries;};
+
+ Obj<bundle_type> getBundle(const int dim);
+
+ Obj<field_type> getField(const std::string& name);
+
+ bool hasField(const std::string& name);
+
+ Obj<std::set<std::string> > getFields();
+
+ void buildHexFaces(int dim,
+ std::map<int, int*> *curSimplex,
+ PointArray *boundary,
+ point_type& simplex);
+
+ void buildFaces(int dim,
+ std::map<int, int*> *curSimplex,
+ PointArray *boundary,
+ point_type& simplex);
+
+ void buildTopology(int numSimplices,
+ int simplices[],
+ int numVertices,
+ bool interpolate = true,
+ int corners = -1);
+
+ void createVertexBundle(int numSimplices,
+ int simplices[],
+ int elementOffset = 0,
+ int corners = -1);
+
+ void createSerialCoordinates(int embedDim,
+ int numSimplices,
+ double coords[]);
+
+ void createParallelVertexReorder(Obj<bundle_type> serialVertexBundle);
+
+ void populate(int numSimplices,
+ int simplices[],
+ int numVertices,
+ double coords[],
+ bool interpolate = true,
+ int corners = -1);
+
+ void populateBd(int numSimplices,
+ int simplices[],
+ int numVertices,
+ double coords[],
+ bool interpolate = true,
+ int corners = -1);
+
+
+}; // PetscMesh
+
+#endif
Added: short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "MeshIOAscii.hh"
+
+#include "petsc.h" // USES PetscInitialize(), PetscFinalize()
+#include "PetscMesh.hh" // USES PetscMesh
+
+#include <iostream> // USES std::cerr
+
+// ----------------------------------------------------------------------
+int
+main(int argc,
+ char** argv)
+{ // main
+ PetscErrorCode err;
+
+ PetscInitialize(&argc, &argv, 0, 0);
+
+ if (3 != argc) {
+ std::cerr << "usage: testascii MESHIN MESHOUT" << std::endl;
+ return -1;
+ } // if
+
+ ALE::Obj<ALE::PetscMesh> mesh;
+
+ MeshIOAscii iohandler;
+ iohandler.filename(argv[1]);
+ iohandler.read(&mesh);
+
+ iohandler.filename(argv[2]);
+ iohandler.write(mesh);
+
+ err = PetscFinalize(); CHKERRQ(err);
+
+ return err;
+} // main
+
+// version
+// $Id$
+
+// End of file
Added: short/3D/PyLith/trunk/playpen/meshio/test/.gdb_history
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/test/.gdb_history 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/test/.gdb_history 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,27 @@
+args=
+set args tri1.mesh tri1.out
+run
+stacktrace
+backtrace
+exit
+quite
+quit
+set args=tri1.mesh tri1.out
+run
+stop
+reset
+help
+help running
+kill
+set args tri1.mesh tri1.out
+run
+stacktrace
+basktrace
+backtrace
+kill
+quit
+set args tri1.mesh tri1.out
+run
+backtrace
+kill
+quit
Added: short/3D/PyLith/trunk/playpen/meshio/test/tri1.mesh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/test/tri1.mesh 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/test/tri1.mesh 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,35 @@
+mesh = {
+ dimension = 2
+ vertices = {
+ dimension = 2
+ count = 3
+ coordinates = {
+ -1.0 0.0
+ 0.0 0.0
+ 0.0 1.0
+ }
+ }
+ elements = {
+ num-corners = 3
+ count = 1
+ simplices = {
+ 0 1 2
+ }
+ }
+ chart = {
+ name = "one"
+ dimension = 2
+ count = 1
+ indices = {
+ 0
+ }
+ }
+ chart = {
+ name = "two"
+ dimension = 0
+ count = 2
+ indices = {
+ 0 3
+ }
+ }
+}
Added: short/3D/PyLith/trunk/playpen/meshio/test/tri2.mesh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/test/tri2.mesh 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/test/tri2.mesh 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,21 @@
+mesh = {
+ dimension = 2
+ vertices = {
+ dimension = 2
+ count = 4
+ coordinates = {
+ -1.0 0.0
+ 0.0 0.0
+ 1.0 0.0
+ 0.0 1.0
+ }
+ }
+ elements = {
+ num-corners = 3
+ count = 2
+ simplices = {
+ 0 1 3
+ 1 2 3
+ }
+ }
+}
Added: short/3D/PyLith/trunk/playpen/meshio/test/tri3.mesh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/test/tri3.mesh 2006-07-21 03:57:20 UTC (rev 4092)
+++ short/3D/PyLith/trunk/playpen/meshio/test/tri3.mesh 2006-07-21 15:48:29 UTC (rev 4093)
@@ -0,0 +1,23 @@
+mesh = {
+ dimension = 2
+ vertices = {
+ dimension = 2
+ count = 5
+ coordinates = {
+ -1.0 0.0
+ 0.0 0.0
+ 1.0 0.0
+ 0.0 1.0
+ 0.0 -1.0
+ }
+ }
+ elements = {
+ num-corners = 3
+ count = 3
+ simplices = {
+ 0 1 3
+ 1 2 3
+ 1 4 2
+ }
+ }
+}
More information about the cig-commits
mailing list