[cig-commits] r6000 - in short/3D/PyLith/trunk: . applications
libsrc libsrc/meshio modulesrc modulesrc/meshio
modulesrc/topology pylith pylith/meshio pylith/problems
pylith/solver pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Sat Feb 10 11:01:27 PST 2007
Author: brad
Date: 2007-02-10 11:01:25 -0800 (Sat, 10 Feb 2007)
New Revision: 6000
Added:
short/3D/PyLith/trunk/modulesrc/topology/
short/3D/PyLith/trunk/modulesrc/topology/Makefile.am
short/3D/PyLith/trunk/modulesrc/topology/topology.pxd
short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
short/3D/PyLith/trunk/pylith/problems/EqDeformation.py
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
Modified:
short/3D/PyLith/trunk/applications/pylithic.py.in
short/3D/PyLith/trunk/configure.ac
short/3D/PyLith/trunk/libsrc/Makefile.am
short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
short/3D/PyLith/trunk/modulesrc/Makefile.am
short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am
short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/PyLithApp.py
short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
short/3D/PyLith/trunk/pylith/problems/Problem.py
short/3D/PyLith/trunk/pylith/problems/__init__.py
short/3D/PyLith/trunk/pylith/solver/Solver.py
short/3D/PyLith/trunk/pylith/solver/__init__.py
short/3D/PyLith/trunk/pylith/topology/Mesh.py
short/3D/PyLith/trunk/setup.py
Log:
Reorganized top-level Python pyre components so that they make sense. Created initial bindings for Mesh.
Modified: short/3D/PyLith/trunk/applications/pylithic.py.in
===================================================================
--- short/3D/PyLith/trunk/applications/pylithic.py.in 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/applications/pylithic.py.in 2007-02-10 19:01:25 UTC (rev 6000)
@@ -32,8 +32,8 @@
from pylith.PyLithApp import PyLithApp
- app = PyLithApp()
- app.run()
+ from pyre.applications import start
+ start(applicationClass=PyLithApp)
# End of file
Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/configure.ac 2007-02-10 19:01:25 UTC (rev 6000)
@@ -149,6 +149,7 @@
modulesrc/Makefile
modulesrc/feassemble/Makefile
modulesrc/meshio/Makefile
+ modulesrc/topology/Makefile
applications/Makefile
unittests/Makefile
unittests/libtests/Makefile
Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am 2007-02-10 19:01:25 UTC (rev 6000)
@@ -30,6 +30,7 @@
feassemble/Quadrature2D.cc \
feassemble/Quadrature2Din3D.cc \
feassemble/Quadrature3D.cc \
+ feassemble/ParameterManager.cc \
meshio/MeshIO.cc \
meshio/MeshIOAscii.cc
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2007-02-10 19:01:25 UTC (rev 6000)
@@ -39,6 +39,8 @@
{ // read
assert(0 == _mesh);
+ std::cout << "mesh: " << mesh << std::endl;
+
_mesh = mesh;
_read();
_mesh = 0;
Modified: short/3D/PyLith/trunk/modulesrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/Makefile.am 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/modulesrc/Makefile.am 2007-02-10 19:01:25 UTC (rev 6000)
@@ -12,9 +12,8 @@
SUBDIRS = \
feassemble \
- meshio
+ meshio \
+ topology
-# version
-# $Id$
# End of file
Modified: short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/modulesrc/meshio/Makefile.am 2007-02-10 19:01:25 UTC (rev 6000)
@@ -28,6 +28,8 @@
INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
+PYREX_INCLUDES = -I$(top_srcdir)/modulesrc/topology
+
meshio.pyx meshio_embed.cpp meshio_embed.h: meshio.pyxe
pyrexembed meshio.pyxe
meshio.pyxe: $(srcdir)/meshio.pyxe.src
@@ -36,7 +38,7 @@
meshio_embed.h: meshio.pyx
.pyx.c:
- pyrexc $<
+ pyrexc $< $(PYREX_INCLUDES)
CLEANFILES = meshio.pyxe meshio.pyx meshio.c *_embed.*
Modified: short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe.src 2007-02-10 19:01:25 UTC (rev 6000)
@@ -29,10 +29,7 @@
void* malloc(size_t size)
void free(void* mem)
-#embed{ void ALEMesh_destructor(void* pObj)
- ALE::Obj<ALE::Mesh>* pMesh = (ALE::Obj<ALE::Mesh>*) pObj;
- delete pMesh;
-#}embed
+#cimport topology # USES topology.Mesh
# ----------------------------------------------------------------------
cdef class MeshIO:
@@ -51,24 +48,19 @@
return
- def read(self):
+ def read(self, mesh):
"""
Read mesh from file.
-
- @param interpolate Flag indicating whether to build intermediate
- topology elements.
"""
# create shim for method 'read'
- #embed{ void MeshIO_read(void* pObj, void** ppMeshObj)
- ALE::Obj<ALE::Mesh>* pMesh = new ALE::Obj<ALE::Mesh>;
+ #embed{ void MeshIO_read(void* pObj, void* pMeshObj)
+ ALE::Obj<ALE::Mesh>* pMesh = (ALE::Obj<ALE::Mesh>*) pMeshObj;
((pylith::meshio::MeshIO*) pObj)->read(pMesh);
- *ppMeshObj = (void*) pMesh;
#}embed
- cdef void* pMeshObj
- pMeshObj = NULL
- MeshIO_read(self.thisptr, &pMeshObj)
- return PyCObject_FromVoidPtr(pMeshObj, ALEMesh_destructor)
+ #cdef topology.Mesh mesh
+ MeshIO_read(self.thisptr, ptrFromHandle(mesh))
+ return mesh
def write(self, mesh):
@@ -80,9 +72,7 @@
ALE::Obj<ALE::Mesh>* pMesh = (ALE::Obj<ALE::Mesh>*) pMeshObj;
((pylith::meshio::MeshIO*) pObj)->write(pMesh);
#}embed
- cdef void* pMeshObj
- pMeshObj = <void*> PyCObject_AsVoidPtr(mesh)
- MeshIO_write(self.thisptr, pMeshObj)
+ MeshIO_write(self.thisptr, ptrFromHandle(mesh))
return
Added: short/3D/PyLith/trunk/modulesrc/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/Makefile.am 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/modulesrc/topology/Makefile.am 2007-02-10 19:01:25 UTC (rev 6000)
@@ -0,0 +1,43 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = topology
+include $(top_srcdir)/subpackage.am
+
+subpkgpyexec_LTLIBRARIES = topologymodule.la
+
+topologymodule_la_LDFLAGS = -module
+
+topologymodule_la_SOURCES = topology.pyxe
+
+nodist_topologymodule_la_SOURCES = \
+ topology.c topology_embed.cpp topology_embed.h
+
+topologymodule_la_LIBADD = \
+ $(top_builddir)/libsrc/libpylith.la \
+ $(PETSC_LIB)
+
+INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
+
+topology.pyx topology_embed.cpp topology_embed.h: topology.pyxe
+ pyrexembed topology.pyxe
+topology.pyxe: $(srcdir)/topology.pyxe.src
+ cp $(srcdir)/topology.pyxe.src $@
+topology_embed.cpp: topology_embed.h
+topology_embed.h: topology.pyx
+
+.pyx.c:
+ pyrexc $<
+
+CLEANFILES = topology.pyxe topology.pyx topology.c *_embed.*
+
+# End of file
Added: short/3D/PyLith/trunk/modulesrc/topology/topology.pxd
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.pxd 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.pxd 2007-02-10 19:01:25 UTC (rev 6000)
@@ -0,0 +1,21 @@
+# -*- Pyrex -*-
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+# ----------------------------------------------------------------------
+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
+
+
+# End of file
Added: short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2007-02-10 19:01:25 UTC (rev 6000)
@@ -0,0 +1,64 @@
+# -*- Pyrex -*-
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+#header{
+#include <Mesh.hh>
+#}header
+
+# ----------------------------------------------------------------------
+cdef extern from "Python.h":
+ object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
+ void* PyCObject_AsVoidPtr(object)
+
+cdef void* ptrFromHandle(obj):
+ """Extract pointer from PyCObject."""
+ return PyCObject_AsVoidPtr(obj.handle)
+
+cdef extern from "stdlib.h":
+ ctypedef unsigned long size_t
+ void* malloc(size_t size)
+ void free(void* mem)
+
+# ----------------------------------------------------------------------
+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()
+ return (void*)(new ALE::Obj<ALE::Mesh>);
+ #}embed
+
+ self.thisptr = MeshPtr_constructor()
+ self.handle = self._createHandle()
+ self.name = "pylith_topology_Mesh"
+ return
+
+
+ def _createHandle(self):
+ """
+ Wrap pointer to C++ object in PyCObject.
+ """
+ #embed{ void MeshPtr_destructor(void* pObj)
+ ALE::Obj<ALE::Mesh>* pMesh = (ALE::Obj<ALE::Mesh>*) pObj;
+ delete pMesh;
+ #}embed
+ return PyCObject_FromVoidPtr(self.thisptr, MeshPtr_destructor)
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2007-02-10 19:01:25 UTC (rev 6000)
@@ -16,10 +16,7 @@
feassemble/__init__.py \
feassemble/FIATCell.py \
feassemble/FIATSimplex.py \
- feassemble/Field.py \
feassemble/Integrator.py \
- feassemble/IntegratorElasticity.py \
- feassemble/IntegratorInertia.py \
feassemble/Quadrature.py \
feassemble/ReferenceCell.py \
materials/__init__.py \
@@ -31,14 +28,12 @@
meshio/MeshIOAscii.py \
meshio/__init__.py \
problems/__init__.py \
- problems/Dynamic.py \
- problems/DynamicExplicit.py \
+ problems/EqDeformation.py \
+ problems/Explicit.py \
+ problems/Formulation.py \
problems/Problem.py \
- problems/QuasiStatic.py \
solver/__init__.py \
solver/Solver.py \
- solver/SolverTSE.py \
- solver/SolverTSI.py \
topology/__init__.py \
topology/Mesh.py \
topology/MeshGenerator.py \
Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -13,17 +13,17 @@
## @file pylith/PyLithApp.py
## @brief Python PyLith application
-from pyre.applications.Script import Script
+from mpi.Application import Application
# PyLithApp class
-class PyLithApp(Script):
+class PyLithApp(Application):
"""
Python PyLithApp application.
"""
# INVENTORY //////////////////////////////////////////////////////////
- class Inventory(Script.Inventory):
+ class Inventory(Application.Inventory):
"""
Python object for managing PyLithApp facilities and properties.
"""
@@ -49,8 +49,8 @@
mesher = pyre.inventory.facility("mesh_generator", factory=MeshImporter)
mesher.meta['tip'] = "Generates or imports the computational mesh."
- from pylith.problems.DynamicExplicit import DynamicExplicit
- problem = pyre.inventory.facility("problem", factory=DynamicExplicit)
+ from pylith.problems.EqDeformation import EqDeformation
+ problem = pyre.inventory.facility("problem", factory=EqDeformation)
problem.meta['tip'] = "Computational problem to solve."
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -61,8 +61,8 @@
"""
mesh = self.mesher.create()
- self.problem.mesh = mesh.distribute()
- self.problem.initialize()
+ #self.problem.mesh = mesh.distribute()
+ #self.problem.initialize()
from pyre.units.time import second
t = 0.0*second
@@ -79,7 +79,7 @@
"""
Constructor.
"""
- Script.__init__(self, name)
+ Application.__init__(self, name)
self.totalTime = None
self.mesher = None
self.problem = None
@@ -92,7 +92,7 @@
"""
Setup members using inventory.
"""
- Script._configure(self)
+ Application._configure(self)
self.totalTime = self.inventory.totalTime
self.mesher = self.inventory.mesher
self.problem = self.inventory.problem
Modified: short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -63,9 +63,12 @@
@returns PETSc mesh object containing finite-element mesh
"""
from pylith.topology.Mesh import Mesh
+ print "Creating Mesh object"
mesh = Mesh()
+ print "Setting interpolate"
self.cppHandle.interpolate = self.interpolate
- mesh.cppHandle = self.cppHandle.read()
+ print "Reading mesh"
+ mesh.cppHandle = self.cppHandle.read(mesh.cppHandle)
return
Added: short/3D/PyLith/trunk/pylith/problems/EqDeformation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/EqDeformation.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/problems/EqDeformation.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/problems/EqDeformation.py
+
+## @brief Python EqDeformation for computing deformation associated
+## with earthquakes.
+
+from Problem import Problem
+
+# EqDeformation class
+class EqDeformation(Problem):
+ """
+ Python EqDeformation for computing deformation associated with
+ earthquakes.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Problem.Inventory):
+ """
+ Python object for managing EqDeformation facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing EqDeformation facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li \b faults Faults or interior slip surfaces.
+
+ import pyre.inventory
+
+ #from Faults import Faults
+ #faults = pyre.inventory.facility("faults", factory=Faults)
+ #faults.meta['tip'] = "Faults or interior slip surfaces."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def initialize(self):
+ """
+ Setup formulation for solving PDE.
+ """
+ Problem.initialize(self)
+
+ self._info.log("WARNING: EqDeofmraiton::initialize not implemented.")
+ return
+
+
+ def prestep(self):
+ """
+ User hook for doing stuff before advancing time step.
+ """
+ self._info.log("WARNING: EqDeformation::prestep not implemented.")
+ return
+
+
+ def step(self, dt):
+ """
+ Advance to next time step.
+ """
+ self._info.log("WARNING: EqDeformation::step not implemented.")
+ return
+
+
+ def poststep(self):
+ """
+ Update time and storage.
+ """
+ self._info.log("WARNING: EqDeformation::poststep not implemented.")
+ return
+
+
+ def stableTimestep(self):
+ """
+ Determine stable time step for problem.
+ """
+ self._info.log("WARNING: EqDeformation::stableTimestep not implemented.")
+ return
+
+
+ def checkpoint(self):
+ """
+ Save problem state for restart.
+ """
+ self._info.log("WARNING: EqDeformation::checkpoint not implemented.")
+ return
+
+
+ def __init__(self, name="eqdeformation"):
+ """
+ Constructor.
+ """
+ Problem.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based using inventory.
+ """
+ Problem._configure(self)
+ #self.faults = self.inventory.faults
+ return
+
+
+# End of file
Added: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/problems/Explicit.py
+
+## @brief Python Explicit object for solving equations using an
+## explicit formulation.
+
+from Formulation import Formulation
+
+# Explicit class
+class Explicit(Formulation):
+ """
+ Python Explicit object for solving equations using an explicit
+ formulation.
+
+ The formulation has the general form, [A(t)] {u(t+dt)} = {b(t)},
+ where we want to solve for {u(t+dt)}, A(t) is usually constant
+ (i.e., independent of time), and {b(t)} usually depends on {u(t)}
+ and {u(t-dt)}.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Formulation.Inventory):
+ """
+ Python object for managing Explicit facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing Explicit facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li None
+
+ #import pyre.inventory
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def initialize(self):
+ """
+ Initialize explicit formulation.
+ """
+ Formulation.initialize(self)
+ return
+
+
+ def calcResidual(self):
+ """
+ Compute residual, {b(t)}.
+ """
+ self._info.log("WARNING: Explicit::calcResidual not implemented.")
+ return
+
+ def calcJacobian(self):
+ """
+ Compute Jacobian, [A(t)].
+ """
+ self._info.log("WARNING: Explicit::calcJacobian not implemented.")
+ return
+
+
+ def __init__(self, name="explicit"):
+ """
+ Constructor.
+ """
+ Formulation.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based using inventory.
+ """
+ Formulation._configure(self)
+ return
+
+
+# End of file
Added: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/problems/Formulation.py
+
+## @brief Python abstract base class for formulations of solving equations.
+
+from pyre.components.Component import Component
+
+# Formulation class
+class Formulation(Component):
+ """
+ Python abstract base class for formulations of solving equations.
+
+ In general, we use some explicit or implicit formulation of the PDEs
+ to create a linear form, [A]{u}={b} that we can solve.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Component.Inventory):
+ """
+ Python object for managing Explicit facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing Explicit facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li \b solver Algebraic solver.
+
+ import pyre.inventory
+
+ #from pylith.solver.SolverTSE import SolverTSE
+ #solver = pyre.inventory.facility("solver", factory=SolverTSE)
+ #solver.meta['tip'] = "Algebraic solver."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def initialize(self):
+ """
+ Initialize the formulation.
+ """
+ self._info.log("WARNING: Formulation::initialize not implemented.")
+ return
+
+
+ def calcResidual(self):
+ """
+ Compute residual, {b(t)}.
+ """
+ raise NotImplementedError("Please implement calcResidual().")
+ return
+
+ def calcJacobian(self):
+ """
+ Compute Jacobian, [A(t)].
+ """
+ raise NotImplementedError("Please implement calcJacobian().")
+ return
+
+
+ def __init__(self, name="formulation"):
+ """
+ Constructor.
+ """
+ Component.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based using inventory.
+ """
+ Component._configure(self)
+ #self.solver = self.inventory.solver
+ return
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -35,29 +35,29 @@
## @li None
##
## \b Facilities
- ## @li \b mesh Finite-element topology.
- ## @li \b assembler Finite-element assembler.
## @li \b materials Materials in problem.
+ ## @li \b bc Boundary conditions.
+ ## @li \b formulation Formulation for solving PDE
import pyre.inventory
- from pylith.topology.Mesh import Mesh
- mesh = pyre.inventory.facility("mesh", factory=Mesh)
- mesh.meta['tip'] = "Finite-element topology."
-
- #from pylith.feassemble.Assembler import Assembler
- #assembler = pyre.inventory.facility("assembler", factory=Assembler)
- #assembler.meta['tip'] = "Finite-element assembler."
-
from pylith.materials.Homogeneous import Homogeneous
materials = pyre.inventory.facility("materials", factory=Homogeneous)
- mesh.meta['tip'] = "Materials in problem."
+ materials.meta['tip'] = "Materials in problem."
+
+ #from BoundaryConditions import BoundaryConditions
+ #bc = pyre.inventory.facility("bc", factory=BoundaryConditions)
+ #bc.meta['tip'] = "Boundary conditions."
+ from Explicit import Explicit
+ formulation = pyre.inventory.facility("formulation", factory=Explicit)
+ formulation.meta['tip'] = "Formulation for solving PDE."
+
# PUBLIC METHODS /////////////////////////////////////////////////////
def initialize(self):
"""
- Create domain, bounday conditions, fields, and setup time loop.
+ Initialize problem by getting mesh, setting up boundary conditions, etc.
"""
return
@@ -104,6 +104,7 @@
Constructor.
"""
Component.__init__(self, name, facility="problem")
+ mesh = None
return
@@ -113,9 +114,9 @@
"""
Set members based using inventory.
"""
- self.mesh = self.inventory.mesh
- #self.assembler = self.inventory.assembler
- self.material = self.inventory.materials
+ self.materials = self.inventory.materials
+ #self.bc = self.inventory.bc
+ self.formulation = self.inventory.formulation
return
Modified: short/3D/PyLith/trunk/pylith/problems/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/__init__.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/problems/__init__.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -14,10 +14,10 @@
## @brief Python PyLith crustal dynamics problems module initialization
-all = ['Dynamic',
- 'DynamicExplicit',
- 'Problem',
- 'QuasiStatic']
+all = ['Problem',
+ 'EqDeformation',
+ 'Formulation',
+ 'Explicit']
# End of file
Modified: short/3D/PyLith/trunk/pylith/solver/Solver.py
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/Solver.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/solver/Solver.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -50,7 +50,4 @@
return
-# version
-__id__ = "$Id$"
-
# End of file
Modified: short/3D/PyLith/trunk/pylith/solver/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/__init__.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/solver/__init__.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -13,9 +13,7 @@
## @file pylith/solver/__init__.py
## @brief Python Pylith solver module initialization
-all = ['Solver', 'SolverTSI']
+all = ['Solver']
-# version
-__id__ = "$Id$"
# End of file
Modified: short/3D/PyLith/trunk/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -46,7 +46,10 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
def distribute(self):
- #raise NotImplementedError, "Mesh::distribute() not implemented."
+ """
+ Distribute mesh across processors.
+ """
+ self._info.log("WARNING: Mesh::distribute() not implemented.")
return self
@@ -55,7 +58,8 @@
Constructor.
"""
Component.__init__(self, name, facility="mesh")
- self.cppHandle = None
+ import pylith.topology.topology as bindings
+ self.cppHandle = bindings.Mesh()
return
Modified: short/3D/PyLith/trunk/setup.py
===================================================================
--- short/3D/PyLith/trunk/setup.py 2007-02-10 19:00:58 UTC (rev 5999)
+++ short/3D/PyLith/trunk/setup.py 2007-02-10 19:01:25 UTC (rev 6000)
@@ -17,9 +17,9 @@
'pythia[mpi] >= 0.8.1.0, < 0.8.2a',
],
- author = 'Charles A. Williams, Brad Aagaard, and Matt Knepley',
+ author = 'Brad Aagaard, Charles A. Williams, and Matt Knepley',
author_email = 'cig-short at geodynamics.org',
- description = """A finite element code for the solution of visco-elastic/plastic deformation that was designed for lithospheric modeling problems.""",
+ description = """A finite element code for the solution of crustal deformation problems associated with earthquakes, including kinematic ruptures, spontaneous ruptures, and pre- and post-seismic deformation.""",
license = 'other',
url = 'http://www.geodynamics.org/cig/software/packages/short/pylith/',
More information about the cig-commits
mailing list