[cig-commits] r15349 - in short/3D/PyLith/trunk: . doc doc/developer doc/install doc/releasenotes examples examples/greensfns examples/greensfns/hex8 examples/greensfns/hex8/gfimpulses examples/greensfns/hex8/gfresponses libsrc/bc modulesrc modulesrc/faults modulesrc/feassemble modulesrc/meshio modulesrc/topology pylith/topology share templates tests/1d/line2 tests/1d/line3 tests/2d/quad4 tests/2d/tri3 unittests/libtests/bc unittests/libtests/feassemble unittests/libtests/materials unittests/libtests/meshio unittests/libtests/topology unittests/pytests/feassemble unittests/pytests/materials unittests/pytests/meshio unittests/pytests/topology
brad at geodynamics.org
brad at geodynamics.org
Fri Jun 19 09:59:09 PDT 2009
Author: brad
Date: 2009-06-19 09:59:05 -0700 (Fri, 19 Jun 2009)
New Revision: 15349
Added:
short/3D/PyLith/trunk/doc/developer/Makefile.am
short/3D/PyLith/trunk/doc/releasenotes/Makefile.am
short/3D/PyLith/trunk/examples/greensfns/Makefile.am
short/3D/PyLith/trunk/examples/greensfns/hex8/Makefile.am
short/3D/PyLith/trunk/examples/greensfns/hex8/gfimpulses/Makefile.am
short/3D/PyLith/trunk/examples/greensfns/hex8/gfresponses/Makefile.am
short/3D/PyLith/trunk/share/Makefile.am
Removed:
short/3D/PyLith/trunk/Make.mm
short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.cc
short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.hh
short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.icc
short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
short/3D/PyLith/trunk/modulesrc/solver/
short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
short/3D/PyLith/trunk/pylith/topology/FieldsManager.py
short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann_OLD.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann_OLD.hh
short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldUniform.cc
short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldUniform.hh
short/3D/PyLith/trunk/unittests/pytests/feassemble/testfeassemble.pyxe.src
Modified:
short/3D/PyLith/trunk/CHANGES
short/3D/PyLith/trunk/Makefile.am
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/configure.ac
short/3D/PyLith/trunk/doc/Makefile.am
short/3D/PyLith/trunk/doc/install/Makefile.am
short/3D/PyLith/trunk/examples/Makefile.am
short/3D/PyLith/trunk/modulesrc/feassemble/Makefile.am
short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am
short/3D/PyLith/trunk/templates/Makefile.am
short/3D/PyLith/trunk/tests/1d/line2/Makefile.am
short/3D/PyLith/trunk/tests/1d/line3/Makefile.am
short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am
short/3D/PyLith/trunk/tests/2d/tri3/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/meshio/Makefile.am
short/3D/PyLith/trunk/unittests/pytests/topology/Makefile.am
Log:
Cleaned up makefiles for source distribution.
Modified: short/3D/PyLith/trunk/CHANGES
===================================================================
--- short/3D/PyLith/trunk/CHANGES 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/CHANGES 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,3 +1,6 @@
+See the release notes in doc/releasenotes for a summary of the changes
+to PyLith from version to version.
+
See
http://www.geodynamics.org/wsvn/cig/short/3D/PyLith/?op=log&rev=0&sc=0&isdir=1
-for a list of changes to PyLith.
+for the complete log of changes made to PyLith.
Deleted: short/3D/PyLith/trunk/Make.mm
===================================================================
--- short/3D/PyLith/trunk/Make.mm 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/Make.mm 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,59 +0,0 @@
-# -*- Makefile -*-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# PyLith by Charles A. Williams
-# Copyright (c) 2003-2006 Rensselaer Polytechnic Institute
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-PROJECT = pylith
-PACKAGE = pylith
-
-RECURSE_DIRS = \
- pylith3d \
-
-# pylith2d \
-# pylithop \
-# pylithax \
-# pylithsph \
-
-#--------------------------------------------------------------------------
-#
-
-all:
- BLD_ACTION="all" $(MM) recurse
-
-PROJ_CLEAN =
-clean::
- BLD_ACTION="clean" $(MM) recurse
-
-tidy::
- BLD_ACTION="tidy" $(MM) recurse
-
-
-# version
-# $Id: Make.mm,v 1.1 2004/04/14 21:07:29 willic3 Exp $
-
-# Generated automatically by MakeMill on Tue Mar 2 16:26:04 2004
-
-# End of file
Modified: short/3D/PyLith/trunk/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -16,13 +16,15 @@
libsrc \
modulesrc \
pylith \
- applications
+ applications \
+ templates \
+ share
if ENABLE_TESTING
SUBDIRS += \
unittests
-# Can't run tests without being able to 'rename' PyLith app.
+# Full-scale tests in progress.
# tests
endif
@@ -33,6 +35,8 @@
endif
EXTRA_DIST = \
+ CHANGES \
+ DEPENDENCIES \
setup.py \
archimedes/__init__.py
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/TODO 2009-06-19 16:59:05 UTC (rev 15349)
@@ -2,29 +2,15 @@
CURRENT ISSUES/PRIORITIES
======================================================================
-CRITICAL
+BUGS
Distribution fails for cases when a processor doesn't have vertices
on a fault.
- Need power-law full-scale "test" to insure that the power-law and
- nonlinear solve give reasonable results.
-
- Run valgrind on the unit tests.
-
RELEASE
Release notes
- Check source distribution
- SWIG files included
- extensions stuff included
-
- Installation using source tarball should not require SWIG. Should
- include .i files in tarball for reference.
-
- Binaries (check)
-
BONUS
pylithinfo (Python application, send extra args to PyLith)
@@ -37,7 +23,7 @@
Charles
3-D Power-law rheology
- full-scale test (axial compression/extension?)
+ full-scale test
----------------------------------------------------------------------
POST RELEASE 1.4
Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/configure.ac 2009-06-19 16:59:05 UTC (rev 15349)
@@ -265,22 +265,19 @@
unittests/pytests/topology/data/Makefile
unittests/pytests/utils/Makefile
tests/Makefile
- tests/petsc/Makefile
tests/1d/Makefile
tests/1d/line2/Makefile
tests/1d/line3/Makefile
tests/2d/Makefile
tests/2d/tri3/Makefile
tests/2d/quad4/Makefile
- tests/3d/Makefile
- tests/3d/tet4/Makefile
- tests/3d/hex8/Makefile
doc/Makefile
+ doc/developer/Makefile
doc/install/Makefile
doc/refguide/Makefile
+ doc/releasenotes/Makefile
doc/userguide/Makefile
doc/presentations/Makefile
- doc/presentations/pylith1.0/Makefile
examples/Makefile
examples/3d/Makefile
examples/bar_shearwave/Makefile
@@ -295,11 +292,18 @@
examples/bar_shearwave/tet4/output/Makefile
examples/bar_shearwave/tri3/Makefile
examples/bar_shearwave/tri3/output/Makefile
+ examples/greensfns/Makefile
+ examples/greensfns/hex8/Makefile
+ examples/greensfns/hex8/gfimpulses/Makefile
+ examples/greensfns/hex8/gfresponses/Makefile
examples/twocells/twohex8/Makefile
examples/twocells/twoquad4/Makefile
examples/twocells/twotet4/Makefile
examples/twocells/twotet4-geoproj/Makefile
examples/twocells/twotri3/Makefile
+ templates/Makefile
+ templates/materials/Makefile
+ share/Makefile
])
AC_OUTPUT
Modified: short/3D/PyLith/trunk/doc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/doc/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/doc/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -11,8 +11,10 @@
#
SUBDIRS = \
+ developer \
install \
presentations \
+ releasenotes \
userguide \
refguide
Added: short/3D/PyLith/trunk/doc/developer/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/doc/developer/Makefile.am (rev 0)
+++ short/3D/PyLith/trunk/doc/developer/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -0,0 +1,19 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+EXTRA_DIST = \
+ general \
+ Sieve \
+ SWIG
+
+
+# End of file
Modified: short/3D/PyLith/trunk/doc/install/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/doc/install/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/doc/install/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -10,10 +10,14 @@
# ----------------------------------------------------------------------
#
-dist_noinst_DATA = \
+EXTRA_DIST = \
README \
Cluster_Rocks-4.3-AMD64.txt \
+ Cluster_Rocks-4.3-AMD64_bash.sh \
Linux_Fedora8-AMD64_Aagaard.txt \
- MacBookPro_Aagaard.txt
+ Linux_Fedora8-AMD64_Aagaard_bash.sh \
+ MacBookPro_Aagaard.txt \
+ MacBookPro_Aagaard_bash.sh
+
# End of file
Added: short/3D/PyLith/trunk/doc/releasenotes/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/doc/releasenotes/Makefile.am (rev 0)
+++ short/3D/PyLith/trunk/doc/releasenotes/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -0,0 +1,23 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+EXTRA_DIST = \
+ announce_v1.0.1.txt \
+ announce_v1.0.2.txt \
+ announce_v1.1.0.txt \
+ announce_v1.2.0.txt \
+ announce_v1.3.0.txt \
+ announce_v1.3.1.txt \
+ announce_v1.4.0.txt
+
+
+# End of file
Modified: short/3D/PyLith/trunk/examples/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/examples/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/examples/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -13,6 +13,8 @@
SUBDIRS = \
3d \
bar_shearwave \
+ greensfns \
twocells
+
# End of file
Added: short/3D/PyLith/trunk/examples/greensfns/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/Makefile.am (rev 0)
+++ short/3D/PyLith/trunk/examples/greensfns/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -0,0 +1,17 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+SUBDIRS = \
+ hex8
+
+
+# End of file
Added: short/3D/PyLith/trunk/examples/greensfns/hex8/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/Makefile.am (rev 0)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -0,0 +1,43 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+dist_noinst_DATA = \
+ README \
+ geometry.jou \
+ mesh_hex8_1000m.jou \
+ box_hex8_1000m.exo \
+ pylithapp.cfg \
+ gftest.cfg \
+ mat_elastic.spatialdb \
+ sliptime.spatialdb \
+ gfspatialdb/gfimpulse00.spatialdb \
+ gfspatialdb/gfimpulse01.spatialdb \
+ gfspatialdb/gfimpulse02.spatialdb \
+ gfspatialdb/gfimpulse03.spatialdb \
+ gfspatialdb/gfimpulse04.spatialdb \
+ gfspatialdb/gfimpulse05.spatialdb \
+ gfspatialdb/gfimpulse06.spatialdb \
+ gfspatialdb/gfimpulse07.spatialdb \
+ gfspatialdb/gfimpulse08.spatialdb \
+ gfspatialdb/gfimpulse09.spatialdb \
+ gfspatialdb/gfimpulse10.spatialdb \
+ gfspatialdb/gfimpulse11.spatialdb \
+ gfspatialdb/gfimpulse12.spatialdb \
+ gfspatialdb/gfimpulse13.spatialdb
+
+
+SUBDIRS = \
+ gfimpulses \
+ gfresponses
+
+
+# End of file
Added: short/3D/PyLith/trunk/examples/greensfns/hex8/gfimpulses/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/gfimpulses/Makefile.am (rev 0)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/gfimpulses/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -0,0 +1,14 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+
+# End of file
Added: short/3D/PyLith/trunk/examples/greensfns/hex8/gfresponses/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/examples/greensfns/hex8/gfresponses/Makefile.am (rev 0)
+++ short/3D/PyLith/trunk/examples/greensfns/hex8/gfresponses/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -0,0 +1,14 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+
+# End of file
Deleted: short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.cc 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.cc 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,376 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "Neumann.hh" // implementation of object methods
-
-#include "pylith/topology/Field.hh" // HOLDSA Field
-#include "pylith/feassemble/CellGeometry.hh" // USES CellGeometry
-
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SpatialDB
-#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
-#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
-
-#include <cstring> // USES memcpy()
-#include <strings.h> // USES strcasecmp()
-#include <cassert> // USES assert()
-#include <stdexcept> // USES std::runtime_error
-#include <sstream> // USES std::ostringstream
-
-//#define PRECOMPUTE_GEOMETRY
-
-// ----------------------------------------------------------------------
-typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
-typedef pylith::topology::SubMesh::RealSection SubRealSection;
-typedef pylith::topology::Mesh::RealSection RealSection;
-typedef pylith::topology::Mesh::RestrictVisitor RestrictVisitor;
-
-// ----------------------------------------------------------------------
-// Default constructor.
-pylith::bc::Neumann::Neumann(void) :
- _db(0)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor.
-pylith::bc::Neumann::~Neumann(void)
-{ // destructor
- deallocate();
-} // destructor
-
-// ----------------------------------------------------------------------
-// Deallocate PETSc and local data structures.
-void
-pylith::bc::Neumann::deallocate(void)
-{ // deallocate
- _db = 0; // :TODO: Use shared pointer
-} // deallocate
-
-// ----------------------------------------------------------------------
-// Initialize boundary condition. Determine orienation and compute traction
-// vector at integration points.
-void
-pylith::bc::Neumann::initialize(const topology::Mesh& mesh,
- const double upDir[3])
-{ // initialize
- assert(0 != _boundaryMesh);
- assert(0 != _quadrature);
- assert(0 != _db);
-
- double_array up(upDir, 3);
- const int numCorners = _quadrature->numBasis();
-
- assert(0 != _normalizer);
- const double lengthScale = _normalizer->lengthScale();
- const double pressureScale = _normalizer->pressureScale();
-
- // Get 'surface' cells (1 dimension lower than top-level cells)
- const ALE::Obj<SieveSubMesh>& subSieveMesh = _boundaryMesh->sieveMesh();
- assert(!subSieveMesh.isNull());
- const ALE::Obj<SieveSubMesh::label_sequence>& cells =
- subSieveMesh->heightStratum(1);
- assert(!cells.isNull());
- const SieveSubMesh::label_sequence::iterator cellsBegin = cells->begin();
- const SieveSubMesh::label_sequence::iterator cellsEnd = cells->end();
-
- // Create section for traction vector in global coordinates
- const feassemble::CellGeometry& cellGeometry = _quadrature->refGeometry();
- const int cellDim = _quadrature->cellDim() > 0 ? _quadrature->cellDim() : 1;
- const int numBasis = _quadrature->numBasis();
- const int numQuadPts = _quadrature->numQuadPts();
- const int spaceDim = cellGeometry.spaceDim();
- const int fiberDim = spaceDim * numQuadPts;
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("BoundaryConditions");
-
- delete _parameters;
- _parameters =
- new topology::Fields<topology::Field<topology::SubMesh> >(*_boundaryMesh);
- assert(0 != _parameters);
- _parameters->add("traction", "traction");
- topology::Field<topology::SubMesh>& traction = _parameters->get("traction");
- traction.newSection(cells, fiberDim);
- traction.allocate();
- traction.scale(pressureScale);
- traction.vectorFieldType(topology::FieldBase::VECTOR);
-
- logger.stagePop();
-
- // Containers for orientation information
- const int orientationSize = spaceDim * spaceDim;
- const int jacobianSize = spaceDim * cellDim;
- double_array jacobian(jacobianSize);
- double jacobianDet = 0;
- double_array orientation(orientationSize);
-
- // Set names based on dimension of problem.
- // 1-D problem = {'normal-traction'}
- // 2-D problem = {'shear-traction', 'normal-traction'}
- // 3-D problem = {'horiz-shear-traction', 'vert-shear-traction',
- // 'normal-traction'}
- _db->open();
- switch (spaceDim)
- { // switch
- case 1 : {
- const char* valueNames[] = {"normal-traction"};
- _db->queryVals(valueNames, 1);
- break;
- } // case 1
- case 2 : {
- const char* valueNames[] = {"shear-traction", "normal-traction"};
- _db->queryVals(valueNames, 2);
- break;
- } // case 2
- case 3 : {
- const char* valueNames[] = {"horiz-shear-traction",
- "vert-shear-traction",
- "normal-traction"};
- _db->queryVals(valueNames, 3);
- break;
- } // case 3
- default :
- std::cerr << "Bad spatial dimension '" << spaceDim << "'." << std::endl;
- assert(0);
- throw std::logic_error("Bad spatial dimension in Neumann.");
- } // switch
-
- // Containers for database query results and quadrature coordinates in
- // reference geometry.
- double_array tractionDataLocal(spaceDim);
- double_array quadPtRef(cellDim);
- double_array quadPtsGlobal(numQuadPts*spaceDim);
- const double_array& quadPtsRef = _quadrature->quadPtsRef();
-
- // Container for cell tractions rotated to global coordinates.
- double_array cellTractionsGlobal(fiberDim);
-
- // Get sections.
- double_array coordinatesCell(numCorners*spaceDim);
- const ALE::Obj<RealSection>& coordinates =
- subSieveMesh->getRealSection("coordinates");
- assert(!coordinates.isNull());
- topology::Mesh::RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(),
- &coordinatesCell[0]);
-
- const ALE::Obj<SubRealSection>& tractionSection =
- _parameters->get("traction").section();
- assert(!tractionSection.isNull());
-
- const spatialdata::geocoords::CoordSys* cs = _boundaryMesh->coordsys();
-
- // Compute quadrature information
- _quadrature->initializeGeometry();
-#if defined(PRECOMPUTE_GEOMETRY)
- _quadrature->computeGeometry(*_boundaryMesh, cells);
-#endif
-
- // Loop over cells in boundary mesh, compute orientations, and then
- // compute corresponding traction vector in global coordinates
- // (store values in _tractionGlobal).
- for(SieveSubMesh::label_sequence::iterator c_iter = cellsBegin;
- c_iter != cellsEnd;
- ++c_iter) {
- // Compute geometry information for current cell
-#if defined(PRECOMPUTE_GEOMETRY)
- _quadrature->retrieveGeometry(*c_iter);
-#else
- coordsVisitor.clear();
- subSieveMesh->restrictClosure(*c_iter, coordsVisitor);
- _quadrature->computeGeometry(coordinatesCell, *c_iter);
-#endif
- const double_array& quadPtsNondim = _quadrature->quadPts();
- quadPtsGlobal = quadPtsNondim;
- _normalizer->dimensionalize(&quadPtsGlobal[0], quadPtsGlobal.size(),
- lengthScale);
-
- cellTractionsGlobal = 0.0;
- for(int iQuad=0, iRef=0, iSpace=0; iQuad < numQuadPts;
- ++iQuad, iRef+=cellDim, iSpace+=spaceDim) {
- // Get traction vector in local coordinate system at quadrature point
- const int err = _db->query(&tractionDataLocal[0], spaceDim,
- &quadPtsGlobal[iSpace], spaceDim, cs);
- if (err) {
- std::ostringstream msg;
- msg << "Could not find traction values at (";
- for (int i=0; i < spaceDim; ++i)
- msg << " " << quadPtsGlobal[i+iSpace];
- msg << ") for traction boundary condition " << _label << "\n"
- << "using spatial database " << _db->label() << ".";
- throw std::runtime_error(msg.str());
- } // if
- _normalizer->nondimensionalize(&tractionDataLocal[0], spaceDim,
- pressureScale);
-
- // Compute Jacobian and determinant at quadrature point, then get
- // orientation.
- memcpy(&quadPtRef[0], &quadPtsRef[iRef], cellDim*sizeof(double));
-#if defined(PRECOMPUTE_GEOMETRY)
- coordsVisitor.clear();
- subSieveMesh->restrictClosure(*c_iter, coordsVisitor);
-#endif
- cellGeometry.jacobian(&jacobian, &jacobianDet,
- coordinatesCell, quadPtRef);
- cellGeometry.orientation(&orientation, jacobian, jacobianDet, up);
- assert(jacobianDet > 0.0);
- orientation /= jacobianDet;
-
- // Rotate traction vector from local coordinate system to global
- // coordinate system
- for(int iDim = 0; iDim < spaceDim; ++iDim) {
- for(int jDim = 0; jDim < spaceDim; ++jDim)
- cellTractionsGlobal[iDim+iSpace] +=
- orientation[jDim*spaceDim+iDim] * tractionDataLocal[jDim];
- } // for
- } // for
-
- // Update tractionsGlobal
- tractionSection->updatePoint(*c_iter, &cellTractionsGlobal[0]);
- } // for
-
- _db->close();
-} // initialize
-
-// ----------------------------------------------------------------------
-// Integrate contributions to residual term (r) for operator.
-void
-pylith::bc::Neumann::integrateResidual(
- const topology::Field<topology::Mesh>& residual,
- const double t,
- topology::SolutionFields* const fields)
-{ // integrateResidual
- assert(0 != _quadrature);
- assert(0 != _boundaryMesh);
- assert(0 != _parameters);
-
- // Get cell geometry information that doesn't depend on cell
- const int numQuadPts = _quadrature->numQuadPts();
- const double_array& quadWts = _quadrature->quadWts();
- assert(quadWts.size() == numQuadPts);
- const int numBasis = _quadrature->numBasis();
- const int spaceDim = _quadrature->spaceDim();
-
- // Allocate vectors for cell values.
- _initCellVector();
- double_array tractionsCell(numQuadPts*spaceDim);
-
- // Get cell information
- const ALE::Obj<SieveSubMesh>& subSieveMesh = _boundaryMesh->sieveMesh();
- assert(!subSieveMesh.isNull());
- const ALE::Obj<SieveSubMesh::label_sequence>& cells =
- subSieveMesh->heightStratum(1);
- assert(!cells.isNull());
- const SieveSubMesh::label_sequence::iterator cellsEnd = cells->end();
-
- // Get sections
- const ALE::Obj<SubRealSection>& tractionSection =
- _parameters->get("traction").section();
- assert(!tractionSection.isNull());
- const ALE::Obj<RealSection>& residualSection = residual.section();
- topology::SubMesh::UpdateAddVisitor residualVisitor(*residualSection,
- &_cellVector[0]);
-
-#if !defined(PRECOMPUTE_GEOMETRY)
- double_array coordinatesCell(numBasis*spaceDim);
- const ALE::Obj<RealSection>& coordinates =
- subSieveMesh->getRealSection("coordinates");
- RestrictVisitor coordsVisitor(*coordinates,
- coordinatesCell.size(), &coordinatesCell[0]);
-#endif
-
- // Loop over faces and integrate contribution from each face
- for (SieveSubMesh::label_sequence::iterator c_iter=cells->begin();
- c_iter != cellsEnd;
- ++c_iter) {
-#if defined(PRECOMPUTE_GEOMETRY)
- _quadrature->retrieveGeometry(*c_iter);
-#else
- coordsVisitor.clear();
- subSieveMesh->restrictClosure(*c_iter, coordsVisitor);
- _quadrature->computeGeometry(coordinatesCell, *c_iter);
-#endif
-
- // Reset element vector to zero
- _resetCellVector();
-
- // Restrict tractions to cell
- tractionSection->restrictPoint(*c_iter,
- &tractionsCell[0], tractionsCell.size());
-
- // Get cell geometry information that depends on cell
- const double_array& basis = _quadrature->basis();
- const double_array& jacobianDet = _quadrature->jacobianDet();
-
- // Compute action for traction bc terms
- for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
- const double wt = quadWts[iQuad] * jacobianDet[iQuad];
- for (int iBasis=0; iBasis < numBasis; ++iBasis) {
- const double valI = wt*basis[iQuad*numBasis+iBasis];
- for (int jBasis=0; jBasis < numBasis; ++jBasis) {
- const double valIJ = valI * basis[iQuad*numBasis+jBasis];
- for (int iDim=0; iDim < spaceDim; ++iDim)
- _cellVector[iBasis*spaceDim+iDim] +=
- tractionsCell[iQuad*spaceDim+iDim] * valIJ;
- } // for
- } // for
- } // for
- // Assemble cell contribution into field
- residualVisitor.clear();
- subSieveMesh->updateAdd(*c_iter, residualVisitor);
-
- PetscLogFlops(numQuadPts*(1+numBasis*(1+numBasis*(1+2*spaceDim))));
- } // for
-} // integrateResidual
-
-// ----------------------------------------------------------------------
-// Integrate contributions to Jacobian matrix (A) associated with
-void
-pylith::bc::Neumann::integrateJacobian(topology::Jacobian* jacobian,
- const double t,
- topology::SolutionFields* const fields)
-{ // integrateJacobian
- _needNewJacobian = false;
-} // integrateJacobian
-
-// ----------------------------------------------------------------------
-// Verify configuration is acceptable.
-void
-pylith::bc::Neumann::verifyConfiguration(const topology::Mesh& mesh) const
-{ // verifyConfiguration
- BCIntegratorSubMesh::verifyConfiguration(mesh);
-} // verifyConfiguration
-
-// ----------------------------------------------------------------------
-// Get cell field for tractions.
-const pylith::topology::Field<pylith::topology::SubMesh>&
-pylith::bc::Neumann::cellField(const char* name,
- topology::SolutionFields* const fields)
-{ // cellField
- assert(0 != _parameters);
- assert(0 != name);
-
- if (0 == strcasecmp(name, "tractions")) {
- return _parameters->get("traction");
- } else {
- std::ostringstream msg;
- msg << "Unknown field '" << name << "' requested for Neumann BC '"
- << _label << "'.";
- throw std::runtime_error(msg.str());
- } // else
-
- return _parameters->get("traction"); // Satisfy method definition
-} // cellField
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.hh 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.hh 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,115 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/** @file libsrc/bc/Neumann.hh
- *
- * @brief C++ implementation of Neumann (prescribed tractions
- * on a surface) boundary conditions.
- */
-
-#if !defined(pylith_bc_neumann_hh)
-#define pylith_bc_neumann_hh
-
-// Include directives ---------------------------------------------------
-#include "BCIntegratorSubMesh.hh" // ISA BCIntegratorSubMesh
-
-// Neumann --------------------------------------------------------------
-class pylith::bc::Neumann : public BCIntegratorSubMesh
-{ // class Neumann
- friend class TestNeumann; // unit testing
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Default constructor.
- Neumann(void);
-
- /// Destructor.
- ~Neumann(void);
-
- /// Deallocate PETSc and local data structures.
- void deallocate(void);
-
- /** Set database for boundary condition parameters.
- *
- * @param db Spatial database
- */
- void db(spatialdata::spatialdb::SpatialDB* const db);
-
- /** Initialize boundary condition.
- *
- * @param mesh Finite-element mesh.
- * @param upDir Direction perpendicular to horizontal surface tangent
- * direction that is not collinear with surface normal.
- */
- void initialize(const topology::Mesh& mesh,
- const double upDir[3]);
-
- /** Integrate contributions to residual term (r) for operator.
- *
- * @param residual Field containing values for residual.
- * @param t Current time.
- * @param fields Solution fields.
- */
- void integrateResidual(const topology::Field<topology::Mesh>& residual,
- const double t,
- topology::SolutionFields* const fields);
-
- /** Integrate contributions to Jacobian matrix (A) associated with
- * operator.
- *
- * @param jacobian Sparse matrix for Jacobian of system.
- * @param t Current time
- * @param fields Solution fields
- */
- void integrateJacobian(topology::Jacobian* jacobian,
- const double t,
- topology::SolutionFields* const fields);
-
- /** Verify configuration is acceptable.
- *
- * @param mesh Finite-element mesh
- */
- void verifyConfiguration(const topology::Mesh& mesh) const;
-
- /** Get cell field with BC information.
- *
- * @param fieldType Type of field.
- * @param name Name of field.
- * @param mesh Finite-element mesh.
- * @param fields Solution fields.
- *
- * @returns Traction vector at integration points.
- */
- const topology::Field<topology::SubMesh>&
- cellField(const char* name,
- topology::SolutionFields* const fields =0);
-
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-private :
-
- spatialdata::spatialdb::SpatialDB* _db; ///< Spatial database w/parameters
-
- // NOT IMPLEMENTED ////////////////////////////////////////////////////
-private :
-
- Neumann(const Neumann&); ///< Not implemented
- const Neumann& operator=(const Neumann&); ///< Not implemented
-
-}; // class Neumann
-
-#include "Neumann.icc" // inline methods
-
-#endif // pylith_bc_neumann_hh
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.icc 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/libsrc/bc/Neumann_OLD.icc 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,25 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#if !defined(pylith_bc_neumann_hh)
-#error "Neumann.icc can only be included from Neumann.hh"
-#endif
-
-// Set database for boundary condition parameters.
-inline
-void
-pylith::bc::Neumann::db(spatialdata::spatialdb::SpatialDB* const db) {
- _db = db;
-}
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,1530 +0,0 @@
-# -*- Pyrex -*-
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-#header{
-#include "pylith/faults/Fault.hh"
-#include "pylith/faults/FaultCohesive.hh"
-#include "pylith/faults/FaultCohesiveKin.hh"
-#include "pylith/faults/EqKinSrc.hh"
-#include "pylith/faults/SlipTimeFn.hh"
-#include "pylith/faults/BruneSlipFn.hh"
-#include "pylith/faults/LiuCosSlipFn.hh"
-#include "pylith/faults/ConstRateSlipFn.hh"
-#include "pylith/faults/StepSlipFn.hh"
-
-#include "pylith/utils/array.hh"
-
-#include <assert.h>
-#include <stdexcept>
-#include <Python.h>
-#}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)
- void strcpy(char*, char*)
-
-# ----------------------------------------------------------------------
-cdef void Fault_destructor(void* obj):
- """
- Destroy Fault object.
- """
- # create shim for destructor
- #embed{ void Fault_destructor_cpp(void* objVptr)
- pylith::faults::Fault* pM = (pylith::faults::Fault*) objVptr;
- delete pM;
- #}embed
- Fault_destructor_cpp(obj)
- return
-
-cdef class Fault:
-
- 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_faults_Fault"
- return
-
-
- def adjustTopology(self, mesh):
- """
- Adjust mesh topology for fault implementation.
- """
- # create shim for method 'adjustTopology'
- #embed{ void Fault_adjustTopology(void* objVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- ((pylith::faults::Fault*) objVptr)->adjustTopology(*mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- Fault_adjustTopology(self.thisptr, ptrFromHandle(mesh))
- return
-
-
- def initialize(self, mesh, cs, upDir, normalDir, matDB):
- """
- Initialize fault.
- """
- # create shim for method 'initialize'
- #embed{ void Fault_initialize(void* objVptr, void* meshVptr, void* csVptr, double* upDirPtr, double* normalDirPtr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != meshVptr);
- assert(0 != csVptr);
- assert(0 != dbVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- spatialdata::geocoords::CoordSys* cs =
- (spatialdata::geocoords::CoordSys*) csVptr;
- spatialdata::spatialdb::SpatialDB* matDB =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- pylith::double_array upDir(3);
- upDir[0] = upDirPtr[0];
- upDir[1] = upDirPtr[1];
- upDir[2] = upDirPtr[2];
- pylith::double_array normalDir(3);
- normalDir[0] = normalDirPtr[0];
- normalDir[1] = normalDirPtr[1];
- normalDir[2] = normalDirPtr[2];
- ((pylith::faults::Fault*) objVptr)->initialize(*mesh, cs, upDir, normalDir, matDB);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
-
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type " \
- "'pylith::topology::Mesh'."
- if not cs.name == "spatialdata_geocoords_CoordSys":
- raise TypeError, \
- "Argument 'cs' must be extension module type " \
- "'spatialdata::geocoords::CoordSys'."
- if 3 != len(upDir):
- raise TypeError, \
- "Argument 'upDir' must be a 3 vector (list)."
- if 3 != len(normalDir):
- raise TypeError, \
- "Argument 'normalDir' must be a 3 vector (list)."
- if not matDB.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument 'matDB' must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- cdef double upDirCpp[3]
- upDirCpp[0] = upDir[0]
- upDirCpp[1] = upDir[1]
- upDirCpp[2] = upDir[2]
- cdef double normalDirCpp[3]
- normalDirCpp[0] = normalDir[0]
- normalDirCpp[1] = normalDir[1]
- normalDirCpp[2] = normalDir[2]
- Fault_initialize(self.thisptr, ptrFromHandle(mesh), ptrFromHandle(cs),
- upDirCpp, normalDirCpp, ptrFromHandle(matDB))
- return
-
-
- def faultMesh(self, mesh):
- """
- Get mesh associated with fault fields.
- """
- # create shim for method 'faultMesh'
- #embed{ void Fault_faultMesh(void* objVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != meshVptr);
- ALE::Obj<pylith::SubMesh>* mesh = (ALE::Obj<pylith::SubMesh>*) meshVptr;
- *mesh = ((pylith::faults::Fault*) objVptr)->faultMesh();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
-
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type " \
- "'pylith::topology::Mesh'."
- Fault_faultMesh(self.thisptr, ptrFromHandle(mesh))
- return
-
-
- def vertexField(self, name, mesh, fields=None):
- """
- Get vertex field.
- """
- # create shim for method 'vertexField'
- #embed{ void* Fault_vertexField(void* objVptr, int* fieldPtr, char* name, void* meshVptr, void* fieldsVptr)
- void* result = 0;
- try {
- assert(0 != objVptr);
- assert(0 != fieldPtr);
- assert(0 != name);
- assert(0 != meshVptr);
- pylith::faults::Fault* fault = (pylith::faults::Fault*) objVptr;
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- pylith::topology::FieldsManager* fields =
- (pylith::topology::FieldsManager*) fieldsVptr;
- pylith::VectorFieldEnum fieldType;
- const ALE::Obj<pylith::real_section_type>& field =
- fault->vertexField(&fieldType, name, *mesh, fields);
- *fieldPtr = fieldType;
- result = (void*) &field;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type " \
- "'pylith::topology::Mesh'."
- if None != fields:
- if not fields.name == "pylith_topology_FieldsManager":
- raise TypeError, \
- "Argument 'fields' must be extension module type " \
- "'pylith::topology::FieldsManager'."
- cdef void* ptr
- cdef int fieldType
- fieldType = 3
- if None != fields:
- ptr = Fault_vertexField(self.thisptr, &fieldType, name,
- ptrFromHandle(mesh), ptrFromHandle(fields))
- else:
- ptr = Fault_vertexField(self.thisptr, &fieldType, name,
- ptrFromHandle(mesh), NULL)
- return (PyCObject_FromVoidPtr(ptr, NULL), fieldType)
-
-
- def cellField(self, name, mesh, fields=None):
- """
- Get cell field.
- """
- # create shim for method 'cellField'
- #embed{ void* Fault_cellField(void* objVptr, int* fieldPtr, char* name, void* meshVptr, void* fieldsVptr)
- void* result = 0;
- try {
- assert(0 != objVptr);
- assert(0 != fieldPtr);
- assert(0 != name);
- assert(0 != meshVptr);
- pylith::faults::Fault* fault = (pylith::faults::Fault*) objVptr;
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- pylith::topology::FieldsManager* fields =
- (pylith::topology::FieldsManager*) fieldsVptr;
- pylith::VectorFieldEnum fieldType;
- const ALE::Obj<pylith::real_section_type>& field =
- fault->cellField(&fieldType, name, *mesh, fields);
- *fieldPtr = fieldType;
- result = (void*) &field;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type " \
- "'pylith::topology::Mesh'."
- if None != fields:
- if not fields.name == "pylith_topology_FieldsManager":
- raise TypeError, \
- "Argument 'fields' must be extension module type " \
- "'pylith::topology::FieldsManager'."
- cdef void* ptr
- cdef int fieldType
- if None != fields:
- ptr = Fault_cellField(self.thisptr, &fieldType, name,
- ptrFromHandle(mesh), ptrFromHandle(fields))
- else:
- ptr = Fault_cellField(self.thisptr, &fieldType, name,
- ptrFromHandle(mesh), NULL)
- return (PyCObject_FromVoidPtr(ptr, NULL), fieldType)
-
-
- def _createHandle(self):
- """
- Wrap pointer to C++ object in PyCObject.
- """
- return PyCObject_FromVoidPtr(self.thisptr, Fault_destructor)
-
-
- property id:
- def __set__(self, value):
- """
- Set identifier of material.
- """
- # create shim for method 'id'
- #embed{ void Fault_id_set(void* objVptr, int value)
- try {
- assert(0 != objVptr);
- ((pylith::faults::Fault*) objVptr)->id(value);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- Fault_id_set(self.thisptr, value)
-
- def __get__(self):
- """
- Get identifier of material.
- """
- # create shim for method 'id'
- #embed{ int Fault_id_get(void* objVptr)
- int result = 0;
- try {
- assert(0 != objVptr);
- result = ((pylith::faults::Fault*) objVptr)->id();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return Fault_id_get(self.thisptr)
-
-
- property label:
- def __set__(self, value):
- """
- Set label of material.
- """
- # create shim for method 'label'
- #embed{ void Fault_label_set(void* objVptr, char* value)
- try {
- assert(0 != objVptr);
- ((pylith::faults::Fault*) objVptr)->label(value);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- Fault_label_set(self.thisptr, value)
-
-
-# ----------------------------------------------------------------------
-cdef class FaultCohesive(Fault):
-
- def __init__(self):
- """
- Constructor.
- """
- Fault.__init__(self)
- return
-
- property useFaultMesh:
- def __set__(self, flag):
- """
- Set use fault mesh flag.
- """
- # create shim for method 'useFaultMesh'
- #embed{ void FaultCohesiveKin_useFaultMesh_set(void* objVptr, int flag)
- try {
- assert(0 != objVptr);
- ((pylith::faults::FaultCohesiveKin*) objVptr)->useFaultMesh(flag);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FaultCohesiveKin_useFaultMesh_set(self.thisptr, flag)
-
-
- property faultMeshFilename: # TEMPORARY
- def __set__(self, filename):
- """
- Set filename for fault mesh UCD file.
- """
- # create shim for method 'faultMeshFilename'
- #embed{ void FaultCohesiveKin_faultMeshFilename_set(void* objVptr, char* filename)
- try {
- assert(0 != objVptr);
- ((pylith::faults::FaultCohesiveKin*) objVptr)->faultMeshFilename(filename);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FaultCohesiveKin_faultMeshFilename_set(self.thisptr, filename)
-
-
-# ----------------------------------------------------------------------
-cdef class FaultCohesiveKin(FaultCohesive):
-
- def __init__(self):
- """
- Constructor.
- """
- # create shim for constructor
- #embed{ void* FaultCohesiveKin_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::faults::FaultCohesiveKin);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- FaultCohesive.__init__(self)
- self.thisptr = FaultCohesiveKin_constructor()
- self.handle = self._createHandle()
- return
-
-
- def integrateResidual(self, residual, t, fields, mesh, cs):
- """
- Integrate contributions to residual term (r) for operator.
- """
- # create shim for method 'integrateResidual'
- #embed{ void FaultCohesiveKin_integrateResidual(void* objVptr, void* residualVptr, double t, void* fieldsVptr, void* meshVptr, void* csVptr)
- try {
- assert(0 != objVptr);
- assert(0 != residualVptr);
- assert(0 != fieldsVptr);
- assert(0 != meshVptr);
- assert(0 != csVptr);
- ALE::Obj<pylith::Mesh>* mesh =
- (ALE::Obj<pylith::Mesh>*) meshVptr;
- ALE::Obj<pylith::real_section_type>* residual =
- (ALE::Obj<pylith::real_section_type>*) residualVptr;
- pylith::topology::FieldsManager* fields =
- (pylith::topology::FieldsManager*) fieldsVptr;
- spatialdata::geocoords::CoordSys* cs =
- (spatialdata::geocoords::CoordSys*) csVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->integrateResidual(*residual,
- t, fields, *mesh, cs);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- FaultCohesiveKin_integrateResidual(self.thisptr,
- PyCObject_AsVoidPtr(residual),
- t,
- ptrFromHandle(fields),
- ptrFromHandle(mesh),
- ptrFromHandle(cs))
- return
-
-
- def integrateJacobian(self, mat, t, fields, mesh):
- """
- Compute contributions to Jacobian matrix (A) associated with operator.
- """
- # create shim for method 'integrateJacobian'
- #embed{ void FaultCohesiveKin_integrateJacobian(void* objVptr, void* matVptr, double t, void* fieldsVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != matVptr);
- assert(0 != fieldsVptr);
- assert(0 != meshVptr);
- ALE::Obj<pylith::Mesh>* mesh =
- (ALE::Obj<pylith::Mesh>*) meshVptr;
- PetscMat* mat = (PetscMat*) matVptr;
- pylith::topology::FieldsManager* fields =
- (pylith::topology::FieldsManager*) fieldsVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->integrateJacobianAssembled(
- mat, t, fields, *mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type 'Mesh'."
- FaultCohesiveKin_integrateJacobian(self.thisptr,
- PyCObject_AsVoidPtr(mat),
- t,
- ptrFromHandle(fields),
- ptrFromHandle(mesh))
- return
-
-
- def integrateResidualAssembled(self, residual, t, fields, mesh, cs):
- """
- Integrate contributions to residual term (r) for operator that do
- not require assembly over cells, vertices, or processors.
- """
- # create shim for method 'integrateResidualAssembled'
- #embed{ void FaultCohesiveKin_integrateResidualAssembled(void* objVptr, void* residualVptr, double t, void* fieldsVptr, void* meshVptr, void* csVptr)
- try {
- assert(0 != objVptr);
- assert(0 != residualVptr);
- assert(0 != fieldsVptr);
- assert(0 != meshVptr);
- assert(0 != csVptr);
- ALE::Obj<pylith::Mesh>* mesh =
- (ALE::Obj<pylith::Mesh>*) meshVptr;
- ALE::Obj<pylith::real_section_type>* residual =
- (ALE::Obj<pylith::real_section_type>*) residualVptr;
- pylith::topology::FieldsManager* fields =
- (pylith::topology::FieldsManager*) fieldsVptr;
- spatialdata::geocoords::CoordSys* cs =
- (spatialdata::geocoords::CoordSys*) csVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->integrateResidualAssembled(*residual,
- t, fields, *mesh, cs);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- FaultCohesiveKin_integrateResidualAssembled(self.thisptr,
- PyCObject_AsVoidPtr(residual),
- t,
- ptrFromHandle(fields),
- ptrFromHandle(mesh),
- ptrFromHandle(cs))
- return
-
-
- def integrateJacobianAssembled(self, mat, t, fields, mesh):
- """
- Compute contributions to Jacobian matrix (A) associated with
- operator that do not require assembly over cells, vertices, or
- processors.
- """
- # create shim for method 'integrateJacobianAssembled'
- #embed{ void FaultCohesiveKin_integrateJacobianAssembled(void* objVptr, void* matVptr, double t, void* fieldsVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != matVptr);
- assert(0 != fieldsVptr);
- assert(0 != meshVptr);
- ALE::Obj<pylith::Mesh>* mesh =
- (ALE::Obj<pylith::Mesh>*) meshVptr;
- PetscMat* mat = (PetscMat*) matVptr;
- pylith::topology::FieldsManager* fields =
- (pylith::topology::FieldsManager*) fieldsVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->integrateJacobianAssembled(
- mat, t, fields, *mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type 'Mesh'."
- FaultCohesiveKin_integrateJacobianAssembled(self.thisptr,
- PyCObject_AsVoidPtr(mat),
- t,
- ptrFromHandle(fields),
- ptrFromHandle(mesh))
- return
-
-
- def updateState(self, t, fields, mesh):
- """
- Update state variables as needed.
- """
- # create shim for method 'updateState'
- #embed{ void FaultCohesiveKin_updateState(void* objVptr, double t, void* fieldsVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != fieldsVptr);
- assert(0 != meshVptr);
- pylith::topology::FieldsManager* fields =
- (pylith::topology::FieldsManager*) fieldsVptr;
- ALE::Obj<pylith::Mesh>* mesh =
- (ALE::Obj<pylith::Mesh>*) meshVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->updateState(t, fields, *mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if fields.name != "pylith_topology_FieldsManager":
- raise TypeError, \
- "Argument 'fields' must be extension module type 'FieldsManager'."
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type 'Mesh'."
- FaultCohesiveKin_updateState(self.thisptr,
- t,
- ptrFromHandle(fields),
- ptrFromHandle(mesh))
- return
-
-
- def verifyConfiguration(self, mesh):
- """
- Verify compatibility of configuration settings.
- """
- # create shim for method 'verifyConfiguration'
- #embed{ void FaultCohesiveKin_verifyConfiguration(void* objVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != meshVptr);
- ALE::Obj<pylith::Mesh>* mesh =
- (ALE::Obj<pylith::Mesh>*) meshVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->verifyConfiguration(*mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type 'Mesh'."
- FaultCohesiveKin_verifyConfiguration(self.thisptr,
- ptrFromHandle(mesh))
- return
-
-
- def eqsrcs(self, names, srcs):
- """
- Set earthquake sources.
- """
- # create shim for method 'eqsrc'
- #embed{ void FaultCohesiveKin_eqsrcs_set(void* objVptr, char** names, void** srcsVptr, int nsrcs)
- try {
- assert(0 != objVptr);
- pylith::faults::EqKinSrc** eqsrcs =
- (pylith::faults::EqKinSrc**) srcsVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->eqsrcs(
- const_cast<const char**>(names), eqsrcs, nsrcs);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- cdef char** namesArray
- cdef void** srcsArray
- namesArray = NULL
- srcsArray = NULL
- nsrcs = len(srcs)
- if len(names) != nsrcs:
- raise ValueError("Lengths of arrays 'names' and 'srcs' must match.")
- if nsrcs > 0:
- namesArray = <char**> malloc(nsrcs*sizeof(char*))
- srcsArray = <void**> malloc(nsrcs*sizeof(void*))
- for i from 0 <= i < nsrcs:
- strsize = len(names[i])
- namesArray[i] = <char*> malloc(1+strsize*sizeof(char))
- tmp = names[i] # KLUDGE??
- strcpy(namesArray[i], tmp)
-
- if not srcs[i].cppHandle.name == "pylith_faults_EqKinSrc":
- raise TypeError, \
- "Argument srcs must be an array of extension module type 'EqKinSrc'."
- srcsArray[i] = ptrFromHandle(srcs[i].cppHandle)
- FaultCohesiveKin_eqsrcs_set(self.thisptr, namesArray, srcsArray, nsrcs)
-
- for i from 0 <= i < nsrcs:
- free(<void*> namesArray[i])
- free(<void*> namesArray)
- free(srcsArray)
- return
-
-
- property quadrature:
- def __set__(self, q):
- """
- Set quadrature.
- """
- # create shim for method 'quadrature'
- #embed{ void FaultCohesiveKin_quadrature_set(void* objVptr, void* qVptr)
- try {
- assert(0 != objVptr);
-#if TODO
- pylith::feassemble::Quadrature* quadrature =
- (pylith::feassemble::Quadrature*) qVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->quadrature(quadrature);
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not q.name == "pylith_feassemble_Quadrature":
- raise TypeError, \
- "Argument must be extension module type 'Quadrature'."
- FaultCohesiveKin_quadrature_set(self.thisptr, ptrFromHandle(q))
-
-
- property normalizer:
- def __set__(self, value):
- """
- Set nondimensionalizer.
- """
- # create shim for method 'normalizer'
- #embed{ void FaultCohesiveKin_normalizer_set(void* objVptr, void* dimVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dimVptr);
- spatialdata::units::Nondimensional* dim =
- (spatialdata::units::Nondimensional*) dimVptr;
-#ifdef TODO
- ((pylith::faults::FaultCohesiveKin*) objVptr)->normalizer(*dim);
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_units_Nondimensional":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::units::Nondimensional'."
- FaultCohesiveKin_normalizer_set(self.thisptr, ptrFromHandle(value))
-
-
- property timeStep:
- def __set__(self, dt):
- """
- Set timeStep.
- """
- # create shim for method 'timeStep'
- #embed{ void FaultCohesiveKin_timeStep_set(void* objVptr, double dt)
- try {
- assert(0 != objVptr);
-#ifdef TODO
- ((pylith::faults::FaultCohesiveKin*) objVptr)->timeStep(dt);
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FaultCohesiveKin_timeStep_set(self.thisptr, dt)
-
-
- property stableTimeStep:
- def __get__(self):
- """
- Get stable time step.
- """
- # create shim for method 'stableTimeStep'
- #embed{ double FaultCohesiveKin_stableTimeStep_get(void* objVptr)
- double result = 0.0;
- try {
- assert(0 != objVptr);
-#ifdef TODO
- result =
- ((pylith::faults::FaultCohesiveKin*) objVptr)->stableTimeStep();
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return FaultCohesiveKin_stableTimeStep_get(self.thisptr)
-
-
- property needNewJacobian:
- def __get__(self):
- """
- Set timeStep.
- """
- # create shim for method 'needNewJacobian'
- #embed{ int FaultCohesiveKin_needNewJacobian_get(void* objVptr)
- int result = 0;
- try {
- assert(0 != objVptr);
-#ifdef TODO
- result =
- ((pylith::faults::FaultCohesiveKin*) objVptr)->needNewJacobian();
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return FaultCohesiveKin_needNewJacobian_get(self.thisptr)
-
-
- property useSolnIncr:
- def __set__(self, flag):
- """
- Set timeStep.
- """
- # create shim for method 'useSolnIncr'
- #embed{ void FaultCohesiveKin_useSolnIncr_set(void* objVptr, int flag)
- try {
- assert(0 != objVptr);
-#ifdef TODO
- ((pylith::faults::FaultCohesiveKin*) objVptr)->useSolnIncr(flag);
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FaultCohesiveKin_useSolnIncr_set(self.thisptr, flag)
-
-
-# ----------------------------------------------------------------------
-cdef void EqKinSrc_destructor(void* obj):
- """
- Destroy EqKinSrc object.
- """
- # create shim for destructor
- #embed{ void EqKinSrc_destructor_cpp(void* objVptr)
- pylith::faults::EqKinSrc* src = (pylith::faults::EqKinSrc*) objVptr;
- delete src;
- #}embed
- EqKinSrc_destructor_cpp(obj)
- return
-
-
-cdef class EqKinSrc:
-
- 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.
- """
- # create shim for constructor
- #embed{ void* EqKinSrc_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::faults::EqKinSrc);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- self.name = "pylith_faults_EqKinSrc"
- self.thisptr = EqKinSrc_constructor()
- self.handle = self._createHandle()
- return
-
-
- def _createHandle(self):
- """
- Wrap pointer to C++ object in PyCObject.
- """
- return PyCObject_FromVoidPtr(self.thisptr, EqKinSrc_destructor)
-
-
- property originTime:
- def __set__(self, value):
- """
- Set origin time for earthquake rupture.
- """
- # create shim for method 'originTime'
- #embed{ void EqKinSrc_originTime_set(void* objVptr, double value)
- try {
- assert(0 != objVptr);
- ((pylith::faults::EqKinSrc*) objVptr)->originTime(value);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- EqKinSrc_originTime_set(self.thisptr, value)
-
-
- property slipfn:
- def __set__(self, value):
- """
- Set slip time function.
- """
- # create shim for method 'slipfn'
- #embed{ void EqKinSrc_slipfn_set(void* objVptr, void* fnVptr)
- try {
- assert(0 != objVptr);
- assert(0 != fnVptr);
- pylith::faults::SlipTimeFn* fn =
- (pylith::faults::SlipTimeFn*) fnVptr;
- ((pylith::faults::EqKinSrc*) objVptr)->slipfn(fn);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "pylith_faults_SlipTimeFn":
- raise TypeError, \
- "Argument must be extension module type " \
- "'pylith_faults_SlipTimeFn'."
- EqKinSrc_slipfn_set(self.thisptr, ptrFromHandle(value))
-
-
-# ----------------------------------------------------------------------
-cdef void SlipTimeFn_destructor(void* obj):
- """
- Destroy SlipTimeFn object.
- """
- # create shim for destructor
- #embed{ void SlipTimeFn_destructor_cpp(void* objVptr)
- pylith::faults::SlipTimeFn* f = (pylith::faults::SlipTimeFn*) objVptr;
- delete f;
- #}embed
- SlipTimeFn_destructor_cpp(obj)
- return
-
-
-cdef class SlipTimeFn:
-
- 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_faults_SlipTimeFn"
- return
-
-
- def _createHandle(self):
- """
- Wrap pointer to C++ object in PyCObject.
- """
- return PyCObject_FromVoidPtr(self.thisptr, SlipTimeFn_destructor)
-
-
-# ----------------------------------------------------------------------
-cdef class BruneSlipFn(SlipTimeFn):
-
- def __init__(self):
- """
- Constructor.
- """
- # create shim for constructor
- #embed{ void* BruneSlipFn_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::faults::BruneSlipFn);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- SlipTimeFn.__init__(self)
- self.thisptr = BruneSlipFn_constructor()
- self.handle = self._createHandle()
- return
-
-
- property dbFinalSlip:
- def __set__(self, value):
- """
- Set database for final slip.
- """
- # create shim for method 'dbFinalSlip'
- #embed{ void BruneSlipFn_dbFinalSlip_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::BruneSlipFn*) objVptr)->dbFinalSlip(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- BruneSlipFn_dbFinalSlip_set(self.thisptr, ptrFromHandle(value))
-
-
- property dbSlipTime:
- def __set__(self, value):
- """
- Set database for slip initiation time.
- """
- # create shim for method 'dbSlipTime'
- #embed{ void BruneSlipFn_dbSlipTime_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::BruneSlipFn*) objVptr)->dbSlipTime(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- BruneSlipFn_dbSlipTime_set(self.thisptr, ptrFromHandle(value))
-
-
- property dbPeakRate:
- def __set__(self, value):
- """
- Set database for peak slip rate.
- """
- # create shim for method 'dbPeakRate'
- #embed{ void BruneSlipFn_dbPeakRate_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::BruneSlipFn*) objVptr)->dbPeakRate(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- BruneSlipFn_dbPeakRate_set(self.thisptr, ptrFromHandle(value))
-
-
-# ----------------------------------------------------------------------
-cdef class LiuCosSlipFn(SlipTimeFn):
-
- def __init__(self):
- """
- Constructor.
- """
- # create shim for constructor
- #embed{ void* LiuCosSlipFn_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::faults::LiuCosSlipFn);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- SlipTimeFn.__init__(self)
- self.thisptr = LiuCosSlipFn_constructor()
- self.handle = self._createHandle()
- return
-
-
- property dbFinalSlip:
- def __set__(self, value):
- """
- Set database for final slip.
- """
- # create shim for method 'dbFinalSlip'
- #embed{ void LiuCosSlipFn_dbFinalSlip_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::LiuCosSlipFn*) objVptr)->dbFinalSlip(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- LiuCosSlipFn_dbFinalSlip_set(self.thisptr, ptrFromHandle(value))
-
-
- property dbSlipTime:
- def __set__(self, value):
- """
- Set database for slip initiation time.
- """
- # create shim for method 'dbSlipTime'
- #embed{ void LiuCosSlipFn_dbSlipTime_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::LiuCosSlipFn*) objVptr)->dbSlipTime(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- LiuCosSlipFn_dbSlipTime_set(self.thisptr, ptrFromHandle(value))
-
-
- property dbRiseTime:
- def __set__(self, value):
- """
- Set database for rise time.
- """
- # create shim for method 'dbRiseTime'
- #embed{ void LiuCosSlipFn_dbRiseTime_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::LiuCosSlipFn*) objVptr)->dbRiseTime(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- LiuCosSlipFn_dbRiseTime_set(self.thisptr, ptrFromHandle(value))
-
-
-# ----------------------------------------------------------------------
-cdef class ConstRateSlipFn(SlipTimeFn):
-
- def __init__(self):
- """
- Constructor.
- """
- # create shim for constructor
- #embed{ void* ConstRateSlipFn_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::faults::ConstRateSlipFn);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- SlipTimeFn.__init__(self)
- self.thisptr = ConstRateSlipFn_constructor()
- self.handle = self._createHandle()
- return
-
-
- property dbSlipRate:
- def __set__(self, value):
- """
- Set database for slip rate.
- """
- # create shim for method 'dbSlipRate'
- #embed{ void ConstRateSlipFn_dbSlipRate_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::ConstRateSlipFn*) objVptr)->dbSlipRate(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- ConstRateSlipFn_dbSlipRate_set(self.thisptr, ptrFromHandle(value))
-
-
- property dbSlipTime:
- def __set__(self, value):
- """
- Set database for slip initiation time.
- """
- # create shim for method 'dbSlipTime'
- #embed{ void ConstRateSlipFn_dbSlipTime_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::ConstRateSlipFn*) objVptr)->dbSlipTime(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- ConstRateSlipFn_dbSlipTime_set(self.thisptr, ptrFromHandle(value))
-
-
-# ----------------------------------------------------------------------
-cdef class StepSlipFn(SlipTimeFn):
-
- def __init__(self):
- """
- Constructor.
- """
- # create shim for constructor
- #embed{ void* StepSlipFn_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::faults::StepSlipFn);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- SlipTimeFn.__init__(self)
- self.thisptr = StepSlipFn_constructor()
- self.handle = self._createHandle()
- return
-
-
- property dbFinalSlip:
- def __set__(self, value):
- """
- Set database for slip rate.
- """
- # create shim for method 'dbFinalSlip'
- #embed{ void StepSlipFn_dbFinalSlip_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::StepSlipFn*) objVptr)->dbFinalSlip(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- StepSlipFn_dbFinalSlip_set(self.thisptr, ptrFromHandle(value))
-
-
- property dbSlipTime:
- def __set__(self, value):
- """
- Set database for slip initiation time.
- """
- # create shim for method 'dbSlipTime'
- #embed{ void StepSlipFn_dbSlipTime_set(void* objVptr, void* dbVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dbVptr);
- spatialdata::spatialdb::SpatialDB* db =
- (spatialdata::spatialdb::SpatialDB*) dbVptr;
- ((pylith::faults::StepSlipFn*) objVptr)->dbSlipTime(db);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_spatialdb_SpatialDB":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::spatialdb::SpatialDB'."
- StepSlipFn_dbSlipTime_set(self.thisptr, ptrFromHandle(value))
-
-
-# End of file
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -28,6 +28,10 @@
GeometryLine3D.i \
GeometryTri2D.i \
GeometryTri3D.i \
+ GeometryQuad2D.i \
+ GeometryQuad3D.i \
+ GeometryTet3D.i \
+ GeometryHex3D.i \
QuadratureRefCell.i \
Quadrature.i \
Integrator.i \
Modified: short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -25,6 +25,8 @@
MeshIOCubit.i \
VertexFilter.i \
VertexFilterVecNorm.i \
+ CellFilter.i \
+ CellFilterAvg.i \
DataWriter.i \
DataWriterVTK.i \
OutputManager.i \
Deleted: short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,1464 +0,0 @@
-# -*- Pyrex -*-
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-#header{
-#include "pylith/meshio/CellFilter.hh"
-#include "pylith/meshio/CellFilterAvg.hh"
-#include "pylith/meshio/DataWriter.hh"
-#include "pylith/meshio/DataWriterVTK.hh"
-#include "pylith/meshio/MeshIO.hh"
-#include "pylith/meshio/MeshIOAscii.hh"
-#include "pylith/meshio/MeshIOLagrit.hh"
-#include "pylith/meshio/OutputManager.hh"
-#include "pylith/meshio/OutputSolnSubset.hh"
-#include "pylith/meshio/VertexFilter.hh"
-#include "pylith/meshio/VertexFilterVecNorm.hh"
-
-#if defined(ENABLE_CUBIT)
-#include "pylith/meshio/MeshIOCubit.hh"
-#endif
-
-#include <strings.h> // USES strcasecmp()
-#include <stdexcept>
-#include <assert.h>
-#include <Python.h>
-#}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)
-
-# ----------------------------------------------------------------------
-cdef void MeshIO_destructor(void* obj):
- """
- Destroy MeshIO object.
- """
- # create shim for destructor
- #embed{ void MeshIO_destructor_cpp(void* pObj)
- pylith::meshio::MeshIO* io = (pylith::meshio::MeshIO*) pObj;
- delete io;
- #}embed
- MeshIO_destructor_cpp(obj)
- return
-
-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, mesh):
- """
- Read mesh from file.
- """
- # create shim for method 'read'
- #embed{ void MeshIO_read(void* objVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != meshVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- ((pylith::meshio::MeshIO*) objVptr)->read(mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- MeshIO_read(self.thisptr, ptrFromHandle(mesh))
- return
-
-
- def write(self, mesh):
- """
- Read write to file.
- """
- # create shim for method 'write'
- #embed{ void MeshIO_write(void* objVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- ((pylith::meshio::MeshIO*) objVptr)->write(mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- MeshIO_write(self.thisptr, ptrFromHandle(mesh))
- return
-
-
- def _createHandle(self):
- """Wrap pointer to C++ object in PyCObject."""
- return PyCObject_FromVoidPtr(self.thisptr, MeshIO_destructor)
-
-
- property normalizer:
- def __set__(self, value):
- """Set normalizer."""
- # create shim for method 'normalizer'
- #embed{ void MeshIO_normalizer_set(void* objVptr, void* dimVptr)
- try {
- assert(0 != objVptr);
- assert(0 != dimVptr);
- spatialdata::units::Nondimensional* dim =
- (spatialdata::units::Nondimensional*) dimVptr;
- ((pylith::meshio::MeshIO*) objVptr)->normalizer(*dim);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not value.name == "spatialdata_units_Nondimensional":
- raise TypeError, \
- "Argument must be extension module type " \
- "'spatialdata::units::Nondimensional'."
- MeshIO_normalizer_set(self.thisptr, ptrFromHandle(value))
-
-
- property interpolate:
- def __set__(self, flag):
- """Set interpolate."""
- # create shim for method 'interpolate'
- #embed{ void MeshIO_interpolate_set(void* objVptr, int flag)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIO*) objVptr)->interpolate(flag);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- MeshIO_interpolate_set(self.thisptr, flag)
-
- def __get__(self):
- """Get interpolate."""
- # create shim for method 'interpolate'
- #embed{ int MeshIO_interpolate_get(void* objVptr)
- int result = 0;
- try {
- assert(0 != objVptr);
- result = ((pylith::meshio::MeshIO*) objVptr)->interpolate();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return MeshIO_interpolate_get(self.thisptr)
-
-
- property debug:
- def __set__(self, flag):
- """Set debug."""
- # create shim for method 'debug'
- #embed{ void MeshIO_debug_set(void* objVptr, int flag)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIO*) objVptr)->debug(flag);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- MeshIO_debug_set(self.thisptr, flag)
-
- def __get__(self):
- """Get debug."""
- # create shim for method 'debug'
- #embed{ int MeshIO_debug_get(void* objVptr)
- int result = 0;
- try {
- assert(0 != objVptr);
- result = ((pylith::meshio::MeshIO*) objVptr)->debug();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return MeshIO_debug_get(self.thisptr)
-
-
-# ----------------------------------------------------------------------
-cdef class MeshIOAscii(MeshIO):
-
- def __init__(self):
- """Constructor."""
- # create shim for constructor
- #embed{ void* MeshIOAscii_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::meshio::MeshIOAscii);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- MeshIO.__init__(self)
- self.thisptr = MeshIOAscii_constructor()
- self.handle = self._createHandle()
- return
-
-
- property filename:
- def __set__(self, name):
- """Set filename."""
- # create shim for method 'filename'
- #embed{ void MeshIOAscii_filename_set(void* objVptr, char* name)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIOAscii*) objVptr)->filename(name);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- MeshIOAscii_filename_set(self.thisptr, name)
-
- def __get__(self):
- """Get filename."""
- # create shim for method 'filename'
- #embed{ char* MeshIOAscii_filename_get(void* objVptr)
- char* result = 0;
- try {
- assert(0 != objVptr);
- result = (char*) ((pylith::meshio::MeshIOAscii*) objVptr)->filename();
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return MeshIOAscii_filename_get(self.thisptr)
-
-
-# ----------------------------------------------------------------------
-cdef class MeshIOCubit(MeshIO):
-
- def __init__(self):
- """Constructor."""
- # create shim for constructor
- #embed{ void* MeshIOCubit_constructor()
- #if defined(ENABLE_CUBIT)
- void* result = 0;
- try {
- result = (void*)(new pylith::meshio::MeshIOCubit);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #else
- throw std::logic_error("Not configured to use CUBIT.");
- return 0;
- #endif
- #}embed
-
- MeshIO.__init__(self)
- self.thisptr = MeshIOCubit_constructor()
- self.handle = self._createHandle()
- return
-
-
- property filename:
- def __set__(self, name):
- """Set filename."""
- # create shim for method 'filename'
- #embed{ void MeshIOCubit_filename_set(void* objVptr, char* name)
- #if defined(ENABLE_CUBIT)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIOCubit*) objVptr)->filename(name);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #else
- throw std::logic_error("Not configured to use CUBIT.");
- #endif
- #}embed
- MeshIOCubit_filename_set(self.thisptr, name)
-
- def __get__(self):
- """Get filename."""
- # create shim for method 'filename'
- #embed{ char* MeshIOCubit_filename_get(void* objVptr)
- #if defined(ENABLE_CUBIT)
- char* result = 0;
- try {
- assert(0 != objVptr);
- result = (char*) ((pylith::meshio::MeshIOCubit*) objVptr)->filename();
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #else
- throw std::logic_error("Not configured to use CUBIT.");
- return 0;
- #endif
- #}embed
- return MeshIOCubit_filename_get(self.thisptr)
-
-# ----------------------------------------------------------------------
-cdef class MeshIOLagrit(MeshIO):
-
- def __init__(self):
- """Constructor."""
- # create shim for constructor
- #embed{ void* MeshIOLagrit_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::meshio::MeshIOLagrit);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- MeshIO.__init__(self)
- self.thisptr = MeshIOLagrit_constructor()
- self.handle = self._createHandle()
- return
-
-
- property filenameGmv:
- def __set__(self, name):
- """Set filename."""
- # create shim for method 'filenameGmv'
- #embed{ void MeshIOLagrit_filenameGmv_set(void* objVptr, char* name)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIOLagrit*) objVptr)->filenameGmv(name);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- MeshIOLagrit_filenameGmv_set(self.thisptr, name)
-
- def __get__(self):
- """Get filename."""
- # create shim for method 'filenameGmv'
- #embed{ char* MeshIOLagrit_filenameGmv_get(void* objVptr)
- char* result = 0;
- try {
- assert(0 != objVptr);
- result = (char*) ((pylith::meshio::MeshIOLagrit*) objVptr)->filenameGmv();
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return MeshIOLagrit_filenameGmv_get(self.thisptr)
-
-
- property filenamePset:
- def __set__(self, name):
- """Set filename."""
- # create shim for method 'filenamePset'
- #embed{ void MeshIOLagrit_filenamePset_set(void* objVptr, char* name)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIOLagrit*) objVptr)->filenamePset(name);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- MeshIOLagrit_filenamePset_set(self.thisptr, name)
-
- def __get__(self):
- """Get filename."""
- # create shim for method 'filenamePset'
- #embed{ char* MeshIOLagrit_filenamePset_get(void* objVptr)
- char* result = 0;
- try {
- assert(0 != objVptr);
- result = (char*) ((pylith::meshio::MeshIOLagrit*) objVptr)->filenamePset();
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return MeshIOLagrit_filenamePset_get(self.thisptr)
-
-
- property flipEndian:
- def __set__(self, flag):
- """Set flip endian flag."""
- # create shim for method 'flipEndian'
- #embed{ void MeshIOLagrit_flipEndian_set(void* objVptr, int flag)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIOLagrit*) objVptr)->flipEndian(flag);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- MeshIOLagrit_flipEndian_set(self.thisptr, flag)
-
- def __get__(self):
- """Get flip endian flag."""
- # create shim for method 'flipEndian'
- #embed{ int MeshIOLagrit_flipEndian_get(void* objVptr)
- int result = 0;
- try {
- assert(0 != objVptr);
- result = ((pylith::meshio::MeshIOLagrit*) objVptr)->flipEndian();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return MeshIOLagrit_flipEndian_get(self.thisptr)
-
-
- property ioInt32:
- def __set__(self, flag):
- """Set flip endian flag."""
- # create shim for method 'ioInt32'
- #embed{ void MeshIOLagrit_ioInt32_set(void* objVptr, int flag)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIOLagrit*) objVptr)->ioInt32(flag);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- MeshIOLagrit_ioInt32_set(self.thisptr, flag)
-
- def __get__(self):
- """Get flip endian flag."""
- # create shim for method 'ioInt32'
- #embed{ int MeshIOLagrit_ioInt32_get(void* objVptr)
- int result = 0;
- try {
- assert(0 != objVptr);
- result = ((pylith::meshio::MeshIOLagrit*) objVptr)->ioInt32();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return MeshIOLagrit_ioInt32_get(self.thisptr)
-
-
- property isRecordHeader32Bit:
- def __set__(self, flag):
- """Set Fortran record header size flag."""
- # create shim for method 'isRecordHeader32Bit'
- #embed{ void MeshIOLagrit_isRecordHeader32Bit_set(void* objVptr, int flag)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::MeshIOLagrit*) objVptr)->isRecordHeader32Bit(flag);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- MeshIOLagrit_isRecordHeader32Bit_set(self.thisptr, flag)
-
- def __get__(self):
- """Get Fortran record header size flag."""
- # create shim for method 'isRecordHeader32Bit'
- #embed{ int MeshIOLagrit_isRecordHeader32Bit_get(void* objVptr)
- int result = 0;
- try {
- assert(0 != objVptr);
- result = ((pylith::meshio::MeshIOLagrit*) objVptr)->isRecordHeader32Bit();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return MeshIOLagrit_isRecordHeader32Bit_get(self.thisptr)
-
-
-# ----------------------------------------------------------------------
-cdef void OutputManager_destructor(void* obj):
- """
- Destroy OutputManager object.
- """
- # create shim for destructor
- #embed{ void OutputManager_destructor_cpp(void* pObj)
- pylith::meshio::OutputManager* io = (pylith::meshio::OutputManager*) pObj;
- delete io;
- #}embed
- OutputManager_destructor_cpp(obj)
- return
-
-cdef class OutputManager:
-
- 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.
- """
- # create shim for constructor
- #embed{ void* OutputManager_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::meshio::OutputManager);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- self.name = "pylith_meshio_OutputManager"
- self.thisptr = OutputManager_constructor()
- self.handle = self._createHandle()
- return
-
-
- def open(self, mesh, cs, numTimeSteps, label, labelId):
- """
- Open output file.
- """
- # create shim for method 'open'
- #embed{ void OutputManager_open(void* objVptr, void* meshVptr, void* csVptr, int numTimeSteps, char* label, int labelId)
- try {
- assert(0 != objVptr);
- assert(0 != csVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- spatialdata::geocoords::CoordSys* cs =
- (spatialdata::geocoords::CoordSys*) csVptr;
- ((pylith::meshio::OutputManager*) objVptr)->open(*mesh, cs, numTimeSteps, label, labelId);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type 'Mesh'."
- if not cs.name == "spatialdata_geocoords_CoordSys":
- raise TypeError, \
- "Argument 'cs' must be extension module type 'CoordSys'."
- if None == label or None == labelId:
- OutputManager_open(self.thisptr, ptrFromHandle(mesh),
- ptrFromHandle(cs), numTimeSteps, NULL, 0)
- else:
- OutputManager_open(self.thisptr, ptrFromHandle(mesh),
- ptrFromHandle(cs), numTimeSteps, label, labelId)
- return
-
-
- def close(self):
- """
- Close solution files.
- """
- # create shim for method 'close'
- #embed{ void OutputManager_close(void* objVptr)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::OutputManager*) objVptr)->close();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- OutputManager_close(self.thisptr)
- return
-
-
- def openTimeStep(self, t, mesh, cs, label, labelId):
- """
- Prepare for writing solution to file.
- """
- # create shim for method 'openTimeStep'
- #embed{ void OutputManager_openTimeStep(void* objVptr, double t, void* meshVptr, void* csVptr, char* label, int labelId)
- try {
- assert(0 != objVptr);
- assert(0 != meshVptr);
- assert(0 != csVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- spatialdata::geocoords::CoordSys* cs =
- (spatialdata::geocoords::CoordSys*) csVptr;
- ((pylith::meshio::OutputManager*) objVptr)->openTimeStep(t, *mesh, cs,
- label, labelId);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- if not cs.name == "spatialdata_geocoords_CoordSys":
- raise TypeError, \
- "Argument must be extension module type 'CoordSys'."
- if None == label or None == labelId:
- OutputManager_openTimeStep(self.thisptr, t,
- ptrFromHandle(mesh), ptrFromHandle(cs),
- NULL, 0)
- else:
- OutputManager_openTimeStep(self.thisptr, t,
- ptrFromHandle(mesh), ptrFromHandle(cs),
- label, labelId)
- return
-
-
- def closeTimeStep(self):
- """
- Prepare for writing solution to file.
- """
- # create shim for method 'closeTimeStep'
- #embed{ void OutputManager_closeTimeStep(void* objVptr)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::OutputManager*) objVptr)->closeTimeStep();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- OutputManager_closeTimeStep(self.thisptr)
- return
-
-
- def appendVertexField(self, t, name, field, fieldType, mesh):
- """
- Append field over vertices to file.
- """
- # create shim for method 'appendVertexField'
- #embed{ void OutputManager_appendVertexField(void* objVptr, double t, char* name, void* fieldVptr, int fieldTypeInt, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != fieldVptr);
- assert(0 != name);
- assert(0 != meshVptr);
- ALE::Obj<pylith::real_section_type>* field =
- (ALE::Obj<pylith::real_section_type>*) fieldVptr;
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- const pylith::VectorFieldEnum fieldType =
- (pylith::VectorFieldEnum) fieldTypeInt;
- ((pylith::meshio::OutputManager*) objVptr)->appendVertexField(t, name,
- *field, fieldType, *mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type 'Mesh'."
- cdef void* fieldVptr
- fieldVptr = PyCObject_AsVoidPtr(field)
- OutputManager_appendVertexField(self.thisptr, t, name, fieldVptr, fieldType,
- ptrFromHandle(mesh))
- return
-
-
- def appendCellField(self, t, name, field, fieldType, mesh, label, labelId):
- """
- Append field over cells to file.
- """
- # create shim for method 'appendCellField'
- #embed{ void OutputManager_appendCellField(void* objVptr, double t, char* name, void* fieldVptr, int fieldTypeInt, void* meshVptr, char* label, int labelId)
- try {
- assert(0 != objVptr);
- assert(0 != fieldVptr);
- assert(0 != name);
- assert(0 != meshVptr);
- ALE::Obj<pylith::real_section_type>* field =
- (ALE::Obj<pylith::real_section_type>*) fieldVptr;
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- const pylith::VectorFieldEnum fieldType =
- (pylith::VectorFieldEnum) fieldTypeInt;
- ((pylith::meshio::OutputManager*) objVptr)->appendCellField(t, name,
- *field,
- fieldType,
- *mesh, label, labelId);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- cdef void* fieldVptr
- fieldVptr = PyCObject_AsVoidPtr(field)
- if None == label or None == labelId:
- OutputManager_appendCellField(self.thisptr, t, name, fieldVptr, fieldType,
- ptrFromHandle(mesh), NULL, 0)
- else:
- OutputManager_appendCellField(self.thisptr, t, name, fieldVptr, fieldType,
- ptrFromHandle(mesh), label, labelId)
- return
-
-
- def _createHandle(self):
- """Wrap pointer to C++ object in PyCObject."""
- return PyCObject_FromVoidPtr(self.thisptr, OutputManager_destructor)
-
-
- property coordsys:
- def __set__(self, cs):
- """Set coordinate system."""
- # create shim for method 'coordsys'
- #embed{ void OutputManager_coordsys_set(void* objVptr, void* csVptr)
- try {
- assert(0 != objVptr);
- assert(0 != csVptr);
- spatialdata::geocoords::CoordSys* cs =
- (spatialdata::geocoords::CoordSys*) csVptr;
- ((pylith::meshio::OutputManager*) objVptr)->coordsys(cs);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- OutputManager_coordsys_set(self.thisptr, ptrFromHandle(cs))
-
-
- property writer:
- def __set__(self, writer):
- """
- Writer for finite-element data.
- """
- # create shim for method 'writer'
- #embed{ void OutputManager_writer_set(void* objVptr, void* writerVptr)
- try {
- assert(0 != objVptr);
- assert(0 != writerVptr);
- pylith::meshio::DataWriter* writer =
- (pylith::meshio::DataWriter*) writerVptr;
- ((pylith::meshio::OutputManager*) objVptr)->writer(writer);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- OutputManager_writer_set(self.thisptr, ptrFromHandle(writer))
-
-
- property vertexFilter:
- def __set__(self, filter):
- """
- Set vertex filter.
- """
- # create shim for method 'vertexFilter'
- #embed{ void OutputManager_vertexFilter_set(void* objVptr, void* filterVptr)
- try {
- assert(0 != objVptr);
- pylith::meshio::VertexFilter* filter =
- (pylith::meshio::VertexFilter*) filterVptr;
- ((pylith::meshio::OutputManager*) objVptr)->vertexFilter(filter);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if filter != None:
- OutputManager_vertexFilter_set(self.thisptr, ptrFromHandle(filter))
- else:
- OutputManager_vertexFilter_set(self.thisptr, NULL)
-
-
- property cellFilter:
- def __set__(self, filter):
- """
- Set cell filter.
- """
- # create shim for method 'cellFilter'
- #embed{ void OutputManager_cellFilter_set(void* objVptr, void* filterVptr)
- try {
- assert(0 != objVptr);
- pylith::meshio::CellFilter* filter =
- (pylith::meshio::CellFilter*) filterVptr;
- ((pylith::meshio::OutputManager*) objVptr)->cellFilter(filter);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if filter != None:
- OutputManager_cellFilter_set(self.thisptr, ptrFromHandle(filter))
- else:
- OutputManager_cellFilter_set(self.thisptr, NULL)
-
-
-# ----------------------------------------------------------------------
-cdef class OutputSolnSubset(OutputManager):
-
- def __init__(self):
- """
- Constructor.
- """
- # create shim for constructor
- #embed{ void* OutputSolnSubset_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::meshio::OutputSolnSubset);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- self.name = "pylith_meshio_OutputSolnSubset"
- self.thisptr = OutputSolnSubset_constructor()
- self.handle = self._createHandle()
- return
-
-
- def verifyConfiguration(self, mesh):
- """
- Verify compatibility of configuration settings.
- """
- # create shim for method 'verifyConfiguration'
- #embed{ void OutputSolnSubset_verifyConfiguration(void* objVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != meshVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- ((pylith::meshio::OutputSolnSubset*) objVptr)->verifyConfiguration(*mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
-
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type " \
- "'pylith::topology::Mesh'."
- OutputSolnSubset_verifyConfiguration(self.thisptr, ptrFromHandle(mesh))
- return
-
-
- def mesh(self, submesh, mesh):
- """
- Get mesh associated with subdomain.
- """
- # create shim for method 'subdomainMesh'
- #embed{ void OutputSolnSubset_subdomainMesh(void* objVptr, void* submeshVptr, void* meshVptr)
- try {
- assert(0 != objVptr);
- assert(0 != submeshVptr);
- assert(0 != meshVptr);
- ALE::Obj<pylith::Mesh>* submesh = (ALE::Obj<pylith::Mesh>*) submeshVptr;
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- *submesh =
- ((pylith::meshio::OutputSolnSubset*) objVptr)->subdomainMesh(*mesh);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
-
- if not submesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'submesh' must be extension module type " \
- "'pylith::topology::Mesh'."
- if not mesh.name == "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type " \
- "'pylith::topology::Mesh'."
- OutputSolnSubset_subdomainMesh(self.thisptr,
- ptrFromHandle(submesh), ptrFromHandle(mesh))
- return
-
-
- property label:
- def __set__(self, value):
- """
- Set label of subdomain.
- """
- # create shim for method 'label'
- #embed{ void OutputSolnSubset_label_set(void* objVptr, char* value)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::OutputSolnSubset*) objVptr)->label(value);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- OutputSolnSubset_label_set(self.thisptr, value)
-
-
-# ----------------------------------------------------------------------
-cdef void DataWriter_destructor(void* obj):
- """
- Destroy DataWriter object.
- """
- # create shim for destructor
- #embed{ void DataWriter_destructor_cpp(void* pObj)
- pylith::meshio::DataWriter* io = (pylith::meshio::DataWriter*) pObj;
- delete io;
- #}embed
- DataWriter_destructor_cpp(obj)
- return
-
-cdef class DataWriter:
-
- 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_DataWriter"
- return
-
-
- def _createHandle(self):
- """Wrap pointer to C++ object in PyCObject."""
- return PyCObject_FromVoidPtr(self.thisptr, DataWriter_destructor)
-
-
-# ----------------------------------------------------------------------
-cdef class DataWriterVTK(DataWriter):
-
- def __init__(self):
- """Constructor."""
- # create shim for constructor
- #embed{ void* DataWriterVTK_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::meshio::DataWriterVTK);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- DataWriter.__init__(self)
- self.thisptr = DataWriterVTK_constructor()
- self.handle = self._createHandle()
- return
-
-
- property filename:
- def __set__(self, name):
- """Set filename."""
- # create shim for method 'filename'
- #embed{ void DataWriterVTK_filename_set(void* objVptr, char* name)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::DataWriterVTK*) objVptr)->filename(name);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- DataWriterVTK_filename_set(self.thisptr, name)
-
-
- property timeFormat:
- def __set__(self, format):
- """Set timeFormat."""
- # create shim for method 'timeFormat'
- #embed{ void DataWriterVTK_timeFormat_set(void* objVptr, char* format)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::DataWriterVTK*) objVptr)->timeFormat(format);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- DataWriterVTK_timeFormat_set(self.thisptr, format)
-
-
- property timeConstant:
- def __set__(self, value):
- """Set time constant."""
- # create shim for method 'timeConstant
- #embed{ void DataWriterVTK_timeConstant_set(void* objVptr, double value)
- try {
- assert(0 != objVptr);
- ((pylith::meshio::DataWriterVTK*) objVptr)->timeConstant(value);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- DataWriterVTK_timeConstant_set(self.thisptr, value)
-
-
-# ----------------------------------------------------------------------
-cdef void CellFilter_destructor(void* obj):
- """
- Destroy CellFilter object.
- """
- # create shim for destructor
- #embed{ void CellFilter_destructor_cpp(void* pObj)
- pylith::meshio::CellFilter* f = (pylith::meshio::CellFilter*) pObj;
- delete f;
- #}embed
- CellFilter_destructor_cpp(obj)
- return
-
-cdef class CellFilter:
-
- 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_CellFilter"
- return
-
-
- property quadrature:
- def __set__(self, quadrature):
- """
- Set quadrature.
- """
- # create shim for method 'quadrature'
- #embed{ void CellFilter_quadrature_set(void* objVptr, void* qVptr)
- try {
- assert(0 != objVptr);
- assert(0 != qVptr);
- pylith::feassemble::Quadrature* quadrature =
- (pylith::feassemble::Quadrature*) qVptr;
- ((pylith::meshio::CellFilter*) objVptr)->quadrature(quadrature);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if not quadrature.name == "pylith_feassemble_Quadrature":
- raise TypeError, \
- "Argument must be extension module type 'Quadrature'."
- CellFilter_quadrature_set(self.thisptr, ptrFromHandle(quadrature))
-
-
- def _createHandle(self):
- """Wrap pointer to C++ object in PyCObject."""
- return PyCObject_FromVoidPtr(self.thisptr, CellFilter_destructor)
-
-
-# ----------------------------------------------------------------------
-cdef class CellFilterAvg(CellFilter):
-
- def __init__(self):
- """Constructor."""
- # create shim for constructor
- #embed{ void* CellFilterAvg_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::meshio::CellFilterAvg);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- CellFilter.__init__(self)
- self.thisptr = CellFilterAvg_constructor()
- self.handle = self._createHandle()
- return
-
-
-# ----------------------------------------------------------------------
-cdef void VertexFilter_destructor(void* obj):
- """
- Destroy VertexFilter object.
- """
- # create shim for destructor
- #embed{ void VertexFilter_destructor_cpp(void* pObj)
- pylith::meshio::VertexFilter* f = (pylith::meshio::VertexFilter*) pObj;
- delete f;
- #}embed
- VertexFilter_destructor_cpp(obj)
- return
-
-cdef class VertexFilter:
-
- 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_VertexFilter"
- return
-
-
- def _createHandle(self):
- """Wrap pointer to C++ object in PyCObject."""
- return PyCObject_FromVoidPtr(self.thisptr, VertexFilter_destructor)
-
-
-# ----------------------------------------------------------------------
-cdef class VertexFilterVecNorm(VertexFilter):
-
- def __init__(self):
- """Constructor."""
- # create shim for constructor
- #embed{ void* VertexFilterVecNorm_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::meshio::VertexFilterVecNorm);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- VertexFilter.__init__(self)
- self.thisptr = VertexFilterVecNorm_constructor()
- self.handle = self._createHandle()
- return
-
-
-# End of file
Deleted: short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,1254 +0,0 @@
-# -*- Pyrex -*-
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-#header{
-#include "pylith/topology/FieldsManager.hh"
-#include "pylith/topology/Distributor.hh"
-#include "pylith/topology/MeshOps.hh"
-#include "pylith/topology/MeshRefiner.hh"
-#include "pylith/topology/RefineUniform.hh"
-#include "pylith/utils/sievetypes.hh"
-#include "pylith/utils/petscfwd.h"
-#include <petscmesh.hh>
-
-#include <stdexcept>
-#include <Python.h>
-#include <assert.h>
-#include <mpi.h>
-#include "mpi/pympi.h"
-#}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)
-
-cdef void PetscMat_destructor(void* obj):
- """
- Destroy PetscMat.
- """
- #embed{ void PetscMat_destructor_cpp(void* objVptr)
- assert(0 != objVptr);
- PetscMat* mat = (PetscMat*) objVptr;
- PetscErrorCode err = MatDestroy(*mat);
- if (err) {
- PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,err,0," ");
- throw std::runtime_error("Could not destroy PETSc matrix.");
- } // if
- #}embed
- PetscMat_destructor_cpp(obj)
- return
-
-# ----------------------------------------------------------------------
-
-cimport mpi
-import mpi
-
-# ----------------------------------------------------------------------
-cdef void MeshPtr_destructor(void* obj):
- """
- Destroy Petsc Mesh.
- """
- #embed{ void MeshPtr_destructor_cpp(void* objVptr)
- ALE::Obj<pylith::Mesh>* pMesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- delete pMesh;
- #}embed
- MeshPtr_destructor_cpp(obj)
- return
-
-cdef class Mesh:
-
- 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.
- """
- # create shim for constructor
- #embed{ void* MeshPtr_constructor()
- void* result = 0;
- try {
- ALE::Obj<pylith::Mesh>* mesh = new ALE::Obj<pylith::Mesh>;
- assert(0 != mesh);
- result = (void*) mesh;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- self.thisptr = MeshPtr_constructor()
- self.handle = self._createHandle()
- self.name = "pylith_topology_Mesh"
- return
-
-
- def getRealSection(self, label):
- """
- Get real section from mesh.
- """
- # create shim for getRealSection
- #embed{ void* Mesh_getRealSection(void* objVptr, char* label)
- void* result = 0;
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- const ALE::Obj<pylith::real_section_type>& section =
- (*mesh)->getRealSection(label);
- assert(!section.isNull());
- result = (void*) §ion;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- cdef void* ptr
- ptr = Mesh_getRealSection(self.thisptr, label)
- return PyCObject_FromVoidPtr(ptr, NULL)
-
-
- def createRealSection(self, label, fiberDim):
- """
- Create real section in mesh.
- """
- # create shim for createRealSection
- #embed{ void* Mesh_createRealSection(void* objVptr, char* label, int fiberDim)
- void* result = 0;
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- const ALE::Obj<pylith::real_section_type>& section =
- (*mesh)->getRealSection(label);
- assert(!section.isNull());
- section->setChart((*mesh)->getSieve()->getChart());
- section->setFiberDimension((*mesh)->depthStratum(0), fiberDim);
- result = (void*) §ion;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- cdef void* ptr
- ptr = Mesh_createRealSection(self.thisptr, label, fiberDim)
- return PyCObject_FromVoidPtr(ptr, NULL)
-
-
- def allocateRealSection(self, section):
- """
- Allocate (and zero) real section.
- """
- # create shim for allocate
- #embed{ void* Mesh_allocateRealSection(void* objVptr, void* sectionVptr)
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- ALE::Obj<pylith::real_section_type>* section =
- (ALE::Obj<pylith::real_section_type>*) sectionVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- assert(0 != section);
- assert(!section->isNull());
- (*mesh)->allocate(*section);
- (*section)->zero();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- cdef void* ptr
- ptr = Mesh_allocateRealSection(self.thisptr, PyCObject_AsVoidPtr(section))
- return
-
-
- def createMatrix(self, field):
- """
- Create matrix compatible with field.
- """
- # create shim for MeshCreateMatrix
- #embed{ void* Mesh_createMatrix(void* objVptr, void* fieldVptr)
- void* result = 0;
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- const ALE::Obj<pylith::real_section_type>* field =
- (ALE::Obj<pylith::real_section_type>*) fieldVptr;
- assert(!field->isNull());
-
- PetscMat* mat = new PetscMat;
- assert(0 != mat);
- // Should make type settable by user
- //PetscErrorCode err = MeshCreateMatrix(*mesh, *field, MATMPIBAIJ, mat);
- PetscErrorCode err = MeshCreateMatrix(*mesh, *field, MATAIJ, mat);
- if (err) {
- PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,err,0," ");
- throw std::runtime_error("Could not create PETSc Matrix.");
- } // if
- result = (void*) mat;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- cdef void* ptr
- cdef void* fieldVptr
- fieldVptr = PyCObject_AsVoidPtr(field)
- ptr = Mesh_createMatrix(self.thisptr, fieldVptr)
- return PyCObject_FromVoidPtr(ptr, PetscMat_destructor)
-
-
- def view(self):
- """
- View the mesh.
- """
- # create shim for view
- #embed{ void* Mesh_view(void* objVptr)
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- (*mesh)->view("");
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- Mesh_view(self.thisptr)
- return
-
-
- def checkMaterialIds(self, materialIds):
- """
- Make sure material id for each cell matches id of a material.
- """
- # create shim for checkMaterialIds
- #embed{ void* Mesh_checkMaterialIds(void* objVptr, int* materialIds, int numMaterials)
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- pylith::topology::MeshOps::checkMaterialIds(*mesh, materialIds, numMaterials);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- cdef int* materialIdVals
- materialIdVals = NULL
- numMaterials = len(materialIds);
- if numMaterials > 0:
- materialIdVals = <int*> malloc(numMaterials*sizeof(int));
- for i from 0 <= i < numMaterials:
- materialIdVals[i] = materialIds[i]
- Mesh_checkMaterialIds(self.thisptr, materialIdVals, numMaterials)
- free(materialIdVals)
- return
-
-
- def _createHandle(self):
- """
- Wrap pointer to C++ object in PyCObject.
- """
- return PyCObject_FromVoidPtr(self.thisptr, MeshPtr_destructor)
-
-
- property debug:
- def __set__(self, value):
- """
- Set debugging flag.
- """
- # create shim for method 'debug'
- #embed{ void Mesh_debug_set(void* objVptr, int value)
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- if (mesh->isNull())
- throw std::runtime_error("Cannot set debug flag when there is " \
- "no mesh data.");
- (*mesh)->setDebug(value);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- Mesh_debug_set(self.thisptr, value)
-
- def __get__(self):
- """
- Get debugging flag.
- """
- # create shim for method 'debug'
- #embed{ int Mesh_debug_get(void* objVptr)
- int result = 0;
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- result = (*mesh)->debug();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return Mesh_debug_get(self.thisptr)
-
-
- property dimension:
- def __get__(self):
- """
- Get dimension of mesh (dimension of cells).
- """
- # create shim for method 'dimension'
- #embed{ int Mesh_dimension_get(void* objVptr)
- int result = 0;
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- result = (*mesh)->getDimension();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- return Mesh_dimension_get(self.thisptr)
-
-
- property comm:
- def __get__(self):
- """
- Get MPI communicator associated with mesh.
- """
- # create shim for method 'comm'
- #embed{ void Mesh_comm_get(void* objVptr, void *vpycomm)
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) objVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- PyMPICommObject *pycomm = (PyMPICommObject *)vpycomm;
- pycomm->comm = (*mesh)->comm();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- cdef mpi.MPI_Comm pycomm
- pycomm = mpi.MPI_Comm()
- Mesh_comm_get(self.thisptr, <void*>pycomm)
- return pycomm
-
-
-# ----------------------------------------------------------------------
-cdef class MeshGenSimple:
-
- def createCubeBoundary(self, debug = 0):
- """
- Returns a Mesh that is the boundary of the unit cube
- """
- # create shim for method 'read'
- #embed{ void MeshGenerator_createCubeBoundary(int debug, void* meshVptr)
- try {
- assert(0 != meshVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- const double lower[3] = {0.0, 0.0, 0.0};
- const double upper[3] = {1.0, 1.0, 1.0};
- const int faces[3] = {1, 1, 1};
-#ifdef IMESH_TODO
- *mesh = ALE::MeshBuilder::createCubeBoundary(PETSC_COMM_WORLD, lower, upper, faces, debug);
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- mesh = Mesh()
- MeshGenerator_createCubeBoundary(debug, ptrFromHandle(mesh))
- return mesh
-
-
- def generate(self, meshBdry):
- """
- Generate a mesh from a boundary mesh.
- """
- # create shim for method 'read'
- #embed{ void MeshGenerator_generate(void* meshVptr, void* meshBdryVptr)
- try {
- assert(0 != meshVptr);
- assert(0 != meshBdryVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- ALE::Obj<pylith::Mesh>* meshBdry = (ALE::Obj<pylith::Mesh>*) meshBdryVptr;
-#ifdef IMESH_TODO
- *mesh = ALE::Generator::generateMesh(*meshBdry);
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if meshBdry.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- mesh = Mesh()
- MeshGenerator_generate(ptrFromHandle(mesh), ptrFromHandle(meshBdry))
- return mesh
-
-
-# ----------------------------------------------------------------------
-cdef class Distributor:
-
- def distribute(self, mesh, partitioner):
- """
- Distribute a mesh.
- """
- # create shim for method 'distribute'
- #embed{ void Distributor_distribute(void* newMeshVptr, void* meshVptr, char *partitioner)
- try {
- assert(0 != meshVptr);
- assert(0 != newMeshVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- ALE::Obj<pylith::Mesh>* newMesh = (ALE::Obj<pylith::Mesh>*) newMeshVptr;
- pylith::topology::Distributor::distribute(newMesh, *mesh, partitioner);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- newMesh = Mesh()
- Distributor_distribute(ptrFromHandle(newMesh), ptrFromHandle(mesh),
- partitioner)
- return newMesh
-
-
- def write(self, writer, mesh, cs):
- """
- Write partitioning information to file..
- """
- # create shim for method 'write'
- #embed{ void Distributor_write(void* writerVptr, void* meshVptr, void* csVptr)
- try {
- assert(0 != writerVptr);
- assert(0 != meshVptr);
- assert(0 != csVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- pylith::meshio::DataWriter* writer =
- (pylith::meshio::DataWriter*) writerVptr;
- spatialdata::geocoords::CoordSys* cs =
- (spatialdata::geocoords::CoordSys*) csVptr;
- pylith::topology::Distributor::write(writer, *mesh, cs);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if writer.name != "pylith_meshio_DataWriter":
- raise TypeError, \
- "Argument 'writer' must be extension module type 'DataWriter'."
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type 'Mesh'."
- if cs.name != "spatialdata_geocoords_CoordSys":
- raise TypeError, \
- "Argument 'cs' must be extension module type 'CoordSys'."
- Distributor_write(ptrFromHandle(writer), ptrFromHandle(mesh),
- ptrFromHandle(cs))
- return
-
-
-# ----------------------------------------------------------------------
-cdef void MeshRefiner_destructor(void* obj):
- """
- Destroy MeshRefiner object.
- """
- # create shim for destructor
- #embed{ void MeshRefiner_destructor_cpp(void* objVptr)
- pylith::topology::MeshRefiner* pRefiner =
- (pylith::topology::MeshRefiner*) objVptr;
- delete pRefiner;
- #}embed
- MeshRefiner_destructor_cpp(obj)
- return
-
-
-cdef class MeshRefiner:
-
- 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_topology_meshrefiner"
- return
-
-
- def _createHandle(self):
- """Wrap pointer to C++ object in PyCObject."""
- return PyCObject_FromVoidPtr(self.thisptr, MeshRefiner_destructor)
-
-
- def write(self, writer, mesh, cs):
- """
- Write refined mesh to file..
- """
- # create shim for method 'write'
- #embed{ void MeshRefiner_write(void* writerVptr, void* meshVptr, void* csVptr)
- try {
- assert(0 != writerVptr);
- assert(0 != meshVptr);
- assert(0 != csVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- pylith::meshio::DataWriter* writer =
- (pylith::meshio::DataWriter*) writerVptr;
- spatialdata::geocoords::CoordSys* cs =
- (spatialdata::geocoords::CoordSys*) csVptr;
- pylith::topology::MeshRefiner::write(writer, *mesh, cs);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if writer.name != "pylith_meshio_DataWriter":
- raise TypeError, \
- "Argument 'writer' must be extension module type 'DataWriter'."
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument 'mesh' must be extension module type 'Mesh'."
- if cs.name != "spatialdata_geocoords_CoordSys":
- raise TypeError, \
- "Argument 'cs' must be extension module type 'CoordSys'."
- MeshRefiner_write(ptrFromHandle(writer), ptrFromHandle(mesh),
- ptrFromHandle(cs))
- return
-
-
-# ----------------------------------------------------------------------
-cdef class RefineUniform(MeshRefiner):
-
- def __init__(self):
- """Constructor."""
- # create shim for constructor
- #embed{ void* RefineUniform_constructor()
- void* result = 0;
- try {
- result = (void*)(new pylith::topology::RefineUniform);
- assert(0 != result);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- MeshRefiner.__init__(self)
- self.thisptr = RefineUniform_constructor()
- self.handle = self._createHandle()
- return
-
-
- def refine(self, mesh, levels):
- """
- Refine mesh.
- """
- # create shim for method 'refine'
- #embed{ void RefineUniform_refine(void* objVptr, void* newMeshVptr, void* meshVptr, int levels)
- try {
- assert(0 != objVptr);
- assert(0 != meshVptr);
- assert(0 != newMeshVptr);
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- ALE::Obj<pylith::Mesh>* newMesh = (ALE::Obj<pylith::Mesh>*) newMeshVptr;
- ((pylith::topology::RefineUniform*) objVptr)->refine(newMesh, *mesh, levels);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- newMesh = Mesh()
- RefineUniform_refine(self.thisptr, ptrFromHandle(newMesh),
- ptrFromHandle(mesh), levels)
- return newMesh
-
-
-
-# ----------------------------------------------------------------------
-cdef void FieldsManager_destructor(void* obj):
- """
- Destroy FieldsManager.
- """
- #embed{ void FieldsManager_destructor_cpp(void* objVptr)
- pylith::topology::FieldsManager* manager = (pylith::topology::FieldsManager*) objVptr;
- delete manager;
- #}embed
- FieldsManager_destructor_cpp(obj)
- return
-
-cdef class FieldsManager:
-
- 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, mesh):
- """
- Constructor.
- """
- # create shim for constructor
- #embed{ void* FieldsManager_constructor(void* meshVptr)
- void* result = 0;
- try {
- ALE::Obj<pylith::Mesh>* mesh = (ALE::Obj<pylith::Mesh>*) meshVptr;
- assert(0 != mesh);
- assert(!mesh->isNull());
- pylith::topology::FieldsManager* manager =
- new pylith::topology::FieldsManager(*mesh);
- result = (void*) manager;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
-
- self.thisptr = FieldsManager_constructor(ptrFromHandle(mesh))
- self.handle = self._createHandle()
- self.name = "pylith_topology_FieldsManager"
- return
-
-
- def getReal(self, label):
- """
- Get real field over mesh.
- """
- # create shim for getReal
- #embed{ void* FieldsManager_getReal(void* objVptr, char* label)
- void* result = 0;
- try {
- pylith::topology::FieldsManager* manager =
- (pylith::topology::FieldsManager*) objVptr;
- assert(0 != manager);
- const ALE::Obj<pylith::real_section_type>& field =
- manager->getReal(label);
- assert(!field.isNull());
- result = (void*) &field;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- cdef void* ptr
- ptr = FieldsManager_getReal(self.thisptr, label)
- return PyCObject_FromVoidPtr(ptr, NULL)
-
-
- def addReal(self, label):
- """
- Create real section over mesh.
- """
- # create shim for addReal
- #embed{ void FieldsManager_addReal(void* objVptr, char* label)
- try {
- assert(0 != objVptr);
- ((pylith::topology::FieldsManager*) objVptr)->addReal(label);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FieldsManager_addReal(self.thisptr, label)
- return
-
-
- def delReal(self, label):
- """
- Delete real section over mesh.
- """
- # create shim for delReal
- #embed{ void FieldsManager_delReal(void* objVptr, char* label)
- try {
- assert(0 != objVptr);
- ((pylith::topology::FieldsManager*) objVptr)->delReal(label);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FieldsManager_delReal(self.thisptr, label)
- return
-
-
- def setFiberDimension(self, label, fiberDim, points):
- """
- Set fiber dimension for field.
- """
- # create shim for setFiberDimension
- #embed{ void FieldsManager_setFiberDimension(void* objVptr, char* label, int fiberDim, char* points)
- try {
- assert(0 != objVptr);
- ((pylith::topology::FieldsManager*) objVptr)->setFiberDimension(label, fiberDim, points);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FieldsManager_setFiberDimension(self.thisptr, label, fiberDim, points)
- return
-
-
- def allocate(self, label):
- """
- Allocate field.
- """
- # create shim for allocate
- #embed{ void FieldsManager_allocate(void* objVptr, char* label)
- try {
- assert(0 != objVptr);
- ((pylith::topology::FieldsManager*) objVptr)->allocate(label);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FieldsManager_allocate(self.thisptr, label)
- return
-
-
- def copyLayout(self, label):
- """
- Copy layout of given section to all other sections in manager.
- """
- # create shim for copyLayout
- #embed{ void FieldsManager_copyLayout(void* objVptr, char* label)
- try {
- assert(0 != objVptr);
- ((pylith::topology::FieldsManager*) objVptr)->copyLayout(label);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FieldsManager_copyLayout(self.thisptr, label)
- return
-
-
- def copyLayoutFromSrc(self, field):
- """
- Copy layout of section to all sections in manager.
- """
- # create shim for copyLayout
- #embed{ void FieldsManager_copyLayoutFromSrc(void* objVptr, void* fieldVptr)
- try {
- assert(0 != objVptr);
- assert(0 != fieldVptr);
- const ALE::Obj<pylith::real_section_type>* field =
- (ALE::Obj<pylith::real_section_type>*) fieldVptr;
- ((pylith::topology::FieldsManager*) objVptr)->copyLayout(*field);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FieldsManager_copyLayoutFromSrc(self.thisptr, PyCObject_AsVoidPtr(field))
- return
-
-
- def solutionField(self, name):
- """
- Set name of field corresponding to solution.
- """
- # create shim for solutionField
- #embed{ void FieldsManager_solutionField(void* objVptr, char* name)
- try {
- assert(0 != objVptr);
- ((pylith::topology::FieldsManager*) objVptr)->solutionField(name);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FieldsManager_solutionField(self.thisptr, name)
-
-
- def getSolution(self):
- """
- Get field corresponding to solution.
- """
- # create shim for getSolution
- #embed{ void* FieldsManager_getSolution(void* objVptr)
- void* result = 0;
- try {
- assert(0 != objVptr);
- const ALE::Obj<pylith::real_section_type>& field =
- ((pylith::topology::FieldsManager*) objVptr)->getSolution();
- result = (void*) &field;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- cdef void* ptr
- ptr = FieldsManager_getSolution(self.thisptr)
- return PyCObject_FromVoidPtr(ptr, NULL)
-
-
- def createHistory(self, labels):
- """
- Create history manager for a subset of the managed fields.
- """
- # create shim for createHistory
- #embed{ void FieldsManager_createHistory(void* objVptr, char** labels, int size)
- try {
- assert(0 != objVptr);
- ((pylith::topology::FieldsManager*) objVptr)->createHistory((const char**) labels, size);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- cdef char** labelsPtr
- size = len(labels)
- labelsPtr = <char**> malloc(size*sizeof(char*))
- for i from 0 <= i < size:
- labelsPtr[i] = labels[i]
- FieldsManager_createHistory(self.thisptr, labelsPtr, size)
- free(labelsPtr)
- return
-
-
- def shiftHistory(self):
- """
- Shift fields in history.
- """
- # create shim for shiftHistory
- #embed{ void FieldsManager_shiftHistory(void* objVptr)
- try {
- assert(0 != objVptr);
- ((pylith::topology::FieldsManager*) objVptr)->shiftHistory();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- FieldsManager_shiftHistory(self.thisptr)
- return
-
-
- def getFieldByHistory(self, index):
- """
- Get field in history by position.
- """
- # create shim for getFieldByHistory
- #embed{ void* FieldsManager_getFieldByHistory(void* objVptr, int index)
- void* result = 0;
- try {
- assert(0 != objVptr);
- const ALE::Obj<pylith::real_section_type>& field =
- ((pylith::topology::FieldsManager*) objVptr)->getFieldByHistory(index);
- result = (void*) &field;
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- return result;
- #}embed
- cdef void* ptr
- ptr = FieldsManager_getFieldByHistory(self.thisptr, index)
- return PyCObject_FromVoidPtr(ptr, NULL)
-
-
- def _createHandle(self):
- """
- Wrap pointer to C++ object in PyCObject.
- """
- return PyCObject_FromVoidPtr(self.thisptr, FieldsManager_destructor)
-
-
-# ----------------------------------------------------------------------
-def zeroRealSection(section):
- """
- Zero real section.
- """
- # create shim for zero section
- #embed{ void* Section_zero(void* objVptr)
- try {
- ALE::Obj<pylith::real_section_type>* section =
- (ALE::Obj<pylith::real_section_type>*) objVptr;
- assert(!section->isNull());
- (*section)->zero();
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- cdef void* ptr
- ptr = PyCObject_AsVoidPtr(section)
- Section_zero(ptr)
- return
-
-
-# ----------------------------------------------------------------------
-def completeSection(mesh, section):
- """
- Complete the section across the mesh overlap.
- """
- # create shim for method 'completeSection'
- #embed{ void Section_complete(void* sectionVptr, void* meshVptr)
- try {
- assert(0 != sectionVptr);
- assert(0 != meshVptr);
- ALE::Obj<pylith::Mesh>* mesh =
- (ALE::Obj<pylith::Mesh>*) meshVptr;
- ALE::Obj<pylith::real_section_type>* section =
- (ALE::Obj<pylith::real_section_type>*) sectionVptr;
-#if 1
- ALE::Completion::completeSectionAdd((*mesh)->getSendOverlap(), (*mesh)->getRecvOverlap(), *section, *section);
-#else
- ALE::Distribution<pylith::Mesh>::completeSection(*mesh, *section);
-#endif
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- if mesh.name != "pylith_topology_Mesh":
- print mesh.name
- raise TypeError, \
- "Argument must be extension module type 'Mesh'."
- Section_complete(PyCObject_AsVoidPtr(section),
- ptrFromHandle(mesh))
- return
-
-
-# ----------------------------------------------------------------------
-def copyRealSection(dst, src):
- """
- Copy values from one section into another, ignoring constraints.
- """
- # create shim for Field::copy()
- #embed{ void Section_copyRealSection(void* objVptr, void* srcVptr)
- try {
- ALE::Obj<pylith::real_section_type>* dst =
- (ALE::Obj<pylith::real_section_type>*) objVptr;
- assert(!dst->isNull());
- ALE::Obj<pylith::real_section_type>* src =
- (ALE::Obj<pylith::real_section_type>*) srcVptr;
- assert(!src->isNull());
- (*dst)->zero();
- (*dst)->axpy(1.0, *src);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- Section_copyRealSection(PyCObject_AsVoidPtr(dst),
- PyCObject_AsVoidPtr(src))
- return
-
-
-# ----------------------------------------------------------------------
-def addRealSections(dst, srcA, srcB):
- """
- Add two sections, storing result in third section.
- """
- # create shim for Field::add()
- #embed{ void Section_addRealSections(void* objVptr, void* aVptr, void* bVptr)
- try {
- ALE::Obj<pylith::real_section_type>* dst =
- (ALE::Obj<pylith::real_section_type>*) objVptr;
- assert(!dst->isNull());
- ALE::Obj<pylith::real_section_type>* a =
- (ALE::Obj<pylith::real_section_type>*) aVptr;
- assert(!a->isNull());
- ALE::Obj<pylith::real_section_type>* b =
- (ALE::Obj<pylith::real_section_type>*) bVptr;
- assert(!b->isNull());
- (*dst)->add(*a, *b);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- Section_addRealSections(PyCObject_AsVoidPtr(dst),
- PyCObject_AsVoidPtr(srcA),
- PyCObject_AsVoidPtr(srcB))
- return
-
-
-# ----------------------------------------------------------------------
-def sectionView(field, label):
- """
- View section.
- """
- # create shim for section::view()
- #embed{ void Section_view(void* objVptr, char* label)
- try {
- ALE::Obj<pylith::real_section_type>* field =
- (ALE::Obj<pylith::real_section_type>*) objVptr;
- assert(0 != field);
- assert(!field->isNull());
- (*field)->view(label);
- } catch (const std::exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.what()));
- } catch (const ALE::Exception& err) {
- PyErr_SetString(PyExc_RuntimeError,
- const_cast<char*>(err.msg().c_str()));
- } catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Caught unknown C++ exception.");
- } // try/catch
- #}embed
- Section_view(PyCObject_AsVoidPtr(field), label)
- return
-
-
-# End of file
Deleted: short/3D/PyLith/trunk/pylith/topology/FieldsManager.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/FieldsManager.py 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/pylith/topology/FieldsManager.py 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,135 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/topology/FieldsManager.py
-##
-## @brief Python manager for fields over a mesh.
-
-# FieldsManager class
-class FieldsManager(object):
- """
- Python manager for fields over a mesh.
- """
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self, mesh):
- """
- Constructor.
- """
- import pylith.topology.topology as bindings
- self.cppHandle = bindings.FieldsManager(mesh.cppHandle)
- return
-
-
- def addReal(self, label):
- """
- Create real field over mesh.
- """
- assert(None != self.cppHandle)
- return self.cppHandle.addReal(label)
-
-
- def getReal(self, label):
- """
- Get real field over mesh.
- """
- assert(None != self.cppHandle)
- return self.cppHandle.getReal(label)
-
-
- def delReal(self, label):
- """
- Delete real field over mesh.
- """
- assert(None != self.cppHandle)
- return self.cppHandle.delReal(label)
-
-
- def setFiberDimension(self, label, fiberDim, points="vertices"):
- """
- Set fiber dimension for field
-
- points = { 'vertices', 'cells' }
- """
- assert(None != self.cppHandle)
- return self.cppHandle.setFiberDimension(label, fiberDim, points)
-
-
- def allocate(self, label):
- """
- Allocate field.
- """
- assert(None != self.cppHandle)
- return self.cppHandle.allocate(label)
-
-
- def copyLayout(self, label):
- """
- Copy layout of field to all fields in manager.
- """
- assert(None != self.cppHandle)
- return self.cppHandle.copyLayout(label)
-
-
- def copyLayoutFromSrc(self, field):
- """
- Copy layout of field to all fields in manager..
- """
- assert(None != self.cppHandle)
- return self.cppHandle.copyLayoutFromSrc(field)
-
-
- def solutionField(self, name):
- """
- Set name of field corresponding to solution.
- """
- assert(None != self.cppHandle)
- self.cppHandle.solutionField(name)
- return
-
-
- def getSolution(self):
- """
- Get field corresponding to solution.
- """
- assert(None != self.cppHandle)
- return self.cppHandle.getSolution()
-
-
- def createHistory(self, labels):
- """
- Create history manager for a subset of the managed fields.
- """
- assert(None != self.cppHandle)
- self.cppHandle.createHistory(labels)
- return
-
-
- def shiftHistory(self):
- """
- Shift fields in history.
- """
- assert(None != self.cppHandle)
- self.cppHandle.shiftHistory()
- return
-
-
- def getFieldByHistory(self, index):
- """
- Get field in history by position.
- """
- assert(None != self.cppHandle)
- return self.cppHandle.getFieldByHistory(index)
-
-
-# End of file
Added: short/3D/PyLith/trunk/share/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/share/Makefile.am (rev 0)
+++ short/3D/PyLith/trunk/share/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -0,0 +1,17 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+EXTRA_DIST = \
+ valgrind-python.supp
+
+
+# End of file
Modified: short/3D/PyLith/trunk/templates/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/templates/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/templates/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -24,6 +24,10 @@
materials/PlaneStrainState.py \
materials/tests/Makefile.am \
materials/tests/testcontrib.py \
- materials/tests/TestPlaneStrainState.py
+ materials/tests/TestPlaneStrainState.py \
+ materials/m4/ac_pkg_swig.m4 \
+ materials/m4/cit_numpy.m4 \
+ materials/m4/cit_python.m4
+
# End of file
Modified: short/3D/PyLith/trunk/tests/1d/line2/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line2/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/tests/1d/line2/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -17,7 +17,8 @@
dist_noinst_PYTHON = \
TestLine2.py \
TestAxial.py \
- TestDislocation.py
+ TestDislocation.py \
+ testpylith.py
dist_noinst_DATA = \
bar.mesh \
Modified: short/3D/PyLith/trunk/tests/1d/line3/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/tests/1d/line3/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/tests/1d/line3/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -17,7 +17,8 @@
dist_noinst_PYTHON = \
TestLine3.py \
TestAxial.py \
- TestDislocation.py
+ TestDislocation.py \
+ testpylith.py
dist_noinst_DATA = \
bar.mesh \
Modified: short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/tests/2d/quad4/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -23,14 +23,19 @@
sheardisp_soln.py \
sheardisp_gendb.py \
TestDislocation.py \
- dislocation_soln.py
+ dislocation_soln.py \
+ dislocation2_soln.py \
+ testpylith.py
dist_noinst_DATA = \
+ geometry.jou \
+ mesh.jou \
mesh.exo \
matprops.spatialdb \
axialdisp.cfg \
sheardisp.cfg \
- dislocation.cfg
+ dislocation.cfg \
+ dislocation2.cfg
noinst_TMP = \
axial_disp.spatialdb \
Modified: short/3D/PyLith/trunk/tests/2d/tri3/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/tests/2d/tri3/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/tests/2d/tri3/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -21,12 +21,15 @@
axialdisp_gendb.py \
TestShearDisp.py \
sheardisp_soln.py \
- sheardisp_gendb.py
+ sheardisp_gendb.py \
+ testpylith.py
# TestDislocation.py \
# dislocation_soln.py
dist_noinst_DATA = \
+ geometry.jou \
+ mesh.jou \
mesh.exo \
matprops.spatialdb \
axialdisp.cfg \
Deleted: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann_OLD.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann_OLD.cc 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann_OLD.cc 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,295 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestNeumann.hh" // Implementation of class methods
-
-#include "pylith/bc/Neumann.hh" // USES Neumann
-
-#include "data/NeumannData.hh" // USES NeumannData
-
-#include "pylith/topology/Mesh.hh" // USES Mesh
-#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
-#include "pylith/topology/SubMesh.hh" // USES SubMesh
-#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
-#include "pylith/topology/SolutionFields.hh" // USES SolutionFields
-
-#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
-#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
-#include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii
-
-#include <stdexcept> // USES std::runtime_erro
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestNeumann );
-
-// ----------------------------------------------------------------------
-typedef pylith::topology::SubMesh::SieveMesh SieveMesh;
-typedef pylith::topology::SubMesh::RealSection RealSection;
-typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
-typedef pylith::topology::SubMesh::RealSection SubRealSection;
-typedef pylith::topology::SubMesh::RestrictVisitor RestrictVisitor;
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestNeumann::setUp(void)
-{ // setUp
- _data = 0;
- _quadrature = new feassemble::Quadrature<topology::SubMesh>();
- CPPUNIT_ASSERT(0 != _quadrature);
-} // setUp
-
-// ----------------------------------------------------------------------
-// Tear down testing data.
-void
-pylith::bc::TestNeumann::tearDown(void)
-{ // tearDown
- delete _data; _data = 0;
- delete _quadrature; _quadrature = 0;
-} // tearDown
-
-// ----------------------------------------------------------------------
-// Test constructor.
-void
-pylith::bc::TestNeumann::testConstructor(void)
-{ // testConstructor
- Neumann bc;
-} // testConstructor
-
-// ----------------------------------------------------------------------
-// Test db().
-void
-pylith::bc::TestNeumann::testDB(void)
-{ // testDB
- const std::string& label = "my db";
- spatialdata::spatialdb::SimpleDB db(label.c_str());
- Neumann bc;
- bc.db(&db);
-
- CPPUNIT_ASSERT(0 != bc._db);
- CPPUNIT_ASSERT_EQUAL(label, std::string(bc._db->label()));
-} // testDB
-
-// ----------------------------------------------------------------------
-// Test initialize().
-void
-pylith::bc::TestNeumann::testInitialize(void)
-{ // testInitialize
- topology::Mesh mesh;
- Neumann bc;
- topology::SolutionFields fields(mesh);
- _initialize(&mesh, &bc, &fields);
-
- CPPUNIT_ASSERT(0 != _data);
-
- const topology::SubMesh& boundaryMesh = *bc._boundaryMesh;
- const ALE::Obj<SieveSubMesh>& submesh = boundaryMesh.sieveMesh();
-
- // Check boundary mesh
- CPPUNIT_ASSERT(!submesh.isNull());
-
- const int cellDim = boundaryMesh.dimension();
- const int numCorners = _data->numCorners;
- const int spaceDim = _data->spaceDim;
- const ALE::Obj<SieveSubMesh::label_sequence>& cells = submesh->heightStratum(1);
- const int numBoundaryVertices = submesh->depthStratum(0)->size();
- const int numBoundaryCells = cells->size();
-
- CPPUNIT_ASSERT_EQUAL(_data->cellDim, cellDim);
- CPPUNIT_ASSERT_EQUAL(_data->numBoundaryVertices, numBoundaryVertices);
- CPPUNIT_ASSERT_EQUAL(_data->numBoundaryCells, numBoundaryCells);
-
- const int boundaryDepth = submesh->depth()-1; // depth of boundary cells
- const ALE::Obj<SubRealSection>& coordinates =
- submesh->getRealSection("coordinates");
- RestrictVisitor coordsVisitor(*coordinates, numCorners*spaceDim);
- // coordinates->view("Mesh coordinates from TestNeumann::testInitialize");
-
- const int numBasis = bc._quadrature->numBasis();
- const int cellVertSize = _data->numCorners * spaceDim;
- double_array cellVertices(cellVertSize);
-
- const double tolerance = 1.0e-06;
-
- // check cell vertices
- int iCell = 0;
- for(SieveSubMesh::label_sequence::iterator c_iter = cells->begin();
- c_iter != cells->end();
- ++c_iter) {
- const int numCorners = submesh->getNumCellCorners(*c_iter, boundaryDepth);
- CPPUNIT_ASSERT_EQUAL(_data->numCorners, numCorners);
-
- coordsVisitor.clear();
- submesh->restrictClosure(*c_iter, coordsVisitor);
- double vert =0.0;
- double vertE =0.0;
- const double* cellVertices = coordsVisitor.getValues();
- // std::cout << "c_iter " << *c_iter << " vertex coords:" << std::endl;
- for(int iVert = 0; iVert < numCorners; ++iVert) {
- for(int iDim = 0; iDim < spaceDim; ++iDim) {
- vertE = _data->cellVertices[iDim+spaceDim*iVert+iCell*cellVertSize];
- vert = cellVertices[iDim+spaceDim*iVert];
- // std::cout << " " << cellVertices[iDim+spaceDim*iVert];
- if (fabs(vertE) > 1.0)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vert/vertE, tolerance);
- else
- CPPUNIT_ASSERT_DOUBLES_EQUAL(vert, vertE, tolerance);
- } // for
- // std::cout << std::endl;
- } // for
- iCell++;
- } // for
-
- // Check traction values
- const int numQuadPts = _data->numQuadPts;
- const int fiberDim = numQuadPts * spaceDim;
- double_array tractionsCell(fiberDim);
- int index = 0;
- CPPUNIT_ASSERT(0 != bc._parameters);
- const ALE::Obj<SubRealSection>& tractionSection =
- bc._parameters->get("traction").section();
-
- for(SieveSubMesh::label_sequence::iterator c_iter = cells->begin();
- c_iter != cells->end();
- ++c_iter) {
- tractionSection->restrictPoint(*c_iter,
- &tractionsCell[0], tractionsCell.size());
- for (int iQuad=0; iQuad < numQuadPts; ++iQuad)
- for (int iDim =0; iDim < spaceDim; ++iDim) {
- const double tractionsCellData = _data->tractionsCell[index];
- CPPUNIT_ASSERT_DOUBLES_EQUAL(tractionsCellData,
- tractionsCell[iQuad*spaceDim+iDim],
- tolerance);
- ++index;
- } // for
- } // for
-
-} // testInitialize
-
-// ----------------------------------------------------------------------
-// Test integrateResidual().
-void
-pylith::bc::TestNeumann::testIntegrateResidual(void)
-{ // testIntegrateResidual
- CPPUNIT_ASSERT(0 != _data);
-
- topology::Mesh mesh;
- Neumann bc;
- topology::SolutionFields fields(mesh);
- _initialize(&mesh, &bc, &fields);
-
- topology::Field<topology::Mesh>& residual = fields.get("residual");
- const double t = 0.0;
- bc.integrateResidual(residual, t, &fields);
-
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- CPPUNIT_ASSERT(!sieveMesh.isNull());
- CPPUNIT_ASSERT(!sieveMesh->depthStratum(0).isNull());
-
- const double* valsE = _data->valsResidual;
- const int totalNumVertices = sieveMesh->depthStratum(0)->size();
- const int sizeE = _data->spaceDim * totalNumVertices;
-
- const ALE::Obj<RealSection>& residualSection = residual.section();
- CPPUNIT_ASSERT(!residualSection.isNull());
-
- const double* vals = residualSection->restrictSpace();
- const int size = residualSection->sizeWithBC();
- CPPUNIT_ASSERT_EQUAL(sizeE, size);
-
- //residual.view("RESIDUAL");
-
- const double tolerance = 1.0e-06;
- // std::cout << "computed residuals: " << std::endl;
- for (int i=0; i < size; ++i)
- // std::cout << " " << vals[i] << std::endl;
- if (fabs(valsE[i]) > 1.0)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/valsE[i], tolerance);
- else
- CPPUNIT_ASSERT_DOUBLES_EQUAL(valsE[i], vals[i], tolerance);
-} // testIntegrateResidual
-
-// ----------------------------------------------------------------------
-void
-pylith::bc::TestNeumann::_initialize(topology::Mesh* mesh,
- Neumann* const bc,
- topology::SolutionFields* fields) const
-{ // _initialize
- CPPUNIT_ASSERT(0 != _data);
- CPPUNIT_ASSERT(0 != mesh);
- CPPUNIT_ASSERT(0 != bc);
- CPPUNIT_ASSERT(0 != fields);
- CPPUNIT_ASSERT(0 != _quadrature);
-
- try {
- // Set up mesh
- meshio::MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(mesh);
-
- // Set up coordinates
- spatialdata::geocoords::CSCart cs;
- spatialdata::units::Nondimensional normalizer;
- cs.setSpaceDim(mesh->dimension());
- cs.initialize();
- mesh->coordsys(&cs);
- mesh->nondimensionalize(normalizer);
-
- // Set up quadrature
- _quadrature->initialize(_data->basis, _data->numQuadPts, _data->numBasis,
- _data->basisDerivRef, _data->numQuadPts,
- _data->numBasis, _data->cellDim,
- _data->quadPts, _data->numQuadPts, _data->cellDim,
- _data->quadWts, _data->numQuadPts,
- _data->spaceDim);
-
- // Set up database
- spatialdata::spatialdb::SimpleDB db("TestNeumann");
- spatialdata::spatialdb::SimpleIOAscii dbIO;
- dbIO.filename(_data->spatialDBFilename);
- db.ioHandler(&dbIO);
- db.queryType(spatialdata::spatialdb::SimpleDB::LINEAR);
-
- const double upDir[] = { 0.0, 0.0, 1.0 };
-
- bc->quadrature(_quadrature);
- bc->label(_data->label);
- bc->db(&db);
- bc->createSubMesh(*mesh);
- bc->initialize(*mesh, upDir);
-
- // Set up fields
- CPPUNIT_ASSERT(0 != fields);
- fields->add("residual", "residual");
- fields->add("disp(t), bc(t+dt)", "displacement");
- fields->solutionName("disp(t), bc(t+dt)");
-
- topology::Field<topology::Mesh>& residual = fields->get("residual");
- const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
- CPPUNIT_ASSERT(!sieveMesh.isNull());
- const ALE::Obj<SieveMesh::label_sequence>& vertices =
- sieveMesh->depthStratum(0);
- CPPUNIT_ASSERT(!vertices.isNull());
- residual.newSection(vertices, _data->spaceDim);
- residual.allocate();
- residual.zero();
-
- fields->copyLayout("residual");
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
-} // _initialize
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann_OLD.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann_OLD.hh 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann_OLD.hh 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,95 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestNeumann.hh
- *
- * @brief C++ TestNeumann object.
- *
- * C++ unit testing for Neumann.
- */
-
-#if !defined(pylith_bc_testneumann_hh)
-#define pylith_bc_testneumann_hh
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "pylith/bc/bcfwd.hh" // forward declarations
-#include "pylith/topology/topologyfwd.hh" // forward declarations
-#include "pylith/feassemble/feassemblefwd.hh" // forward declarations
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestNeumann;
- class NeumannData; // HOLDSA NeumannData
- } // bc
-} // pylith
-
-/// C++ unit testing for Neumann.
-class pylith::bc::TestNeumann : public CppUnit::TestFixture
-{ // class TestNeumann
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestNeumann );
-
- CPPUNIT_TEST( testConstructor );
- CPPUNIT_TEST( testDB );
-
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
- /// Tear down testing data.
- void tearDown(void);
-
- /// Test constructor.
- void testConstructor(void);
-
- /// Test db()
- void testDB(void);
-
- /// Test initialize().
- void testInitialize(void);
-
- /// Test integrateResidual().
- void testIntegrateResidual(void);
-
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- NeumannData* _data; ///< Data for testing
- feassemble::Quadrature<topology::SubMesh>* _quadrature; ///< Used in testing.
-
- // PRIVATE METHODS ////////////////////////////////////////////////////
-private :
-
- /** Initialize Neumann boundary condition.
- *
- * @param mesh Finite-element mesh to initialize
- * @param bc Neumann boundary condition to initialize.
- * @param fields Solution fields.
- */
- void _initialize(topology::Mesh* mesh,
- Neumann* const bc,
- topology::SolutionFields* fields) const;
-
-}; // class TestNeumann
-
-#endif // pylith_bc_neumann_hh
-
-
-// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -104,6 +104,8 @@
TestGeometryQuad3D.hh \
TestGeometryTet3D.hh \
TestGeometryHex3D.hh \
+ TestQuadratureRefCell.hh \
+ TestQuadratureEngine.hh \
TestIntegrator.hh \
TestIntegratorElasticity.hh \
TestQuadrature.hh \
Modified: short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -37,6 +37,7 @@
noinst_HEADERS = \
+ TestMetadata.hh \
TestMaterial.hh \
TestElasticMaterial.hh \
TestElasticStrain1D.hh \
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -73,6 +73,7 @@
TestDataWriterVTKMatMeshQuad4.hh \
TestDataWriterVTKMatMeshTet4.hh \
TestDataWriterVTKMatMeshHex8.hh \
+ TestDataWriterVTKSubMesh.hh \
TestDataWriterVTKSubMeshLine2.hh \
TestDataWriterVTKSubMeshTri3.hh \
TestDataWriterVTKSubMeshQuad4.hh \
Deleted: short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldUniform.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldUniform.cc 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldUniform.cc 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,154 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestFieldUniform.hh" // Implementation of class methods
-#include "pylith/topology/FieldUniform.hh" // USES FieldUniform
-
-#include "pylith/topology/Mesh.hh" // USES Mesh
-#include "pylith/utils/array.hh" // USES double_array
-
-#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestFieldUniform );
-
-// ----------------------------------------------------------------------
-namespace pylith {
- namespace topology {
- namespace _TestFieldUniform {
- const int spaceDim = 2;
- const int cellDim = 2;
- const int nvertices = 4;
- const int ncells = 1;
- const int ncorners = 4;
- const int cells[] = { 0, 1, 2, 3 };
- const double coordinates[] = {
- 0.0, 0.0,
- 1.0, 0.0,
- 0.0, 1.0,
- 1.0, 1.0,
- };
- } // _TestFieldUniform
- } // topology
-} // pylith
-
-// ----------------------------------------------------------------------
-// Test constructor.
-void
-pylith::topology::TestFieldUniform::testConstructor(void)
-{ // testConstructor
- Mesh mesh;
- mesh.createSieveMesh();
- const int fiberDim = 4;
- FieldUniform field(mesh.sieveMesh(), fiberDim);
-
- CPPUNIT_ASSERT(!field._mesh.isNull());
- CPPUNIT_ASSERT_EQUAL(fiberDim, field._fiberDim);
-} // testConstructor
-
-// ----------------------------------------------------------------------
-// Test createSection() with points.
-void
-pylith::topology::TestFieldUniform::testCreateSectionPoints(void)
-{ // testCreateSectionPoints
- const int fiberDim = 3;
-
- Mesh mesh;
- _buildMesh(&mesh);
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- const ALE::Obj<SieveMesh::label_sequence>& vertices =
- sieveMesh->depthStratum(0);
-
- FieldUniform field(sieveMesh, fiberDim);
- field.createSection(vertices);
-
- const ALE::Obj<SieveRealSection>& section = field.section();
- for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != vertices->end();
- ++v_iter)
- CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
-} // testCreateSectionPoints
-
-// ----------------------------------------------------------------------
-// Test createSection() with chart.
-void
-pylith::topology::TestFieldUniform::testCreateSectionChart(void)
-{ // testCreateSectionChart
- const int fiberDim = 2;
-
- Mesh mesh;
- _buildMesh(&mesh);
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- const ALE::Obj<SieveMesh::label_sequence>& vertices =
- sieveMesh->depthStratum(0);
-
- // Create field with to use to create new field
- FieldUniform fieldSrc(sieveMesh, fiberDim);
- { // Setup source field
- fieldSrc.newSection();
- const ALE::Obj<SieveRealSection>& section = fieldSrc.section();
- section->setChart(SieveMesh::real_section_type::chart_type(
- *std::min_element(vertices->begin(), vertices->end()),
- *std::max_element(vertices->begin(), vertices->end())+1));
- section->setFiberDimension(vertices, fiberDim);
- sieveMesh->allocate(section);
- } // Setup source field
-
- FieldUniform field(sieveMesh, fiberDim);
- field.createSection(fieldSrc.section()->getChart());
-
- const ALE::Obj<SieveRealSection>& section = field.section();
- for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != vertices->end();
- ++v_iter)
- CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
-} // testCreateSectionChart
-
-// ----------------------------------------------------------------------
-void
-pylith::topology::TestFieldUniform::_buildMesh(Mesh* mesh)
-{ // _buildMesh
- assert(0 != mesh);
-
- mesh->createSieveMesh(_TestFieldUniform::cellDim);
- const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
-
- ALE::Obj<SieveMesh::sieve_type> sieve =
- new SieveMesh::sieve_type(sieveMesh->comm());
- CPPUNIT_ASSERT(!sieve.isNull());
-
- ALE::Obj<ALE::Mesh::sieve_type> s =
- new ALE::Mesh::sieve_type(sieve->comm(), sieve->debug());
-
- const int cellDim = _TestFieldUniform::cellDim;
- const int ncells = _TestFieldUniform::ncells;
- const int* cells = _TestFieldUniform::cells;
- const int nvertices = _TestFieldUniform::nvertices;
- const int ncorners = _TestFieldUniform::ncorners;
- const int spaceDim = _TestFieldUniform::spaceDim;
- const double* coordinates = _TestFieldUniform::coordinates;
- const bool interpolate = false;
- ALE::SieveBuilder<ALE::Mesh>::buildTopology(s, cellDim, ncells, (int*) cells,
- nvertices, interpolate,
- ncorners);
- std::map<SieveMesh::point_type,SieveMesh::point_type> renumbering;
- ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
- sieveMesh->setSieve(sieve);
- sieveMesh->stratify();
- ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim,
- coordinates);
-
-} // _buildMesh
-
-// End of file
Deleted: short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldUniform.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldUniform.hh 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldUniform.hh 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,76 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/topology/TestFieldUniform.hh
- *
- * @brief C++ unit testing for FieldUniform.
- */
-
-#if !defined(pylith_topology_testfielduniform_hh)
-#define pylith_topology_testfielduniform_hh
-
-// Include directives ---------------------------------------------------
-#include <cppunit/extensions/HelperMacros.h>
-
-// Forward declarations -------------------------------------------------
-/// Namespace for pylith package
-namespace pylith {
- namespace topology {
- class TestFieldUniform;
-
- class FieldUniform;
- class Mesh;
- } // topology
-} // pylith
-
-// TestFieldUniform -------------------------------------------------------------
-/// C++ unit testing for FieldUniform.
-class pylith::topology::TestFieldUniform : public CppUnit::TestFixture
-{ // class TestFieldUniform
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestFieldUniform );
-
- CPPUNIT_TEST( testConstructor );
- CPPUNIT_TEST( testCreateSectionPoints );
- CPPUNIT_TEST( testCreateSectionChart );
-
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Test constructor.
- void testConstructor(void);
-
- /// Test createSection() with points.
- void testCreateSectionPoints(void);
-
- /// Test createSection() with chart.
- void testCreateSectionChart(void);
-
-// PRIVATE METHODS /////////////////////////////////////////////////////
-private :
-
- /** Build mesh.
- *
- * @param mesh Finite-element mesh.
- */
- void _buildMesh(Mesh* mesh);
-
-}; // class TestFieldUniform
-
-#endif // pylith_topology_testfielduniform_hh
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/unittests/pytests/feassemble/testfeassemble.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/testfeassemble.pyxe.src 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/testfeassemble.pyxe.src 2009-06-19 16:59:05 UTC (rev 15349)
@@ -1,245 +0,0 @@
-# -*- Pyrex -*-
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-#header{
-#include "TestQuadrature.hh"
-#}header
-
-import spatialdata.utils.simplearray
-
-# ----------------------------------------------------------------------
-cdef extern from "Python.h":
- object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
- void* PyCObject_AsVoidPtr(object)
-
-cdef void* ptrFromHandle(obj):
- return PyCObject_AsVoidPtr(obj.handle)
-
-cdef extern from "stdlib.h":
- ctypedef unsigned long size_t
- void* malloc(size_t size)
- void free(void* mem)
-
-
-# ----------------------------------------------------------------------
-# create shim for TestQuadrature::cellDim
-#embed{ int TestQuadrature_cellDim(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-return pylith::feassemble::TestQuadrature::cellDim(*q);
-#}embed
-
-# create shim for TestQuadrature::numBasis
-#embed{ int TestQuadrature_numBasis(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-return pylith::feassemble::TestQuadrature::numBasis(*q);
-#}embed
-
-# create shim for TestQuadrature::numQuadPts
-#embed{ int TestQuadrature_numQuadPts(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-return pylith::feassemble::TestQuadrature::numQuadPts(*q);
-#}embed
-
-# create shim for TestQuadrature::spaceDim
-#embed{ int TestQuadrature_spaceDim(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-return pylith::feassemble::TestQuadrature::spaceDim(*q);
-#}embed
-
-# create shim for TestQuadrature::basis
-#embed{ double* TestQuadrature_basis(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-const int size = TestQuadrature_numQuadPts(obj) *
- TestQuadrature_numBasis(obj);
-double* vals = (size > 0) ? new double[size] : 0;
-const double* basis = pylith::feassemble::TestQuadrature::basis(*q);
-memcpy(vals, basis, size*sizeof(double));
-return vals;
-#}embed
-
-# create shim for TestQuadrature::vertices
-#embed{ double* TestQuadrature_vertices(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-const int size = TestQuadrature_numBasis(obj) *
- TestQuadrature_cellDim(obj);
-double* vals = (size > 0) ? new double[size] : 0;
-const double* vertices = pylith::feassemble::TestQuadrature::vertices(*q);
-memcpy(vals, vertices, size*sizeof(double));
-return vals;
-#}embed
-
-# create shim for TestQuadrature::basisDeriv
-#embed{ double* TestQuadrature_basisDeriv(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-const int size = TestQuadrature_numQuadPts(obj) *
- TestQuadrature_numBasis(obj) *
- TestQuadrature_cellDim(obj);
-double* vals = (size > 0) ? new double[size] : 0;
-const double* basisDeriv = pylith::feassemble::TestQuadrature::basisDeriv(*q);
-memcpy(vals, basisDeriv, size*sizeof(double));
-return vals;
-#}embed
-
-# create shim for TestQuadrature::quadPtsRef
-#embed{ double* TestQuadrature_quadPtsRef(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-const int size = TestQuadrature_numQuadPts(obj) *
- TestQuadrature_cellDim(obj);
-double* vals = (size > 0) ? new double[size] : 0;
-const double* quadPtsRef = pylith::feassemble::TestQuadrature::quadPtsRef(*q);
-memcpy(vals, quadPtsRef, size*sizeof(double));
-return vals;
-#}embed
-
-# create shim for TestQuadrature::quadWts
-#embed{ double* TestQuadrature_quadWts(void* obj)
-const pylith::feassemble::Quadrature* q =
- (pylith::feassemble::Quadrature*) obj;
-const int size = TestQuadrature_numQuadPts(obj);
-double* vals = (size > 0) ? new double[size] : 0;
-const double* quadWts = pylith::feassemble::TestQuadrature::quadWts(*q);
-memcpy(vals, quadWts, size*sizeof(double));
-return vals;
-#}embed
-
-# ----------------------------------------------------------------------
-def vertices(qhandle):
- """
- Call TestQuadrature::vertices().
- """
- if not qhandle.name == "pylith_feassemble_Quadrature":
- raise TypeError, \
- "Argument 'quadrature' must be extension type 'Quadrature'."
-
- cdef void* qptr
- qptr = ptrFromHandle(qhandle)
-
- cdef int numBasis
- cdef int cellDim
- numBasis = TestQuadrature_numBasis(qptr)
- cellDim = TestQuadrature_cellDim(qptr)
-
- cdef double* values
- values = TestQuadrature_vertices(qptr)
- dims = [numBasis, cellDim]
- valuesObj = PyCObject_FromVoidPtr(values, NULL)
- return spatialdata.utils.simplearray.SimpleCppArray(valuesObj, dims, "double")
-
-
-# ----------------------------------------------------------------------
-def basis(qhandle):
- """
- Call TestQuadrature::basis().
- """
- if not qhandle.name == "pylith_feassemble_Quadrature":
- raise TypeError, \
- "Argument 'quadrature' must be extension type 'Quadrature'."
-
- cdef void* qptr
- qptr = ptrFromHandle(qhandle)
-
- cdef int numQuadPts
- cdef int numBasis
- numQuadPts = TestQuadrature_numQuadPts(qptr)
- numBasis = TestQuadrature_numBasis(qptr)
-
- cdef double* values
- values = TestQuadrature_basis(qptr)
- dims = [numQuadPts, numBasis]
- valuesObj = PyCObject_FromVoidPtr(values, NULL)
- return spatialdata.utils.simplearray.SimpleCppArray(valuesObj, dims, "double")
-
-
-# ----------------------------------------------------------------------
-def basisDeriv(qhandle):
- """
- Call TestQuadrature::basisDeriv().
- """
- if not qhandle.name == "pylith_feassemble_Quadrature":
- raise TypeError, \
- "Argument 'quadrature' must be extension type 'Quadrature'."
-
- cdef void* qptr
- qptr = ptrFromHandle(qhandle)
-
- cdef int numQuadPts
- cdef int numBasis
- cdef int cellDim
- numQuadPts = TestQuadrature_numQuadPts(qptr)
- numBasis = TestQuadrature_numBasis(qptr)
- cellDim = TestQuadrature_cellDim(qptr)
-
- cdef double* values
- values = TestQuadrature_basisDeriv(qptr)
- dims = [numQuadPts, numBasis, cellDim]
- valuesObj = PyCObject_FromVoidPtr(values, NULL)
- return spatialdata.utils.simplearray.SimpleCppArray(valuesObj, dims,
- "double")
-
-
-# ----------------------------------------------------------------------
-def quadPtsRef(qhandle):
- """
- Call TestQuadrature::quadPtsRef().
- """
- if not qhandle.name == "pylith_feassemble_Quadrature":
- raise TypeError, \
- "Argument 'quadrature' must be extension type 'Quadrature'."
-
- cdef void* qptr
- qptr = ptrFromHandle(qhandle)
-
- cdef int numQuadPts
- cdef int cellDim
- numQuadPts = TestQuadrature_numQuadPts(qptr)
- cellDim = TestQuadrature_cellDim(qptr)
-
- cdef double* values
- values = TestQuadrature_quadPtsRef(qptr)
- dims = [numQuadPts, cellDim]
- valuesObj = PyCObject_FromVoidPtr(values, NULL)
- return spatialdata.utils.simplearray.SimpleCppArray(valuesObj, dims,
- "double")
-
-
-# ----------------------------------------------------------------------
-def quadWts(qhandle):
- """
- Call TestQuadrature::quadWts().
- """
- if not qhandle.name == "pylith_feassemble_Quadrature":
- raise TypeError, \
- "Argument 'quadrature' must be extension type 'Quadrature'."
-
- cdef void* qptr
- qptr = ptrFromHandle(qhandle)
-
- cdef int numQuadPts
- numQuadPts = TestQuadrature_numQuadPts(qptr)
-
- cdef double* values
- values = TestQuadrature_quadWts(qptr)
- dims = [numQuadPts]
- valuesObj = PyCObject_FromVoidPtr(values, NULL)
- return spatialdata.utils.simplearray.SimpleCppArray(valuesObj, dims,
- "double")
-
-
-# End of file
Modified: short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -30,7 +30,8 @@
TestElasticPlaneStress.py \
TestElasticIsotropic3D.py \
TestMaxwellIsotropic3D.py \
- TestGenMaxwellIsotropic3D.py
+ TestGenMaxwellIsotropic3D.py \
+ TestPowerLaw3D.py
# End of file
Modified: short/3D/PyLith/trunk/unittests/pytests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/meshio/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/pytests/meshio/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -29,8 +29,10 @@
TestOutputManagerMesh.py \
TestOutputManagerSubMesh.py \
TestOutputSolnSubset.py \
- TestDataWriterVTK.py
+ TestDataWriterVTK.py \
+ TestSingleOutput.py
+
if ENABLE_CUBIT
TESTS += testcubit.py
dist_check_SCRIPTS += testcubit.py
Modified: short/3D/PyLith/trunk/unittests/pytests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/Makefile.am 2009-06-19 15:40:19 UTC (rev 15348)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/Makefile.am 2009-06-19 16:59:05 UTC (rev 15349)
@@ -29,9 +29,8 @@
noinst_PYTHON = \
TestMesh.py \
TestSubMesh.py \
- TestFieldBase.py
+ TestFieldBase.py \
TestMeshField.py \
- TestSubMeshField.py \
TestMeshFields.py \
TestSolutionFields.py \
TestJacobian.py \
More information about the CIG-COMMITS
mailing list