[cig-commits] r4538 - in short/3D/PyLith/trunk: . modulesrc
modulesrc/meshio playpen/meshio/src playpen/meshio/test
pylith pylith/feassemble pylith/materials pylith/meshio
pylith/problems pylith/solver pylith/topology pylith/utils
baagaard at geodynamics.org
baagaard at geodynamics.org
Thu Sep 14 15:37:28 PDT 2006
Author: baagaard
Date: 2006-09-14 15:37:27 -0700 (Thu, 14 Sep 2006)
New Revision: 4538
Added:
short/3D/PyLith/trunk/modulesrc/
short/3D/PyLith/trunk/modulesrc/Makefile.am
short/3D/PyLith/trunk/modulesrc/meshio/
short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am
short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe
short/3D/PyLith/trunk/pylith/meshio/
short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py
short/3D/PyLith/trunk/pylith/meshio/__init__.py
Removed:
short/3D/PyLith/trunk/pylith/feassemble/Makefile.am
short/3D/PyLith/trunk/pylith/materials/Makefile.am
short/3D/PyLith/trunk/pylith/problems/Makefile.am
short/3D/PyLith/trunk/pylith/solver/Makefile.am
short/3D/PyLith/trunk/pylith/topology/Makefile.am
short/3D/PyLith/trunk/pylith/utils/Makefile.am
Modified:
short/3D/PyLith/trunk/Makefile.am
short/3D/PyLith/trunk/configure.ac
short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.cc
short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.hh
short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.icc
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/testascii.cc
short/3D/PyLith/trunk/playpen/meshio/test/tri1.mesh
short/3D/PyLith/trunk/pylith/Makefile.am
Log:
Started work on Python interface for mesh I/O. Consolidated Python Makefiles into a single top-level Makefile in pylith.
Modified: short/3D/PyLith/trunk/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -14,7 +14,8 @@
SUBDIRS = \
pylith \
- libsrc
+ libsrc \
+ modulesrc
#modulesrc
Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/configure.ac 2006-09-14 22:37:27 UTC (rev 4538)
@@ -100,14 +100,10 @@
# ----------------------------------------------------------------------
AC_CONFIG_FILES([Makefile
pylith/Makefile
- pylith/feassemble/Makefile
- pylith/materials/Makefile
- pylith/problems/Makefile
- pylith/solver/Makefile
- pylith/topology/Makefile
- pylith/utils/Makefile
libsrc/Makefile
libsrc/materials/Makefile
+ modulesrc/Makefile
+ modulesrc/meshio/Makefile
doc/Makefile])
AC_OUTPUT
Added: short/3D/PyLith/trunk/modulesrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/modulesrc/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -0,0 +1,19 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+SUBDIRS = \
+ meshio
+
+# version
+# $Id$
+
+# End of file
Added: short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -0,0 +1,40 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = meshio
+include $(top_srcdir)/subpackage.am
+
+subpkgpyexec_LTLIBRARIES = meshiomodule.la
+
+meshiomodule_la_LDFLAGS = -module
+
+meshiomodule_la_SOURCES = meshio.pyxe
+
+nodist_meshiomodule_la_SOURCES = \
+ meshio.c meshio_embed.cpp meshio_embed.h
+
+meshiomodule_la_LIBADD = \
+ $(top_builddir)/libsrc/meshio/libpylithmeshio.la
+
+INCLUDES += -I$(PYTHON_INCDIR)
+
+meshio.pyx meshio_embed.cpp meshio_embed.h: meshio.pyxe
+ cp $< . && pyrexembed.py meshio.pyxe && rm -f meshio.pyxe
+meshio_embed.cpp: meshio_embed.h
+meshio_embed.h: meshio.pyx
+
+.pyx.c:
+ pyrexc $<
+
+CLEANFILES = meshio.pyx meshio.c *_embed.*
+
+# End of file
Added: short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe 2006-09-14 22:37:27 UTC (rev 4538)
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+#header{
+#include "pylith/meshio/MeshIO.hh"
+#include "pylith/meshio/MeshIOAscii.hh"
+#}header
+
+# ----------------------------------------------------------------------
+cdef extern from "Python.h":
+ object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
+ void* PyCObject_AsVoidPtr(object)
+
+cdef void* ptrFromHandle(obj):
+ """Extract pointer from PyCObject."""
+ return PyCObject_AsVoidPtr(obj.handle)
+
+cdef extern from "stdlib.h":
+ ctypedef unsigned long size_t
+ void* malloc(size_t size)
+ void free(void* mem)
+
+#embed{ void ALEMesh_destructor(void* pObj)
+ ALE::Obj<ALE::Mesh>* pMesh = (ALE::Obj<ALE::Mesh>*) pObj;
+ delete pMesh;
+#}embed
+
+# ----------------------------------------------------------------------
+cdef class MeshIO:
+
+ cdef void* thisptr # Pointer to C++ object
+ cdef readonly object handle # PyCObject holding pointer to C++ object
+ cdef readonly object name # Identifier for object base type
+
+ def __init__(self):
+ """
+ Constructor.
+ """
+ self.handle = None
+ self.thisptr = NULL
+ self.name = "pylith_meshio_MeshIO"
+ return
+
+
+ def read(self, interpolate):
+ """
+ Read mesh from file.
+
+ @param interpolate Flag indicating whether to build intermediate
+ topology elements.
+ """
+ # create shim for method 'read'
+ #embed{ void MeshIO_read(void* pObj, void** ppMeshObj, bool interpolate)
+ ALE::Obj<ALE::Mesh>* pMesh = new ALE::Obj<ALE::Mesh>;
+ ((pylith::meshio::MeshIO*) pObj)->read(*pMesh, interpolate);
+ *ppMeshObj = (void*) pMesh;
+ #}embed
+
+ cdef void* pMeshObj
+ pMeshObj = NULL
+ MeshIO_interpolate(self.thisptr, &pMeshObj, interpolate)
+ return PyCObject_FromVoidPtr(pMeshObj, ALEMesh_destructor)
+
+
+ def write(self, mesh):
+ """
+ Read write to file.
+ """
+ # create shim for method 'write'
+ #embed{ void MeshIO_write(void* pObj, void* pMeshObj)
+ ALE::Obj<ALE::Mesh>* pMesh = (ALE::Obj<ALE::Mesh>*) pMeshObj;
+ ((pylith::meshio::MeshIO*) pObj)->write(*pMesh);
+ #}embed
+ pMeshObj = <void*> PyCObject_AsVoidPtr(mesh)
+ MeshIO_write(self.thisptr, pMeshObj)
+ return
+
+
+ def _createHandle(self):
+ """Wrap pointer to C++ object in PyCObject."""
+ # create shim for destructor
+ #embed{ void MeshIO_destructor(void* pObj)
+ spatialdata::geocoords::MeshIO* pMesh =
+ (spatialdata::geocoords::MeshIO*) pObj;
+ delete pMesh;
+ #}embed
+ return PyCObject_FromVoidPtr(self.thisptr, MeshIO_destructor)
+
+
+# ----------------------------------------------------------------------
+cdef class MeshIOAscii(MeshIO):
+
+ def __init__(self):
+ """Constructor."""
+ # create shim for constructor
+ #embed{ void* MeshIOAscii_constructor()
+ return (void*)(new pylith::meshio::MeshIOAscii);
+ #}embed
+
+ MeshIO.__init__(self)
+ self.thisptr = MeshIOAscii_constructor()
+ self.handle = self._createHandle()
+ return
+
+
+# End of file
Modified: short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.cc 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.cc 2006-09-14 22:37:27 UTC (rev 4538)
@@ -14,14 +14,14 @@
// ----------------------------------------------------------------------
// Constructor
-pylith::meshIO::MeshIO::MeshIO(void) :
+pylith::meshio::MeshIO::MeshIO(void) :
_useIndexZero(true)
{ // constructor
} // constructor
// ----------------------------------------------------------------------
// Destructor
-pylith::meshIO::MeshIO::~MeshIO(void)
+pylith::meshio::MeshIO::~MeshIO(void)
{ // destructor
} // destructor
Modified: short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.hh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.hh 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.hh 2006-09-14 22:37:27 UTC (rev 4538)
@@ -16,12 +16,12 @@
#include <Mesh.hh> // PETSc Mesh
namespace pylith {
- namespace meshIO {
+ namespace meshio {
class MeshIO;
} // meshio
} // pylith
-class pylith::meshIO::MeshIO
+class pylith::meshio::MeshIO
{ // MeshIO
// PUBLIC MEMBERS ///////////////////////////////////////////////////////
Modified: short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.icc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.icc 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIO.icc 2006-09-14 22:37:27 UTC (rev 4538)
@@ -17,14 +17,14 @@
// Get flag indicating whether indices start at 0 (True) or 1 (False).
inline
bool
-pylith::meshIO::MeshIO::useIndexZero(void) const {
+pylith::meshio::MeshIO::useIndexZero(void) const {
return _useIndexZero;
}
// Set flag indicating whether indices start at 0 (True) or 1 (False).
inline
void
-pylith::meshIO::MeshIO::useIndexZero(const bool flag) {
+pylith::meshio::MeshIO::useIndexZero(const bool flag) {
_useIndexZero = flag;
}
Modified: short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc 2006-09-14 22:37:27 UTC (rev 4538)
@@ -21,21 +21,22 @@
// ----------------------------------------------------------------------
// Constructor
-pylith::meshIO::MeshIOAscii::MeshIOAscii(void) :
+pylith::meshio::MeshIOAscii::MeshIOAscii(void) :
_filename("")
{ // constructor
} // constructor
// ----------------------------------------------------------------------
// Destructor
-pylith::meshIO::MeshIOAscii::~MeshIOAscii(void)
+pylith::meshio::MeshIOAscii::~MeshIOAscii(void)
{ // destructor
} // destructor
// ----------------------------------------------------------------------
// Unpickle mesh
void
-pylith::meshIO::MeshIOAscii::read(Obj<Mesh>& mesh, const bool interpolate)
+pylith::meshio::MeshIOAscii::read(Obj<Mesh>& mesh,
+ const bool interpolate)
{ // read
int meshDim = 0;
int numDims = 0;
@@ -90,12 +91,12 @@
filein.ignore(maxIgnore, '{');
_readCells(filein, &cells, &numCells, &numCorners);
readCells = true;
- } else if (0 == strcasecmp(token.c_str(), "chart")) {
+ } else if (0 == strcasecmp(token.c_str(), "group")) {
if (!builtTopology)
throw std::runtime_error("Both 'vertices' and 'cells' must "
- "precede any charts in mesh file.");
+ "precede any groups in mesh file.");
filein.ignore(maxIgnore, '{');
- _readChart(filein, mesh);
+ _readGroup(filein, mesh);
} else {
std::ostringstream msg;
msg << "Could not parse '" << token << "' into a mesh setting.";
@@ -130,7 +131,7 @@
// ----------------------------------------------------------------------
// Write mesh to file.
void
-pylith::meshIO::MeshIOAscii::write(const Obj<Mesh>& mesh) const
+pylith::meshio::MeshIOAscii::write(const Obj<Mesh>& mesh) const
{ // write
std::ofstream fileout(_filename.c_str());
if (!fileout.is_open() || !fileout.good()) {
@@ -150,8 +151,8 @@
_writeVertices(fileout, mesh);
_writeCells(fileout, mesh);
- // LOOP OVER CHARTS
- // _writeChart(fileout, mesh, nameIter->c_str());
+ // LOOP OVER GROUPS
+ // _writeGroup(fileout, mesh, nameIter->c_str());
fileout << "}\n";
fileout.close();
@@ -160,7 +161,7 @@
// ----------------------------------------------------------------------
// Read mesh vertices.
void
-pylith::meshIO::MeshIOAscii::_readVertices(std::istream& filein,
+pylith::meshio::MeshIOAscii::_readVertices(std::istream& filein,
double** pCoordinates,
int* pNumVertices,
int* pNumDims) const
@@ -214,7 +215,7 @@
// ----------------------------------------------------------------------
// Write mesh vertices.
void
-pylith::meshIO::MeshIOAscii::_writeVertices(std::ostream& fileout,
+pylith::meshio::MeshIOAscii::_writeVertices(std::ostream& fileout,
const Obj<Mesh>& mesh) const
{ // _writeVertices
const Obj<Mesh::section_type>& coords_field = mesh->getSection("coordinates");
@@ -248,7 +249,7 @@
// ----------------------------------------------------------------------
// Read mesh cells.
void
-pylith::meshIO::MeshIOAscii::_readCells(std::istream& filein,
+pylith::meshio::MeshIOAscii::_readCells(std::istream& filein,
int** pCells,
int* pNumCells,
int* pNumCorners) const
@@ -310,7 +311,7 @@
// ----------------------------------------------------------------------
// Write mesh cells.
void
-pylith::meshIO::MeshIOAscii::_writeCells(std::ostream& fileout,
+pylith::meshio::MeshIOAscii::_writeCells(std::ostream& fileout,
const Obj<Mesh>& mesh) const
{ // _writeCells
const Obj<topology_type>& topology = mesh->getTopologyNew();
@@ -342,15 +343,15 @@
} // _writeCells
// ----------------------------------------------------------------------
-// Read mesh charts.
+// Read mesh group.
void
-pylith::meshIO::MeshIOAscii::_readChart(std::istream& filein,
+pylith::meshio::MeshIOAscii::_readGroup(std::istream& filein,
const Obj<Mesh>& mesh) 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
+{ // _readGroup
+ std::string name = ""; // Name of group
+ int dimension = 0; // Topology dimension associated with group
+ int count = 0; // Number of entities in group
+ int* indices = 0; // Indices of entities in group
std::string token;
const int maxIgnore = 1024;
@@ -380,17 +381,17 @@
filein.ignore(maxIgnore, '}');
} else {
std::ostringstream msg;
- msg << "Could not parse '" << token << "' into a chart setting.";
+ msg << "Could not parse '" << token << "' into a group 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.");
+ throw std::runtime_error("I/O error while parsing group settings.");
#if 0
assert(!mesh.isNull());
- Obj<Mesh::field_type> chartField = mesh->getField(name);
+ Obj<Mesh::field_type> groupField = mesh->getField(name);
const int meshDim = mesh->getDimension();
Obj<std::list<Mesh::point_type> > patchPoints =
std::list<Mesh::point_type>();
@@ -400,31 +401,31 @@
if (meshDim == dimension) {
for (int i=0; i < count; ++i)
patchPoints->push_back(Mesh::point_type(0, indices[i]));
- chartField->setPatch(patchPoints, patch);
+ groupField->setPatch(patchPoints, patch);
} else if (0 == dimension) {
} // if
- chartField->setFiberDimensionByHeight(patch, 0, 1);
- chartField->orderPatches();
+ groupField->setFiberDimensionByHeight(patch, 0, 1);
+ groupField->orderPatches();
const double zero = 0;
for (int i=0; i < count; ++i)
- chartField->update(patch, Mesh::point_type(0, i), &zero);
+ groupField->update(patch, Mesh::point_type(0, i), &zero);
#endif
-} // _readChart
+} // _readGroup
// ----------------------------------------------------------------------
-// Write mesh chart.
+// Write mesh group.
void
-pylith::meshIO::MeshIOAscii::_writeChart(std::ostream& fileout,
+pylith::meshio::MeshIOAscii::_writeGroup(std::ostream& fileout,
const Obj<Mesh>& mesh,
const char* name) const
-{ // _writeChart
- //_writeChart(fileout, mesh);
+{ // _writeGroup
+ //_writeGroup(fileout, mesh);
// ADD STUFF HERE
int count = 0; // TEMPORARY
int dimension = 0; // TEMPORARY
fileout
- << " chart = {\n"
+ << " group = {\n"
<< " name = " << name << "\n"
<< " dimension = " << dimension << "\n"
<< " count = " << count << "\n"
@@ -433,6 +434,6 @@
fileout
<< " }\n"
<< " }\n";
-} // _writeChart
+} // _writeGroup
// End of file
Modified: short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.hh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.hh 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.hh 2006-09-14 22:37:27 UTC (rev 4538)
@@ -20,12 +20,12 @@
using ALE::Obj;
namespace pylith {
- namespace meshIO {
+ namespace meshio {
class MeshIOAscii;
} // meshio
} // pylith
-class pylith::meshIO::MeshIOAscii : public pylith::meshIO::MeshIO
+class pylith::meshio::MeshIOAscii : public pylith::meshio::MeshIO
{ // MeshIOAscii
// PUBLIC TYPEDEFS -------------------------------------------------------
public :
@@ -56,8 +56,10 @@
/** Read mesh from file.
*
* @param pMesh Pointer to PETSc mesh object
+ * @param interpolate Flag indicating whether to build intermediate topology
*/
- void read(Obj<Mesh>& mesh, const bool interpolate = false);
+ void read(Obj<Mesh>& mesh,
+ const bool interpolate =false);
/** Write mesh to file.
*
@@ -96,9 +98,9 @@
* @param pNumCorners Pointer to number of corners in each element
*/
void _readCells(std::istream& filein,
- int** pCells,
- int* pNumCells,
- int* pNumCorners) const;
+ int** pCells,
+ int* pNumCells,
+ int* pNumCorners) const;
/** Write mesh cells.
*
@@ -106,23 +108,23 @@
* @param mesh PETSc mesh
*/
void _writeCells(std::ostream& fileout,
- const Obj<Mesh>& mesh) const;
+ const Obj<Mesh>& mesh) const;
- /** Read mesh chart.
+ /** Read mesh group.
*
* @param filein Output stream
* @param pMesh Pointer to PETSc mesh
*/
- void _readChart(std::istream& filein,
+ void _readGroup(std::istream& filein,
const Obj<Mesh>& pMesh) const;
- /** Write mesh chart.
+ /** Write mesh group.
*
* @param fileout Output stream
* @param mesh PETSc mesh
- * @param name Name of chart
+ * @param name Name of group
*/
- void _writeChart(std::ostream& fileout,
+ void _writeGroup(std::ostream& fileout,
const Obj<Mesh>& mesh,
const char* name) const;
Modified: short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.icc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.icc 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.icc 2006-09-14 22:37:27 UTC (rev 4538)
@@ -17,14 +17,14 @@
// Set filename for ASCII file.
inline
void
-pylith::meshIO::MeshIOAscii::filename(const char* name) {
+pylith::meshio::MeshIOAscii::filename(const char* name) {
_filename = name;
}
// Get filename of ASCII file.
inline
const char*
-pylith::meshIO::MeshIOAscii::filename(void) const {
+pylith::meshio::MeshIOAscii::filename(void) const {
return _filename.c_str();
}
Modified: short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc 2006-09-14 22:37:27 UTC (rev 4538)
@@ -32,16 +32,16 @@
try {
ALE::Obj<ALE::Mesh> mesh;
- pylith::meshIO::MeshIOAscii iohandler;
+ pylith::meshio::MeshIOAscii iohandler;
iohandler.filename(argv[1]);
iohandler.read(mesh);
iohandler.filename(argv[2]);
iohandler.write(mesh);
- } catch(ALE::Exception e) {
+ } catch(const ALE::Exception& err) {
int rank;
MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
- std::cout <<"["<<rank<<"]: " << e << std::endl;
+ std::cout << "[" << rank << "]: " << err << std::endl;
}
err = PetscFinalize(); CHKERRQ(err);
Modified: short/3D/PyLith/trunk/playpen/meshio/test/tri1.mesh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/test/tri1.mesh 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/playpen/meshio/test/tri1.mesh 2006-09-14 22:37:27 UTC (rev 4538)
@@ -16,7 +16,7 @@
0 1 2
}
}
- chart = {
+ group = {
name = "one"
dimension = 2
count = 1
@@ -24,7 +24,7 @@
0
}
}
- chart = {
+ group = {
name = "two"
dimension = 0
count = 2
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -10,17 +10,32 @@
# ----------------------------------------------------------------------
#
-SUBDIRS = \
- feassemble \
- materials \
- problems \
- solver \
- topology \
- utils
-
-pkgpyexec_PYTHON = \
+nobase_pkgpyexec_PYTHON = \
PyLithApp.py \
- __init__.py
+ __init__.py \
+ feassemble/__init__.py \
+ feassemble/Assembler.py \
+ feassemble/Field.py \
+ feassemble/Integrator.py \
+ feassemble/IntegratorElasticity.py \
+ materials/__init__.py \
+ materials/ElasticIsotropic3D.py \
+ materials/Homogeneous.py \
+ materials/Material.py \
+ materials/MaterialsBin.py \
+ problems/__init__.py \
+ problems/Dynamic.py \
+ problems/Problem.py \
+ problems/QuasiStatic.py \
+ solver/__init__.py \
+ solver/Solver.py \
+ solver/SolverTSE.py \
+ solver/SolverTSI.py \
+ topology/__init__.py \
+ topology/Mesh.py \
+ topology/MeshGenerator.py \
+ utils/__init__.py \
+ utils/importing.py
# version
# $Id$
Deleted: short/3D/PyLith/trunk/pylith/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/feassemble/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -1,26 +0,0 @@
-# -*- Makefile -*-
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-subpackage = feassemble
-include $(top_srcdir)/subpackage.am
-
-subpkgpyexec_PYTHON = \
- Assembler.py \
- Field.py \
- Integrator.py \
- IntegratorElasticity.py \
- __init__.py
-
-# version
-# $Id$
-
-# End of file
Deleted: short/3D/PyLith/trunk/pylith/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/materials/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -1,27 +0,0 @@
-# -*- Makefile -*-
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-subpackage = materials
-include $(top_srcdir)/subpackage.am
-
-subpkgpyexec_PYTHON = \
- ElasticIsotropic3D.py \
- Homogeneous.py \
- Material.py \
- MaterialModel.py \
- MaterialsBin.py \
- __init__.py
-
-# version
-# $Id$
-
-# End of file
Added: short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2006-09-14 22:37:27 UTC (rev 4538)
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pyre/meshio/MeshIO.py
+
+## @brief Python abstract base class for finite-element mesh I/O.
+
+import FIAT.shapes
+
+from pyre.components.Component import Component
+
+# MeshIO class
+class MeshIO(Component):
+ """
+ Python abstract base class for finite-element mesh I/O.
+ """
+
+ class Inventory(Component.Inventory):
+ """Python object for managing MeshIO facilities and properties."""
+
+ ## @class Inventory
+ ## Python object for managing Field facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b interpolate Build intermediate mesh topology elements
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ interpolate = pyre.inventory.bool("interpolate", default=False)
+ interpolate.meta['tip'] = "Build intermediate mesh topology elements"
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="meshio"):
+ """
+ Constructor.
+
+ @param name Component name
+ """
+ Component.__init__(self, name, facility="meshio")
+ self.cppHandle = None
+ return
+
+
+ def read(self):
+ """
+ Read finite-element mesh and store in Sieve mesh object.
+
+ @returns Sieve mesh object containing finite-element mesh
+ """
+ return self.cppHandle.read(self.interpolate)
+
+
+ def write(self, mesh):
+ """
+ Write finite-element mesh.stored in Sieve mesh object.
+
+ @param mesh Sieve mesh object containing finite-element mesh
+ """
+ self.cppHandle.write(mesh)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """Set members based using inventory."""
+ self.interpolate = self.inventory.interpolate
+ return
+
+# version
+__id__ = "$Id$"
+
+# End of file
Added: short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIOAscii.py 2006-09-14 22:37:27 UTC (rev 4538)
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pyre/meshio/MeshIOAscii.py
+
+## @brief Python object for reading/writing finite-element mesh from
+## simple ASCII file.
+
+import FIAT.shapes
+
+from pyre.components.Component import Component
+
+# MeshIO class
+class MeshIO(Component):
+ """
+ Python object for reading/writing finite-element mesh from simple
+ ASCII file.
+ """
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="meshio"):
+ """Constructor."""
+ Component.__init__(self, name, facility="meshio")
+ import pylith.meshio.meshio as bindings
+ self.cppHandler = bindings.MeshIOAscii()
+ return
+
+
+# version
+__id__ = "$Id$"
+
+# End of file
Added: short/3D/PyLith/trunk/pylith/meshio/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/__init__.py 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/meshio/__init__.py 2006-09-14 22:37:27 UTC (rev 4538)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/meshio___init__.py
+## @brief Python meshio PyLith module initialization
+
+all = ['MeshIO']
+
+# version
+__id__ = "$Id$"
+
+# End of file
Deleted: short/3D/PyLith/trunk/pylith/problems/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/problems/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -1,25 +0,0 @@
-# -*- Makefile -*-
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-subpackage = problems
-include $(top_srcdir)/subpackage.am
-
-subpkgpyexec_PYTHON = \
- Dynamic.py \
- Problem.py \
- QuasiStatic.py \
- __init__.py
-
-# version
-# $Id$
-
-# End of file
Deleted: short/3D/PyLith/trunk/pylith/solver/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/solver/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -1,25 +0,0 @@
-# -*- Makefile -*-
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-subpackage = solver
-include $(top_srcdir)/subpackage.am
-
-subpkgpyexec_PYTHON = \
- Solver.py \
- SolverTSE.py \
- SolverTSI.py \
- __init__.py
-
-# version
-# $Id$
-
-# End of file
Deleted: short/3D/PyLith/trunk/pylith/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/topology/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -1,24 +0,0 @@
-# -*- Makefile -*-
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-subpackage = topology
-include $(top_srcdir)/subpackage.am
-
-subpkgpyexec_PYTHON = \
- Mesh.py \
- MeshGenerator.py \
- __init__.py
-
-# version
-# $Id$
-
-# End of file
Deleted: short/3D/PyLith/trunk/pylith/utils/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/Makefile.am 2006-09-14 22:13:11 UTC (rev 4537)
+++ short/3D/PyLith/trunk/pylith/utils/Makefile.am 2006-09-14 22:37:27 UTC (rev 4538)
@@ -1,23 +0,0 @@
-# -*- Makefile -*-
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-subpackage = utils
-include $(top_srcdir)/subpackage.am
-
-subpkgpyexec_PYTHON = \
- importing.py \
- __init__.py
-
-# version
-# $Id$
-
-# End of file
More information about the cig-commits
mailing list