[cig-commits] r6570 - in short/3D/PyLith/branches/pylith-0.8: .
pylith3d pylith3d/applications pylith3d/libpylith3d
pylith3d/module pylith3d/pylith3d
leif at geodynamics.org
leif at geodynamics.org
Fri Apr 13 19:02:56 PDT 2007
Author: leif
Date: 2007-04-13 19:02:55 -0700 (Fri, 13 Apr 2007)
New Revision: 6570
Added:
short/3D/PyLith/branches/pylith-0.8/pylith3d/libpylith3d/libpylith3d.pxd
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithLib.pyx
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pxd
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pyx
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.pyx
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/const.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/constants.pxd
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.pxd
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.pxd
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petsc.pxd
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petscmeshfwd.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.pyx
short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLithApp.py
Removed:
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/bindings.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/bindings.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptions.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptions.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/libpylith3d.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/libpylith3d.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/misc.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/misc.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3d_externs.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3dmodule.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3dmodule.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/CodecKeyVal.py
short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/ElementTypeDef.py
short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/KeyValParser.py
short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLith.py
short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/constants.py
short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/scan_parameter.defs
Modified:
short/3D/PyLith/branches/pylith-0.8/configure.ac
short/3D/PyLith/branches/pylith-0.8/pylith3d/Makefile.am
short/3D/PyLith/branches/pylith-0.8/pylith3d/applications/pylith3dapp.py
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/Makefile.am
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/interpolate.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/__init__.py
short/3D/PyLith/branches/pylith-0.8/pylith3d/pypylith3d.cc
Log:
Eliminated the bindings by converting the bulk of the Python code to
Pyrex.
Modified: short/3D/PyLith/branches/pylith-0.8/configure.ac
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/configure.ac 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/configure.ac 2007-04-14 02:02:55 UTC (rev 6570)
@@ -6,7 +6,7 @@
AC_INIT([PyLith3D], [0.8.2], [cig-short at geodynamics.org])
AC_CONFIG_AUX_DIR([./aux-config])
AC_CONFIG_SRCDIR([pylith3d/applications/pylith3dapp.py])
-AC_CONFIG_HEADER([portinfo])
+AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/Makefile.am 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/Makefile.am 2007-04-14 02:02:55 UTC (rev 6570)
@@ -20,8 +20,6 @@
# pylith3d
nobase_pyexec_PYTHON = \
- pylith3d/constants.py \
- pylith3d/ElementTypeDef.py \
pylith3d/__init__.py \
pylith3d/KeywordValueParse.py \
pylith3d/MaterialModel/__init__.py \
@@ -33,13 +31,14 @@
pylith3d/MaterialModel/IsotropicPowerLawMaxwellViscoelasticZT.py \
pylith3d/MaterialModel/MaterialModel.py \
pylith3d/Materials.py \
- pylith3d/PyLith.py
+ pylith3d/PyLithApp.py
# pypylith3d (libpylith3d + pylith3dmodule + embedded Python interpreter)
INCLUDES = -I$(top_srcdir)/pylith3d/module $(PYTHON_EGG_CPPFLAGS) -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
pypylith3d_SOURCES = pypylith3d.cc
pypylith3d_LDADD = \
- $(top_builddir)/pylith3d/module/libpylith3dmodule.a \
+ $(top_builddir)/pylith3d/module/libPyLithLibmodule.a \
+ $(top_builddir)/pylith3d/module/libPyLithMeshLibmodule.a \
$(top_builddir)/pylith3d/libpylith3d/libpylith3d.a
pypylith3d$(EXEEXT): $(pypylith3d_OBJECTS) $(pypylith3d_DEPENDENCIES)
@rm -f pypylith3d$(EXEEXT)
@@ -55,7 +54,8 @@
mpipypylith3d_SOURCES = pypylith3d.cc
mpipypylith3d_CXXFLAGS = -DUSE_MPI
mpipypylith3d_LDADD = \
- $(top_builddir)/pylith3d/module/libpylith3dmodule.a \
+ $(top_builddir)/pylith3d/module/libPyLithLibmodule.a \
+ $(top_builddir)/pylith3d/module/libPyLithMeshLibmodule.a \
$(top_builddir)/pylith3d/libpylith3d/libpylith3d.a
mpipypylith3d$(EXEEXT): $(mpipypylith3d_OBJECTS) $(mpipypylith3d_DEPENDENCIES)
@rm -f mpipypylith3d$(EXEEXT)
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/applications/pylith3dapp.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/applications/pylith3dapp.py 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/applications/pylith3dapp.py 2007-04-14 02:02:55 UTC (rev 6570)
@@ -47,9 +47,9 @@
sys.path.insert(1, directory)
site.addsitedir(directory)
- from pylith3d.PyLith import PyLith
+ from pylith3d import PyLithApp
from pyre.applications import start
- start(applicationClass=PyLith)
+ start(applicationClass=PyLithApp)
# version
Copied: short/3D/PyLith/branches/pylith-0.8/pylith3d/libpylith3d/libpylith3d.pxd (from rev 6509, short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3d_externs.h)
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3d_externs.h 2007-04-05 21:54:55 UTC (rev 6509)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/libpylith3d/libpylith3d.pxd 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,1321 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+cdef extern from "config.h":
+ pass # FC_FUNC and FC_FUNC_
+
+cdef extern from "stddef.h":
+ ctypedef unsigned int size_t
+
+cimport petsc
+
+
+cdef extern void assign_wink "FC_FUNC_(assign_wink, ASSIGN_WINK)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void autoprestr "FC_FUNC(autoprestr, AUTOPRESTR)" (
+ petsc.Mat *, # sparse
+ petsc.Vec *,
+ petsc.Vec *,
+ double *, # force
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ int *,
+ double *,
+ double *, # global
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ double *,
+ int *,
+ int *,
+ int *, # bc
+ double *,
+ double *, # slip
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ double *,
+ int *,
+ int *,
+ int *,
+ double *, # split
+ int *,
+ double *,
+ double *,
+ double *, # stiff
+ double *,
+ double *, # element
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *, # traction
+ double *,
+ double *,
+ double *,
+ int *,
+ double *, # material
+ int *,
+ double *, # element type
+ double *,
+ double *,
+ int *,
+ double *, # time data
+ double *,
+ int *,
+ int *,
+ int *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ double *,
+ double *,
+ double *,
+ int *,
+ double *, # iterations
+ double *, # skew
+ int *, # i/o info
+ int *,
+ int *,
+ int *,
+ int *,
+ char *, # files
+ char *,
+ char *,
+ int *, # PETSc logging
+ int *,
+ int *, # error codes
+ char *,
+ size_t, # string lengths
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void cmp_stiffsz "FC_FUNC_(cmp_stiffsz, CMP_STIFFSZ)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void create_id "FC_FUNC_(create_id, CREATE_ID)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void elastc "FC_FUNC(elastc, ELASTC)" (
+ petsc.Mat *, # sparse
+ petsc.Vec *,
+ petsc.Vec *,
+ double *, # force
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ int *,
+ double *,
+ double *, # global
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ double *,
+ int *,
+ int *,
+ int *, # bc
+ double *,
+ double *, # slip
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ double *,
+ int *,
+ int *,
+ int *,
+ double *, # split
+ int *,
+ double *,
+ double *,
+ double *, # stiff
+ double *,
+ double *, # element
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *, # traction
+ double *,
+ double *,
+ double *,
+ int *,
+ double *, # material
+ int *,
+ double *, # element type
+ double *,
+ double *,
+ int *,
+ double *, # time data
+ double *,
+ int *,
+ int *,
+ int *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ double *,
+ double *,
+ double *,
+ int *,
+ double *, # iterations
+ double *, # skew
+ int *, # i/o info
+ int *,
+ int *,
+ int *,
+ int *,
+ char *, # files
+ char *,
+ char *,
+ int *, # PETSc logging
+ int *,
+ int *, # error codes
+ char *,
+ size_t, # string lengths
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void id_split "FC_FUNC_(id_split, ID_SPLIT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void lnklst "FC_FUNC(lnklst, LNKLST)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void local "FC_FUNC(local, LOCAL)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void localf "FC_FUNC(localf, LOCALF)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void localx "FC_FUNC(localx, LOCALX)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void makemsr "FC_FUNC(makemsr, MAKEMSR)" (
+ petsc.Mat *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ double *) except *
+
+cdef extern void matmod_def "FC_FUNC_(matmod_def, MATMOD_DEF)" (int *) except *
+
+cdef extern void nfind "FC_FUNC(nfind, NFIND)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void preshape "FC_FUNC(preshape, PRESHAPE)" (
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void preshape2d "FC_FUNC(preshape2d, PRESHAPE2D)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void read_bc "FC_FUNC_(read_bc, READ_BC)" (
+ double *,
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_connect "FC_FUNC_(read_connect, READ_CONNECT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+
+cdef extern void read_coords "FC_FUNC_(read_coords, READ_COORDS)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_diff "FC_FUNC_(read_diff, READ_DIFF)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_fuldat "FC_FUNC_(read_fuldat, READ_FULDAT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_hist "FC_FUNC_(read_hist, READ_HIST)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+# code for reading prestress input files is presently disabled
+cdef extern void read_prestr "FC_FUNC_(read_prestr, READ_PRESTR)" ( # MISSING
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_skew "FC_FUNC_(read_skew, READ_SKEW)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_slip "FC_FUNC_(read_slip, READ_SLIP)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_split "FC_FUNC_(read_split, READ_SPLIT)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_stateout "FC_FUNC_(read_stateout, READ_STATEOUT)" (
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_timdat "FC_FUNC_(read_timdat, READ_TIMDAT)" (
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_tractions "FC_FUNC_(read_tractions, READ_TRACTIONS)" (
+ int *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void read_wink "FC_FUNC_(read_wink, READ_WINK)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_bc "FC_FUNC_(scan_bc, SCAN_BC)" (
+ int *,
+ int *,
+ char *,
+ char *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_connect "FC_FUNC_(scan_connect, SCAN_CONNECT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_coords "FC_FUNC_(scan_coords, SCAN_COORDS)" (
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_diff "FC_FUNC_(scan_diff, SCAN_DIFF)" (
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_fuldat "FC_FUNC_(scan_fuldat, SCAN_FULDAT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_hist "FC_FUNC_(scan_hist, SCAN_HIST)" (
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+# code for reading prestress input files is presently disabled
+cdef extern void scan_prestr "FC_FUNC_(scan_prestr, SCAN_PRESTR)" ( # MISSING
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void scan_skew "FC_FUNC_(scan_skew, SCAN_SKEW)" (
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_slip "FC_FUNC_(scan_slip, SCAN_SLIP)" (
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_split "FC_FUNC_(scan_split, SCAN_SPLIT)" (
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_timdat "FC_FUNC_(scan_timdat, SCAN_TIMDAT)" (
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_tractions "FC_FUNC_(scan_tractions, SCAN_TRACTIONS)" (
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_wink "FC_FUNC_(scan_wink, SCAN_WINK)" (
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void scan_winkx "FC_FUNC_(scan_winkx, SCAN_WINKX)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void sort_elements "FC_FUNC_(sort_elements, SORT_ELEMENTS)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void sort_slip_nodes "FC_FUNC_(sort_slip_nodes, SORT_SLIP_NODES)" (
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void sort_split_nodes "FC_FUNC_(sort_split_nodes, SORT_SPLIT_NODES)" (
+ int *,
+ int *,
+ int *,
+ int *) except *
+
+cdef extern void try_binio "FC_FUNC_(try_binio, TRY_BINIO)" (
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void viscos "FC_FUNC(viscos, VISCOS)" (
+ petsc.Mat *, # sparse
+ petsc.Vec *,
+ petsc.Vec *,
+ double *, # force
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *, # 10
+ double *,
+ double *,
+ double *,
+ int *,
+ double *,
+ double *, # global
+ double *,
+ double *,
+ double *,
+ int *, # 20
+ int *,
+ double *,
+ int *,
+ int *,
+ int *, # bc
+ double *,
+ double *, # slip
+ double *,
+ double *,
+ double *, # 30
+ int *,
+ int *,
+ double *,
+ int *,
+ int *,
+ int *,
+ double *, # split
+ int *,
+ double *,
+ double *, # 40
+ double *, # stiff
+ double *,
+ double *, # element
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *, # 50
+ int *,
+ int *,
+ int *,
+ int *, # traction
+ double *,
+ double *,
+ double *,
+ int *,
+ double *, # material
+ int *, # 60
+ double *, # element type
+ double *,
+ double *,
+ int *,
+ double *, # time data
+ double *,
+ int *,
+ int *,
+ int *,
+ double *, # 70
+ double *,
+ int *,
+ int *,
+ int *,
+ double *,
+ double *,
+ double *,
+ int *,
+ double *, # iterations
+ double *, # 80: skew
+ int *, # i/o info
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *, # files
+ char *,
+ char *,
+ int *, # 90: PETSC logging
+ int *,
+ int *, # error codes
+ char *,
+ size_t, # string lengths
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void viscos_setup "FC_FUNC_(viscos_setup, VISCOS_SETUP)" (
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void viscos_step "FC_FUNC_(viscos_step, VISCOS_STEP)" (
+ petsc.Mat *, # sparse
+ petsc.Vec *,
+ petsc.Vec *,
+ double *, # force
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *, # 10
+ double *,
+ double *,
+ double *,
+ int *,
+ double *,
+ double *, # global
+ double *,
+ double *,
+ double *,
+ int *, # 20
+ int *,
+ double *,
+ int *,
+ int *,
+ int *, # bc
+ double *,
+ double *, # slip
+ double *,
+ double *,
+ double *, # 30
+ int *,
+ int *,
+ double *,
+ int *,
+ int *,
+ int *,
+ double *, # split
+ int *,
+ double *,
+ double *, # 40
+ double *, # stiff
+ double *,
+ double *, # element
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *, # 50
+ int *,
+ int *,
+ int *,
+ int *, # traction
+ double *,
+ double *,
+ double *,
+ int *,
+ double *, # material
+ int *, # 60
+ double *, # element type
+ double *,
+ double *,
+ int *,
+ double *, # time data
+ double *,
+ int *,
+ int *,
+ int *,
+ double *, # 70
+ double *,
+ int *,
+ int *,
+ int *,
+ double *,
+ double *,
+ double *,
+ int *,
+ double *, # iterations
+ double *, # 80: skew
+ int *, # i/o info
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *, # files
+ char *,
+ char *,
+ int *, # 90: PETSC logging
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ double *,
+ double *,
+ int *,
+ double *,
+ int *, # error codes
+ char *,
+ size_t, # string lengths
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void viscos_cleanup "FC_FUNC_(viscos_cleanup, VISCOS_CLEANUP)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void write_bc "FC_FUNC_(write_bc, WRITE_BC)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void write_connect "FC_FUNC_(write_connect, WRITE_CONNECT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void write_coords "FC_FUNC_(write_coords, WRITE_COORDS)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void write_diff "FC_FUNC_(write_diff, WRITE_DIFF)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void write_element_info "FC_FUNC_(write_element_info, WRITE_ELEMENT_INFO)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ double *,
+ double *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void write_fuldat "FC_FUNC_(write_fuldat, WRITE_FULDAT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void write_global_info "FC_FUNC_(write_global_info, WRITE_GLOBAL_INFO)" (
+ char *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void write_hist "FC_FUNC_(write_hist, WRITE_HIST)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void write_props "FC_FUNC_(write_props, WRITE_PROPS)" (
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void write_skew "FC_FUNC_(write_skew, WRITE_SKEW)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void write_slip "FC_FUNC_(write_slip, WRITE_SLIP)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void write_sparse_info "FC_FUNC_(write_sparse_info, WRITE_SPARSE_INFO)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ double *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void write_split "FC_FUNC_(write_split, WRITE_SPLIT)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void write_split_plot "FC_FUNC_(write_split_plot, WRITE_SPLIT_PLOT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void write_stateout "FC_FUNC_(write_stateout, WRITE_STATEOUT)" (
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t,
+ size_t) except *
+
+cdef extern void write_strscomp "FC_FUNC_(write_strscomp, WRITE_STRSCOMP)" (
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void write_subiter "FC_FUNC_(write_subiter, WRITE_SUBITER)" (
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void write_tractions "FC_FUNC_(write_tractions, WRITE_TRACTIONS)" (
+ int *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void write_timdat "FC_FUNC_(write_timdat, WRITE_TIMDAT)" (
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void write_ucd_mesh "FC_FUNC_(write_ucd_mesh, WRITE_UCD_MESH)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ size_t) except *
+
+cdef extern void write_wink "FC_FUNC_(write_wink, WRITE_WINK)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+cdef extern void write_winkx "FC_FUNC_(write_winkx, WRITE_WINKX)" (
+ double *,
+ int *,
+ int *,
+ int *,
+ int *,
+ int *,
+ char *,
+ int *,
+ char *,
+ size_t,
+ size_t) except *
+
+
+# end of file
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/Makefile.am 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/Makefile.am 2007-04-14 02:02:55 UTC (rev 6570)
@@ -6,52 +6,94 @@
if COND_EMBEDDING
# static library
- noinst_LIBRARIES += libpylith3dmodule.a
+ noinst_LIBRARIES += libPyLithLibmodule.a libPyLithMeshLibmodule.a
else
# extension module (libtool)
- pkgpyexec_LTLIBRARIES += pylith3dmodule.la
+ pkgpyexec_LTLIBRARIES += PyLithLibmodule.la PyLithMeshLibmodule.la
endif
-# static library
-libpylith3dmodule_a_CXXFLAGS = $(AM_CXXFLAGS) # hack for automake
-libpylith3dmodule_a_SOURCES = $(sources)
+# static libraries
-# extension module (libtool)
-pylith3dmodule_la_SOURCES = $(sources)
-pylith3dmodule_la_LDFLAGS = -module
-pylith3dmodule_la_LIBADD = \
+libPyLithLibmodule_a_CFLAGS = $(AM_CFLAGS) # hack for automake
+libPyLithLibmodule_a_CXXFLAGS = $(AM_CXXFLAGS) # hack for automake
+libPyLithLibmodule_a_SOURCES = $(sources)
+
+libPyLithMeshLibmodule_a_CFLAGS = $(AM_CFLAGS) # hack for automake
+libPyLithMeshLibmodule_a_CXXFLAGS = $(AM_CXXFLAGS) # hack for automake
+libPyLithMeshLibmodule_a_SOURCES = $(meshsources)
+
+# extension modules (libtool)
+
+PyLithLibmodule_la_SOURCES = $(sources)
+PyLithLibmodule_la_LDFLAGS = -module
+PyLithLibmodule_la_LIBADD = \
$(top_builddir)/pylith3d/libpylith3d/libpylith3d.la \
$(PYTHON_EGG_LDFLAGS) \
$(PETSC_LIB) \
$(FCLIBS)
+PyLithMeshLibmodule_la_SOURCES = $(meshsources)
+PyLithMeshLibmodule_la_LDFLAGS = -module
+PyLithMeshLibmodule_la_LIBADD = \
+ $(PYTHON_EGG_LDFLAGS) \
+ $(PETSC_LIB) \
+ $(FCLIBS)
+
INCLUDES = $(PETSC_INCLUDE) -I$(PYTHON_INCDIR)
AM_CPPFLAGS = $(PYTHON_EGG_CPPFLAGS) $(PETSC_SIEVE_FLAGS)
+
sources = \
- array.cc \
- array.h \
- bindings.cc \
- bindings.h \
+ array.pyx \
+ constants.pxd \
+ elementtypes.cc \
+ elementtypes.h \
+ elementtypes.pxd \
exceptionhandler.cc \
- exceptionhandler.h \
- exceptions.cc \
- exceptions.h \
- libpylith3d.cc \
- libpylith3d.h \
- pylith3dmodule.cc \
- pylith3dmodule.h \
- pylith3d_externs.h \
+ exceptionhandler.pxd \
+ PyLithLib.cc \
+ setup.pyx
+
+meshsources = \
mesh.cc \
mesh.h \
- misc.cc \
- misc.h \
- setup.cc \
- setup.h
+ PyLithMeshLib.cc \
+ PyLithMeshLib.pxd
if ENABLE_GREENSFNS
-sources += interpolate.cc \
+meshsources += interpolate.cc \
interpolate.h
CPPFLAGS += -DGREENSFNS
endif
+
+mesh.cc: PyLithMeshLib.h
+
+
+PYREX_FLAGS = -I$(srcdir) -I$(top_srcdir)/pylith3d/libpylith3d
+pyxincludes = \
+ $(srcdir)/constants.pxd \
+ $(srcdir)/elementtypes.pxd \
+ $(top_srcdir)/pylith3d/libpylith3d/libpylith3d.pxd \
+ $(srcdir)/petsc.pxd \
+ $(srcdir)/PyLithMeshLib.pxd \
+ $(srcdir)/array.pyx \
+ $(srcdir)/exceptionhandler.pxd \
+ $(srcdir)/setup.pyx
+
+
+PyLithLib.cc: $(srcdir)/PyLithLib.pyx $(pyxincludes)
+ pyrexc $(PYREX_FLAGS) $< -o PyLithLib.cc
+
+PyLithMeshLib.cc: $(srcdir)/PyLithMeshLib.pyx $(srcdir)/petsc.pxd
+ pyrexc $(PYREX_FLAGS) $< -o PyLithMeshLib.cc
+
+PyLithMeshLib.h: PyLithMeshLib.pxd
+
+EXTRA_DIST = \
+ $(srcdir)/PyLithLib.pyx \
+ $(srcdir)/PyLithMeshLib.pyx \
+ PyLithLib.h \
+ PyLithMeshLib.h
+
+
## end of Makefile.am
Copied: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithLib.pyx (from rev 6509, short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLith.py)
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLith.py 2007-04-05 21:54:55 UTC (rev 6509)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithLib.pyx 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,2817 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+# simple C external declarations
+cimport constants
+cimport elementtypes
+cimport libpylith3d
+cimport petsc
+
+# external Pyrex modules
+cimport PyLithMeshLib
+
+# Pyrex code inlined in this module
+include "array.pyx"
+include "exceptionhandler.pxd"
+include "setup.pyx"
+
+
+cdef enum:
+ prestress = 0 # code for reading prestress input files is presently disabled
+
+
+cdef class PyLith:
+
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ #
+ # Public Interface
+ #
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ # These properties and methods are accessible from Python. They
+ # form the interface between the UI (the Pyre Component) and the
+ # native code.
+
+ cdef public object title
+
+ # Basename for all files (may be overridden by specific filename entries).
+ cdef public object fileRoot
+
+ # Output filenames (all are optional).
+ cdef public object ofile # asciiOutputFile ooo.ascii
+ cdef public object pfile # plotOutputFile ooo.plot
+ cdef public object ucdroot # ucdOutputRoot ooo.*.inp
+
+ # Required input files.
+ cdef public object coordinateInputFile # coordinateInputFile iii.coord
+ cdef public object bcfile # bcInputFile iii.bc
+ cdef public object timeStepInputFile # timeStepInputFile iii.time
+ cdef public object stfile # stateVariableInputFile iii.statevar
+ cdef public object connectivityInputFile # connectivityInputFile iii.connect
+
+ # This file is only required for time-dependent problems.
+ cdef public object fofile # fullOutputInputFile iii.fuldat
+
+ # These files are optional unless generating Green's functions, in
+ # which case they are required.
+ cdef public object sampleLocationFile # sampleLocationFile iii.sample
+ cdef public object spfile # splitNodeInputFile iii.split
+
+ # Optional input files.
+ cdef public object skfile # rotationInputFile iii.skew
+ cdef public object hfile # loadHistoryInputFile iii.hist
+ cdef public object tractionInputFile # tractionInputFile iii.traction
+
+ # Unused input files.
+ cdef public object wfile # winklerInputFile iii.wink
+ cdef public object materialHistoryInputFile # materialHistoryInputFile iii.mhist
+ cdef public object prestressInputFile # prestressInputFile iii.prestr
+ cdef public object slfile # slipperyNodeInputFile iii.slip
+ cdef public object difile # differentialForceInputFile iii.diff
+ cdef public object wxfile # slipperyWinklerInputFile iii.winkx
+
+ # Output option flags.
+ cdef public int idout # asciiOutput
+ cdef public int idsk # plotOutput
+ cdef public int iucd # ucdOutput
+
+ # Additional option flags.
+ cdef public int icode # analysisType
+ cdef public int pythonTimestep # pythonTimestep
+ cdef public int generateGreen # generateGreen
+ cdef public int idebug # debuggingOutput
+ cdef public int ncycle # numberCycles
+
+ # Unused option flags.
+ cdef public int iskopt # autoRotateSlipperyNodes
+
+ #
+ # Category 2 parameters formerly placed in *.keyval files.
+ #
+
+ cdef public double stol # stressTolerance in Pa
+ cdef public double dtol # minimumStrainPerturbation
+ cdef public double epert # initialStrainPerturbation
+
+ cdef public int nprevdflag # usePreviousDisplacementFlag
+
+ cdef public int intord # quadratureOrder
+
+ cdef public int ipstrs # prestressAutoCompute
+ cdef public int ipauto # prestressAutoChangeElasticProps
+ cdef public double tpois # prestressAutoComputePoisson
+ cdef public double tyoungs # prestressAutoComputeYoungs in Pa
+
+ #
+ # Array properties.
+ #
+
+ property grav: # gravityX, gravityY, gravityZ in m/(s*s)
+ def __set__(self, gravity):
+ cdef int dim
+ dim = sizeof(self._grav)/sizeof(self._grav[0])
+ assert(len(gravity) == dim)
+ for i from 0 <= i < dim:
+ self._grav[i] = gravity[i]
+
+ property prscal: # prestressScale{Xx,Yy,Zz,Xy,Xz,Yz}
+ def __set__(self, prestressScale):
+ cdef int dim
+ dim = sizeof(self._prscal)/sizeof(self._prscal[0])
+ assert(len(prestressScale) == dim)
+ for i from 0 <= i < dim:
+ self._prscal[i] = prestressScale[i]
+
+ property wscal: # winklerScaleX, winklerScaleY, winklerScaleZ
+ def __set__(self, winklerScale):
+ cdef int dim
+ dim = sizeof(self._wscal)/sizeof(self._wscal[0])
+ assert(len(winklerScale) == dim)
+ for i from 0 <= i < dim:
+ self._wscal[i] = winklerScale[i]
+
+ property wxscal: # winklerSlipScaleX, winklerSlipScaleY, winklerSlipScaleZ
+ def __set__(self, winklerSlipScale):
+ cdef int dim
+ dim = sizeof(self._wxscal)/sizeof(self._wxscal[0])
+ assert(len(winklerSlipScale) == dim)
+ for i from 0 <= i < dim:
+ self._wxscal[i] = winklerSlipScale[i]
+
+ #
+ # materialPropertiesInputFile iii.prop
+ #
+
+ cdef public int numat
+
+ property prop:
+ def __set__(self, propertyList):
+ cdef int nprops
+ nprops = len(propertyList)
+ self._prop = DoubleArray(nprops)
+ for i from 0 <= i < nprops:
+ self._prop.ptr[i] = propertyList[i]
+
+ property infmat:
+ def __set__(self, materialModel):
+ cdef int ninfmats
+ ninfmats = len(materialModel)
+ self._infmat = IntArray(ninfmats)
+ for i from 0 <= i < ninfmats:
+ self._infmat.ptr[i] = materialModel[i]
+
+
+ # Unit numbers for Fortran I/O.
+ cdef public int kti # f77StandardInput
+ cdef public int kto # f77StandardOutput
+ cdef public int kr # f77FileInput
+ cdef public int kw # f77AsciiOutput
+ cdef public int kp # f77PlotOutput
+ cdef public int kucd # f77UcdOutput
+
+ #
+ # Mesh.
+ #
+
+ ## work-around silly Pyrex limitation
+ #cdef public PyLithMeshLib.Mesh mesh
+ cdef PyLithMeshLib.Mesh _mesh
+ property mesh:
+ def __get__(self): return self._mesh
+ def __set__(self, mesh): self._mesh = mesh
+
+
+ def run(self, points):
+
+ self.scan()
+ self.read()
+ self.numberequations()
+ self.sortmesh()
+ self.sparsesetup()
+ self.allocateremaining()
+ self.meshwrite()
+
+ if self.generateGreen:
+ self.greenFunction(points)
+ else:
+ self.runSimulation()
+
+ return
+
+
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ #
+ # Private
+ #
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ # (public)
+ cdef double _grav[3]
+ cdef double _prscal[6]
+ cdef double _wscal[3]
+ cdef double _wxscal[3]
+ cdef DoubleArray _prop
+ cdef IntArray _infmat
+
+ # debugging
+ cdef object trace
+
+ # (constants)
+ cdef int maxElementEquations
+ cdef int neni[10]
+
+ # matmod_def
+ cdef int infmatmod[6 * constants.maxMaterialModels]
+
+ # scan_coords
+ cdef int numnp
+ cdef double cscale
+
+ # scan_bc
+ cdef int numbc
+ cdef double dscale, vscale, fscale
+
+ # scan_wink
+ cdef int nwinke, nwink
+
+ # scan_skew
+ cdef int numrot
+ cdef double runits
+
+ # scan_timdat
+ cdef int lastep, nintg
+ cdef double tunits
+
+ # scan_fuldat
+ cdef int icontr
+
+ # scan_hist
+ cdef int nhist
+
+ # scan_prestr
+ cdef int nprestr
+ cdef int nprestrflag
+
+ # scan_tractions
+ cdef int numtractions
+ cdef double tscale
+
+ # scan_split
+ cdef int numfn
+
+ # scan_slip
+ cdef int numslp
+
+ # scan_diff
+ cdef int numdif
+
+ # scan_winkx
+ cdef int nwinkxe, nwinkx
+
+ # scan_connect
+ cdef int maxvfamilies
+ cdef IntArray ivflist
+ cdef int numelv, nvfamilies, ietypev
+
+ # getdef, preshape, preshape2d
+ cdef int nen, nsnodes, ngauss, nee
+ cdef int connectivitySize
+ cdef DoubleArray sh, shj, gauss
+ cdef DoubleArray sh2d, gauss2d
+ cdef int infetype[4], infetype2d[4]
+
+ # read_coords
+ cdef DoubleArray x
+
+ # read_bc
+ cdef DoubleArray bond
+ cdef IntArray ibond
+ cdef int numberConcForces
+
+ # read_skew
+ cdef DoubleArray skew
+
+ # read_timdat
+ cdef DoubleArray delt, alfa, utol, ftol, etol, times
+ cdef IntArray maxstp, maxit, ntdinit, lgdef, itmax
+
+ # read_fuldat
+ cdef IntArray iprint
+
+ # read_stateout
+ cdef int istatout[3*constants.maxStateVariables]
+ cdef int nstatout[3]
+
+ # read_hist
+ cdef DoubleArray histry
+
+ # read_connect
+ cdef IntArray ien, mat
+
+ # read_tractions
+ cdef IntArray tractionverts
+ cdef DoubleArray tractionvals
+
+ # read_split
+ cdef IntArray nfault
+ cdef DoubleArray fault
+ cdef int numflt
+
+ # read_slip
+ cdef IntArray nslip
+ cdef int numsn
+
+ # read_diff
+ cdef IntArray idhist
+ cdef DoubleArray diforc
+
+ # read_wink
+ cdef IntArray iwinkdef, iwinkid
+ cdef DoubleArray winkdef
+ cdef IntArray iwinkxdef, iwinkxid
+ cdef DoubleArray winkxdef
+
+ # id_split
+ cdef IntArray idftn
+
+ # create_id
+ cdef IntArray id, idx, idslp
+ cdef int neq
+
+ # nfind
+ cdef IntArray ipslp
+
+ # assign_wink
+ cdef DoubleArray wink, winkx
+ cdef IntArray iwink, iwinkx
+
+ # sort_elements
+ cdef IntArray iens, ivfamily, indxiel, ielindx
+ cdef int nstatesz, nstatesz0, npropsz
+
+ # setupPETScLogging
+ cdef petsc.PetscInt autoprestrStage, elasticStage, viscousStage
+ cdef petsc.PetscEvent iterateEvent
+
+ # local, localf, localx
+ cdef IntArray lm, lmf, lmx
+
+ # lnklst
+ cdef int nnz
+
+ # makemsr
+ cdef int nmin, nmax
+ cdef double wavg
+
+ # Force vectors
+ cdef DoubleArray bextern, btraction, bgravity, bconcForce
+ cdef DoubleArray bwink, bwinkx, bintern, bresid, dispVec, dprev
+
+ # Displacement arrays
+ cdef DoubleArray d, deld, dcur
+
+ # Slippery node arrays
+ cdef DoubleArray dx, deldx, dxcur
+
+ # Split node arrays
+ cdef DoubleArray dfault, tfault
+
+ # Local stiffness matrix arrays
+ cdef DoubleArray s, stemp
+
+ # Element arrays
+ cdef DoubleArray state, dstate, dmat, state0
+ cdef int iddmat[36]
+
+ # other arrays needed for the solution
+ cdef int nforce[8]
+ cdef int ncodat[2]
+ cdef int npar[12]
+ cdef int nprint[4]
+ cdef int nsysdat[11]
+ cdef int nunits[6]
+ cdef int nvisdat[4]
+ cdef double rgiter[3]
+ cdef double rtimdat[4]
+ cdef int ntimdat[9]
+
+
+ def __new__(self):
+
+ # Initialize public properties, just to be safe. (These
+ # defaults will be overwritten by the Pyre component.)
+
+ # Output option flags.
+ self.idout = 1 # asciiOutput=echo
+ self.idsk = 0 # plotOutput=none
+ self.iucd = 0 # ucdOutput=none
+
+ # Additional option flags.
+ self.icode = 3 # analysisType=fullSolution
+ self.pythonTimestep = 0 # pythonTimestep=False
+ self.generateGreen = 0 # generateGreen=False
+ self.idebug = 0 # debuggingOutput=False
+ self.ncycle = 1 # numberCycles=1
+
+ # Unused option flags.
+ self.iskopt = 2 # autoRotateSlipperyNodes=True
+
+ #
+ # Category 2 parameters formerly placed in *.keyval files.
+ #
+
+ self.stol = 1.0e-12 # stressTolerance
+ self.dtol = 1.0e-7 # minimumStrainPerturbation
+ self.epert = 1.0e-1 # initialStrainPerturbation
+
+ self.nprevdflag = 0 # usePreviousDisplacementFlag
+
+ self.intord = 1 # quadratureOrder=Full
+
+ self.ipstrs = 0 # prestressAutoCompute=False
+ self.ipauto = 0 # prestressAutoChangeElasticProps=False
+ self.tpois = 0.49 # prestressAutoComputePoisson
+ self.tyoungs = 1.0e30 # prestressAutoComputeYoungs in Pa
+
+ # Array properties.
+
+ cdef int dim
+
+ # _grav
+ dim = sizeof(self._grav)/sizeof(self._grav[0])
+ for i from 0 <= i < dim:
+ self._grav[i] = 0.0
+
+ # _prscal
+ dim = sizeof(self._prscal)/sizeof(self._prscal[0])
+ for i from 0 <= i < dim:
+ self._prscal[i] = 1.0
+
+ # _wscal
+ dim = sizeof(self._wscal)/sizeof(self._wscal[0])
+ for i from 0 <= i < dim:
+ self._wscal[i] = 1.0
+
+ dim = sizeof(self._wxscal)/sizeof(self._wxscal[0])
+ for i from 0 <= i < dim:
+ self._wxscal[i] = 1.0
+
+ # Unit numbers for Fortran I/O.
+ self.kti = 5 # f77StandardInput
+ self.kto = 6 # f77StandardOutput
+ self.kr = 10 # f77FileInput
+ self.kw = 11 # f77AsciiOutput
+ self.kp = 12 # f77PlotOutput
+ self.kucd = 13 # f77UcdOutput
+
+ return
+
+
+ def __init__(self):
+ import journal
+ self.trace = journal.debug("pylith3d.trace")
+
+
+ cdef outputSampleValues(self, filename, impulseNode, values):
+ '''impulse# sample# sample values'''
+ # Computing normal to the fault:
+ # Split nodes define the fault
+ # Get all fault faces for a node
+ # Area weighted average of normals
+ f = file(filename, 'w')
+ for v, values in enumerate(values):
+ write(f, '%d %d %g %g %g' % (impulseNode, v, values[0], values[1], values[2]))
+ f.close()
+ return
+
+
+ cdef greenFunction(self, points):
+ """
+ # Beginning of loop that loops over split node sets, creating
+ # an 'impulse' for each one and outputting response values.
+ # Below at present is a quasi-C version of the needed code.
+
+ splitField = None
+ m = None
+
+ # Need bindings for these
+ pylith3d.meshGetSectionPair(mesh, "split", splitField)
+ pylith3d.meshGetMesh(self.mesh, m)
+
+ # This is incorrect, but I need something like:
+ topology = getTopology(m)
+ patch = 0
+ eNumbering = pylith3d.getLocalNumbering(topology, patch, ??)
+ vNumbering = pylith3d.getLocalNumbering(topology, patch, 0)
+
+
+ # Need to loop over global nodes
+ for node in ??:
+ # Need integer and double lists to hold split node info
+ faultind = []
+ faultvals = []
+ indfault = None
+ valfault = None
+
+ # Need to find elements in the split node 'patch' that contain node.
+ numSet = 0
+ for elem in ??:
+ # Not sure if this does what I want
+ if (pylith3d.sieve.baseContains(elem)):
+ # This is totally wrong, but I need to get local element and node numbers,
+ # along with values
+ numSet += 1
+ faultind += [eNumbering.getIndex(elem)]
+ faultind += [vNumbering.getIndex(node)]
+
+ # Need to look up how to get field values
+ faultvals += [value.x, value.y, value.z]
+
+ # Create arrays to send to fortran code
+ indfault = intListToArray(faultind)
+ valfault = doubleListToArray(faultvals)
+
+ # Call fortran routine to set specified split values and clear the rest
+ pylith3d.setsplit(self.nfault, self.fault, numfn, indfault, valfault, numSet)
+ # Solve
+ pylith3d.solveElastic()
+ values = self.interpolatePoints(points)
+ self.outputSampleValues(self.fileRoot+'.output', values)
+ return
+
+
+
+ SectionReal splitField;
+
+ # Need bindings for this
+ ierr = MeshGetSectionPair(mesh, "split", &splitField);
+ // Loop over split nodes
+ for() {
+ // Loop over elements
+ for() {
+ # Need bindings for this
+ ierr = SectionPairSetFiberDimension(splitField, e, 1);
+ }
+ # Need bindings for this
+ ierr = SectionPairAllocate(splitField);
+ // Loop over elements
+ for() {
+ PetscPair value;
+
+ value.i = node;
+ value.x = ;
+ value.y = ;
+ value.z = ;
+ # Need bindings for this
+ ierr = SectionPairUpdate(splitField, e, &value);
+ # Major problem right now: This just updates PETSc/Sieve's copy of splitField.
+ # It does not change the values within PyLith, which have been read from
+ # per-process input files.
+ }
+ // Solve
+ pl3drun.solveElastic()
+ # Need bindings for this
+ ierr = SectionPairClear(splitField);
+ }
+ values = self.interpolatePoints(points)
+ self.outputSampleValues(self.fileRoot+'.output', values)
+ """
+ return
+
+
+# derived or automatically-specified quantities (category 3)
+
+ cdef scan(self):
+
+ self.trace.log("Hello from PyLith.scan (begin)!")
+ self.trace.log("Scanning ascii files to determine dimensions.")
+
+ import pyre.units
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ uparser = pyre.units.parser()
+
+ # This is a test version where the geometry type is automatically
+ # specified by using Pylith3d. The geometry type is only used for
+ # f77 routines and not in pyre. An integer value is also defined
+ # for use in f77 routines.
+ # Define some integer values that are derived from string variables.
+
+ # Invariant parameters related to element type
+ self.maxElementEquations = constants.numberDegreesFreedom*constants.maxElementNodes
+
+ neni = [8, 7, 6, 5, 4, 20, 18, 15, 13, 10]
+ cdef int dim
+ dim = sizeof(self.neni)/sizeof(self.neni[0])
+ assert(len(neni) == dim)
+ for i from 0 <= i < dim:
+ self.neni[i] = neni[i]
+
+ # Invariant parameters related to material model
+ libpylith3d.matmod_def(
+ self.infmatmod # intent(out)
+ )
+
+ # Parameters derived from the number of entries in a file.
+
+ cdef char coord_units[30]
+ libpylith3d.scan_coords(
+ &self.numnp, # intent(out)
+ &self.kr,
+ coord_units, # intent(out)
+ self.coordinateInputFile,
+ &errorcode,
+ errorstring,
+ sizeof(coord_units),
+ len(self.coordinateInputFile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+ coord_units[sizeof(coord_units)-1] = 0 # null-terminate
+
+ self.cscale = uparser.parse(str(coord_units).strip()).value
+
+ cdef char displacement_units[30]
+ cdef char velocity_units[30]
+ cdef char force_units[30]
+ libpylith3d.scan_bc(
+ &self.numbc, # intent(out)
+ &self.kr,
+ displacement_units, # intent(out)
+ velocity_units, # intent(out)
+ force_units, # intent(out)
+ self.bcfile,
+ &errorcode,
+ errorstring,
+ sizeof(displacement_units),
+ sizeof(velocity_units),
+ sizeof(force_units),
+ len(self.bcfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+ displacement_units[sizeof(displacement_units)-1] = 0 # null-terminate
+ velocity_units[sizeof(velocity_units)-1] = 0 # null-terminate
+ force_units[sizeof(force_units)-1] = 0 # null-terminate
+
+ if self.numbc > 0:
+ self.dscale = uparser.parse(str(displacement_units).strip()).value
+ self.vscale = uparser.parse(str(velocity_units).strip()).value
+ self.fscale = uparser.parse(str(force_units).strip()).value
+ else:
+ self.dscale = 0.0
+ self.vscale = 0.0
+ self.fscale = 0.0
+
+ libpylith3d.scan_wink(
+ &self.nwinke, # intent(out)
+ &self.nwink, # intent(out)
+ &self.kr,
+ self.wfile,
+ &errorcode,
+ errorstring,
+ len(self.wfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ cdef char rotation_units[30]
+ libpylith3d.scan_skew(
+ &self.numrot, # intent(out)
+ &self.kr,
+ rotation_units, # intent(out)
+ self.skfile,
+ &errorcode,
+ errorstring,
+ sizeof(rotation_units),
+ len(self.skfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+ rotation_units[sizeof(rotation_units)-1] = 0 # null-terminate
+
+ if self.numrot != 0:
+ self.runits = uparser.parse(str(rotation_units).strip()).value
+ else:
+ self.runits = 0.0
+
+ cdef char time_units[30]
+ libpylith3d.scan_timdat(
+ &self.lastep, # intent(out)
+ &self.nintg, # intent(out)
+ &self.kr,
+ time_units, # intent(out)
+ self.timeStepInputFile,
+ &errorcode,
+ errorstring,
+ len(time_units),
+ len(self.timeStepInputFile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+ time_units[sizeof(time_units)-1] = 0 # null-terminate
+
+ self.tunits = uparser.parse(str(time_units).strip()).value
+
+ libpylith3d.scan_fuldat(
+ &self.icode,
+ &self.lastep,
+ &self.icontr, # intent(out)
+ &self.kr,
+ self.fofile,
+ &errorcode,
+ errorstring,
+ len(self.fofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ libpylith3d.scan_hist(
+ &self.nhist, # intent(out)
+ &self.kr,
+ self.hfile,
+ &errorcode,
+ errorstring,
+ len(self.hfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.scan_connect()
+
+ if prestress:
+ ###### TODO
+# libpylith3d.scan_prestr(
+# &constants.stateVariableDimension,
+# &self.numberPrestressGaussPoints,
+# &self.nprestr, # intent(out)
+# &self.numberElements,
+# &self.ipstrs,
+# &self.kr,
+# self.prestressInputFile,
+# &errorcode,
+# errorstring,
+# len(self.prestressInputFile),
+# sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+ self.nprestr = 0
+ else:
+ self.nprestr = 0
+
+ cdef char traction_units[30]
+ cdef int nsnodesmax
+ nsnodesmax = constants.nsnodesmax
+ libpylith3d.scan_tractions(
+ &self.numtractions, # intent(out)
+ &nsnodesmax,
+ &self.kr,
+ traction_units, # intent(out)
+ self.tractionInputFile,
+ &errorcode,
+ errorstring,
+ sizeof(traction_units),
+ len(self.tractionInputFile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+ traction_units[sizeof(traction_units)-1] = 0 # null-terminate
+
+ if self.numtractions != 0:
+ self.tscale = uparser.parse(str(traction_units).strip()).value
+ else:
+ self.tscale = 0.0
+
+ libpylith3d.scan_split(
+ &self.numfn, # intent(out)
+ &self.kr,
+ self.spfile,
+ &errorcode,
+ errorstring,
+ len(self.spfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ libpylith3d.scan_slip(
+ &self.numslp, # intent(out)
+ &self.kr,
+ self.slfile,
+ &errorcode,
+ errorstring,
+ len(self.slfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ libpylith3d.scan_diff(
+ &self.numslp,
+ &self.numdif, # intent(out)
+ &self.kr,
+ self.difile,
+ &errorcode,
+ errorstring,
+ len(self.difile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ libpylith3d.scan_winkx(
+ &self.numslp,
+ &self.nwinkxe, # intent(out)
+ &self.nwinkx, # intent(out)
+ &self.kr,
+ self.wxfile,
+ &errorcode,
+ errorstring,
+ len(self.wxfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.trace.log("Hello from PyLith.scan (end)!")
+
+ return
+
+
+ cdef scan_connect(self):
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ # At present, we assume that the number of element families is equal to
+ # the number of material types used, since only one volume element type at a
+ # time is allowed.
+ self.maxvfamilies = (constants.numberAllowedVolumeElementTypes *
+ self.numat)
+
+ self.ivflist = IntArray(3*self.maxvfamilies)
+
+ libpylith3d.scan_connect(
+ self.neni,
+ self.infmatmod,
+ self._infmat.ptr,
+ self.ivflist.ptr, # intent(out)
+ &self.maxvfamilies,
+ &self.numat,
+ &self.numelv, # intent(out)
+ &self.nvfamilies, # intent(out)
+ &self.ietypev, # intent(out)
+ &self.kr,
+ self.connectivityInputFile,
+ &errorcode,
+ errorstring,
+ len(self.connectivityInputFile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ return
+
+
+# The main function of this code is to emulate the original functionality of
+# input.f in the original version of TECTON. This code segment controls the
+# allocation of memory and the reading of the input file. Additional functions
+# covered by this code include the sparse matrix setup portion, which also does
+# some memory allocation. Additional code sections will call the main elastic
+# and time-dependent solution drivers, which are presently f77 subroutines.
+
+
+ cdef read(self):
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ # This function reads all input and performs some memory allocation.
+
+ self.trace.log("Hello from pl3dsetup.read (begin)!")
+
+ print "Reading problem definition and allocating necessary storage."
+
+ # Set up global integration info.
+ self.getdef()
+
+ #
+ # Node-based info (coordinates, displacement arrays, BC, and skew BC).
+ #
+
+ self.x = DoubleArray(constants.numberSpaceDimensions*self.numnp)
+ libpylith3d.read_coords(
+ self.x.ptr, # intent(out)
+ &self.cscale,
+ &self.numnp,
+ &self.kr,
+ self.coordinateInputFile,
+ &errorcode,
+ errorstring,
+ len(self.coordinateInputFile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.ibond = IntArray(constants.numberDegreesFreedom*self.numnp)
+ self.bond = DoubleArray(constants.numberDegreesFreedom*self.numnp)
+ libpylith3d.read_bc(
+ self.bond.ptr, # intent(out)
+ &self.dscale,
+ &self.vscale,
+ &self.fscale,
+ self.ibond.ptr, # intent(out)
+ &self.numnp,
+ &self.numbc,
+ &self.numberConcForces, # intent(out)
+ &self.kr,
+ self.bcfile,
+ &errorcode,
+ errorstring,
+ len(self.bcfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.skew = DoubleArray(constants.numberSkewDimensions*self.numnp)
+ libpylith3d.read_skew(
+ self.skew.ptr, # intent(out)
+ &self.runits,
+ &self.numrot,
+ &self.numnp,
+ &self.iskopt,
+ &self.kr,
+ self.skfile,
+ &errorcode,
+ errorstring,
+ len(self.skfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ #
+ # Allocate and read time step, time output, and load history info.
+ #
+
+ self.delt = DoubleArray(self.nintg)
+ self.alfa = DoubleArray(self.nintg)
+ self.utol = DoubleArray(self.nintg)
+ self.ftol = DoubleArray(self.nintg)
+ self.etol = DoubleArray(self.nintg)
+ # Note that array 'times' is needed for output, if requested.
+ self.times = DoubleArray(self.lastep+1)
+ self.maxstp = IntArray(self.nintg)
+ self.maxit = IntArray(self.nintg)
+ self.ntdinit = IntArray(self.nintg)
+ self.lgdef = IntArray(self.nintg)
+ self.itmax = IntArray(self.nintg)
+ libpylith3d.read_timdat(
+ self.delt.ptr, # intent(out)
+ self.alfa.ptr, # intent(out)
+ self.utol.ptr, # intent(out)
+ self.ftol.ptr, # intent(out)
+ self.etol.ptr, # intent(out)
+ self.times.ptr, # intent(out)
+ &self.tunits,
+ self.maxstp.ptr, # intent(out)
+ self.maxit.ptr, # intent(out)
+ self.ntdinit.ptr, # intent(out)
+ self.lgdef.ptr, # intent(out)
+ self.itmax.ptr, # intent(out)
+ &self.nintg,
+ &self.lastep,
+ &self.kr,
+ self.timeStepInputFile,
+ &errorcode,
+ errorstring,
+ len(self.timeStepInputFile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.iprint = IntArray(self.icontr)
+ libpylith3d.read_fuldat(
+ self.iprint.ptr, # intent(out)
+ &self.icontr,
+ &self.icode,
+ &self.ncycle,
+ &self.lastep,
+ &self.kr,
+ self.fofile,
+ &errorcode,
+ errorstring,
+ len(self.fofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ libpylith3d.read_stateout(
+ self.istatout,
+ self.nstatout,
+ &self.kr,
+ self.stfile,
+ &errorcode,
+ errorstring,
+ len(self.stfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.histry = DoubleArray((self.lastep+1)*self.nhist)
+ libpylith3d.read_hist(
+ self.histry.ptr, # intent(out)
+ self.times.ptr,
+ &self.nhist,
+ &self.lastep,
+ &self.kr,
+ self.hfile,
+ &errorcode,
+ errorstring,
+ len(self.hfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ #
+ # Allocate and read info on connectivities and prestresses
+ #
+
+ if self.nprestr != 0 or self.ipstrs != 0:
+ self.nprestrflag = 1
+ else:
+ self.nprestrflag = 0
+
+ self.ien = IntArray(self.nen*self.numelv)
+ self.mat = IntArray(self.numelv)
+ libpylith3d.read_connect(
+ self.ien.ptr, # intent(out)
+ self.mat.ptr, # intent(out)
+ &self.nen,
+ &self.numelv,
+ &self.numnp,
+ &self.nvfamilies,
+ &self.kr,
+ self.connectivityInputFile,
+ &errorcode,
+ errorstring,
+ len(self.connectivityInputFile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ if prestress:
+ ###### TODO
+# libpylith3d.read_prestr(
+# self.stn,
+# self.st0,
+# self._prscal,
+# self.numberStressComponents,
+# self.numberGaussPoints,
+# self.numberPrestressGaussPoints,
+# self.numberElements,
+# self.nprestr,
+# self.ipstrs,
+# self.idout,
+# self.kr,
+# self.kw,
+# self.prestressInputFile,
+# self.ofile)
+ pass
+
+ # Read traction BC
+ self.tractionverts = IntArray(self.nsnodes*self.numtractions)
+ self.tractionvals = DoubleArray(constants.numberDegreesFreedom*self.numtractions)
+ libpylith3d.read_tractions(
+ self.tractionverts.ptr, # intent(out)
+ self.tractionvals.ptr, # intent(out)
+ &self.tscale,
+ &self.numtractions,
+ &self.nsnodes,
+ &self.kr,
+ self.tractionInputFile,
+ &errorcode,
+ errorstring,
+ len(self.tractionInputFile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Read split node info
+ self.nfault = IntArray(3*self.numfn)
+ self.fault = DoubleArray(constants.numberDegreesFreedom*self.numfn)
+ libpylith3d.read_split(
+ self.fault.ptr, # intent(out)
+ self.nfault.ptr, # intent(out)
+ &self.numfn,
+ &self.numflt, # intent(out)
+ &self.numnp,
+ &self.numelv,
+ &self.kr,
+ self.spfile,
+ &errorcode,
+ errorstring,
+ len(self.spfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Read slippery node info
+ # Note that array Nslip is also required in functions sortmesh and sparsesetup
+ # before it can be deallocated.
+ self.nslip = IntArray(constants.numberSlipDimensions*self.numslp)
+ libpylith3d.read_slip(
+ self.nslip.ptr, # intent(out)
+ &self.numslp,
+ &self.numsn, # intent(out)
+ &self.numnp,
+ &self.iskopt,
+ &self.kr,
+ self.slfile,
+ &errorcode,
+ errorstring,
+ len(self.slfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.idhist = IntArray(self.numnp)
+ self.diforc = DoubleArray(constants.numberDegreesFreedom*self.numnp)
+ libpylith3d.read_diff(
+ self.diforc.ptr, # intent(out)
+ self.nslip.ptr,
+ self.idhist.ptr, # intent(out)
+ &self.numslp,
+ &self.numdif,
+ &self.numnp,
+ &self.kr,
+ self.difile,
+ &errorcode,
+ errorstring,
+ len(self.difile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Read Winkler forces and slippery Winkler forces.
+ # All input is finished after this section.
+ self.iwinkdef = IntArray(constants.numberDegreesFreedom*self.nwinke)
+ self.iwinkid = IntArray(self.nwinke)
+ self.winkdef = DoubleArray(constants.numberDegreesFreedom*self.nwinke)
+ libpylith3d.read_wink(
+ self.winkdef.ptr, # intent(out)
+ self._wscal,
+ self.iwinkdef.ptr, # intent(out)
+ self.iwinkid.ptr, # intent(out)
+ &self.nwink,
+ &self.nwinke,
+ &self.kr,
+ self.wfile,
+ &errorcode,
+ errorstring,
+ len(self.wfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.iwinkxdef = IntArray(constants.numberDegreesFreedom*self.nwinkxe)
+ self.iwinkxid = IntArray(self.nwinkxe)
+ self.winkxdef = DoubleArray(constants.numberDegreesFreedom*self.nwinkxe)
+ libpylith3d.read_wink(
+ self.winkxdef.ptr, # intent(out)
+ self._wxscal,
+ self.iwinkxdef.ptr, # intent(out)
+ self.iwinkxid.ptr, # intent(out)
+ &self.nwinkx,
+ &self.nwinkxe,
+ &self.kr,
+ self.wxfile,
+ &errorcode,
+ errorstring,
+ len(self.wxfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.trace.log("Hello from pl3dsetup.read (end)!")
+
+ return
+
+
+ cdef getdef(self):
+
+ assert(self.ietypev <= elementtypes.numElementTypes)
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ cdef elementtypes.ElementType *elementType
+ cdef int nsgauss
+
+ elementType = &elementtypes.elementTypes[self.ietypev - 1]
+
+ self.nen = elementType.nodes
+ self.nsnodes = elementType.nodes2d
+
+ if self.intord == 1:
+ self.ngauss = elementType.fullGauss
+ nsgauss = elementType.fullGauss2d
+ elif self.intord == 2:
+ self.ngauss = elementType.reducedGauss
+ nsgauss = elementType.reducedGauss2d
+ elif self.intord == 3:
+ self.ngauss = elementType.fullGauss
+ nsgauss = elementType.fullGauss2d
+ else:
+ raise ValueError("intord (%d) is not in [1, 2, 3]" % intord)
+
+ cdef int nsd, nsd1
+ nsd = constants.numberSpaceDimensions
+ nsd1 = nsd + 1
+
+ self.sh = DoubleArray(nsd1 * self.nen * self.ngauss)
+ self.shj = DoubleArray(nsd1 * self.nen * self.ngauss)
+ self.gauss = DoubleArray(nsd1 * self.ngauss)
+
+ libpylith3d.preshape(
+ self.sh.ptr, # intent(out)
+ self.shj.ptr, # intent(out)
+ self.gauss.ptr, # intent(out)
+ &self.intord,
+ &self.ietypev,
+ &self.nen,
+ &self.ngauss,
+ &errorcode,
+ errorstring,
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.sh2d = DoubleArray(nsd * self.nsnodes * nsgauss)
+ self.gauss2d = DoubleArray(nsd * nsgauss)
+
+ libpylith3d.preshape2d(
+ self.sh2d.ptr, # intent(out)
+ self.gauss2d.ptr, # intent(out)
+ &self.intord,
+ &self.ietypev,
+ &self.nsnodes,
+ &nsgauss,
+ &errorcode,
+ errorstring,
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.connectivitySize = self.numelv*self.nen
+
+ #
+ # infetype array
+ #
+
+ self.nee = constants.numberDegreesFreedom * self.nen
+ cdef int nec
+ nec = 0
+
+ cdef int *infetype
+ infetype = &self.infetype[0] - 1 # convert to one-based
+ infetype[1] = self.nen
+ infetype[2] = self.ngauss
+ infetype[3] = self.nee
+ infetype[4] = nec
+ assert( 4 == sizeof(self.infetype)/sizeof(self.infetype[0]))
+
+ #
+ # infetype2d array
+ #
+
+ cdef int numberSurfaceElementEquations, numberSurfaceElementCoordinates
+ numberSurfaceElementEquations = (constants.numberDegreesFreedom *
+ self.nsnodes)
+ numberSurfaceElementCoordinates = (constants.numberSpaceDimensions *
+ self.nsnodes)
+
+ cdef int *infetype2d
+ infetype2d = &self.infetype2d[0] - 1 # convert to one-based
+ infetype2d[1] = self.nsnodes
+ infetype2d[2] = nsgauss
+ infetype2d[3] = numberSurfaceElementEquations # unused?
+ infetype2d[4] = numberSurfaceElementCoordinates # unused?
+ assert( 4 == sizeof(self.infetype2d)/sizeof(self.infetype2d[0]))
+
+ return
+
+
+ cdef numberequations(self):
+
+ # This functions numbers equations based on BC and slippery node info.
+
+ self.trace.log("Hello from pl3dsetup.numberequations (begin)!")
+
+ print "Numbering global equations."
+
+ # Create Idftn array for split nodes. This can be deallocated
+ # after meshwrite function has been called.
+ self.idftn = IntArray(self.numflt)
+
+ libpylith3d.id_split(
+ self.nfault.ptr,
+ self.idftn.ptr, # intent(out)
+ &self.numnp,
+ &self.numfn,
+ &self.numflt)
+
+ # Determine global equations and store equation numbers in Id and Idx.
+ self.id = IntArray(constants.numberSpaceDimensions*self.numnp)
+ self.idx = IntArray(constants.numberSpaceDimensions*self.numnp)
+ self.idslp = IntArray(self.numnp)
+
+ # Number of equations
+
+ libpylith3d.create_id(
+ self.id.ptr, # intent(out)
+ self.idx.ptr, # intent(out)
+ self.ibond.ptr,
+ self.nslip.ptr,
+ self.idslp.ptr, # intent(out)
+ &self.numslp,
+ &self.numnp,
+ &self.numsn,
+ &self.neq # intent(out)
+ )
+
+ self.ipslp = IntArray(constants.numberSlipNeighbors*self.numsn)
+
+ # If there are slippery nodes and the auto-rotation option is selected, find
+ # neighboring nodes on the fault so that a best-fit plane can be determined at
+ # each node.
+ if self.numsn != 0 and self.iskopt == 2:
+ self.nfind()
+
+ # Assign appropriate equation numbers to Iwink array, and compact Wink
+ # array to correspond to assigned BC.
+ self.wink = DoubleArray(self.nwink)
+ self.iwink = IntArray(2*self.nwink)
+
+ libpylith3d.assign_wink(
+ self.winkdef.ptr,
+ self.wink.ptr, # intent(out)
+ self.iwinkdef.ptr,
+ self.iwinkid.ptr,
+ self.iwink.ptr, # intent(out)
+ self.id.ptr,
+ &self.numnp,
+ &self.nwink,
+ &self.nwinke)
+
+ # Assign appropriate equation numbers to Iwinkx array, and compact Winkx
+ # array to correspond to assigned BC.
+ self.winkx = DoubleArray(self.nwinkx)
+ self.iwinkx = IntArray(2*self.nwinkx)
+
+ libpylith3d.assign_wink(
+ self.winkxdef.ptr,
+ self.winkx.ptr, # intent(out)
+ self.iwinkxdef.ptr,
+ self.iwinkxid.ptr,
+ self.iwinkx.ptr, # intent(out)
+ self.idx.ptr,
+ &self.numnp,
+ &self.nwinkx,
+ &self.nwinkxe)
+
+ self.trace.log("Hello from pl3dsetup.numberequations (end)!")
+
+ return
+
+
+ cdef nfind(self):
+
+ # Temporary arrays
+ cdef DoubleArray xtmp
+ cdef IntArray itmp, itmp1, itmp2
+
+ xtmp = DoubleArray(self.numsn)
+ itmp = IntArray(self.numsn)
+ itmp1 = IntArray(self.numsn)
+ itmp2 = IntArray(self.numsn)
+
+ libpylith3d.nfind(
+ self.x.ptr,
+ xtmp.ptr,
+ self.idslp.ptr,
+ self.ipslp.ptr, # intent(out)
+ itmp.ptr,
+ itmp1.ptr,
+ itmp2.ptr,
+ self.nslip.ptr,
+ &self.numslp,
+ &self.numsn,
+ &self.numnp)
+
+ return
+
+
+ cdef sortmesh(self):
+
+ # This function sorts elements into families and sorts all other items that are
+ # affected by this.
+
+ self.trace.log("Hello from pl3dsetup.sortmesh (begin)!")
+
+ print "Renumbering elements, split nodes, and slippery nodes."
+
+ self.sort_elements()
+
+ # Sort split node entries.
+ libpylith3d.sort_split_nodes(
+ self.nfault.ptr, # intent(inout)
+ self.indxiel.ptr,
+ &self.numfn,
+ &self.numelv)
+
+ # Sort slippery node entries.
+ libpylith3d.sort_slip_nodes(
+ self.nslip.ptr, # intent(inout)
+ self.indxiel.ptr,
+ &self.numslp,
+ &self.numelv)
+
+ self.trace.log("Hello from pl3dsetup.sortmesh (end)!")
+
+ return
+
+
+ cdef sort_elements(self):
+ # Sort elements into families. The sorted elements are contained
+ # in array Iens, and the index array for the new ordering is
+ # Indxiel. The index array for the original ordering is Ielindx.
+ # The original element node array (Ien) and the associated
+ # material type array (Mat) may be deallocated after sorting.
+
+ self.iens = IntArray(self.nen*self.numelv)
+ self.ivfamily = IntArray(6*self.nvfamilies)
+ self.indxiel = IntArray(self.numelv)
+ self.ielindx = IntArray(self.numelv)
+
+ cdef IntArray ivftmp
+ ivftmp = IntArray(self.nvfamilies)
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ libpylith3d.sort_elements(
+ self.ien.ptr,
+ self.mat.ptr,
+ self.infmatmod,
+ self.ivflist.ptr,
+ self.ivfamily.ptr, # intent(out)
+ self.iens.ptr, # intent(out)
+ ivftmp.ptr,
+ self.indxiel.ptr, # intent(out)
+ self.ielindx.ptr, # intent(out)
+ &self.nen,
+ &self.ngauss,
+ &self.maxvfamilies,
+ &self.nvfamilies,
+ &self.nprestrflag,
+ &self.numelv,
+ &self.numnp,
+ &self.nstatesz, # intent(out)
+ &self.nstatesz0, # intent(out)
+ &self.npropsz, # intent(out)
+ &errorcode,
+ errorstring,
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.ien = None ### DEALLOC
+ self.mat = None ### DEALLOC
+ self.ivflist = None ### DEALLOC
+
+ return
+
+
+ cdef setupPETScLogging(self):
+
+ self.autoprestrStage = PetscLogStageRegister("AutoPrestress Solve")
+ self.elasticStage = PetscLogStageRegister("Elastic Solve")
+ self.viscousStage = PetscLogStageRegister("Viscous Solve")
+
+ self.iterateEvent = PetscLogEventRegister("Iterate", petsc.KSP_COOKIE)
+
+ return
+
+
+ cdef sparsesetup(self):
+
+ # This function sets up sparse matrix and associated storage.
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ self.trace.log("Hello from pl3dsetup.sparsesetup (begin)!")
+
+ print "Setting up sparse matrix storage."
+
+ self.setupPETScLogging()
+
+ # Arrays to map element equation numbers to global
+ # Localize global equation numbers in element index arrays.
+
+ self.lm = IntArray(constants.numberDegreesFreedom*self.connectivitySize)
+ libpylith3d.local(
+ self.id.ptr,
+ &self.numnp,
+ self.iens.ptr,
+ self.lm.ptr, # intent(out)
+ &self.numelv,
+ &self.nen)
+
+ self.lmf = IntArray(self.connectivitySize)
+ libpylith3d.localf(
+ self.iens.ptr,
+ self.lmf.ptr, # intent(out)
+ &self.numelv,
+ self.nfault.ptr,
+ &self.numfn,
+ &self.nen)
+
+ self.lmx = IntArray(constants.numberDegreesFreedom*self.connectivitySize)
+ libpylith3d.localx(
+ self.idx.ptr,
+ &self.numnp,
+ self.iens.ptr,
+ self.lmx.ptr, # intent(out)
+ &self.numelv,
+ self.nslip.ptr,
+ &self.numslp,
+ &self.nen)
+
+ # Keeping this for now as it may be wanted for output
+ if False: self.nslip = None ### DEALLOC
+
+ # Allocate and populate sparse matrix arrays. Some of these are
+ # temporary and are then deleted after use.
+ cdef int iwork
+ iwork = 0
+ libpylith3d.cmp_stiffsz(
+ &self.neq,
+ self.lm.ptr,
+ self.lmx.ptr,
+ &self.numelv,
+ &iwork, # intent(out)
+ &self.numsn,
+ &self.nen,
+ &errorcode,
+ errorstring,
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Temporary arrays
+ cdef IntArray indx, link, nbrs
+ indx = IntArray(self.neq)
+ link = IntArray(iwork)
+ nbrs = IntArray(iwork)
+
+ cdef int nsizea
+
+ libpylith3d.lnklst(
+ &self.neq,
+ self.lm.ptr,
+ self.lmx.ptr,
+ &self.numelv,
+ &self.nen,
+ &self.nee,
+ indx.ptr,
+ link.ptr,
+ nbrs.ptr,
+ &iwork,
+ &nsizea, # intent(out)
+ &self.nnz, # intent(out)
+ &self.numsn,
+ &errorcode,
+ errorstring,
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self._mesh.createMat()
+
+ libpylith3d.makemsr(
+ &self._mesh.A,
+ indx.ptr,
+ link.ptr,
+ nbrs.ptr,
+ &self.neq,
+ &self.nnz,
+ &iwork,
+ &self.nmin,
+ &self.nmax,
+ &self.wavg)
+
+ print ""
+ print ""
+ print "Sparse matrix information:"
+ print ""
+ print "numberGlobalEquations: %i" % self.neq
+ print "workingArraySize: %i" % iwork
+ print "stiffnessMatrixSize: %i" % (self.nnz-1)
+ print "stiffnessOffDiagonalSize: %i" % nsizea
+ print "minimumNonzeroTermsPerRow: %i" % self.nmin
+ print "maximumNonzeroTermsPerRow: %i" % self.nmax
+ print "averageNonzeroTermsPerRow: %g" % self.wavg
+ print ""
+
+ self.trace.log("Hello from pl3dsetup.sparsesetup (end)!")
+
+ return
+
+
+ cdef allocateremaining(self):
+
+ # This function allocates all remaining arrays that are needed for computations.
+
+ self.trace.log("Hello from pl3dsetup.allocateremaining (begin)!")
+
+ print "Allocating remaining storage."
+
+ # Allocate memory for all additional arrays
+
+ cdef int ntractflag, ngravflag, nconcflag, nextflag
+ cdef int nwinkflag, nwinkxflag
+ cdef int dim
+
+ # Force vectors
+ if self.numtractions != 0:
+ ntractflag = 1
+ else:
+ ntractflag = 0
+
+ ngravflag = 0
+ dim = sizeof(self._grav)/sizeof(self._grav[0])
+ for i from 0 <= i < dim:
+ if self._grav[i] != 0.0:
+ ngravflag = 1
+ break
+
+ if self.numberConcForces != 0 or self.numdif != 0:
+ nconcflag = 1
+ else:
+ nconcflag = 0
+ if ntractflag != 0 or ngravflag != 0 or nconcflag != 0:
+ nextflag = 1
+ else:
+ nextflag = 0
+ if self.nwink != 0:
+ nwinkflag = 1
+ else:
+ nwinkflag = 0
+ if self.nwinkx != 0:
+ nwinkxflag = 1
+ else:
+ nwinkxflag = 0
+
+ self.bextern = DoubleArray(nextflag*self.neq)
+ self.btraction = DoubleArray(ntractflag*self.neq)
+ self.bgravity = DoubleArray(ngravflag*self.neq)
+ self.bconcForce = DoubleArray(nconcflag*self.neq)
+ self.bwink = DoubleArray(nwinkflag*self.neq)
+ self.bwinkx = DoubleArray(nwinkxflag*self.neq)
+ self.bintern = DoubleArray(self.neq)
+ self.bresid = DoubleArray(self.neq)
+ self.dispVec = DoubleArray(self.neq)
+ self.dprev = DoubleArray(self.nprevdflag*self.neq)
+
+ # Displacement arrays
+ self.d = DoubleArray(constants.numberDegreesFreedom*self.numnp)
+ self.deld = DoubleArray(constants.numberDegreesFreedom*self.numnp)
+ self.dcur = DoubleArray(constants.numberDegreesFreedom*self.numnp)
+
+ # Slippery node arrays
+ self.dx = DoubleArray(constants.numberDegreesFreedom*self.numnp)
+ self.deldx = DoubleArray(constants.numberDegreesFreedom*self.numnp)
+ self.dxcur = DoubleArray(constants.numberDegreesFreedom*self.numnp)
+
+ # Split node arrays
+ self.dfault = DoubleArray(constants.numberDegreesFreedom*self.numfn)
+ self.tfault = DoubleArray(constants.numberDegreesFreedom*self.numfn)
+
+ # Local stiffness matrix arrays
+ self.s = DoubleArray(self.maxElementEquations*self.maxElementEquations)
+ self.stemp = DoubleArray(self.maxElementEquations*self.maxElementEquations)
+
+ # Element arrays
+ self.state = DoubleArray(self.nstatesz)
+ self.dstate = DoubleArray(self.nstatesz)
+ self.dmat = DoubleArray(constants.materialMatrixDimension *
+ self.ngauss *
+ self.numelv)
+
+ # This corresponds to the BLAS packed symmetric matrix format.
+ listIddmat = [
+ 1, 2, 4, 7,11,16,
+ 2, 3, 5, 8,12,17,
+ 4, 5, 6, 9,13,18,
+ 7, 8, 9,10,14,19,
+ 11,12,13,14,15,20,
+ 16,17,18,19,20,21
+ ]
+ dim = sizeof(self.iddmat)/sizeof(self.iddmat[0])
+ assert(len(listIddmat) == dim)
+ for i from 0 <= i < dim:
+ self.iddmat[i] = listIddmat[i]
+
+ self.state0 = DoubleArray(self.nstatesz0)
+
+ # Create arrays from lists that will be needed for the solution
+
+ # nforce array ~ see nforce_def.inc
+ cdef int *nforce
+ nforce = &self.nforce[0] - 1 # convert to one-based
+ nforce[1] = nextflag
+ nforce[2] = ntractflag
+ nforce[3] = ngravflag
+ nforce[4] = nconcflag
+ nforce[5] = self.nprestrflag
+ nforce[6] = nwinkflag
+ nforce[7] = nwinkxflag
+ nforce[8] = self.nprevdflag
+ assert(8 == sizeof(self.nforce)/sizeof(self.nforce[0]))
+
+ # ncodat array ~ see ncodat_def.inc
+ cdef int *ncodat
+ ncodat = &self.ncodat[0] - 1 # convert to one-based
+ ncodat[1] = self.icode
+ ncodat[2] = self.idebug
+ assert(2 == sizeof(self.ncodat)/sizeof(self.ncodat[0]))
+
+ # npar array ~ see npar_def.inc
+ cdef int *npar
+ npar = &self.npar[0] - 1 # convert to one-based
+ npar[1] = self.numelv
+ npar[2] = self.numat
+ npar[3] = self.numtractions
+ npar[4] = self.numslp
+ npar[5] = self.numfn
+ npar[6] = self.ipstrs
+ npar[7] = self.ipauto
+ npar[8] = self.nstatesz
+ npar[9] = self.nstatesz0
+ npar[10] = self.nvfamilies
+ npar[11] = self.numdif
+ npar[12] = self.intord
+ assert(12 == sizeof(self.npar)/sizeof(self.npar[0]))
+
+ # nprint array ~ see nprint_def.inc
+ cdef int *nprint
+ nprint = &self.nprint[0] - 1 # convert to one-based
+ nprint[1] = self.icontr
+ nprint[2] = self.idout
+ nprint[3] = self.idsk
+ nprint[4] = self.iucd
+ assert(4 == sizeof(self.nprint)/sizeof(self.nprint[0]))
+
+ # nsysdat array ~ see nsysdat_def.inc
+ cdef int *nsysdat
+ nsysdat = &self.nsysdat[0] - 1 # convert to one-based
+ nsysdat[1] = self.numnp
+ nsysdat[2] = self.neq
+ nsysdat[3] = self.nnz
+ nsysdat[4] = self.numrot
+ nsysdat[5] = self.nprestr
+ nsysdat[6] = self.numsn
+ nsysdat[7] = self.numflt
+ nsysdat[8] = self.npropsz
+ nsysdat[9] = self.nwink
+ nsysdat[10] = self.nwinkx
+ nsysdat[11] = self.iskopt
+ assert( 11 == sizeof(self.nsysdat)/sizeof(self.nsysdat[0]))
+
+ # nunits array ~ see nunits_def.inc
+ cdef int *nunits
+ nunits = &self.nunits[0] - 1 # convert to one-based
+ nunits[1] = self.kti
+ nunits[2] = self.kto
+ nunits[3] = self.kr
+ nunits[4] = self.kw
+ nunits[5] = self.kp
+ nunits[6] = self.kucd
+ assert(6 == sizeof(self.nunits)/sizeof(self.nunits[0]))
+
+ # nvisdat array ~ see nvisdat_def.inc
+ cdef int *nvisdat
+ nvisdat = &self.nvisdat[0] - 1 # convert to one-based
+ nvisdat[1] = self.ncycle
+ nvisdat[2] = self.nintg
+ nvisdat[3] = self.lastep
+ nvisdat[4] = self.nhist
+ assert( 4 == sizeof(self.nvisdat)/sizeof(self.nvisdat[0]))
+
+ # rgiter array ~ see rgiter_def.inc
+ cdef double *rgiter
+ rgiter = &self.rgiter[0] - 1 # convert to one-based
+ rgiter[1] = self.stol
+ rgiter[2] = self.dtol
+ rgiter[3] = self.epert
+ assert(3 == sizeof(self.rgiter)/sizeof(self.rgiter[0]))
+
+ # rtimdat array ~ see rtimdat_def.inc
+ cdef double *rtimdat
+ rtimdat = &self.rtimdat[0] - 1 # convert to one-based
+ cdef double deltp, alfap
+ deltp = 0.0; alfap = 0.0
+ rtimdat[1] = deltp
+ rtimdat[2] = alfap
+ rtimdat[3] = self.tpois
+ rtimdat[4] = self.tyoungs
+ assert( 4 == sizeof(self.rtimdat)/sizeof(self.rtimdat[0]))
+
+ # ntimdat array ~ see ntimdat_def.inc
+ cdef int *ntimdat
+ cdef int nstep, maxitp, ntdinitp
+ cdef int lgdefp, itmaxp, nittot
+ cdef int nrftot, ndtot , ireform
+ ntimdat = &self.ntimdat[0] - 1 # convert to one-based
+ nstep = 0; maxitp = 0; ntdinitp = 0
+ lgdefp = 0; itmaxp = 0; nittot = 0
+ nrftot = 0; ndtot = 0; ireform = 0
+ ntimdat[1] = nstep
+ ntimdat[2] = maxitp
+ ntimdat[3] = ntdinitp
+ ntimdat[4] = lgdefp
+ ntimdat[5] = itmaxp
+ ntimdat[6] = nittot
+ ntimdat[7] = nrftot
+ ntimdat[8] = ndtot
+ ntimdat[9] = ireform
+ assert( 9 == sizeof(self.ntimdat)/sizeof(self.ntimdat[0]))
+
+ self.trace.log("Hello from pl3dsetup.allocateremaining (end)!")
+
+ return
+
+
+ cdef meshwrite(self):
+
+ # This function outputs mesh information.
+ # In the near future, this needs to be broken into classes for
+ # Ascii output, plot output, UCD output, etc.
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ self.trace.log("Hello from pl3dsetup.meshwriteascii (begin)!")
+
+ print "Outputting Ascii mesh information."
+
+ # Write out global parameters
+ libpylith3d.write_global_info(
+ self.title,
+ &self.idout,
+ &self.idsk,
+ &self.numnp,
+ &self.icode,
+ &self.idebug,
+ &self.kw,
+ &self.kp,
+ self.ofile,
+ self.pfile,
+ len(self.title),
+ len(self.ofile),
+ len(self.pfile))
+
+ # Write out nodal coordinates
+ libpylith3d.write_coords(
+ self.x.ptr,
+ &self.numnp,
+ &self.kw,
+ &self.kp,
+ &self.idout,
+ &self.idsk,
+ self.ofile,
+ self.pfile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write out nodal boundary condition info
+ libpylith3d.write_bc(
+ self.bond.ptr,
+ self.ibond.ptr,
+ &self.numnp,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write out local coordinate rotations
+ libpylith3d.write_skew(
+ self.skew.ptr,
+ &self.numrot,
+ &self.iskopt,
+ &self.numnp,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write stress computation and subiteration parameters.
+ libpylith3d.write_strscomp(
+ &self.stol,
+ &self.dtol,
+ &self.epert,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ len(self.ofile))
+
+ libpylith3d.write_subiter(
+ &self.nprevdflag,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ len(self.ofile))
+
+ # Write out time step information
+ libpylith3d.write_timdat(
+ self.delt.ptr,
+ self.alfa.ptr,
+ self.utol.ptr,
+ self.ftol.ptr,
+ self.etol.ptr,
+ self.times.ptr,
+ self.maxstp.ptr,
+ self.maxit.ptr,
+ self.ntdinit.ptr,
+ self.lgdef.ptr,
+ self.itmax.ptr,
+ &self.nintg,
+ &self.lastep,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write out timesteps when full output is desired
+ libpylith3d.write_fuldat(
+ self.iprint.ptr,
+ &self.icontr,
+ &self.icode,
+ &self.ncycle,
+ &self.lastep,
+ &self.kw,
+ &self.kp,
+ &self.idout,
+ &self.idsk,
+ self.ofile,
+ self.pfile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write out state variables desired for output
+ libpylith3d.write_stateout(
+ self.istatout,
+ self.nstatout,
+ &self.kw,
+ &self.kp,
+ &self.idout,
+ &self.idsk,
+ self.ofile,
+ self.pfile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write out load history information and deallocate 'times' array
+ libpylith3d.write_hist(
+ self.histry.ptr,
+ self.times.ptr,
+ &self.nhist,
+ &self.lastep,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.times = None ### DEALLOC
+
+ # Write element info
+ libpylith3d.write_element_info(
+ &self.numelv,
+ &self.nen,
+ &self.ngauss,
+ &self.ietypev,
+ &self.intord,
+ &self.ipstrs,
+ &self.ipauto,
+ &self.tpois,
+ &self.tyoungs,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ len(self.ofile))
+
+ # Write element node array and deallocate 'indxiel'
+ libpylith3d.write_connect(
+ self.iens.ptr,
+ self.ivfamily.ptr,
+ self.indxiel.ptr,
+ &self.nen,
+ &self.ngauss,
+ &self.numelv,
+ &self.ietypev,
+ &self.nvfamilies,
+ &self.kw,
+ &self.kp,
+ &self.idout,
+ &self.idsk,
+ self.ofile,
+ self.pfile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.indxiel = None ### DEALLOC
+
+ # Write material properties
+ libpylith3d.write_props(
+ self._prop.ptr,
+ self._grav,
+ self.ivfamily.ptr,
+ self.infmatmod,
+ &self.nvfamilies,
+ &self.npropsz,
+ &self.idout,
+ &self.idsk,
+ &self.kw,
+ &self.kp,
+ self.ofile,
+ self.pfile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write mesh info to UCD file, if requested
+ if self.iucd >= 0:
+ libpylith3d.write_ucd_mesh(
+ self.x.ptr,
+ &self.numnp,
+ self.iens.ptr,
+ self.ivfamily.ptr,
+ &self.numelv,
+ &self.nvfamilies,
+ self.sh.ptr,
+ &self.nen,
+ &self.ngauss,
+ &self.ietypev,
+ self.istatout,
+ self.nstatout,
+ &self.kucd,
+ &self.iucd,
+ self.ucdroot,
+ len(self.ucdroot))
+
+ # Write traction info
+ libpylith3d.write_tractions(
+ self.tractionverts.ptr,
+ self.tractionvals.ptr,
+ &self.numtractions,
+ &self.nsnodes,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write split node info
+ libpylith3d.write_split(
+ self.fault.ptr,
+ self.nfault.ptr,
+ &self.numfn,
+ &self.kw,
+ &self.kp,
+ &self.idout,
+ &self.idsk,
+ self.ofile,
+ self.pfile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write slippery node info
+ libpylith3d.write_slip(
+ self.nslip.ptr,
+ &self.numslp,
+ &self.numsn,
+ &self.kw,
+ &self.kp,
+ &self.idout,
+ &self.idsk,
+ self.ofile,
+ self.pfile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Write differential force info and deallocate 'nslip'
+ libpylith3d.write_diff(
+ self.diforc.ptr,
+ self.nslip.ptr,
+ self.idhist.ptr,
+ &self.numslp,
+ &self.numdif,
+ &self.numnp,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.nslip = None ### DEALLOC
+
+ # Write split nodes to plot file, if requested and deallocate 'idftn'
+ libpylith3d.write_split_plot(
+ self.idftn.ptr,
+ &self.numflt,
+ &self.kp,
+ &self.idsk,
+ self.pfile,
+ len(self.pfile))
+
+ self.idftn = None ### DEALLOC
+
+ # Write Winkler force info and deallocate definition arrays
+ libpylith3d.write_wink(
+ self.winkdef.ptr,
+ self.iwinkdef.ptr,
+ self.iwinkid.ptr,
+ &self.nwinke,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.winkdef = None ### DEALLOC
+ self.iwinkdef = None ### DEALLOC
+
+ # Write slippery node Winkler force info and deallocate definition arrays
+ libpylith3d.write_winkx(
+ self.winkxdef.ptr,
+ self.iwinkxdef.ptr,
+ self.iwinkxid.ptr,
+ &self.nwinkxe,
+ &self.kw,
+ &self.idout,
+ self.ofile,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self.winkxdef = None ### DEALLOC
+ self.iwinkxdef = None ### DEALLOC
+
+ # Write sparse matrix info
+ libpylith3d.write_sparse_info(
+ &self.neq,
+ &self.nnz,
+ &self.nmin,
+ &self.nmax,
+ &self.wavg,
+ &self.idout,
+ &self.kw,
+ self.ofile,
+ len(self.ofile))
+
+ self.trace.log("Hello from pl3dsetup.meshwrite (end)!")
+
+ return
+
+
+# The function of this code is to call the elastic and time-dependent solution
+# drivers. To do this, a number of previously-defined parameters need to be
+# bundled into lists.
+
+
+ cdef solveElastic(self):
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ libpylith3d.elastc(
+ &self._mesh.A, # sparse
+ &self._mesh.rhs,
+ &self._mesh.sol,
+ self.bextern.ptr, # force
+ self.btraction.ptr,
+ self.bgravity.ptr,
+ self.bconcForce.ptr,
+ self.bintern.ptr,
+ self.bresid.ptr,
+ self.bwink.ptr,
+ self.bwinkx.ptr,
+ self.dispVec.ptr,
+ self.dprev.ptr,
+ self.nforce,
+ self._grav,
+ self.x.ptr, # global
+ self.d.ptr,
+ self.deld.ptr,
+ self.dcur.ptr,
+ self.id.ptr,
+ self.iwink.ptr,
+ self.wink.ptr,
+ self.nsysdat,
+ self.iddmat,
+ self.ibond.ptr, # BC
+ self.bond.ptr,
+ self.dx.ptr, # slip
+ self.deldx.ptr,
+ self.dxcur.ptr,
+ self.diforc.ptr,
+ self.idx.ptr,
+ self.iwinkx.ptr,
+ self.winkx.ptr,
+ self.idslp.ptr,
+ self.ipslp.ptr,
+ self.idhist.ptr,
+ self.fault.ptr, # fault
+ self.nfault.ptr,
+ self.dfault.ptr,
+ self.tfault.ptr,
+ self.s.ptr, # stiff
+ self.stemp.ptr,
+ self.state.ptr, # element
+ self.dstate.ptr,
+ self.state0.ptr,
+ self.dmat.ptr,
+ self.iens.ptr,
+ self.lm.ptr,
+ self.lmx.ptr,
+ self.lmf.ptr,
+ self.ivfamily.ptr,
+ self.npar,
+ self.ielindx.ptr,
+ self.tractionverts.ptr, # traction
+ self.tractionvals.ptr,
+ self.gauss2d.ptr,
+ self.sh2d.ptr,
+ self.infetype2d,
+ self._prop.ptr, # material
+ self.infmatmod,
+ self.gauss.ptr, # eltype
+ self.sh.ptr,
+ self.shj.ptr,
+ self.infetype,
+ self.histry.ptr, # timdat
+ self.rtimdat,
+ self.ntimdat,
+ self.nvisdat,
+ self.maxstp.ptr,
+ self.delt.ptr,
+ self.alfa.ptr,
+ self.maxit.ptr,
+ self.ntdinit.ptr,
+ self.lgdef.ptr,
+ self.utol.ptr,
+ self.ftol.ptr,
+ self.etol.ptr,
+ self.itmax.ptr,
+ self.rgiter, # stresscmp
+ self.skew.ptr, # skew
+ self.ncodat, # ioinfo
+ self.nunits,
+ self.nprint,
+ self.istatout,
+ self.nstatout,
+ self.ofile, # files
+ self.pfile,
+ self.ucdroot,
+ &self.elasticStage, # PETSc logging
+ &self.iterateEvent,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ len(self.ucdroot),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ return
+
+ cdef interpolatePoints(self, points):
+ return self._mesh.interpolatePoints(points)
+
+ cdef runSimulation(self):
+ # First define all of the lists that maintain variable values. The
+ # variables in these lists are altered during the running of the code
+ # and should not be accessed directly except as a member of the list.
+ # They should not have been defined previously.
+
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+ errorcode = 0
+
+ self.trace.log("Hello from pl3drun.run (begin)!")
+
+ print "Beginning problem solution."
+
+ if False: # Temporarily out-of-order
+ # Output approximate memory usage
+ self.memorySizeMB =0.0
+ self.memorySizeMB=self.memorySize/(1024.0*1024.0)
+
+ print ""
+ print "Approximate memory allocation for f77 arrays (MB): %g" % self.memorySizeMB
+
+ # Compute gravitational prestresses, if requeste
+ if self.icode == 2 or self.icode == 3: # elasticSolution or fullSolution
+ if self.ipstrs == 1:
+ libpylith3d.autoprestr(
+ &self._mesh.A, # sparse
+ &self._mesh.rhs,
+ &self._mesh.sol,
+ self.bextern.ptr, # force
+ self.btraction.ptr,
+ self.bgravity.ptr,
+ self.bconcForce.ptr,
+ self.bintern.ptr,
+ self.bresid.ptr,
+ self.bwink.ptr,
+ self.bwinkx.ptr,
+ self.dispVec.ptr,
+ self.dprev.ptr,
+ self.nforce,
+ self._grav,
+ self.x.ptr, # global
+ self.d.ptr,
+ self.deld.ptr,
+ self.dcur.ptr,
+ self.id.ptr,
+ self.iwink.ptr,
+ self.wink.ptr,
+ self.nsysdat,
+ self.iddmat,
+ self.ibond.ptr, # BC
+ self.bond.ptr,
+ self.dx.ptr, # slip
+ self.deldx.ptr,
+ self.dxcur.ptr,
+ self.diforc.ptr,
+ self.idx.ptr,
+ self.iwinkx.ptr,
+ self.winkx.ptr,
+ self.idslp.ptr,
+ self.ipslp.ptr,
+ self.idhist.ptr,
+ self.fault.ptr, # split
+ self.nfault.ptr,
+ self.dfault.ptr,
+ self.tfault.ptr,
+ self.s.ptr, # stiff
+ self.stemp.ptr,
+ self.state.ptr, # element
+ self.dstate.ptr,
+ self.state0.ptr,
+ self.dmat.ptr,
+ self.iens.ptr,
+ self.lm.ptr,
+ self.lmx.ptr,
+ self.lmf.ptr,
+ self.ivfamily.ptr,
+ self.npar,
+ self.ielindx.ptr,
+ self.tractionverts.ptr, # traction
+ self.tractionvals.ptr,
+ self.gauss2d.ptr,
+ self.sh2d.ptr,
+ self.infetype2d,
+ self._prop.ptr, # material
+ self.infmatmod,
+ self.gauss.ptr, # eltype
+ self.sh.ptr,
+ self.shj.ptr,
+ self.infetype,
+ self.histry.ptr, # timdat
+ self.rtimdat,
+ self.ntimdat,
+ self.nvisdat,
+ self.maxstp.ptr,
+ self.delt.ptr,
+ self.alfa.ptr,
+ self.maxit.ptr,
+ self.ntdinit.ptr,
+ self.lgdef.ptr,
+ self.utol.ptr,
+ self.ftol.ptr,
+ self.etol.ptr,
+ self.itmax.ptr,
+ self.rgiter, # stresscmp
+ self.skew.ptr, # skew
+ self.ncodat, # ioinfo
+ self.nunits,
+ self.nprint,
+ self.istatout,
+ self.nstatout,
+ self.ofile, # files
+ self.pfile,
+ self.ucdroot,
+ &self.autoprestrStage, # PETSc logging
+ &self.iterateEvent,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ len(self.ucdroot),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ # Perform elastic solution, if requested.
+ self.solveElastic()
+ self._mesh.outputMesh(self.fileRoot)
+
+ # Perform time-dependent solution, if requested.
+
+ cdef int numCycles, numTimeStepGroups, numslp
+ cdef int iskopt, icontr, indexx, totalSteps
+
+ cdef int nextStartStep, timeStep, startStep
+ cdef double time
+
+ cdef int maxitp, ntdinitp, lgdefp, itmaxp
+ cdef double dt, alfap, gtol[3]
+
+ cdef int ltim, cycle, tsGroup, j, skc
+
+ if self.icode == 3 and self.nintg > 1:
+ if self.pythonTimestep:
+ # Setup timestepping
+ # Open output files
+ libpylith3d.viscos_setup(
+ self.nprint,
+ self.nunits,
+ self.ofile,
+ self.pfile,
+ &self.viscousStage,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ numCycles = self.nvisdat[0]
+ numTimeStepGroups = self.nvisdat[1]
+ numslp = self.npar[3]
+ iskopt = self.nsysdat[10]
+ icontr = self.nprint[0]
+ indexx = 1 # Fortran index
+ totalSteps = 0 # This is ntot
+
+ for cycle from 0 <= cycle < numCycles:
+
+ if numCycles > 1: print ' working on cycle %d' % cycle
+ nextStartStep = 0 # This is naxstp
+ timeStep = 0 # This is nstep
+ startStep = 0 # This is nfirst
+ time = 0.0
+
+ for tsGroup from 1 <= tsGroup < numTimeStepGroups:
+ # Define constants
+ dt = self.delt.ptr[tsGroup] # This is deltp
+ self.rtimdat[0] = dt
+ alfap = self.alfa.ptr[tsGroup]
+ self.rtimdat[1] = alfap
+ self.ntimdat[0] = timeStep
+ maxitp = self.maxit.ptr[tsGroup]
+ self.ntimdat[1] = maxitp
+ ntdinitp = self.ntdinit.ptr[tsGroup]
+ self.ntimdat[2] = ntdinitp
+ lgdefp = self.lgdef.ptr[tsGroup]
+ self.ntimdat[3] = lgdefp
+ itmaxp = self.itmax.ptr[tsGroup]
+ self.ntimdat[4] = itmaxp
+ gtol[0] = self.utol.ptr[tsGroup]
+ gtol[1] = self.ftol.ptr[tsGroup]
+ gtol[2] = self.etol.ptr[tsGroup]
+ startStep = nextStartStep + 1
+ nextStartStep = startStep + self.maxstp.ptr[tsGroup] - 1
+
+ ltim = 1
+
+ for j from startStep <= j < nextStartStep+1:
+ totalSteps = totalSteps + 1
+ timeStep = timeStep + 1
+ self.ntimdat[0] = timeStep
+ time = time + dt
+ skc = (numslp != 0 and (iskopt == 2 or (iskopt <= 0 and abs(iskopt) == timeStep)))
+
+ libpylith3d.viscos_step(
+ &self._mesh.A, # sparse
+ &self._mesh.rhs,
+ &self._mesh.sol,
+ self.bextern.ptr, # force
+ self.btraction.ptr,
+ self.bgravity.ptr,
+ self.bconcForce.ptr,
+ self.bintern.ptr,
+ self.bresid.ptr,
+ self.bwink.ptr,
+ self.bwinkx.ptr,
+ self.dispVec.ptr,
+ self.dprev.ptr,
+ self.nforce,
+ self._grav,
+ self.x.ptr, # global
+ self.d.ptr,
+ self.deld.ptr,
+ self.dcur.ptr,
+ self.id.ptr,
+ self.iwink.ptr,
+ self.wink.ptr,
+ self.nsysdat,
+ self.iddmat,
+ self.ibond.ptr, # BC
+ self.bond.ptr,
+ self.dx.ptr, # slip
+ self.deldx.ptr,
+ self.dxcur.ptr,
+ self.diforc.ptr,
+ self.idx.ptr,
+ self.iwinkx.ptr,
+ self.winkx.ptr,
+ self.idslp.ptr,
+ self.ipslp.ptr,
+ self.idhist.ptr,
+ self.fault.ptr, # fault
+ self.nfault.ptr,
+ self.dfault.ptr,
+ self.tfault.ptr,
+ self.s.ptr, # stiff
+ self.stemp.ptr,
+ self.state.ptr, # element
+ self.dstate.ptr,
+ self.state0.ptr,
+ self.dmat.ptr,
+ self.iens.ptr,
+ self.lm.ptr,
+ self.lmx.ptr,
+ self.lmf.ptr,
+ self.ivfamily.ptr,
+ self.npar,
+ self.ielindx.ptr,
+ self.tractionverts.ptr, # traction
+ self.tractionvals.ptr,
+ self.gauss2d.ptr,
+ self.sh2d.ptr,
+ self.infetype2d,
+ self._prop.ptr, # material
+ self.infmatmod,
+ self.gauss.ptr, # eltype
+ self.sh.ptr,
+ self.shj.ptr,
+ self.infetype,
+ self.histry.ptr, # timdat
+ self.rtimdat,
+ self.ntimdat,
+ self.nvisdat,
+ self.maxstp.ptr,
+ self.delt.ptr,
+ self.alfa.ptr,
+ self.maxit.ptr,
+ self.ntdinit.ptr,
+ self.lgdef.ptr,
+ self.utol.ptr,
+ self.ftol.ptr,
+ self.etol.ptr,
+ self.itmax.ptr,
+ self.rgiter, # stresscmp
+ self.skew.ptr, # skew
+ self.iprint.ptr, # ioinfo
+ self.ncodat,
+ self.nunits,
+ self.nprint,
+ self.istatout,
+ self.nstatout,
+ self.ofile, # files
+ self.pfile,
+ self.ucdroot,
+ &self.viscousStage, # PETSc logging
+ &self.iterateEvent,
+ &totalSteps,
+ <im,
+ &indexx,
+ &cycle,
+ &tsGroup,
+ &j,
+ &skc,
+ &startStep,
+ &timeStep,
+ &time,
+ &dt,
+ &lgdefp,
+ gtol,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ len(self.ucdroot),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ ltim = 0
+ if (totalSteps == self.iprint.ptr[indexx-1]):
+ self._mesh.outputMesh(self.fileRoot+'.'+str(totalSteps))
+ indexx = indexx + 1
+ if (indexx > icontr): indexx = icontr
+
+ print " Total number of equilibrium iterations =",self.ntimdat[5]
+ print " Total number of stiffness matrix reformations =",self.ntimdat[6]
+ print " Total number of displacement subiterations =",self.ntimdat[7]
+
+ libpylith3d.viscos_cleanup(
+ self.ntimdat,
+ self.nprint,
+ self.nunits,
+ &errorcode,
+ errorstring,
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ else:
+
+ libpylith3d.viscos(
+ &self._mesh.A, # sparse
+ &self._mesh.rhs,
+ &self._mesh.sol,
+ self.bextern.ptr, # force
+ self.btraction.ptr,
+ self.bgravity.ptr,
+ self.bconcForce.ptr,
+ self.bintern.ptr,
+ self.bresid.ptr,
+ self.bwink.ptr,
+ self.bwinkx.ptr,
+ self.dispVec.ptr,
+ self.dprev.ptr,
+ self.nforce,
+ self._grav,
+ self.x.ptr, # global
+ self.d.ptr,
+ self.deld.ptr,
+ self.dcur.ptr,
+ self.id.ptr,
+ self.iwink.ptr,
+ self.wink.ptr,
+ self.nsysdat,
+ self.iddmat,
+ self.ibond.ptr, # BC
+ self.bond.ptr,
+ self.dx.ptr, # slip
+ self.deldx.ptr,
+ self.dxcur.ptr,
+ self.diforc.ptr,
+ self.idx.ptr,
+ self.iwinkx.ptr,
+ self.winkx.ptr,
+ self.idslp.ptr,
+ self.ipslp.ptr,
+ self.idhist.ptr,
+ self.fault.ptr, # fault
+ self.nfault.ptr,
+ self.dfault.ptr,
+ self.tfault.ptr,
+ self.s.ptr, # stiff
+ self.stemp.ptr,
+ self.state.ptr, # element
+ self.dstate.ptr,
+ self.state0.ptr,
+ self.dmat.ptr,
+ self.iens.ptr,
+ self.lm.ptr,
+ self.lmx.ptr,
+ self.lmf.ptr,
+ self.ivfamily.ptr,
+ self.npar,
+ self.ielindx.ptr,
+ self.tractionverts.ptr, # traction
+ self.tractionvals.ptr,
+ self.gauss2d.ptr,
+ self.sh2d.ptr,
+ self.infetype2d,
+ self._prop.ptr, # material
+ self.infmatmod,
+ self.gauss.ptr, # eltype
+ self.sh.ptr,
+ self.shj.ptr,
+ self.infetype,
+ self.histry.ptr, # timdat
+ self.rtimdat,
+ self.ntimdat,
+ self.nvisdat,
+ self.maxstp.ptr,
+ self.delt.ptr,
+ self.alfa.ptr,
+ self.maxit.ptr,
+ self.ntdinit.ptr,
+ self.lgdef.ptr,
+ self.utol.ptr,
+ self.ftol.ptr,
+ self.etol.ptr,
+ self.itmax.ptr,
+ self.rgiter, # stresscmp
+ self.skew.ptr, # skew
+ self.iprint.ptr, # ioinfo
+ self.ncodat,
+ self.nunits,
+ self.nprint,
+ self.istatout,
+ self.nstatout,
+ self.ofile, # files
+ self.pfile,
+ self.ucdroot,
+ &self.viscousStage, # PETSc logging
+ &self.iterateEvent,
+ &errorcode,
+ errorstring,
+ len(self.ofile),
+ len(self.pfile),
+ len(self.ucdroot),
+ sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ self._mesh.destroyMat()
+
+ self.trace.log("Hello from pl3drun.run (end)!")
+
+ return
+
+
+
+def try_binio(kucd):
+ cdef int u
+ cdef int errorcode
+ cdef char errorstring[errorstring_size]
+
+ u = kucd
+ errorcode = 0
+
+ libpylith3d.try_binio(&u, &errorcode, errorstring, sizeof(errorstring))
+ exceptionhandler(errorcode, errorstring)
+
+ return
+
+
+
+# end of file
Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pxd
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pxd 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pxd 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,57 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+cimport petsc
+
+
+# C interface of PyLithMeshLib
+
+cdef public class Mesh [object PyMeshObject, type PyMesh_Type]:
+
+
+ cdef petsc.Mesh mesh
+
+ cdef petsc.Mat A
+ cdef petsc.Vec rhs, sol
+
+ cdef char *meshInputFile
+ cdef char *meshBcFile
+ cdef int interpolateMesh
+ cdef char *partitioner
+
+ cdef object _meshInputFile, _meshBcFile, _partitioner
+
+
+ cdef createMat(self)
+ cdef destroyMat(self)
+ cdef outputMesh(self, fileRoot)
+
+
+# end of file
Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pyx
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pyx 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pyx 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,107 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+# implementation of PyLithMeshLib
+
+
+cdef public class Mesh [object PyMeshObject, type PyMesh_Type]:
+
+
+ def __new__(self,
+ meshInputFile,
+ meshBcFile,
+ interpolateMesh,
+ partitioner):
+ self.mesh = NULL
+ self.A = NULL
+ self.rhs = NULL
+ self.sol = NULL
+ self.meshInputFile = NULL
+ self.meshBcFile = NULL
+ self.interpolateMesh = 0
+ self.partitioner = NULL
+ return
+
+
+ def __init__(self,
+ meshInputFile,
+ meshBcFile,
+ interpolateMesh,
+ partitioner):
+
+ # maintain references to Python strings
+ self._meshInputFile = meshInputFile # Py_INCREF
+ self._meshBcFile = meshBcFile # Py_INCREF
+ self._partitioner = partitioner # Py_INCREF
+
+ # fetch raw char * pointers
+ self.meshInputFile = self._meshInputFile
+ self.meshBcFile = self._meshBcFile
+ self.partitioner = self._partitioner
+
+ self.interpolateMesh = interpolateMesh
+
+ _processMesh(self)
+
+ return
+
+
+ def __dealloc__(self):
+ if self.A is not NULL:
+ _destroyMat(self)
+ if self.mesh is not NULL:
+ petsc.MeshDestroy(self.mesh)
+ self.mesh = NULL
+ return
+
+
+ cdef createMat(self):
+ _createMat(self)
+
+
+ cdef destroyMat(self):
+ _destroyMat(self)
+
+
+ cdef outputMesh(self, fileRoot):
+ _outputMesh(self, fileRoot)
+
+
+
+# C++ implementation
+
+cdef extern from "mesh.h":
+ cdef extern object _processMesh "PyLithMeshLib::Mesh::_processMesh" (Mesh self)
+ cdef extern object _createMat "PyLithMeshLib::Mesh::_createMat " (Mesh self)
+ cdef extern object _destroyMat "PyLithMeshLib::Mesh::_destroyMat" (Mesh self)
+ cdef extern object _outputMesh "PyLithMeshLib::Mesh::_outputMesh" (Mesh self, char *fileRoot)
+
+
+# end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,279 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-//
-#include <portinfo>
-#include <Python.h>
-
-#include "array.h"
-
-
-// allocateInt
-char pypylith3d_allocateInt__doc__[] = "";
-char pypylith3d_allocateInt__name__[] = "allocateInt";
-
-PyObject * pypylith3d_allocateInt(PyObject *, PyObject * args)
-{
-
- int len;
- // int i;
-
- int ok = PyArg_ParseTuple(args, "i:allocateInt",&len);
-
- if (!ok) {
- return 0;
- }
-
- int * p = (int *)malloc(sizeof(int)*len);
-
- // Experimental portion to initialize all values to zero.
- // for (i = 0; i < len; ++i)
- //p[i] = 0;
-
- // Experimental section to increment the reference count for the
- // array pointer.
- PyObject *arrayPointer;
- arrayPointer = PyCObject_FromVoidPtr(p,clearp);
- //Py_XINCREF(arrayPointer);
-
- // return
- return arrayPointer;
-
-}
-
-
-// allocateDouble
-char pypylith3d_allocateDouble__doc__[] = "";
-char pypylith3d_allocateDouble__name__[] = "allocateDouble";
-
-PyObject * pypylith3d_allocateDouble(PyObject *, PyObject * args)
-{
-
- int len;
- // int i;
-
- int ok = PyArg_ParseTuple(args, "i:allocateDouble",&len);
-
- if (!ok) {
- return 0;
- }
-
- double * p = (double *)malloc(sizeof(double)*len);
-
- // Experimental portion to initialize all values to zero.
- //for (i = 0; i < len; ++i)
- //p[i] = 0.0;
-
- // Experimental section to increment the reference count for the
- // array pointer.
- PyObject *arrayPointer;
- arrayPointer = PyCObject_FromVoidPtr(p,clearp);
- //Py_XINCREF(arrayPointer);
-
- // return
- return arrayPointer;
-
-}
-
-
-// intListToArray
-char pypylith3d_intListToArray__doc__[] = "";
-char pypylith3d_intListToArray__name__[] = "intListToArray";
-
-PyObject * pypylith3d_intListToArray(PyObject *, PyObject * args)
-{
- PyObject *listobj;
- PyObject *listitem;
- int len,i;
-
- int ok = PyArg_ParseTuple(args, "O!:intListToArray",&PyList_Type,&listobj);
-
- if (!ok) {
- return 0;
- }
-
- len = PyList_Size(listobj);
- int * p = (int *)malloc(sizeof(int)*len);
- for(i=0;i<len;i++) {
- listitem = PyList_GetItem(listobj,i);
- if(!PyInt_Check(listitem)) { //error if list item is not int
- return 0; //may want better error handling
- }
- p[i] = (int)PyInt_AsLong(listitem);
- }
-
- // Experimental section to increment the reference count for the
- // array pointer.
- PyObject *arrayPointer;
- arrayPointer = PyCObject_FromVoidPtr(p,clearp);
- //Py_XINCREF(arrayPointer);
-
- // return
- return arrayPointer;
-
-}
-
-
-// doubleListToArray
-char pypylith3d_doubleListToArray__doc__[] = "";
-char pypylith3d_doubleListToArray__name__[] = "doubleListToArray";
-
-PyObject * pypylith3d_doubleListToArray(PyObject *, PyObject * args)
-{
- PyObject *listobj;
- PyObject *listitem;
- int len,i;
-
- int ok = PyArg_ParseTuple(args, "O!:doubleListToArray",&PyList_Type,&listobj);
-
- if (!ok) {
- return 0;
- }
-
- len = PyList_Size(listobj);
- double * p = (double *)malloc(sizeof(double)*len);
- for(i=0;i<len;i++) {
- listitem = PyList_GetItem(listobj,i);
- if(!PyFloat_Check(listitem)) { //error if list item is not float
- return 0; //may want better error handling
- }
- p[i] = PyFloat_AsDouble(listitem);
- }
-
- // Experimental section to increment the reference count for the
- // array pointer.
- PyObject *arrayPointer;
- arrayPointer = PyCObject_FromVoidPtr(p,clearp);
- //Py_XINCREF(arrayPointer);
-
- // return
- return arrayPointer;
-
-}
-
-// Retrieve an integer list member
-char pypylith3d_intListRef__doc__[] = "";
-char pypylith3d_intListRef__name__[] = "intListRef";
-
-PyObject * pypylith3d_intListRef(PyObject *, PyObject * args)
-{
- PyObject *pyArray;
- int member;
-
- int ok = PyArg_ParseTuple(args, "Oi:intListRef", &pyArray, &member);
- if (!ok) {
- return 0;
- }
-
- int *array = (int *) PyCObject_AsVoidPtr(pyArray);
- PyObject *val = PyInt_FromLong(array[member]);
-
- // return
- return val;
-}
-
-// Retrieve a double list member
-char pypylith3d_doubleListRef__doc__[] = "";
-char pypylith3d_doubleListRef__name__[] = "doubleListRef";
-
-PyObject * pypylith3d_doubleListRef(PyObject *, PyObject * args)
-{
- PyObject *pyArray;
- int member;
-
- int ok = PyArg_ParseTuple(args, "Oi:intListRef", &pyArray, &member);
- if (!ok) {
- return 0;
- }
-
- double *array = (double *) PyCObject_AsVoidPtr(pyArray);
- PyObject *val = PyFloat_FromDouble(array[member]);
-
- // return
- return val;
-}
-
-// Set an integer list member
-char pypylith3d_intListSet__doc__[] = "";
-char pypylith3d_intListSet__name__[] = "intListSet";
-
-PyObject * pypylith3d_intListSet(PyObject *, PyObject * args)
-{
- PyObject *pyArray;
- int member;
- int value;
-
- int ok = PyArg_ParseTuple(args, "Oii:intListSet", &pyArray, &member, &value);
- if (!ok) {
- return 0;
- }
-
- int *array = (int *) PyCObject_AsVoidPtr(pyArray);
- array[member] = value;
-
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Set a double list member
-char pypylith3d_doubleListSet__doc__[] = "";
-char pypylith3d_doubleListSet__name__[] = "doubleListSet";
-
-PyObject * pypylith3d_doubleListSet(PyObject *, PyObject * args)
-{
- PyObject *pyArray;
- int member;
- double value;
-
- int ok = PyArg_ParseTuple(args, "Oid:doubleListSet", &pyArray, &member, &value);
- if (!ok) {
- return 0;
- }
-
- double *array = (double *) PyCObject_AsVoidPtr(pyArray);
- array[member] = value;
-
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// clearp
-// deconstructor
-void clearp(void *p)
-{
- free(p);
- p = NULL;
- return;
-}
-
-
-// version
-// $Id: array.cc,v 1.3 2005/03/31 23:27:57 willic3 Exp $
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,99 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pypylith3d_array_h)
-#define pypylith3d_array_h
-
-// allocateInt
-extern char pypylith3d_allocateInt__doc__[];
-extern char pypylith3d_allocateInt__name__[];
-
-extern "C"
-PyObject * pypylith3d_allocateInt(PyObject *, PyObject *);
-
-// allocateDouble
-extern char pypylith3d_allocateDouble__doc__[];
-extern char pypylith3d_allocateDouble__name__[];
-
-extern "C"
-PyObject * pypylith3d_allocateDouble(PyObject *, PyObject *);
-
-// intListToArray
-extern char pypylith3d_intListToArray__doc__[];
-extern char pypylith3d_intListToArray__name__[];
-
-extern "C"
-PyObject * pypylith3d_intListToArray(PyObject *, PyObject *);
-
-// doubleListToArray
-extern char pypylith3d_doubleListToArray__doc__[];
-extern char pypylith3d_doubleListToArray__name__[];
-
-extern "C"
-PyObject * pypylith3d_doubleListToArray(PyObject *, PyObject *);
-
-// Retrieve an integer list member
-extern char pypylith3d_intListRef__doc__[];
-char extern pypylith3d_intListRef__name__[];
-
-extern "C"
-PyObject * pypylith3d_intListRef(PyObject *, PyObject *);
-
-// Retrieve an double list member
-extern char pypylith3d_doubleListRef__doc__[];
-extern char pypylith3d_doubleListRef__name__[];
-
-extern "C"
-PyObject * pypylith3d_doubleListRef(PyObject *, PyObject * );
-
-// Set an integer list member
-extern char pypylith3d_intListSet__doc__[];
-char extern pypylith3d_intListSet__name__[];
-
-extern "C"
-PyObject * pypylith3d_intListSet(PyObject *, PyObject *);
-
-// Set an double list member
-extern char pypylith3d_doubleListSet__doc__[];
-extern char pypylith3d_doubleListSet__name__[];
-
-extern "C"
-PyObject * pypylith3d_doubleListSet(PyObject *, PyObject * );
-
-// clear p
-void clearp(void *);
-
-#endif
-
-
-// version
-// $Id: array.h,v 1.2 2005/03/31 23:27:58 willic3 Exp $
-
-// End of file
Copied: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.pyx (from rev 6509, short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.cc 2007-04-05 21:54:55 UTC (rev 6509)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/array.pyx 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,91 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#
+
+
+cdef extern from "stdlib.h":
+ void *malloc(unsigned int)
+ void free(void *)
+
+
+cdef class IntArray:
+
+ cdef int len
+ cdef int *ptr
+ cdef int *_rawptr
+
+ def __new__(self, unsigned int len):
+ self.len = len
+ self._rawptr = <int *>malloc(sizeof(int) * (len + 2))
+ if self._rawptr is NULL:
+ raise MemoryError("malloc failed")
+ self._rawptr[0] = 0xdeadbeef
+ self._rawptr[len + 1] = 0xdeadbeef
+ self.ptr = self._rawptr + 1
+ return
+
+ def __dealloc__(self):
+ if (self._rawptr[0] != 0xdeadbeef or
+ self._rawptr[self.len + 1] != 0xdeadbeef):
+ print "memory corrupted"
+ free(self._rawptr)
+ self._rawptr = NULL
+ self.ptr = NULL
+ return
+
+
+cdef class DoubleArray:
+
+ cdef int len
+ cdef double *ptr
+ cdef double *_rawptr
+ cdef double guard
+
+ def __new__(self, unsigned int len):
+ self.len = len
+ self._rawptr = <double *>malloc(sizeof(double) * (len + 2))
+ if self._rawptr is NULL:
+ raise MemoryError("malloc failed")
+ self.guard = 3.14159
+ self._rawptr[0] = self.guard
+ self._rawptr[len + 1] = self.guard
+ self.ptr = self._rawptr + 1
+ return
+
+ def __dealloc__(self):
+ if (self._rawptr[0] != self.guard or
+ self._rawptr[self.len + 1] != self.guard):
+ print "memory corrupted"
+ free(self._rawptr)
+ self._rawptr = NULL
+ self.ptr = NULL
+ return
+
+
+# end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/bindings.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/bindings.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/bindings.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,423 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#include <portinfo>
-#include <Python.h>
-
-#include "bindings.h"
-
-#include "libpylith3d.h" // fortran library functions
-
-#include "array.h" // array allocation and conversion functions
-#include "mesh.h" // PETSc Sieve Mesh routines
-#include "setup.h" // initialization/setup routines
-#include "misc.h" // miscellaneous methods
-
-#if defined(GREENSFNS)
-#include "interpolate.h"
-#endif
-
-// the method table
-
-struct PyMethodDef pypylith3d_methods[] = {
-
- // initialize PETSc
- {pypylith3d_petsc_initialize__name__, pypylith3d_petsc_initialize,
- METH_VARARGS, pypylith3d_petsc_initialize__doc__},
-
- // finalize PETSc
- {pypylith3d_petsc_finalize__name__, pypylith3d_petsc_finalize,
- METH_VARARGS, pypylith3d_petsc_finalize__doc__},
-
- // Setup PETSc Logging
- {pypylith3d_setup_petsc_logging__name__, pypylith3d_setup_petsc_logging,
- METH_VARARGS, pypylith3d_setup_petsc_logging__doc__},
-
- // allocate an integer array
- {pypylith3d_allocateInt__name__, pypylith3d_allocateInt,
- METH_VARARGS, pypylith3d_allocateInt__doc__},
-
- // allocate a double array
- {pypylith3d_allocateDouble__name__, pypylith3d_allocateDouble,
- METH_VARARGS, pypylith3d_allocateDouble__doc__},
-
- // assign equation numbers for Winkler forces
- {pypylith3d_assign_wink__name__, pypylith3d_assign_wink,
- METH_VARARGS, pypylith3d_assign_wink__doc__},
-
- // compute gravitational prestresses
- {pypylith3d_autoprestr__name__, pypylith3d_autoprestr,
- METH_VARARGS, pypylith3d_autoprestr__doc__},
-
- // compute maximum number of nonzero entries in stiffness matrix
- {pypylith3d_cmp_stiffsz__name__, pypylith3d_cmp_stiffsz,
- METH_VARARGS, pypylith3d_cmp_stiffsz__doc__},
-
- // create id and idx arrays
- {pypylith3d_create_id__name__, pypylith3d_create_id,
- METH_VARARGS, pypylith3d_create_id__doc__},
-
- // convert a double list to an array
- {pypylith3d_doubleListToArray__name__, pypylith3d_doubleListToArray,
- METH_VARARGS, pypylith3d_doubleListToArray__doc__},
-
- // Retrieve an integer list member
- {pypylith3d_intListRef__name__, pypylith3d_intListRef,
- METH_VARARGS, pypylith3d_intListRef__doc__},
-
- // Retrieve a double list member
- {pypylith3d_doubleListRef__name__, pypylith3d_doubleListRef,
- METH_VARARGS, pypylith3d_doubleListRef__doc__},
-
- // Set an integer list member
- {pypylith3d_intListSet__name__, pypylith3d_intListSet,
- METH_VARARGS, pypylith3d_intListSet__doc__},
-
- // Set a double list member
- {pypylith3d_doubleListSet__name__, pypylith3d_doubleListSet,
- METH_VARARGS, pypylith3d_doubleListSet__doc__},
-
- // drive elastic solution
- {pypylith3d_elastc__name__, pypylith3d_elastc,
- METH_VARARGS, pypylith3d_elastc__doc__},
-
- // form id array for split nodes
- {pypylith3d_id_split__name__, pypylith3d_id_split,
- METH_VARARGS, pypylith3d_id_split__doc__},
-
- // convert an integer list to an array
- {pypylith3d_intListToArray__name__, pypylith3d_intListToArray,
- METH_VARARGS, pypylith3d_intListToArray__doc__},
-
- // create linked list for sparse matrix
- {pypylith3d_lnklst__name__, pypylith3d_lnklst,
- METH_VARARGS, pypylith3d_lnklst__doc__},
-
- // localize id array
- {pypylith3d_local__name__, pypylith3d_local,
- METH_VARARGS, pypylith3d_local__doc__},
-
- // localize id array for split nodes
- {pypylith3d_localf__name__, pypylith3d_localf,
- METH_VARARGS, pypylith3d_localf__doc__},
-
- // localize id array for slippery nodes
- {pypylith3d_localx__name__, pypylith3d_localx,
- METH_VARARGS, pypylith3d_localx__doc__},
-
- // create PETSc matrix
- {pypylith3d_createPETScMat__name__, pypylith3d_createPETScMat,
- METH_VARARGS, pypylith3d_createPETScMat__doc__},
-
- // destroy PETSc matrix
- {pypylith3d_destroyPETScMat__name__, pypylith3d_destroyPETScMat,
- METH_VARARGS, pypylith3d_destroyPETScMat__doc__},
-
- // output PETSc Mesh and Fields
- {pypylith3d_outputMesh__name__, pypylith3d_outputMesh,
- METH_VARARGS, pypylith3d_outputMesh__doc__},
-
- // create sparse matrix in modified sparse row format
- {pypylith3d_makemsr__name__, pypylith3d_makemsr,
- METH_VARARGS, pypylith3d_makemsr__doc__},
-
- // initialize material model information
- {pypylith3d_matmod_def__name__, pypylith3d_matmod_def,
- METH_VARARGS, pypylith3d_matmod_def__doc__},
-
- // find closest fault neignbors for slippery nodes
- {pypylith3d_nfind__name__, pypylith3d_nfind,
- METH_VARARGS, pypylith3d_nfind__doc__},
-
- // precompute shape function information
- {pypylith3d_preshape__name__, pypylith3d_preshape,
- METH_VARARGS, pypylith3d_preshape__doc__},
-
- // precompute shape function information for surfaces
- {pypylith3d_preshape2d__name__, pypylith3d_preshape2d,
- METH_VARARGS, pypylith3d_preshape2d__doc__},
-
- // read boundary conditions
- {pypylith3d_read_bc__name__, pypylith3d_read_bc,
- METH_VARARGS, pypylith3d_read_bc__doc__},
-
- // read connectivities
- {pypylith3d_read_connect__name__, pypylith3d_read_connect,
- METH_VARARGS, pypylith3d_read_connect__doc__},
-
- // read coordinates
- {pypylith3d_read_coords__name__, pypylith3d_read_coords,
- METH_VARARGS, pypylith3d_read_coords__doc__},
-
- // read differential forces
- {pypylith3d_read_diff__name__, pypylith3d_read_diff,
- METH_VARARGS, pypylith3d_read_diff__doc__},
-
- // read time steps at which full output is desired
- {pypylith3d_read_fuldat__name__, pypylith3d_read_fuldat,
- METH_VARARGS, pypylith3d_read_fuldat__doc__},
-
- // read time history info
- {pypylith3d_read_hist__name__, pypylith3d_read_hist,
- METH_VARARGS, pypylith3d_read_hist__doc__},
-
- // read prestresses
- // {pypylith3d_read_prestr__name__, pypylith3d_read_prestr,
- // METH_VARARGS, pypylith3d_read_prestr__doc__},
-
- // read local coordinate rotations
- {pypylith3d_read_skew__name__, pypylith3d_read_skew,
- METH_VARARGS, pypylith3d_read_skew__doc__},
-
- // read slippery node definitions
- {pypylith3d_read_slip__name__, pypylith3d_read_slip,
- METH_VARARGS, pypylith3d_read_slip__doc__},
-
- // read split node definitions
- {pypylith3d_read_split__name__, pypylith3d_read_split,
- METH_VARARGS, pypylith3d_read_split__doc__},
-
- // read state output information
- {pypylith3d_read_stateout__name__, pypylith3d_read_stateout,
- METH_VARARGS, pypylith3d_read_stateout__doc__},
-
- // read time step group information
- {pypylith3d_read_timdat__name__, pypylith3d_read_timdat,
- METH_VARARGS, pypylith3d_read_timdat__doc__},
-
- // read traction boundary conditions
- {pypylith3d_read_tractions__name__, pypylith3d_read_tractions,
- METH_VARARGS, pypylith3d_read_tractions__doc__},
-
- // read winkler force information
- {pypylith3d_read_wink__name__, pypylith3d_read_wink,
- METH_VARARGS, pypylith3d_read_wink__doc__},
-
- // process mesh
- {pypylith3d_processMesh__name__, pypylith3d_processMesh,
- METH_VARARGS, pypylith3d_processMesh__doc__},
-
- // scan boundary condition file
- {pypylith3d_scan_bc__name__, pypylith3d_scan_bc,
- METH_VARARGS, pypylith3d_scan_bc__doc__},
-
- // scan connectivity file
- {pypylith3d_scan_connect__name__, pypylith3d_scan_connect,
- METH_VARARGS, pypylith3d_scan_connect__doc__},
-
- // scan coordinates file
- {pypylith3d_scan_coords__name__, pypylith3d_scan_coords,
- METH_VARARGS, pypylith3d_scan_coords__doc__},
-
- // scan differential forces file
- {pypylith3d_scan_diff__name__, pypylith3d_scan_diff,
- METH_VARARGS, pypylith3d_scan_diff__doc__},
-
- // scan time step output info file
- {pypylith3d_scan_fuldat__name__, pypylith3d_scan_fuldat,
- METH_VARARGS, pypylith3d_scan_fuldat__doc__},
-
- // scan time history definition file
- {pypylith3d_scan_hist__name__, pypylith3d_scan_hist,
- METH_VARARGS, pypylith3d_scan_hist__doc__},
-
- // scan prestress file
- // {pypylith3d_scan_prestr__name__, pypylith3d_scan_prestr,
- // METH_VARARGS, pypylith3d_scan_prestr__doc__},
-
- // scan local coordinate rotations file
- {pypylith3d_scan_skew__name__, pypylith3d_scan_skew,
- METH_VARARGS, pypylith3d_scan_skew__doc__},
-
- // scan slippery node definitions file
- {pypylith3d_scan_slip__name__, pypylith3d_scan_slip,
- METH_VARARGS, pypylith3d_scan_slip__doc__},
-
- // scan split node definitions file
- {pypylith3d_scan_split__name__, pypylith3d_scan_split,
- METH_VARARGS, pypylith3d_scan_split__doc__},
-
- // scan time step group info file
- {pypylith3d_scan_timdat__name__, pypylith3d_scan_timdat,
- METH_VARARGS, pypylith3d_scan_timdat__doc__},
-
- // scan traction boundary conditions file
- {pypylith3d_scan_tractions__name__, pypylith3d_scan_tractions,
- METH_VARARGS, pypylith3d_scan_tractions__doc__},
-
- // scan winkler forces info file
- {pypylith3d_scan_wink__name__, pypylith3d_scan_wink,
- METH_VARARGS, pypylith3d_scan_wink__doc__},
-
- // scan winkler forces info file for slippery nodes
- {pypylith3d_scan_winkx__name__, pypylith3d_scan_winkx,
- METH_VARARGS, pypylith3d_scan_winkx__doc__},
-
- // sort elements into families
- {pypylith3d_sort_elements__name__, pypylith3d_sort_elements,
- METH_VARARGS, pypylith3d_sort_elements__doc__},
-
- // sort slippery node elements
- {pypylith3d_sort_slip_nodes__name__, pypylith3d_sort_slip_nodes,
- METH_VARARGS, pypylith3d_sort_slip_nodes__doc__},
-
- // sort split node elements
- {pypylith3d_sort_split_nodes__name__, pypylith3d_sort_split_nodes,
- METH_VARARGS, pypylith3d_sort_split_nodes__doc__},
-
- // drive time-dependent solution
- {pypylith3d_viscos__name__, pypylith3d_viscos,
- METH_VARARGS, pypylith3d_viscos__doc__},
-
- // setup time-dependent solution
- {pypylith3d_viscos_setup__name__, pypylith3d_viscos_setup,
- METH_VARARGS, pypylith3d_viscos_setup__doc__},
-
- // drive time-dependent solution
- {pypylith3d_viscos_step__name__, pypylith3d_viscos_step,
- METH_VARARGS, pypylith3d_viscos_step__doc__},
-
- // cleanup time-dependent solution
- {pypylith3d_viscos_cleanup__name__, pypylith3d_viscos_cleanup,
- METH_VARARGS, pypylith3d_viscos_cleanup__doc__},
-
- // write out BC
- {pypylith3d_write_bc__name__, pypylith3d_write_bc,
- METH_VARARGS, pypylith3d_write_bc__doc__},
-
- // write out element node array
- {pypylith3d_write_connect__name__, pypylith3d_write_connect,
- METH_VARARGS, pypylith3d_write_connect__doc__},
-
- // write out nodal coordinates
- {pypylith3d_write_coords__name__, pypylith3d_write_coords,
- METH_VARARGS, pypylith3d_write_coords__doc__},
-
- // write out differential forces
- {pypylith3d_write_diff__name__, pypylith3d_write_diff,
- METH_VARARGS, pypylith3d_write_diff__doc__},
-
- // write out element and prestress information
- {pypylith3d_write_element_info__name__, pypylith3d_write_element_info,
- METH_VARARGS, pypylith3d_write_element_info__doc__},
-
- // write out time steps at which full output is desired
- {pypylith3d_write_fuldat__name__, pypylith3d_write_fuldat,
- METH_VARARGS, pypylith3d_write_fuldat__doc__},
-
- // write out global control information
- {pypylith3d_write_global_info__name__, pypylith3d_write_global_info,
- METH_VARARGS, pypylith3d_write_global_info__doc__},
-
- // write out time histories
- {pypylith3d_write_hist__name__, pypylith3d_write_hist,
- METH_VARARGS, pypylith3d_write_hist__doc__},
-
- // write out material property information
- {pypylith3d_write_props__name__, pypylith3d_write_props,
- METH_VARARGS, pypylith3d_write_props__doc__},
-
- // write out local coordinate rotations
- {pypylith3d_write_skew__name__, pypylith3d_write_skew,
- METH_VARARGS, pypylith3d_write_skew__doc__},
-
- // write out slippery node definitions
- {pypylith3d_write_slip__name__, pypylith3d_write_slip,
- METH_VARARGS, pypylith3d_write_slip__doc__},
-
- // write out sparse matrix information
- {pypylith3d_write_sparse_info__name__, pypylith3d_write_sparse_info,
- METH_VARARGS, pypylith3d_write_sparse_info__doc__},
-
- // write out split node definitions
- {pypylith3d_write_split__name__, pypylith3d_write_split,
- METH_VARARGS, pypylith3d_write_split__doc__},
-
- // write out split node info for plotting
- {pypylith3d_write_split_plot__name__, pypylith3d_write_split_plot,
- METH_VARARGS, pypylith3d_write_split_plot__doc__},
-
- // write out state variable output info
- {pypylith3d_write_stateout__name__, pypylith3d_write_stateout,
- METH_VARARGS, pypylith3d_write_stateout__doc__},
-
- // write out stress computation information
- {pypylith3d_write_strscomp__name__, pypylith3d_write_strscomp,
- METH_VARARGS, pypylith3d_write_strscomp__doc__},
-
- // write out subiteration convergence information
- {pypylith3d_write_subiter__name__, pypylith3d_write_subiter,
- METH_VARARGS, pypylith3d_write_subiter__doc__},
-
- // write out time step information
- {pypylith3d_write_timdat__name__, pypylith3d_write_timdat,
- METH_VARARGS, pypylith3d_write_timdat__doc__},
-
- // write out traction information
- {pypylith3d_write_tractions__name__, pypylith3d_write_tractions,
- METH_VARARGS, pypylith3d_write_tractions__doc__},
-
- // write mesh info to UCD file
- {pypylith3d_write_ucd_mesh__name__, pypylith3d_write_ucd_mesh,
- METH_VARARGS, pypylith3d_write_ucd_mesh__doc__},
-
- // write out Winkler force info
- {pypylith3d_write_wink__name__, pypylith3d_write_wink,
- METH_VARARGS, pypylith3d_write_wink__doc__},
-
- // write out slippery node Winkler force info
- {pypylith3d_write_winkx__name__, pypylith3d_write_winkx,
- METH_VARARGS, pypylith3d_write_winkx__doc__},
-
- // try binary I/O to see if it works
- {pypylith3d_try_binio__name__, pypylith3d_try_binio,
- METH_VARARGS, pypylith3d_try_binio__doc__},
-
-#if defined(GREENSFNS)
-
- // try binary I/O to see if it works
- {pypylith3d_interpolatePoints__name__, pypylith3d_interpolatePoints,
- METH_VARARGS, pypylith3d_interpolatePoints__doc__},
-
-#endif
-
- // copyright note
- {pypylith3d_copyright__name__, pypylith3d_copyright,
- METH_VARARGS, pypylith3d_copyright__doc__},
-
-
-// Sentinel
- {0, 0}
-};
-
-// version
-// $Id: bindings.cc,v 1.10 2005/04/21 23:16:35 willic3 Exp $
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/bindings.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/bindings.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/bindings.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,43 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pypylith3d_bindings_h)
-#define pypylith3d_bindings_h
-
-// the method table
-
-extern struct PyMethodDef pypylith3d_methods[];
-
-#endif
-
-// version
-// $Id: bindings.h,v 1.2 2005/03/31 23:27:58 willic3 Exp $
-
-// End of file
Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/const.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/const.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/const.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+//
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+//
+// Copyright (c) 2004-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.
+//
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+
+#if !defined(pypylith3d_const_h)
+#define pypylith3d_const_h
+
+
+typedef const char const_char;
+
+
+#endif
+
+// end of file
Copied: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/constants.pxd (from rev 6509, short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/constants.py)
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/constants.py 2007-04-05 21:54:55 UTC (rev 6509)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/constants.pxd 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,57 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+cdef enum:
+
+
+ # Parameters that are invariant for this geometry type
+ numberSpaceDimensions = 3
+ numberDegreesFreedom = 3
+ stateVariableDimension = 6
+ materialMatrixDimension = 21
+ numberSkewDimensions = 2
+ numberSlipDimensions = 5
+ numberSlipNeighbors = 4
+
+
+ # Invariant parameters related to element type
+ maxElementNodes = 20
+ nsnodesmax = 4
+
+
+ # Invariant parameters related to material model
+ maxMaterialModels = 20
+ maxStateVariables = 30
+
+
+ numberAllowedVolumeElementTypes = 1
+
+
+# end of file
Copied: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.cc (from rev 6509, short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/ElementTypeDef.py)
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/ElementTypeDef.py 2007-04-05 21:54:55 UTC (rev 6509)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,107 @@
+//
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+//
+// Copyright (c) 2004-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.
+//
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+
+
+#include "elementtypes.h"
+
+
+ElementType elementTypes[] = {
+ // nen ngauss nsnodes nsgauss
+ // -------------- ------------------------------ -------------- ------------------------------
+ // nodes fullGauss reducedGauss nodes2d fullGauss2d reducedGauss2d
+ // ============== ============== ============== ============== ============== ==============
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 8, 8, 1, 4, 4, 1 },
+ { 7, 8, 1, 4, 4, 1 },
+ { 6, 2, 1, 4, 4, 1 },
+ { 5, 5, 1, 3, 1, 1 },
+ { 4, 1, 1, 3, 1, 1 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 20, 27, 8, 8, 9, 4 },
+ { 18, 27, 8, 8, 9, 4 },
+ { 15, 9, 2, 8, 8, 4 },
+ { 13, 13, 5, 6, 3, 1 },
+ { 10, 4, 1, 6, 3, 1 }
+};
+
+
+int numElementTypes = sizeof(elementTypes)/sizeof(elementTypes[0]);
+
+
+// end of file
Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,52 @@
+//
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+//
+// Copyright (c) 2004-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.
+//
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef struct ElementType {
+ int nodes;
+ int fullGauss;
+ int reducedGauss;
+ int nodes2d;
+ int fullGauss2d;
+ int reducedGauss2d;
+ } ElementType;
+
+
+ extern ElementType elementTypes[];
+ extern int numElementTypes;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+// end of file
Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.pxd
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.pxd 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/elementtypes.pxd 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,46 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+cdef extern from "elementtypes.h":
+
+ struct ElementType:
+ int nodes
+ int fullGauss
+ int reducedGauss
+ int nodes2d
+ int fullGauss2d
+ int reducedGauss2d
+
+
+ extern ElementType elementTypes[]
+ extern int numElementTypes
+
+
+# end of file
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -28,27 +28,24 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-#include <portinfo>
+#include "config.h"
#include <Python.h>
-#include "exceptionhandler.h"
-
-int
-exceptionhandler(const int errorcode,
- const char* errorstring)
+extern "C" PyObject *exceptionhandler(int errorcode, char* errorstring)
{
// Generate python exceptions from error codes
- const int maxsize = 4096;
- char errormsg[maxsize];
+ const int errorstring_size = 4096;
+ char errormsg[errorstring_size];
if (errorcode == 0) {
- return 0;
+ Py_INCREF(Py_None);
+ return Py_None;
}
// copy string to 'errormsg', trim spaces, and null-terminate
- char *dest = errormsg + maxsize;
- const char *src = errorstring + maxsize;
+ char *dest = errormsg + errorstring_size;
+ const char *src = errorstring + errorstring_size;
while (dest > errormsg && (*--dest = *--src) == ' ')
;
dest[1] = '\0';
@@ -105,10 +102,7 @@
PyErr_Format(exception, format, errormsg);
- return errorcode;
+ return 0;
}
-// version
-// $Id: exceptionhandler.cc,v 1.3 2005/03/31 23:27:57 willic3 Exp $
-
-// End of file
+// end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,43 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pypylith3d_exceptionhandler_h)
-#define pypylith3d_exceptionhandler_h
-
-// exceptionhandler
-
-extern int exceptionhandler(const int errorcode, const char* errorstring);
-
-#endif
-
-// version
-// $Id: exceptionhandler.h,v 1.3 2005/03/31 23:27:58 willic3 Exp $
-
-// End of file
Copied: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.pxd (from rev 6509, short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.h)
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.h 2007-04-05 21:54:55 UTC (rev 6509)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptionhandler.pxd 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,35 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+cdef enum:
+ errorstring_size = 4096
+
+cdef extern object exceptionhandler(int errorcode, char *errorstring)
+
+# end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptions.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptions.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptions.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,39 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#include <portinfo>
-#include <Python.h>
-
-PyObject *pypylith3d_runtimeError = 0;
-
-// version
-// $Id: exceptions.cc,v 1.2 2005/03/31 23:27:57 willic3 Exp $
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptions.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptions.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/exceptions.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,43 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pypylith3d_exceptions_h)
-#define pypylith3d_exceptions_h
-
-// exceptions
-
-extern PyObject *pypylith3d_runtimeError;
-
-#endif
-
-// version
-// $Id: exceptions.h,v 1.2 2005/03/31 23:27:58 willic3 Exp $
-
-// End of file
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/interpolate.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/interpolate.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/interpolate.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -28,17 +28,17 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
+#include "config.h"
+
#include <Distribution.hh>
#include <petscmesh.h>
#include <src/dm/mesh/meshpylith.h>
#include <petscmat.h>
-#include <portinfo>
#include "journal/debug.h"
#include <Python.h>
#include "interpolate.h"
-#include "exceptionhandler.h"
#include <stdio.h>
#include <string.h>
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/libpylith3d.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/libpylith3d.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/libpylith3d.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,5832 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#include <portinfo>
-#include "journal/debug.h"
-
-#include <Python.h>
-
-#include "libpylith3d.h"
-#include "exceptionhandler.h"
-#include "pylith3d_externs.h"
-#include <stdio.h>
-#include <string.h>
-
-
-// Autocompute gravitational prestresses.
-
-char pypylith3d_autoprestr__doc__[] = "";
-char pypylith3d_autoprestr__name__[] = "autoprestr";
-
-PyObject * pypylith3d_autoprestr(PyObject *, PyObject *args)
-{
- PyObject* pyA; // Sparse matrix array
- PyObject* pyRhs;
- PyObject* pySol;
- PyObject* py_bextern; // Force vectors
- PyObject* py_btraction;
- PyObject* py_bgravity;
- PyObject* py_bconcForce;
- PyObject* py_bintern;
- PyObject* py_bresid;
- PyObject* py_bwink;
- PyObject* py_bwinkx;
- PyObject* py_dispVec;
- PyObject* py_dprev;
- PyObject* py_nforce;
- PyObject* py_grav;
- PyObject* py_x; // Global arrays
- PyObject* py_d;
- PyObject* py_deld;
- PyObject* py_dcur;
- PyObject* py_id;
- PyObject* py_iwink;
- PyObject* py_wink;
- PyObject* py_nsysdat;
- PyObject* py_iddmat;
- PyObject* py_ibond; // Boundary condition arrays
- PyObject* py_bond;
- PyObject* py_dx; // Slippery node arrays
- PyObject* py_deldx;
- PyObject* py_dxcur;
- PyObject* py_diforc;
- PyObject* py_idx;
- PyObject* py_iwinkx;
- PyObject* py_winkx;
- PyObject* py_idslp;
- PyObject* py_ipslp;
- PyObject* py_idhist;
- PyObject* py_fault; // Split node arrays
- PyObject* py_nfault;
- PyObject* py_dfault;
- PyObject* py_tfault;
- PyObject* py_s; // Local stiffness matrix arrays
- PyObject* py_stemp;
- PyObject* py_state; // Element arrays
- PyObject* py_dstate;
- PyObject* py_state0;
- PyObject* py_dmat;
- PyObject* py_iens;
- PyObject* py_lm;
- PyObject* py_lmx;
- PyObject* py_lmf;
- PyObject* py_ivfamily;
- PyObject* py_npar;
- PyObject* py_ielindx;
- PyObject* py_tractionverts; // Traction BC arrays
- PyObject* py_tractionvals;
- PyObject* py_gauss2d;
- PyObject* py_sh2d;
- PyObject* py_infetype2d;
- PyObject* py_prop; // Material property arrays
- PyObject* py_infmatmod;
- PyObject* py_gauss; // Element type arrays
- PyObject* py_sh;
- PyObject* py_shj;
- PyObject* py_infetype;
- PyObject* py_histry; // Time information
- PyObject* py_rtimdat;
- PyObject* py_ntimdat;
- PyObject* py_nvisdat;
- PyObject* py_maxstp;
- PyObject* py_delt;
- PyObject* py_alfa;
- PyObject* py_maxit;
- PyObject* py_ntdinit;
- PyObject* py_lgdef;
- PyObject* py_utol;
- PyObject* py_ftol;
- PyObject* py_etol;
- PyObject* py_itmax;
- PyObject* py_rgiter; // Iterative solution information
- PyObject* py_skew; // Skew rotation information
- PyObject* py_ncodat; // Input/output information
- PyObject* py_nunits;
- PyObject* py_nprint;
- PyObject* py_istatout;
- PyObject* py_nstatout;
- char* ofile; // Output file names
- char* pfile;
- char* ucdroot;
- int autoprestrStage, iterateEvent; // PETSc logging
-
- int ok = PyArg_ParseTuple(args, "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOsssii:autoprestr",
- &pyA, // Sparse matrix arrays
- &pyRhs,
- &pySol,
- &py_bextern, // Force vectors
- &py_btraction,
- &py_bgravity,
- &py_bconcForce,
- &py_bintern,
- &py_bresid,
- &py_bwink,
- &py_bwinkx,
- &py_dispVec,
- &py_dprev,
- &py_nforce,
- &py_grav,
- &py_x, // Global arrays
- &py_d,
- &py_deld,
- &py_dcur,
- &py_id,
- &py_iwink,
- &py_wink,
- &py_nsysdat,
- &py_iddmat,
- &py_ibond, // Boundary condition arrays
- &py_bond,
- &py_dx, // Slippery node arrays
- &py_deldx,
- &py_dxcur,
- &py_diforc,
- &py_idx,
- &py_iwinkx,
- &py_winkx,
- &py_idslp,
- &py_ipslp,
- &py_idhist,
- &py_fault, // Split node arrays
- &py_nfault,
- &py_dfault,
- &py_tfault,
- &py_s, // Local stiffness matrix arrays
- &py_stemp,
- &py_state, // Element arrays
- &py_dstate,
- &py_state0,
- &py_dmat,
- &py_iens,
- &py_lm,
- &py_lmx,
- &py_lmf,
- &py_ivfamily,
- &py_npar,
- &py_ielindx,
- &py_tractionverts, // Traction BC arrays
- &py_tractionvals,
- &py_gauss2d,
- &py_sh2d,
- &py_infetype2d,
- &py_prop, // Material property arrays
- &py_infmatmod,
- &py_gauss, // Element type arrays
- &py_sh,
- &py_shj,
- &py_infetype,
- &py_histry, // Time information
- &py_rtimdat,
- &py_ntimdat,
- &py_nvisdat,
- &py_maxstp,
- &py_delt,
- &py_alfa,
- &py_maxit,
- &py_ntdinit,
- &py_lgdef,
- &py_utol,
- &py_ftol,
- &py_etol,
- &py_itmax,
- &py_rgiter, // Iterative solution information
- &py_skew, // Skew rotation information
- &py_ncodat, // Input/output information
- &py_nunits,
- &py_nprint,
- &py_istatout,
- &py_nstatout,
- &ofile, // Output file names
- &pfile,
- &ucdroot,
- &autoprestrStage, // PETSc logging
- &iterateEvent);
-
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- Mat A = (Mat) PyCObject_AsVoidPtr(pyA);
- Vec rhs = (Vec) PyCObject_AsVoidPtr(pyRhs);
- Vec sol = (Vec) PyCObject_AsVoidPtr(pySol);
- double* bextern = (double*) PyCObject_AsVoidPtr(py_bextern);
- double* btraction = (double*) PyCObject_AsVoidPtr(py_btraction);
- double* bgravity = (double*) PyCObject_AsVoidPtr(py_bgravity);
- double* bconcForce = (double*) PyCObject_AsVoidPtr(py_bconcForce);
- double* bintern = (double*) PyCObject_AsVoidPtr(py_bintern);
- double* bresid = (double*) PyCObject_AsVoidPtr(py_bresid);
- double* bwink = (double*) PyCObject_AsVoidPtr(py_bwink);
- double* bwinkx = (double*) PyCObject_AsVoidPtr(py_bwinkx);
- double* dispVec = (double*) PyCObject_AsVoidPtr(py_dispVec);
- double* dprev = (double*) PyCObject_AsVoidPtr(py_dprev);
- int* nforce = (int*) PyCObject_AsVoidPtr(py_nforce);
- double* grav = (double*) PyCObject_AsVoidPtr(py_grav);
- double* x = (double*) PyCObject_AsVoidPtr(py_x);
- double* d = (double*) PyCObject_AsVoidPtr(py_d);
- double* deld = (double*) PyCObject_AsVoidPtr(py_deld);
- double* dcur = (double*) PyCObject_AsVoidPtr(py_dcur);
- int* id = (int*) PyCObject_AsVoidPtr(py_id);
- int* iwink = (int*) PyCObject_AsVoidPtr(py_iwink);
- double* wink = (double*) PyCObject_AsVoidPtr(py_wink);
- int* nsysdat = (int*) PyCObject_AsVoidPtr(py_nsysdat);
- int* iddmat = (int*) PyCObject_AsVoidPtr(py_iddmat);
- int* ibond = (int*) PyCObject_AsVoidPtr(py_ibond);
- double* bond = (double*) PyCObject_AsVoidPtr(py_bond);
- double* dx = (double*) PyCObject_AsVoidPtr(py_dx);
- double* deldx = (double*) PyCObject_AsVoidPtr(py_deldx);
- double* dxcur = (double*) PyCObject_AsVoidPtr(py_dxcur);
- double* diforc = (double*) PyCObject_AsVoidPtr(py_diforc);
- int* idx = (int*) PyCObject_AsVoidPtr(py_idx);
- int* iwinkx = (int*) PyCObject_AsVoidPtr(py_iwinkx);
- double* winkx = (double*) PyCObject_AsVoidPtr(py_winkx);
- int* idslp = (int*) PyCObject_AsVoidPtr(py_idslp);
- int* ipslp = (int*) PyCObject_AsVoidPtr(py_ipslp);
- int* idhist = (int*) PyCObject_AsVoidPtr(py_idhist);
- double* fault = (double*) PyCObject_AsVoidPtr(py_fault);
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
- double* dfault = (double*) PyCObject_AsVoidPtr(py_dfault);
- double* tfault = (double*) PyCObject_AsVoidPtr(py_tfault);
- double* s = (double*) PyCObject_AsVoidPtr(py_s);
- double* stemp = (double*) PyCObject_AsVoidPtr(py_stemp);
- double* state = (double*) PyCObject_AsVoidPtr(py_state);
- double* dstate = (double*) PyCObject_AsVoidPtr(py_dstate);
- double* state0 = (double*) PyCObject_AsVoidPtr(py_state0);
- double* dmat = (double*) PyCObject_AsVoidPtr(py_dmat);
- int* iens = (int*) PyCObject_AsVoidPtr(py_iens);
- int* lm = (int*) PyCObject_AsVoidPtr(py_lm);
- int* lmx = (int*) PyCObject_AsVoidPtr(py_lmx);
- int* lmf = (int*) PyCObject_AsVoidPtr(py_lmf);
- int* ivfamily = (int*) PyCObject_AsVoidPtr(py_ivfamily);
- int* npar = (int*) PyCObject_AsVoidPtr(py_npar);
- int* ielindx = (int*) PyCObject_AsVoidPtr(py_ielindx);
- int* tractionverts = (int*) PyCObject_AsVoidPtr(py_tractionverts);
- double* tractionvals = (double*) PyCObject_AsVoidPtr(py_tractionvals);
- double* gauss2d = (double*) PyCObject_AsVoidPtr(py_gauss2d);
- double* sh2d = (double*) PyCObject_AsVoidPtr(py_sh2d);
- int* infetype2d = (int*) PyCObject_AsVoidPtr(py_infetype2d);
- double* prop = (double*) PyCObject_AsVoidPtr(py_prop);
- int* infmatmod = (int*) PyCObject_AsVoidPtr(py_infmatmod);
- double* gauss = (double*) PyCObject_AsVoidPtr(py_gauss);
- double* sh = (double*) PyCObject_AsVoidPtr(py_sh);
- double* shj = (double*) PyCObject_AsVoidPtr(py_shj);
- int* infetype = (int*) PyCObject_AsVoidPtr(py_infetype);
- double* histry = (double*) PyCObject_AsVoidPtr(py_histry);
- double* rtimdat = (double*) PyCObject_AsVoidPtr(py_rtimdat);
- int* ntimdat = (int*) PyCObject_AsVoidPtr(py_ntimdat);
- int* nvisdat = (int*) PyCObject_AsVoidPtr(py_nvisdat);
- int* maxstp = (int*) PyCObject_AsVoidPtr(py_maxstp);
- double* delt = (double*) PyCObject_AsVoidPtr(py_delt);
- double* alfa = (double*) PyCObject_AsVoidPtr(py_alfa);
- int* maxit = (int*) PyCObject_AsVoidPtr(py_maxit);
- int* ntdinit = (int*) PyCObject_AsVoidPtr(py_ntdinit);
- int* lgdef = (int*) PyCObject_AsVoidPtr(py_lgdef);
- double* utol = (double*) PyCObject_AsVoidPtr(py_utol);
- double* ftol = (double*) PyCObject_AsVoidPtr(py_ftol);
- double* etol = (double*) PyCObject_AsVoidPtr(py_etol);
- int* itmax = (int*) PyCObject_AsVoidPtr(py_itmax);
- double* rgiter = (double*) PyCObject_AsVoidPtr(py_rgiter);
- double* skew = (double*) PyCObject_AsVoidPtr(py_skew);
- int* ncodat = (int*) PyCObject_AsVoidPtr(py_ncodat);
- int* nunits = (int*) PyCObject_AsVoidPtr(py_nunits);
- int* nprint = (int*) PyCObject_AsVoidPtr(py_nprint);
- int* istatout = (int*) PyCObject_AsVoidPtr(py_istatout);
- int* nstatout = (int*) PyCObject_AsVoidPtr(py_nstatout);
-
- autoprestr_f(&A, // Sparse matrix arrays
- &rhs,
- &sol,
- bextern, // Force vectors
- btraction,
- bgravity,
- bconcForce,
- bintern,
- bresid,
- bwink,
- bwinkx,
- dispVec,
- dprev,
- nforce,
- grav,
- x, // Global arrays
- d,
- deld,
- dcur,
- id,
- iwink,
- wink,
- nsysdat,
- iddmat,
- ibond, // Boundary condition arrays
- bond,
- dx, // Slippery node arrays
- deldx,
- dxcur,
- diforc,
- idx,
- iwinkx,
- winkx,
- idslp,
- ipslp,
- idhist,
- fault, // Split node arrays
- nfault,
- dfault,
- tfault,
- s, // Local stiffness matrix arrays
- stemp,
- state, // Element arrays
- dstate,
- state0,
- dmat,
- iens,
- lm,
- lmx,
- lmf,
- ivfamily,
- npar,
- ielindx,
- tractionverts, // Traction BC arrays
- tractionvals,
- gauss2d,
- sh2d,
- infetype2d,
- prop, // Material property arrays
- infmatmod,
- gauss, // Element type arrays
- sh,
- shj,
- infetype,
- histry, // Time information
- rtimdat,
- ntimdat,
- nvisdat,
- maxstp,
- delt,
- alfa,
- maxit,
- ntdinit,
- lgdef,
- utol,
- ftol,
- etol,
- itmax,
- rgiter, // Iterative solution information
- skew, // Skew rotation information
- ncodat, // Input/output information
- nunits,
- nprint,
- istatout,
- nstatout,
- ofile, // Output file names
- pfile,
- ucdroot,
- &autoprestrStage,
- &iterateEvent,
- &errorcode, // Error codes
- errorstring,
- strlen(ofile), // String lengths
- strlen(pfile),
- strlen(ucdroot),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "ofile:" << ofile
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-
-// Perform the elastic solution.
-
-char pypylith3d_elastc__doc__[] = "";
-char pypylith3d_elastc__name__[] = "elastc";
-
-PyObject * pypylith3d_elastc(PyObject *, PyObject *args)
-{
- PyObject* pyA; // Sparse matrix arrays
- PyObject* pyRhs;
- PyObject* pySol;
- PyObject* py_bextern; // Force vectors
- PyObject* py_btraction;
- PyObject* py_bgravity;
- PyObject* py_bconcForce;
- PyObject* py_bintern;
- PyObject* py_bresid;
- PyObject* py_bwink;
- PyObject* py_bwinkx;
- PyObject* py_dispVec;
- PyObject* py_dprev;
- PyObject* py_nforce;
- PyObject* py_grav;
- PyObject* py_x; // Global arrays
- PyObject* py_d;
- PyObject* py_deld;
- PyObject* py_dcur;
- PyObject* py_id;
- PyObject* py_iwink;
- PyObject* py_wink;
- PyObject* py_nsysdat;
- PyObject* py_iddmat;
- PyObject* py_ibond; // Boundary condition arrays
- PyObject* py_bond;
- PyObject* py_dx; // Slippery node arrays
- PyObject* py_deldx;
- PyObject* py_dxcur;
- PyObject* py_diforc;
- PyObject* py_idx;
- PyObject* py_iwinkx;
- PyObject* py_winkx;
- PyObject* py_idslp;
- PyObject* py_ipslp;
- PyObject* py_idhist;
- PyObject* py_fault; // Split node arrays
- PyObject* py_nfault;
- PyObject* py_dfault;
- PyObject* py_tfault;
- PyObject* py_s; // Local stiffness matrix arrays
- PyObject* py_stemp;
- PyObject* py_state; // Element arrays
- PyObject* py_dstate;
- PyObject* py_state0;
- PyObject* py_dmat;
- PyObject* py_ien;
- PyObject* py_lm;
- PyObject* py_lmx;
- PyObject* py_lmf;
- PyObject* py_ivfamily;
- PyObject* py_npar;
- PyObject* py_ielindx;
- PyObject* py_tractionverts; // Traction BC arrays
- PyObject* py_tractionvals;
- PyObject* py_gauss2d;
- PyObject* py_sh2d;
- PyObject* py_infetype2d;
- PyObject* py_prop; // Material property arrays
- PyObject* py_infmatmod;
- PyObject* py_gauss; // Element type arrays
- PyObject* py_sh;
- PyObject* py_shj;
- PyObject* py_infetype;
- PyObject* py_histry; // Time information
- PyObject* py_rtimdat;
- PyObject* py_ntimdat;
- PyObject* py_nvisdat;
- PyObject* py_maxstp;
- PyObject* py_delt;
- PyObject* py_alfa;
- PyObject* py_maxit;
- PyObject* py_ntdinit;
- PyObject* py_lgdef;
- PyObject* py_utol;
- PyObject* py_ftol;
- PyObject* py_etol;
- PyObject* py_itmax;
- PyObject* py_rgiter; // Iterative solution information
- PyObject* py_skew; // Skew rotation information
- PyObject* py_ncodat; // Input/output information
- PyObject* py_nunits;
- PyObject* py_nprint;
- PyObject* py_istatout;
- PyObject* py_nstatout;
- char* ofile; // Output file names
- char* pfile;
- char* ucdroot;
- int elasticStage, iterateEvent; // PETSc logging
-
- int ok = PyArg_ParseTuple(args, "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOsssii:elastc",
- &pyA, // Sparse matrix arrays
- &pyRhs,
- &pySol,
- &py_bextern, // Force vectors
- &py_btraction,
- &py_bgravity,
- &py_bconcForce,
- &py_bintern,
- &py_bresid,
- &py_bwink,
- &py_bwinkx,
- &py_dispVec,
- &py_dprev,
- &py_nforce,
- &py_grav,
- &py_x, // Global arrays
- &py_d,
- &py_deld,
- &py_dcur,
- &py_id,
- &py_iwink,
- &py_wink,
- &py_nsysdat,
- &py_iddmat,
- &py_ibond, // Boundary condition arrays
- &py_bond,
- &py_dx, // Slippery node arrays
- &py_deldx,
- &py_dxcur,
- &py_diforc,
- &py_idx,
- &py_iwinkx,
- &py_winkx,
- &py_idslp,
- &py_ipslp,
- &py_idhist,
- &py_fault, // Split node arrays
- &py_nfault,
- &py_dfault,
- &py_tfault,
- &py_s, // Local stiffness matrix arrays
- &py_stemp,
- &py_state, // Element arrays
- &py_dstate,
- &py_state0,
- &py_dmat,
- &py_ien,
- &py_lm,
- &py_lmx,
- &py_lmf,
- &py_ivfamily,
- &py_npar,
- &py_ielindx,
- &py_tractionverts, // Traction BC arrays
- &py_tractionvals,
- &py_gauss2d,
- &py_sh2d,
- &py_infetype2d,
- &py_prop, // Material property arrays
- &py_infmatmod,
- &py_gauss, // Element type arrays
- &py_sh,
- &py_shj,
- &py_infetype,
- &py_histry, // Time information
- &py_rtimdat,
- &py_ntimdat,
- &py_nvisdat,
- &py_maxstp,
- &py_delt,
- &py_alfa,
- &py_maxit,
- &py_ntdinit,
- &py_lgdef,
- &py_utol,
- &py_ftol,
- &py_etol,
- &py_itmax,
- &py_rgiter, // Iterative solution information
- &py_skew, // Skew rotation information
- &py_ncodat, // Input/output information
- &py_nunits,
- &py_nprint,
- &py_istatout,
- &py_nstatout,
- &ofile, // Output file names
- &pfile,
- &ucdroot,
- &elasticStage, // PETSc logging
- &iterateEvent);
-
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- Mat A = (Mat) PyCObject_AsVoidPtr(pyA);
- Vec rhs = (Vec) PyCObject_AsVoidPtr(pyRhs);
- Vec sol = (Vec) PyCObject_AsVoidPtr(pySol);
- double* bextern = (double*) PyCObject_AsVoidPtr(py_bextern);
- double* btraction = (double*) PyCObject_AsVoidPtr(py_btraction);
- double* bgravity = (double*) PyCObject_AsVoidPtr(py_bgravity);
- double* bconcForce = (double*) PyCObject_AsVoidPtr(py_bconcForce);
- double* bintern = (double*) PyCObject_AsVoidPtr(py_bintern);
- double* bresid = (double*) PyCObject_AsVoidPtr(py_bresid);
- double* bwink = (double*) PyCObject_AsVoidPtr(py_bwink);
- double* bwinkx = (double*) PyCObject_AsVoidPtr(py_bwinkx);
- double* dispVec = (double*) PyCObject_AsVoidPtr(py_dispVec);
- double* dprev = (double*) PyCObject_AsVoidPtr(py_dprev);
- int* nforce = (int*) PyCObject_AsVoidPtr(py_nforce);
- double* grav = (double*) PyCObject_AsVoidPtr(py_grav);
- double* x = (double*) PyCObject_AsVoidPtr(py_x);
- double* d = (double*) PyCObject_AsVoidPtr(py_d);
- double* deld = (double*) PyCObject_AsVoidPtr(py_deld);
- double* dcur = (double*) PyCObject_AsVoidPtr(py_dcur);
- int* id = (int*) PyCObject_AsVoidPtr(py_id);
- int* iwink = (int*) PyCObject_AsVoidPtr(py_iwink);
- double* wink = (double*) PyCObject_AsVoidPtr(py_wink);
- int* nsysdat = (int*) PyCObject_AsVoidPtr(py_nsysdat);
- int* iddmat = (int*) PyCObject_AsVoidPtr(py_iddmat);
- int* ibond = (int*) PyCObject_AsVoidPtr(py_ibond);
- double* bond = (double*) PyCObject_AsVoidPtr(py_bond);
- double* dx = (double*) PyCObject_AsVoidPtr(py_dx);
- double* deldx = (double*) PyCObject_AsVoidPtr(py_deldx);
- double* dxcur = (double*) PyCObject_AsVoidPtr(py_dxcur);
- double* diforc = (double*) PyCObject_AsVoidPtr(py_diforc);
- int* idx = (int*) PyCObject_AsVoidPtr(py_idx);
- int* iwinkx = (int*) PyCObject_AsVoidPtr(py_iwinkx);
- double* winkx = (double*) PyCObject_AsVoidPtr(py_winkx);
- int* idslp = (int*) PyCObject_AsVoidPtr(py_idslp);
- int* ipslp = (int*) PyCObject_AsVoidPtr(py_ipslp);
- int* idhist = (int*) PyCObject_AsVoidPtr(py_idhist);
- double* fault = (double*) PyCObject_AsVoidPtr(py_fault);
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
- double* dfault = (double*) PyCObject_AsVoidPtr(py_dfault);
- double* tfault = (double*) PyCObject_AsVoidPtr(py_tfault);
- double* s = (double*) PyCObject_AsVoidPtr(py_s);
- double* stemp = (double*) PyCObject_AsVoidPtr(py_stemp);
- double* state = (double*) PyCObject_AsVoidPtr(py_state);
- double* dstate = (double*) PyCObject_AsVoidPtr(py_dstate);
- double* state0 = (double*) PyCObject_AsVoidPtr(py_state0);
- double* dmat = (double*) PyCObject_AsVoidPtr(py_dmat);
- int* ien = (int*) PyCObject_AsVoidPtr(py_ien);
- int* lm = (int*) PyCObject_AsVoidPtr(py_lm);
- int* lmx = (int*) PyCObject_AsVoidPtr(py_lmx);
- int* lmf = (int*) PyCObject_AsVoidPtr(py_lmf);
- int* ivfamily = (int*) PyCObject_AsVoidPtr(py_ivfamily);
- int* npar = (int*) PyCObject_AsVoidPtr(py_npar);
- int* ielindx = (int*) PyCObject_AsVoidPtr(py_ielindx);
- int* tractionverts = (int*) PyCObject_AsVoidPtr(py_tractionverts);
- double* tractionvals = (double*) PyCObject_AsVoidPtr(py_tractionvals);
- double* gauss2d = (double*) PyCObject_AsVoidPtr(py_gauss2d);
- double* sh2d = (double*) PyCObject_AsVoidPtr(py_sh2d);
- int* infetype2d = (int*) PyCObject_AsVoidPtr(py_infetype2d);
- double* prop = (double*) PyCObject_AsVoidPtr(py_prop);
- int* infmatmod = (int*) PyCObject_AsVoidPtr(py_infmatmod);
- double* gauss = (double*) PyCObject_AsVoidPtr(py_gauss);
- double* sh = (double*) PyCObject_AsVoidPtr(py_sh);
- double* shj = (double*) PyCObject_AsVoidPtr(py_shj);
- int* infetype = (int*) PyCObject_AsVoidPtr(py_infetype);
- double* histry = (double*) PyCObject_AsVoidPtr(py_histry);
- double* rtimdat = (double*) PyCObject_AsVoidPtr(py_rtimdat);
- int* ntimdat = (int*) PyCObject_AsVoidPtr(py_ntimdat);
- int* nvisdat = (int*) PyCObject_AsVoidPtr(py_nvisdat);
- int* maxstp = (int*) PyCObject_AsVoidPtr(py_maxstp);
- double* delt = (double*) PyCObject_AsVoidPtr(py_delt);
- double* alfa = (double*) PyCObject_AsVoidPtr(py_alfa);
- int* maxit = (int*) PyCObject_AsVoidPtr(py_maxit);
- int* ntdinit = (int*) PyCObject_AsVoidPtr(py_ntdinit);
- int* lgdef = (int*) PyCObject_AsVoidPtr(py_lgdef);
- double* utol = (double*) PyCObject_AsVoidPtr(py_utol);
- double* ftol = (double*) PyCObject_AsVoidPtr(py_ftol);
- double* etol = (double*) PyCObject_AsVoidPtr(py_etol);
- int* itmax = (int*) PyCObject_AsVoidPtr(py_itmax);
- double* rgiter = (double*) PyCObject_AsVoidPtr(py_rgiter);
- double* skew = (double*) PyCObject_AsVoidPtr(py_skew);
- int* ncodat = (int*) PyCObject_AsVoidPtr(py_ncodat);
- int* nunits = (int*) PyCObject_AsVoidPtr(py_nunits);
- int* nprint = (int*) PyCObject_AsVoidPtr(py_nprint);
- int* istatout = (int*) PyCObject_AsVoidPtr(py_istatout);
- int* nstatout = (int*) PyCObject_AsVoidPtr(py_nstatout);
-
- elastc_f(&A, // Sparse matrix arrays
- &rhs,
- &sol,
- bextern, // Force vectors
- btraction,
- bgravity,
- bconcForce,
- bintern,
- bresid,
- bwink,
- bwinkx,
- dispVec,
- dprev,
- nforce,
- grav,
- x, // Global arrays
- d,
- deld,
- dcur,
- id,
- iwink,
- wink,
- nsysdat,
- iddmat,
- ibond, // Boundary condition arrays
- bond,
- dx, // Slippery node arrays
- deldx,
- dxcur,
- diforc,
- idx,
- iwinkx,
- winkx,
- idslp,
- ipslp,
- idhist,
- fault, // Split node arrays
- nfault,
- dfault,
- tfault,
- s, // Local stiffness matrix arrays
- stemp,
- state, // Element arrays
- dstate,
- state0,
- dmat,
- ien,
- lm,
- lmx,
- lmf,
- ivfamily,
- npar,
- ielindx,
- tractionverts, // Traction BC arrays
- tractionvals,
- gauss2d,
- sh2d,
- infetype2d,
- prop, // Material property arrays
- infmatmod,
- gauss, // Element type arrays
- sh,
- shj,
- infetype,
- histry, // Time information
- rtimdat,
- ntimdat,
- nvisdat,
- maxstp,
- delt,
- alfa,
- maxit,
- ntdinit,
- lgdef,
- utol,
- ftol,
- etol,
- itmax,
- rgiter, // Iterative solution information
- skew, // Skew rotation information
- ncodat, // Input/output information
- nunits,
- nprint,
- istatout,
- nstatout,
- ofile, // Output file names
- pfile,
- ucdroot,
- &elasticStage,
- &iterateEvent,
- &errorcode, // Error codes
- errorstring,
- strlen(ofile), // String lengths
- strlen(pfile),
- strlen(ucdroot),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- //int *fail = NULL;
- //int i = fail[0];
- return NULL;
- }
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "ofile:" << ofile
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-
-
-// Assign equation numbers to Iwink and Iwinkx arrays, and compact
-// Wink and Winkx arrays to correspond to assigned BC.
-
-char pypylith3d_assign_wink__doc__[] = "";
-char pypylith3d_assign_wink__name__[] = "assign_wink";
-
-PyObject * pypylith3d_assign_wink(PyObject *, PyObject *args)
-{
- PyObject* py_winkdef;
- PyObject* py_wink;
- PyObject* py_iwinkdef;
- PyObject* py_iwinkid;
- PyObject* py_iwink;
- PyObject* py_id;
- int numnp;
- int nwink;
- int nwinke;
-
- int ok = PyArg_ParseTuple(args, "OOOOOOiii:assign_wink",
- &py_winkdef,
- &py_wink,
- &py_iwinkdef,
- &py_iwinkid,
- &py_iwink,
- &py_id,
- &numnp,
- &nwink,
- &nwinke);
-
- if (!ok) {
- return 0;
- }
-
- double* winkdef = (double*) PyCObject_AsVoidPtr(py_winkdef);
- double* wink = (double*) PyCObject_AsVoidPtr(py_wink);
- int* iwinkdef = (int*) PyCObject_AsVoidPtr(py_iwinkdef);
- int* iwinkid = (int*) PyCObject_AsVoidPtr(py_iwinkid);
- int* iwink = (int*) PyCObject_AsVoidPtr(py_iwink);
- int* id = (int*) PyCObject_AsVoidPtr(py_id);
-
- assign_wink_f(winkdef,
- wink,
- iwinkdef,
- iwinkid,
- iwink,
- id,
- &numnp,
- &nwink,
- &nwinke);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nwink:" << nwink
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Create Id and Idx arrays, and determine the number of equations.
-
-char pypylith3d_create_id__doc__[] = "";
-char pypylith3d_create_id__name__[] = "create_id";
-
-PyObject * pypylith3d_create_id(PyObject *, PyObject *args)
-{
- PyObject* py_id;
- PyObject* py_idx;
- PyObject* py_ibond;
- PyObject* py_nslip;
- PyObject* py_idslp;
- int numslp;
- int numnp;
- int totalNumberSlipperyNodes;
-
- int ok = PyArg_ParseTuple(args, "OOOOOiii:create_id",
- &py_id,
- &py_idx,
- &py_ibond,
- &py_nslip,
- &py_idslp,
- &numslp,
- &numnp,
- &totalNumberSlipperyNodes);
-
- if (!ok) {
- return 0;
- }
-
- int* id = (int*) PyCObject_AsVoidPtr(py_id);
- int* idx = (int*) PyCObject_AsVoidPtr(py_idx);
- int* ibond = (int*) PyCObject_AsVoidPtr(py_ibond);
- int* nslip = (int*) PyCObject_AsVoidPtr(py_nslip);
- int* idslp = (int*) PyCObject_AsVoidPtr(py_idslp);
- int neq = 0;
-
- create_id_f(id,
- idx,
- ibond,
- nslip,
- idslp,
- &numslp,
- &numnp,
- &totalNumberSlipperyNodes,
- &neq);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "neq:" << neq
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue("i", neq);
-}
-
-
-// Form id array for split nodes
-
-char pypylith3d_id_split__doc__[] = "";
-char pypylith3d_id_split__name__[] = "id_split";
-
-PyObject * pypylith3d_id_split(PyObject *, PyObject *args)
-{
- PyObject* py_nfault;
- PyObject* py_idftn;
- int numnp;
- int numfn;
- int totalNumberSplitNodes;
-
- int ok = PyArg_ParseTuple(args, "OOiii:id_split",
- &py_nfault,
- &py_idftn,
- &numnp,
- &numfn,
- &totalNumberSplitNodes);
-
- if (!ok) {
- return 0;
- }
-
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
- int* idftn = (int*) PyCObject_AsVoidPtr(py_idftn);
-
- id_split_f(nfault,
- idftn,
- &numnp,
- &numfn,
- &totalNumberSplitNodes);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numfn:" << numfn
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Find closest fault neighbors for slippery nodes
-
-char pypylith3d_nfind__doc__[] = "";
-char pypylith3d_nfind__name__[] = "nfind";
-
-PyObject * pypylith3d_nfind(PyObject *, PyObject *args)
-{
- PyObject* py_x;
- PyObject* py_xtmp;
- PyObject* py_idslp;
- PyObject* py_ipslp;
- PyObject* py_itmp;
- PyObject* py_itmp1;
- PyObject* py_itmp2;
- PyObject* py_nslip;
- int numslp;
- int totalNumberSlipperyNodes;
- int numnp;
-
- int ok = PyArg_ParseTuple(args, "OOOOOOOOiii:nfind",
- &py_x,
- &py_xtmp,
- &py_idslp,
- &py_ipslp,
- &py_itmp,
- &py_itmp1,
- &py_itmp2,
- &py_nslip,
- &numslp,
- &totalNumberSlipperyNodes,
- &numnp);
-
- if (!ok) {
- return 0;
- }
-
- double* x = (double*) PyCObject_AsVoidPtr(py_x);
- double* xtmp = (double*) PyCObject_AsVoidPtr(py_xtmp);
- int* idslp = (int*) PyCObject_AsVoidPtr(py_idslp);
- int* ipslp = (int*) PyCObject_AsVoidPtr(py_ipslp);
- int* itmp = (int*) PyCObject_AsVoidPtr(py_itmp);
- int* itmp1 = (int*) PyCObject_AsVoidPtr(py_itmp1);
- int* itmp2 = (int*) PyCObject_AsVoidPtr(py_itmp2);
- int* nslip = (int*) PyCObject_AsVoidPtr(py_nslip);
-
- nfind_f(x,
- xtmp,
- idslp,
- ipslp,
- itmp,
- itmp1,
- itmp2,
- nslip,
- &numslp,
- &totalNumberSlipperyNodes,
- &numnp);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "x:" << x
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read boundary conditions
-
-char pypylith3d_read_bc__doc__[] = "";
-char pypylith3d_read_bc__name__[] = "read_bc";
-
-PyObject * pypylith3d_read_bc(PyObject *, PyObject *args)
-{
- PyObject* py_bond;
- double dscale;
- double vscale;
- double fscale;
- PyObject* py_ibond;
- int numnp;
- int numbc;
- int kr;
- char* bcInputFile;
-
- int ok = PyArg_ParseTuple(args, "OdddOiiis:read_bc",
- &py_bond,
- &dscale,
- &vscale,
- &fscale,
- &py_ibond,
- &numnp,
- &numbc,
- &kr,
- &bcInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* bond = (double*) PyCObject_AsVoidPtr(py_bond);
- int* ibond = (int*) PyCObject_AsVoidPtr(py_ibond);
- int numberConcForces = 0;
-
- read_bc_f(bond,
- &dscale,
- &vscale,
- &fscale,
- ibond,
- &numnp,
- &numbc,
- &numberConcForces,
- &kr,
- bcInputFile,
- &errorcode,
- errorstring,
- strlen(bcInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numbc:" << numbc
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue("i", numberConcForces);
-}
-
-
-// Read connectivities
-
-char pypylith3d_read_connect__doc__[] = "";
-char pypylith3d_read_connect__name__[] = "read_connect";
-
-PyObject * pypylith3d_read_connect(PyObject *, PyObject *args)
-{
- PyObject* py_ien;
- PyObject* py_mat;
- int nen;
- int numelv;
- int numnp;
- int nvfamilies;
- int kr;
- char* connectivityInputFile;
-
- int ok = PyArg_ParseTuple(args, "OOiiiiis:read_connect",
- &py_ien,
- &py_mat,
- &nen,
- &numelv,
- &numnp,
- &nvfamilies,
- &kr,
- &connectivityInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* ien = (int*) PyCObject_AsVoidPtr(py_ien);
- int* mat = (int*) PyCObject_AsVoidPtr(py_mat);
-
- read_connect_f(ien,
- mat,
- &nen,
- &numelv,
- &numnp,
- &nvfamilies,
- &kr,
- connectivityInputFile,
- &errorcode,
- errorstring,
- strlen(connectivityInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nvfamilies:" << nvfamilies
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read coordinates
-
-char pypylith3d_read_coords__doc__[] = "";
-char pypylith3d_read_coords__name__[] = "read_coords";
-
-PyObject * pypylith3d_read_coords(PyObject *, PyObject *args)
-{
- PyObject* py_x;
- double cscale;
- int numnp;
- int kr;
- char* coordinateInputFile;
-
- int ok = PyArg_ParseTuple(args, "Odiis:read_coords",
- &py_x,
- &cscale,
- &numnp,
- &kr,
- &coordinateInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* x = (double*) PyCObject_AsVoidPtr(py_x);
-
- read_coords_f(x,
- &cscale,
- &numnp,
- &kr,
- coordinateInputFile,
- &errorcode,
- errorstring,
- strlen(coordinateInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "cscale:" << cscale
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read differential forces
-
-char pypylith3d_read_diff__doc__[] = "";
-char pypylith3d_read_diff__name__[] = "read_diff";
-
-PyObject * pypylith3d_read_diff(PyObject *, PyObject *args)
-{
- PyObject* py_diforc;
- PyObject* py_nslip;
- PyObject* py_idhist;
- int numslp;
- int numdif;
- int numnp;
- int kr;
- char* difile;
-
- int ok = PyArg_ParseTuple(args, "OOOiiiis:read_diff",
- &py_diforc,
- &py_nslip,
- &py_idhist,
- &numslp,
- &numdif,
- &numnp,
- &kr,
- &difile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* diforc = (double*) PyCObject_AsVoidPtr(py_diforc);
- int* nslip = (int*) PyCObject_AsVoidPtr(py_nslip);
- int* idhist = (int*) PyCObject_AsVoidPtr(py_idhist);
-
- read_diff_f(diforc,
- nslip,
- idhist,
- &numslp,
- &numdif,
- &numnp,
- &kr,
- difile,
- &errorcode,
- errorstring,
- strlen(difile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numdif:" << numdif
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read time steps at which full output is desired
-
-char pypylith3d_read_fuldat__doc__[] = "";
-char pypylith3d_read_fuldat__name__[] = "read_fuldat";
-
-PyObject * pypylith3d_read_fuldat(PyObject *, PyObject *args)
-{
- PyObject* py_iprint;
- int icontr;
- int icode;
- int ncycle;
- int lastep;
- int kr;
- char* fofile;
-
- int ok = PyArg_ParseTuple(args, "Oiiiiis:read_fuldat",
- &py_iprint,
- &icontr,
- &icode,
- &ncycle,
- &lastep,
- &kr,
- &fofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* iprint = (int*) PyCObject_AsVoidPtr(py_iprint);
-
- read_fuldat_f(iprint,
- &icontr,
- &icode,
- &ncycle,
- &lastep,
- &kr,
- fofile,
- &errorcode,
- errorstring,
- strlen(fofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "icontr:" << icontr
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read load histories
-
-char pypylith3d_read_hist__doc__[] = "";
-char pypylith3d_read_hist__name__[] = "read_hist";
-
-PyObject * pypylith3d_read_hist(PyObject *, PyObject *args)
-{
- PyObject* py_histry;
- PyObject* py_times;
- int nhist;
- int lastep;
- int kr;
- char* hfile;
-
- int ok = PyArg_ParseTuple(args, "OOiiis:read_hist",
- &py_histry,
- &py_times,
- &nhist,
- &lastep,
- &kr,
- &hfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* histry = (double*) PyCObject_AsVoidPtr(py_histry);
- double* times = (double*) PyCObject_AsVoidPtr(py_times);
-
- read_hist_f(histry,
- times,
- &nhist,
- &lastep,
- &kr,
- hfile,
- &errorcode,
- errorstring,
- strlen(hfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nhist:" << nhist
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read element prestresses
-
-// char pypylith3d_read_prestr__doc__[] = "";
-// char pypylith3d_read_prestr__name__[] = "read_prestr";
-
-// PyObject * pypylith3d_read_prestr(PyObject *, PyObject *args)
-// {
- // PyObject* py_stn;
- // PyObject* py_st0;
- // PyObject* py_prscal;
- // int numberStressComponents;
- // int numberGaussPoints;
- // int numberPrestressGaussPoints;
- // int numberElements;
- // int numberPrestressEntries;
- // int ipstrs;
- // int idout;
- // int kr;
- // int kw;
- // char* prestressInputFile;
- // char* ofile;
-
- // int ok = PyArg_ParseTuple(args, "OOOiiiiiiiiiss:read_prestr",
- // &py_stn,
- // &py_st0,
- // &py_prscal,
- // &numberStressComponents,
- // &numberGaussPoints,
- // &numberPrestressGaussPoints,
- // &numberElements,
- // &numberPrestressEntries,
- // &ipstrs,
- // &idout,
- // &kr,
- // &kw,
- // &prestressInputFile,
- // &ofile);
-
- // if (!ok) {
- // return 0;
- // }
-
- // int errorcode = 0;
- // const int maxsize = 4096;
- // char errorstring[maxsize];
- // double* stn = (double*) PyCObject_AsVoidPtr(py_stn);
- // double* st0 = (double*) PyCObject_AsVoidPtr(py_st0);
- // double* prscal = (double*) PyCObject_AsVoidPtr(py_prscal);
-
- // read_prestr_f(stn,
- // st0,
- // prscal,
- // &numberStressComponents,
- // &numberGaussPoints,
- // &numberPrestressGaussPoints,
- // &numberElements,
- // &numberPrestressEntries,
- // &ipstrs,
- // &idout,
- // &kr,
- // &kw,
- // &errorcode,
- // prestressInputFile,
- // ofile,
- // strlen(prestressInputFile),
- // strlen(ofile));
-
-// if(0 != exceptionhandler(errorcode, errorstring)) {
- // return 0;
- // }
-
- // journal::debug_t debug("pylith3d");
- // debug
- // << journal::at(__HERE__)
- // << "numberPrestressEntries:" << numberPrestressEntries
- // << journal::endl;
-
- // return
- // Py_INCREF(Py_None);
- // return Py_None;
-// }
-
-
-// Read local coordinate rotations
-
-char pypylith3d_read_skew__doc__[] = "";
-char pypylith3d_read_skew__name__[] = "read_skew";
-
-PyObject * pypylith3d_read_skew(PyObject *, PyObject *args)
-{
- PyObject* py_skew;
- double runits;
- int numrot;
- int numnp;
- int iskopt;
- int kr;
- char* skfile;
-
- int ok = PyArg_ParseTuple(args, "Odiiiis:read_skew",
- &py_skew,
- &runits,
- &numrot,
- &numnp,
- &iskopt,
- &kr,
- &skfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* skew = (double*) PyCObject_AsVoidPtr(py_skew);
-
- read_skew_f(skew,
- &runits,
- &numrot,
- &numnp,
- &iskopt,
- &kr,
- skfile,
- &errorcode,
- errorstring,
- strlen(skfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numrot:" << numrot
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read slippery node entries
-
-char pypylith3d_read_slip__doc__[] = "";
-char pypylith3d_read_slip__name__[] = "read_slip";
-
-PyObject * pypylith3d_read_slip(PyObject *, PyObject *args)
-{
- PyObject* py_nslip;
- int numslp;
- int numnp;
- int iskopt;
- int kr;
- char* slfile;
-
- int ok = PyArg_ParseTuple(args, "Oiiiis:read_slip",
- &py_nslip,
- &numslp,
- &numnp,
- &iskopt,
- &kr,
- &slfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* nslip = (int*) PyCObject_AsVoidPtr(py_nslip);
- int totalNumberSlipperyNodes = 0;
-
- read_slip_f(nslip,
- &numslp,
- &totalNumberSlipperyNodes,
- &numnp,
- &iskopt,
- &kr,
- slfile,
- &errorcode,
- errorstring,
- strlen(slfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "totalNumberSlipperyNodes:" << totalNumberSlipperyNodes
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue("i", totalNumberSlipperyNodes);
-}
-
-
-// Read split node entries
-
-char pypylith3d_read_split__doc__[] = "";
-char pypylith3d_read_split__name__[] = "read_split";
-
-PyObject * pypylith3d_read_split(PyObject *, PyObject *args)
-{
- PyObject* py_fault;
- PyObject* py_nfault;
- int numfn;
- int numnp;
- int numelv;
- int kr;
- char* spfile;
-
- int ok = PyArg_ParseTuple(args, "OOiiiis:read_split",
- &py_fault,
- &py_nfault,
- &numfn,
- &numnp,
- &numelv,
- &kr,
- &spfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* fault = (double*) PyCObject_AsVoidPtr(py_fault);
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
- int totalNumberSplitNodes = 0;
-
- read_split_f(fault,
- nfault,
- &numfn,
- &totalNumberSplitNodes,
- &numnp,
- &numelv,
- &kr,
- spfile,
- &errorcode,
- errorstring,
- strlen(spfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "totalNumberSplitNodes:" << totalNumberSplitNodes
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue("i", totalNumberSplitNodes);
-}
-
-
-// Read state output information
-
-char pypylith3d_read_stateout__doc__[] = "";
-char pypylith3d_read_stateout__name__[] = "read_stateout";
-
-PyObject * pypylith3d_read_stateout(PyObject *, PyObject *args)
-{
- PyObject* py_istatout;
- PyObject* py_nstatout;
- int kr;
- char* stfile;
-
- int ok = PyArg_ParseTuple(args, "OOis:read_stateout",
- &py_istatout,
- &py_nstatout,
- &kr,
- &stfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* istatout = (int*) PyCObject_AsVoidPtr(py_istatout);
- int* nstatout = (int*) PyCObject_AsVoidPtr(py_nstatout);
-
- read_stateout_f(istatout,
- nstatout,
- &kr,
- stfile,
- &errorcode,
- errorstring,
- strlen(stfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "istatout:" << istatout
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read time step data
-
-char pypylith3d_read_timdat__doc__[] = "";
-char pypylith3d_read_timdat__name__[] = "read_timdat";
-
-PyObject * pypylith3d_read_timdat(PyObject *, PyObject *args)
-{
- PyObject* py_delt;
- PyObject* py_alfa;
- PyObject* py_utol;
- PyObject* py_ftol;
- PyObject* py_etol;
- PyObject* py_times;
- double tunits;
- PyObject* py_maxstp;
- PyObject* py_maxit;
- PyObject* py_ntdinit;
- PyObject* py_lgdef;
- PyObject* py_itmax;
- int nintg;
- int lastep;
- int kr;
- char* timeStepInputFile;
-
- int ok = PyArg_ParseTuple(args, "OOOOOOdOOOOOiiis:read_timdat",
- &py_delt,
- &py_alfa,
- &py_utol,
- &py_ftol,
- &py_etol,
- &py_times,
- &tunits,
- &py_maxstp,
- &py_maxit,
- &py_ntdinit,
- &py_lgdef,
- &py_itmax,
- &nintg,
- &lastep,
- &kr,
- &timeStepInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* delt = (double*) PyCObject_AsVoidPtr(py_delt);
- double* alfa = (double*) PyCObject_AsVoidPtr(py_alfa);
- double* utol = (double*) PyCObject_AsVoidPtr(py_utol);
- double* ftol = (double*) PyCObject_AsVoidPtr(py_ftol);
- double* etol = (double*) PyCObject_AsVoidPtr(py_etol);
- double* times = (double*) PyCObject_AsVoidPtr(py_times);
- int* maxstp = (int*) PyCObject_AsVoidPtr(py_maxstp);
- int* maxit = (int*) PyCObject_AsVoidPtr(py_maxit);
- int* ntdinit = (int*) PyCObject_AsVoidPtr(py_ntdinit);
- int* lgdef = (int*) PyCObject_AsVoidPtr(py_lgdef);
- int* itmax = (int*) PyCObject_AsVoidPtr(py_itmax);
-
- read_timdat_f(delt,
- alfa,
- utol,
- ftol,
- etol,
- times,
- &tunits,
- maxstp,
- maxit,
- ntdinit,
- lgdef,
- itmax,
- &nintg,
- &lastep,
- &kr,
- timeStepInputFile,
- &errorcode,
- errorstring,
- strlen(timeStepInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "lastep:" << lastep
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read traction BC
-
-char pypylith3d_read_tractions__doc__[] = "";
-char pypylith3d_read_tractions__name__[] = "read_tractions";
-
-PyObject * pypylith3d_read_tractions(PyObject *, PyObject *args)
-{
- PyObject* py_tractionverts;
- PyObject* py_tractionvals;
- double tscale;
- int numtractions;
- int numberSurfaceElementNodes;
- int kr;
- char* tractionInputFile;
-
- int ok = PyArg_ParseTuple(args, "OOdiiis:read_tractions",
- &py_tractionverts,
- &py_tractionvals,
- &tscale,
- &numtractions,
- &numberSurfaceElementNodes,
- &kr,
- &tractionInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* tractionverts = (int*) PyCObject_AsVoidPtr(py_tractionverts);
- double* tractionvals = (double*) PyCObject_AsVoidPtr(py_tractionvals);
-
- read_tractions_f(tractionverts,
- tractionvals,
- &tscale,
- &numtractions,
- &numberSurfaceElementNodes,
- &kr,
- tractionInputFile,
- &errorcode,
- errorstring,
- strlen(tractionInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "tscale:" << tscale
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Read winkler BC
-
-char pypylith3d_read_wink__doc__[] = "";
-char pypylith3d_read_wink__name__[] = "read_wink";
-
-PyObject * pypylith3d_read_wink(PyObject *, PyObject *args)
-{
- PyObject* py_winkdef;
- PyObject* py_wscal;
- PyObject* py_iwinkdef;
- PyObject* py_iwinkid;
- int nwink;
- int nwinke;
- int kr;
- char* wfile;
-
- int ok = PyArg_ParseTuple(args, "OOOOiiis:read_wink",
- &py_winkdef,
- &py_wscal,
- &py_iwinkdef,
- &py_iwinkid,
- &nwink,
- &nwinke,
- &kr,
- &wfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* winkdef = (double*) PyCObject_AsVoidPtr(py_winkdef);
- double* wscal = (double*) PyCObject_AsVoidPtr(py_wscal);
- int* iwinkdef = (int*) PyCObject_AsVoidPtr(py_iwinkdef);
- int* iwinkid = (int*) PyCObject_AsVoidPtr(py_iwinkid);
-
- read_wink_f(winkdef,
- wscal,
- iwinkdef,
- iwinkid,
- &nwink,
- &nwinke,
- &kr,
- wfile,
- &errorcode,
- errorstring,
- strlen(wfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nwink:" << nwink
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Sort elements into element families
-
-char pypylith3d_sort_elements__doc__[] = "";
-char pypylith3d_sort_elements__name__[] = "sort_elements";
-
-PyObject * pypylith3d_sort_elements(PyObject *, PyObject *args)
-{
- PyObject* py_ien;
- PyObject* py_mat;
- PyObject* py_infmatmod;
- PyObject* py_volumeElementFamilyList;
- PyObject* py_ivfamily;
- PyObject* py_iens;
- PyObject* py_ivftmp;
- PyObject* py_indxiel;
- PyObject* py_ielindx;
- int nen;
- int ngauss;
- int maxvfamilies;
- int nvfamilies;
- int prestressFlag;
- int numelv;
- int numnp;
-
- int ok = PyArg_ParseTuple(args, "OOOOOOOOOiiiiiii:sort_elements",
- &py_ien,
- &py_mat,
- &py_infmatmod,
- &py_volumeElementFamilyList,
- &py_ivfamily,
- &py_iens,
- &py_ivftmp,
- &py_indxiel,
- &py_ielindx,
- &nen,
- &ngauss,
- &maxvfamilies,
- &nvfamilies,
- &prestressFlag,
- &numelv,
- &numnp);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* ien = (int*) PyCObject_AsVoidPtr(py_ien);
- int* mat = (int*) PyCObject_AsVoidPtr(py_mat);
- int* infmatmod = (int*) PyCObject_AsVoidPtr(py_infmatmod);
- int* ivflist = (int*) PyCObject_AsVoidPtr(py_volumeElementFamilyList);
- int* ivfamily = (int*) PyCObject_AsVoidPtr(py_ivfamily);
- int* iens = (int*) PyCObject_AsVoidPtr(py_iens);
- int* ivftmp = (int*) PyCObject_AsVoidPtr(py_ivftmp);
- int* indxiel = (int*) PyCObject_AsVoidPtr(py_indxiel);
- int* ielindx = (int*) PyCObject_AsVoidPtr(py_ielindx);
- int stateSize = 0;
- int state0Size = 0;
- int propertySize = 0;
-
- sort_elements_f(ien,
- mat,
- infmatmod,
- ivflist,
- ivfamily,
- iens,
- ivftmp,
- indxiel,
- ielindx,
- &nen,
- &ngauss,
- &maxvfamilies,
- &nvfamilies,
- &prestressFlag,
- &numelv,
- &numnp,
- &stateSize,
- &state0Size,
- &propertySize,
- &errorcode,
- errorstring,
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "stateSize:" << stateSize
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue("iii",
- stateSize,
- state0Size,
- propertySize);
-}
-
-// Sort slippery nodes according to reordered elements
-
-char pypylith3d_sort_slip_nodes__doc__[] = "";
-char pypylith3d_sort_slip_nodes__name__[] = "sort_slip_nodes";
-
-PyObject * pypylith3d_sort_slip_nodes(PyObject *, PyObject *args)
-{
- PyObject* py_nslip;
- PyObject* py_indxiel;
- int numslp;
- int numelv;
-
- int ok = PyArg_ParseTuple(args, "OOii:sort_slip_nodes",
- &py_nslip,
- &py_indxiel,
- &numslp,
- &numelv);
-
- if (!ok) {
- return 0;
- }
-
- int* nslip = (int*) PyCObject_AsVoidPtr(py_nslip);
- int* indxiel = (int*) PyCObject_AsVoidPtr(py_indxiel);
-
- sort_slip_nodes_f(nslip,
- indxiel,
- &numslp,
- &numelv);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numslp:" << numslp
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-
-// Sort split nodes according to reordered elements
-
-char pypylith3d_sort_split_nodes__doc__[] = "";
-char pypylith3d_sort_split_nodes__name__[] = "sort_split_nodes";
-
-PyObject * pypylith3d_sort_split_nodes(PyObject *, PyObject *args)
-{
- PyObject* py_nfault;
- PyObject* py_indxiel;
- int numfn;
- int numelv;
-
- int ok = PyArg_ParseTuple(args, "OOii:sort_split_nodes",
- &py_nfault,
- &py_indxiel,
- &numfn,
- &numelv);
-
- if (!ok) {
- return 0;
- }
-
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
- int* indxiel = (int*) PyCObject_AsVoidPtr(py_indxiel);
-
- sort_split_nodes_f(nfault,
- indxiel,
- &numfn,
- &numelv);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numfn:" << numfn
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Compute number of nonzero entries in stiffness matrix
-
-char pypylith3d_cmp_stiffsz__doc__[] = "";
-char pypylith3d_cmp_stiffsz__name__[] = "cmp_stiffsz";
-
-PyObject * pypylith3d_cmp_stiffsz(PyObject *, PyObject *args)
-{
- int neq;
- PyObject* py_lm;
- PyObject* py_lmx;
- int numelv;
- int totalNumberSlipperyNodes;
- int nen;
-
- int ok = PyArg_ParseTuple(args, "iOOiii:cmp_stiffsz",
- &neq,
- &py_lm,
- &py_lmx,
- &numelv,
- &totalNumberSlipperyNodes,
- &nen);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* lm = (int*) PyCObject_AsVoidPtr(py_lm);
- int* lmx = (int*) PyCObject_AsVoidPtr(py_lmx);
- int iwork = 0;
-
- cmp_stiffsz_f(&neq,
- lm,
- lmx,
- &numelv,
- &iwork,
- &totalNumberSlipperyNodes,
- &nen,
- &errorcode,
- errorstring,
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "iwork:" << iwork
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue("i", iwork);
-}
-
-
-
-// Create linked list of nonzero row and column entries in the stiffness matrix
-
-char pypylith3d_lnklst__doc__[] = "";
-char pypylith3d_lnklst__name__[] = "lnklst";
-
-PyObject * pypylith3d_lnklst(PyObject *, PyObject *args)
-{
- int neq;
- PyObject* py_lm;
- PyObject* py_lmx;
- int numelv;
- int nen;
- int numberVolumeElementEquations;
- PyObject* py_indx;
- PyObject* py_link;
- PyObject* py_nbrs;
- int iwork;
- int totalNumberSlipperyNodes;
-
- int ok = PyArg_ParseTuple(args, "iOOiiiOOOii:lnklst",
- &neq,
- &py_lm,
- &py_lmx,
- &numelv,
- &nen,
- &numberVolumeElementEquations,
- &py_indx,
- &py_link,
- &py_nbrs,
- &iwork,
- &totalNumberSlipperyNodes);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* lm = (int*) PyCObject_AsVoidPtr(py_lm);
- int* lmx = (int*) PyCObject_AsVoidPtr(py_lmx);
- int* indx = (int*) PyCObject_AsVoidPtr(py_indx);
- int* link = (int*) PyCObject_AsVoidPtr(py_link);
- int* nbrs = (int*) PyCObject_AsVoidPtr(py_nbrs);
- int stiffnessMatrixSize =0;
- int stiffnessOffDiagonalSize =0;
-
- lnklst_f(&neq,
- lm,
- lmx,
- &numelv,
- &nen,
- &numberVolumeElementEquations,
- indx,
- link,
- nbrs,
- &iwork,
- &stiffnessOffDiagonalSize,
- &stiffnessMatrixSize,
- &totalNumberSlipperyNodes,
- &errorcode,
- errorstring,
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "stiffnessMatrixSize:" << stiffnessMatrixSize
- << journal::endl;
-
- // return
- return Py_BuildValue("ii", stiffnessMatrixSize,
- stiffnessOffDiagonalSize);
-}
-
-
-// Localize id array for reference by element
-
-char pypylith3d_local__doc__[] = "";
-char pypylith3d_local__name__[] = "local";
-
-PyObject * pypylith3d_local(PyObject *, PyObject *args)
-{
- PyObject* py_id;
- int numnp;
- PyObject* py_iens;
- PyObject* py_lm;
- int numelv;
- int nen;
-
- int ok = PyArg_ParseTuple(args, "OiOOii:local",
- &py_id,
- &numnp,
- &py_iens,
- &py_lm,
- &numelv,
- &nen);
-
- if (!ok) {
- return 0;
- }
-
- int* id = (int*) PyCObject_AsVoidPtr(py_id);
- int* iens = (int*) PyCObject_AsVoidPtr(py_iens);
- int* lm = (int*) PyCObject_AsVoidPtr(py_lm);
-
- local_f(id,
- &numnp,
- iens,
- lm,
- &numelv,
- &nen);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numelv:" << numelv
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Localize nfault array for reference by element
-
-char pypylith3d_localf__doc__[] = "";
-char pypylith3d_localf__name__[] = "localf";
-
-PyObject * pypylith3d_localf(PyObject *, PyObject *args)
-{
- PyObject* py_iens;
- PyObject* py_lmf;
- int numelv;
- PyObject* py_nfault;
- int numfn;
- int nen;
-
- int ok = PyArg_ParseTuple(args, "OOiOii:localf",
- &py_iens,
- &py_lmf,
- &numelv,
- &py_nfault,
- &numfn,
- &nen);
-
- if (!ok) {
- return 0;
- }
-
- int* iens = (int*) PyCObject_AsVoidPtr(py_iens);
- int* lmf = (int*) PyCObject_AsVoidPtr(py_lmf);
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
-
- localf_f(iens,
- lmf,
- &numelv,
- nfault,
- &numfn,
- &nen);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numfn:" << numfn
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Localize idx array for reference by element
-
-char pypylith3d_localx__doc__[] = "";
-char pypylith3d_localx__name__[] = "localx";
-
-PyObject * pypylith3d_localx(PyObject *, PyObject *args)
-{
- PyObject* py_idx;
- int numnp;
- PyObject* py_iens;
- PyObject* py_lmx;
- int numelv;
- PyObject* py_nslip;
- int numslp;
- int nen;
-
- int ok = PyArg_ParseTuple(args, "OiOOiOii:localx",
- &py_idx,
- &numnp,
- &py_iens,
- &py_lmx,
- &numelv,
- &py_nslip,
- &numslp,
- &nen);
-
- if (!ok) {
- return 0;
- }
-
- int* idx = (int*) PyCObject_AsVoidPtr(py_idx);
- int* iens = (int*) PyCObject_AsVoidPtr(py_iens);
- int* lmx = (int*) PyCObject_AsVoidPtr(py_lmx);
- int* nslip = (int*) PyCObject_AsVoidPtr(py_nslip);
-
- localx_f(idx,
- &numnp,
- iens,
- lmx,
- &numelv,
- nslip,
- &numslp,
- &nen);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numelv:" << numelv
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Transform linked list into index array for modified sparse row format
-
-char pypylith3d_makemsr__doc__[] = "";
-char pypylith3d_makemsr__name__[] = "makemsr";
-
-PyObject * pypylith3d_makemsr(PyObject *, PyObject *args)
-{
- PyObject* pyA;
- PyObject* py_indx;
- PyObject* py_link;
- PyObject* py_nbrs;
- int neq;
- int stiffnessMatrixSize;
- int iwork;
-
- int ok = PyArg_ParseTuple(args, "OOOOiii:makemsr",
- &pyA,
- &py_indx,
- &py_link,
- &py_nbrs,
- &neq,
- &stiffnessMatrixSize,
- &iwork);
-
- if (!ok) {
- return 0;
- }
- Mat A = (Mat) PyCObject_AsVoidPtr(pyA);
- int* indx = (int*) PyCObject_AsVoidPtr(py_indx);
- int* link = (int*) PyCObject_AsVoidPtr(py_link);
- int* nbrs = (int*) PyCObject_AsVoidPtr(py_nbrs);
- int nmin = 0;
- int nmax = 0;
- double wavg = 0.0;
-
- makemsr_f(&A,
- indx,
- link,
- nbrs,
- &neq,
- &stiffnessMatrixSize,
- &iwork,
- &nmin,
- &nmax,
- &wavg);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "iwork:" << iwork
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- // return Py_None;
- return Py_BuildValue("iid",
- nmin,
- nmax,
- wavg);
-}
-
-
-
-// Perform the time-dependent solution.
-
-char pypylith3d_viscos__doc__[] = "";
-char pypylith3d_viscos__name__[] = "viscos";
-
-PyObject * pypylith3d_viscos(PyObject *, PyObject *args)
-{
- PyObject* pyA; // Sparse matrix arrays
- PyObject* pyRhs;
- PyObject* pySol;
- PyObject* py_bextern; // Force vectors
- PyObject* py_btraction;
- PyObject* py_bgravity;
- PyObject* py_bconcForce;
- PyObject* py_bintern;
- PyObject* py_bresid;
- PyObject* py_bwink;
- PyObject* py_bwinkx;
- PyObject* py_dispVec;
- PyObject* py_dprev;
- PyObject* py_nforce;
- PyObject* py_grav;
- PyObject* py_x; // Global arrays
- PyObject* py_d;
- PyObject* py_deld;
- PyObject* py_dcur;
- PyObject* py_id;
- PyObject* py_iwink;
- PyObject* py_wink;
- PyObject* py_nsysdat;
- PyObject* py_iddmat;
- PyObject* py_ibond; // Boundary condition arrays
- PyObject* py_bond;
- PyObject* py_dx; // Slippery node arrays
- PyObject* py_deldx;
- PyObject* py_dxcur;
- PyObject* py_diforc;
- PyObject* py_idx;
- PyObject* py_iwinkx;
- PyObject* py_winkx;
- PyObject* py_idslp;
- PyObject* py_ipslp;
- PyObject* py_idhist;
- PyObject* py_fault; // Split node arrays
- PyObject* py_nfault;
- PyObject* py_dfault;
- PyObject* py_tfault;
- PyObject* py_s; // Local stiffness matrix arrays
- PyObject* py_stemp;
- PyObject* py_state; // Element arrays
- PyObject* py_dstate;
- PyObject* py_state0;
- PyObject* py_dmat;
- PyObject* py_ien;
- PyObject* py_lm;
- PyObject* py_lmx;
- PyObject* py_lmf;
- PyObject* py_ivfamily;
- PyObject* py_npar;
- PyObject* py_ielindx;
- PyObject* py_tractionverts; // Traction BC arrays
- PyObject* py_tractionvals;
- PyObject* py_gauss2d;
- PyObject* py_sh2d;
- PyObject* py_infetype2d;
- PyObject* py_prop; // Material property arrays
- PyObject* py_infmatmod;
- PyObject* py_gauss; // Element type arrays
- PyObject* py_sh;
- PyObject* py_shj;
- PyObject* py_infetype;
- PyObject* py_histry; // Time information
- PyObject* py_rtimdat;
- PyObject* py_ntimdat;
- PyObject* py_nvisdat;
- PyObject* py_maxstp;
- PyObject* py_delt;
- PyObject* py_alfa;
- PyObject* py_maxit;
- PyObject* py_ntdinit;
- PyObject* py_lgdef;
- PyObject* py_utol;
- PyObject* py_ftol;
- PyObject* py_etol;
- PyObject* py_itmax;
- PyObject* py_rgiter; // Iterative solution information
- PyObject* py_skew; // Skew rotation information
- PyObject* py_iprint; // Input/output information
- PyObject* py_ncodat;
- PyObject* py_nunits;
- PyObject* py_nprint;
- PyObject* py_istatout;
- PyObject* py_nstatout;
- char* ofile; // Output file names
- char* pfile;
- char* ucdroot;
- int viscousStage;
- int iterateEvent;
-
- int ok = PyArg_ParseTuple(args, "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOsssii:viscos",
- &pyA, // Sparse matrix arrays
- &pyRhs,
- &pySol,
- &py_bextern, // Force vectors
- &py_btraction,
- &py_bgravity,
- &py_bconcForce,
- &py_bintern,
- &py_bresid,
- &py_bwink,
- &py_bwinkx,
- &py_dispVec,
- &py_dprev,
- &py_nforce,
- &py_grav,
- &py_x, // Global arrays
- &py_d,
- &py_deld,
- &py_dcur,
- &py_id,
- &py_iwink,
- &py_wink,
- &py_nsysdat,
- &py_iddmat,
- &py_ibond, // Boundary condition arrays
- &py_bond,
- &py_dx, // Slippery node arrays
- &py_deldx,
- &py_dxcur,
- &py_diforc,
- &py_idx,
- &py_iwinkx,
- &py_winkx,
- &py_idslp,
- &py_ipslp,
- &py_idhist,
- &py_fault, // Split node arrays
- &py_nfault,
- &py_dfault,
- &py_tfault,
- &py_s, // Local stiffness matrix arrays
- &py_stemp,
- &py_state, // Element arrays
- &py_dstate,
- &py_state0,
- &py_dmat,
- &py_ien,
- &py_lm,
- &py_lmx,
- &py_lmf,
- &py_ivfamily,
- &py_npar,
- &py_ielindx,
- &py_tractionverts, // Traction BC arrays
- &py_tractionvals,
- &py_gauss2d,
- &py_sh2d,
- &py_infetype2d,
- &py_prop, // Material property arrays
- &py_infmatmod,
- &py_gauss, // Element type arrays
- &py_sh,
- &py_shj,
- &py_infetype,
- &py_histry, // Time information
- &py_rtimdat,
- &py_ntimdat,
- &py_nvisdat,
- &py_maxstp,
- &py_delt,
- &py_alfa,
- &py_maxit,
- &py_ntdinit,
- &py_lgdef,
- &py_utol,
- &py_ftol,
- &py_etol,
- &py_itmax,
- &py_rgiter, // Iterative solution information
- &py_skew, // Skew rotation information
- &py_iprint, // Input/output information
- &py_ncodat,
- &py_nunits,
- &py_nprint,
- &py_istatout,
- &py_nstatout,
- &ofile, // Output file names
- &pfile,
- &ucdroot,
- &viscousStage,
- &iterateEvent);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- Mat A = (Mat) PyCObject_AsVoidPtr(pyA);
- Vec rhs = (Vec) PyCObject_AsVoidPtr(pyRhs);
- Vec sol = (Vec) PyCObject_AsVoidPtr(pySol);
- double* bextern = (double*) PyCObject_AsVoidPtr(py_bextern);
- double* btraction = (double*) PyCObject_AsVoidPtr(py_btraction);
- double* bgravity = (double*) PyCObject_AsVoidPtr(py_bgravity);
- double* bconcForce = (double*) PyCObject_AsVoidPtr(py_bconcForce);
- double* bintern = (double*) PyCObject_AsVoidPtr(py_bintern);
- double* bresid = (double*) PyCObject_AsVoidPtr(py_bresid);
- double* bwink = (double*) PyCObject_AsVoidPtr(py_bwink);
- double* bwinkx = (double*) PyCObject_AsVoidPtr(py_bwinkx);
- double* dispVec = (double*) PyCObject_AsVoidPtr(py_dispVec);
- double* dprev = (double*) PyCObject_AsVoidPtr(py_dprev);
- int* nforce = (int*) PyCObject_AsVoidPtr(py_nforce);
- double* grav = (double*) PyCObject_AsVoidPtr(py_grav);
- double* x = (double*) PyCObject_AsVoidPtr(py_x);
- double* d = (double*) PyCObject_AsVoidPtr(py_d);
- double* deld = (double*) PyCObject_AsVoidPtr(py_deld);
- double* dcur = (double*) PyCObject_AsVoidPtr(py_dcur);
- int* id = (int*) PyCObject_AsVoidPtr(py_id);
- int* iwink = (int*) PyCObject_AsVoidPtr(py_iwink);
- double* wink = (double*) PyCObject_AsVoidPtr(py_wink);
- int* nsysdat = (int*) PyCObject_AsVoidPtr(py_nsysdat);
- int* iddmat = (int*) PyCObject_AsVoidPtr(py_iddmat);
- int* ibond = (int*) PyCObject_AsVoidPtr(py_ibond);
- double* bond = (double*) PyCObject_AsVoidPtr(py_bond);
- double* dx = (double*) PyCObject_AsVoidPtr(py_dx);
- double* deldx = (double*) PyCObject_AsVoidPtr(py_deldx);
- double* dxcur = (double*) PyCObject_AsVoidPtr(py_dxcur);
- double* diforc = (double*) PyCObject_AsVoidPtr(py_diforc);
- int* idx = (int*) PyCObject_AsVoidPtr(py_idx);
- int* iwinkx = (int*) PyCObject_AsVoidPtr(py_iwinkx);
- double* winkx = (double*) PyCObject_AsVoidPtr(py_winkx);
- int* idslp = (int*) PyCObject_AsVoidPtr(py_idslp);
- int* ipslp = (int*) PyCObject_AsVoidPtr(py_ipslp);
- int* idhist = (int*) PyCObject_AsVoidPtr(py_idhist);
- double* fault = (double*) PyCObject_AsVoidPtr(py_fault);
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
- double* dfault = (double*) PyCObject_AsVoidPtr(py_dfault);
- double* tfault = (double*) PyCObject_AsVoidPtr(py_tfault);
- double* s = (double*) PyCObject_AsVoidPtr(py_s);
- double* stemp = (double*) PyCObject_AsVoidPtr(py_stemp);
- double* state = (double*) PyCObject_AsVoidPtr(py_state);
- double* dstate = (double*) PyCObject_AsVoidPtr(py_dstate);
- double* state0 = (double*) PyCObject_AsVoidPtr(py_state0);
- double* dmat = (double*) PyCObject_AsVoidPtr(py_dmat);
- int* ien = (int*) PyCObject_AsVoidPtr(py_ien);
- int* lm = (int*) PyCObject_AsVoidPtr(py_lm);
- int* lmx = (int*) PyCObject_AsVoidPtr(py_lmx);
- int* lmf = (int*) PyCObject_AsVoidPtr(py_lmf);
- int* ivfamily = (int*) PyCObject_AsVoidPtr(py_ivfamily);
- int* npar = (int*) PyCObject_AsVoidPtr(py_npar);
- int* ielindx = (int*) PyCObject_AsVoidPtr(py_ielindx);
- int* tractionverts = (int*) PyCObject_AsVoidPtr(py_tractionverts);
- double* tractionvals = (double*) PyCObject_AsVoidPtr(py_tractionvals);
- double* gauss2d = (double*) PyCObject_AsVoidPtr(py_gauss2d);
- double* sh2d = (double*) PyCObject_AsVoidPtr(py_sh2d);
- int* infetype2d = (int*) PyCObject_AsVoidPtr(py_infetype2d);
- double* prop = (double*) PyCObject_AsVoidPtr(py_prop);
- int* infmatmod = (int*) PyCObject_AsVoidPtr(py_infmatmod);
- double* gauss = (double*) PyCObject_AsVoidPtr(py_gauss);
- double* sh = (double*) PyCObject_AsVoidPtr(py_sh);
- double* shj = (double*) PyCObject_AsVoidPtr(py_shj);
- int* infetype = (int*) PyCObject_AsVoidPtr(py_infetype);
- double* histry = (double*) PyCObject_AsVoidPtr(py_histry);
- double* rtimdat = (double*) PyCObject_AsVoidPtr(py_rtimdat);
- int* ntimdat = (int*) PyCObject_AsVoidPtr(py_ntimdat);
- int* nvisdat = (int*) PyCObject_AsVoidPtr(py_nvisdat);
- int* maxstp = (int*) PyCObject_AsVoidPtr(py_maxstp);
- double* delt = (double*) PyCObject_AsVoidPtr(py_delt);
- double* alfa = (double*) PyCObject_AsVoidPtr(py_alfa);
- int* maxit = (int*) PyCObject_AsVoidPtr(py_maxit);
- int* ntdinit = (int*) PyCObject_AsVoidPtr(py_ntdinit);
- int* lgdef = (int*) PyCObject_AsVoidPtr(py_lgdef);
- double* utol = (double*) PyCObject_AsVoidPtr(py_utol);
- double* ftol = (double*) PyCObject_AsVoidPtr(py_ftol);
- double* etol = (double*) PyCObject_AsVoidPtr(py_etol);
- int* itmax = (int*) PyCObject_AsVoidPtr(py_itmax);
- double* rgiter = (double*) PyCObject_AsVoidPtr(py_rgiter);
- double* skew = (double*) PyCObject_AsVoidPtr(py_skew);
- int* iprint = (int*) PyCObject_AsVoidPtr(py_iprint);
- int* ncodat = (int*) PyCObject_AsVoidPtr(py_ncodat);
- int* nunits = (int*) PyCObject_AsVoidPtr(py_nunits);
- int* nprint = (int*) PyCObject_AsVoidPtr(py_nprint);
- int* istatout = (int*) PyCObject_AsVoidPtr(py_istatout);
- int* nstatout = (int*) PyCObject_AsVoidPtr(py_nstatout);
-
-
- viscos_f(&A, // 1: Sparse matrix arrays
- &rhs,
- &sol,
- bextern, // Force vectors
- btraction,
- bgravity,
- bconcForce,
- bintern,
- bresid,
- bwink, // 10
- bwinkx,
- dispVec,
- dprev,
- nforce,
- grav,
- x, // Global arrays
- d,
- deld,
- dcur,
- id, // 20
- iwink,
- wink,
- nsysdat,
- iddmat,
- ibond, // Boundary condition arrays
- bond,
- dx, // Slippery node arrays
- deldx,
- dxcur,
- diforc, // 30
- idx,
- iwinkx,
- winkx,
- idslp,
- ipslp,
- idhist,
- fault, // Split node arrays
- nfault,
- dfault,
- tfault, // 40
- s, // Local stiffness matrix arrays
- stemp,
- state, // Element arrays
- dstate,
- state0,
- dmat,
- ien,
- lm,
- lmx,
- lmf, // 50
- ivfamily,
- npar,
- ielindx,
- tractionverts, // Traction BC arrays
- tractionvals,
- gauss2d,
- sh2d,
- infetype2d,
- prop, // Material property arrays
- infmatmod, // 60
- gauss, // Element type arrays
- sh,
- shj,
- infetype,
- histry, // Time information
- rtimdat,
- ntimdat,
- nvisdat,
- maxstp,
- delt, // 70
- alfa,
- maxit,
- ntdinit,
- lgdef,
- utol,
- ftol,
- etol,
- itmax,
- rgiter, // Iterative solution information
- skew, // 80: Skew rotation information
- iprint, // Input/output information
- ncodat,
- nunits,
- nprint,
- istatout,
- nstatout,
- ofile, // Output file names
- pfile,
- ucdroot,
- &viscousStage, // 90: PETSC logging
- &iterateEvent,
- &errorcode, // Error codes
- errorstring,
- strlen(ofile), // String lengths
- strlen(pfile),
- strlen(ucdroot),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "ofile:" << ofile
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Perform the time-dependent solution.
-
-char pypylith3d_viscos_step__doc__[] = "";
-char pypylith3d_viscos_step__name__[] = "viscos_step";
-
-PyObject * pypylith3d_viscos_step(PyObject *, PyObject *args)
-{
- PyObject* pyA; // Sparse matrix arrays
- PyObject* pyRhs;
- PyObject* pySol;
- PyObject* py_bextern; // Force vectors
- PyObject* py_btraction;
- PyObject* py_bgravity;
- PyObject* py_bconcForce;
- PyObject* py_bintern;
- PyObject* py_bresid;
- PyObject* py_bwink;
- PyObject* py_bwinkx;
- PyObject* py_dispVec;
- PyObject* py_dprev;
- PyObject* py_nforce;
- PyObject* py_grav;
- PyObject* py_x; // Global arrays
- PyObject* py_d;
- PyObject* py_deld;
- PyObject* py_dcur;
- PyObject* py_id;
- PyObject* py_iwink;
- PyObject* py_wink;
- PyObject* py_nsysdat;
- PyObject* py_iddmat;
- PyObject* py_ibond; // Boundary condition arrays
- PyObject* py_bond;
- PyObject* py_dx; // Slippery node arrays
- PyObject* py_deldx;
- PyObject* py_dxcur;
- PyObject* py_diforc;
- PyObject* py_idx;
- PyObject* py_iwinkx;
- PyObject* py_winkx;
- PyObject* py_idslp;
- PyObject* py_ipslp;
- PyObject* py_idhist;
- PyObject* py_fault; // Split node arrays
- PyObject* py_nfault;
- PyObject* py_dfault;
- PyObject* py_tfault;
- PyObject* py_s; // Local stiffness matrix arrays
- PyObject* py_stemp;
- PyObject* py_state; // Element arrays
- PyObject* py_dstate;
- PyObject* py_state0;
- PyObject* py_dmat;
- PyObject* py_ien;
- PyObject* py_lm;
- PyObject* py_lmx;
- PyObject* py_lmf;
- PyObject* py_ivfamily;
- PyObject* py_npar;
- PyObject* py_ielindx;
- PyObject* py_tractionverts; // Traction BC arrays
- PyObject* py_tractionvals;
- PyObject* py_gauss2d;
- PyObject* py_sh2d;
- PyObject* py_infetype2d;
- PyObject* py_prop; // Material property arrays
- PyObject* py_infmatmod;
- PyObject* py_gauss; // Element type arrays
- PyObject* py_sh;
- PyObject* py_shj;
- PyObject* py_infetype;
- PyObject* py_histry; // Time information
- PyObject* py_rtimdat;
- PyObject* py_ntimdat;
- PyObject* py_nvisdat;
- PyObject* py_maxstp;
- PyObject* py_delt;
- PyObject* py_alfa;
- PyObject* py_maxit;
- PyObject* py_ntdinit;
- PyObject* py_lgdef;
- PyObject* py_utol;
- PyObject* py_ftol;
- PyObject* py_etol;
- PyObject* py_itmax;
- PyObject* py_rgiter; // Iterative solution information
- PyObject* py_skew; // Skew rotation information
- PyObject* py_iprint; // Input/output information
- PyObject* py_ncodat;
- PyObject* py_nunits;
- PyObject* py_nprint;
- PyObject* py_istatout;
- PyObject* py_nstatout;
- char* ofile; // Output file names
- char* pfile;
- char* ucdroot;
- int viscousStage;
- int iterateEvent;
- int ntot, ltim, indexx, jcyc, i, j, skc, nfirst, nstep, lgdefp;
- double time, deltp;
- PyObject *pyGtol;
-
- int ok = PyArg_ParseTuple(args, "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOsssiiiiiiiiiiiddiO!:viscos_step",
- &pyA, // Sparse matrix arrays
- &pyRhs,
- &pySol,
- &py_bextern, // Force vectors
- &py_btraction,
- &py_bgravity,
- &py_bconcForce,
- &py_bintern,
- &py_bresid,
- &py_bwink,
- &py_bwinkx,
- &py_dispVec,
- &py_dprev,
- &py_nforce,
- &py_grav,
- &py_x, // Global arrays
- &py_d,
- &py_deld,
- &py_dcur,
- &py_id,
- &py_iwink,
- &py_wink,
- &py_nsysdat,
- &py_iddmat,
- &py_ibond, // Boundary condition arrays
- &py_bond,
- &py_dx, // Slippery node arrays
- &py_deldx,
- &py_dxcur,
- &py_diforc,
- &py_idx,
- &py_iwinkx,
- &py_winkx,
- &py_idslp,
- &py_ipslp,
- &py_idhist,
- &py_fault, // Split node arrays
- &py_nfault,
- &py_dfault,
- &py_tfault,
- &py_s, // Local stiffness matrix arrays
- &py_stemp,
- &py_state, // Element arrays
- &py_dstate,
- &py_state0,
- &py_dmat,
- &py_ien,
- &py_lm,
- &py_lmx,
- &py_lmf,
- &py_ivfamily,
- &py_npar,
- &py_ielindx,
- &py_tractionverts, // Traction BC arrays
- &py_tractionvals,
- &py_gauss2d,
- &py_sh2d,
- &py_infetype2d,
- &py_prop, // Material property arrays
- &py_infmatmod,
- &py_gauss, // Element type arrays
- &py_sh,
- &py_shj,
- &py_infetype,
- &py_histry, // Time information
- &py_rtimdat,
- &py_ntimdat,
- &py_nvisdat,
- &py_maxstp,
- &py_delt,
- &py_alfa,
- &py_maxit,
- &py_ntdinit,
- &py_lgdef,
- &py_utol,
- &py_ftol,
- &py_etol,
- &py_itmax,
- &py_rgiter, // Iterative solution information
- &py_skew, // Skew rotation information
- &py_iprint, // Input/output information
- &py_ncodat,
- &py_nunits,
- &py_nprint,
- &py_istatout,
- &py_nstatout,
- &ofile, // Output file names
- &pfile,
- &ucdroot,
- &viscousStage,
- &iterateEvent,
- &ntot,
- <im,
- &indexx,
- &jcyc,
- &i,
- &j,
- &skc,
- &nfirst,
- &nstep,
- &time,
- &deltp,
- &lgdefp,
- &PyList_Type, &pyGtol);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- Mat A = (Mat) PyCObject_AsVoidPtr(pyA);
- Vec rhs = (Vec) PyCObject_AsVoidPtr(pyRhs);
- Vec sol = (Vec) PyCObject_AsVoidPtr(pySol);
- double* bextern = (double*) PyCObject_AsVoidPtr(py_bextern);
- double* btraction = (double*) PyCObject_AsVoidPtr(py_btraction);
- double* bgravity = (double*) PyCObject_AsVoidPtr(py_bgravity);
- double* bconcForce = (double*) PyCObject_AsVoidPtr(py_bconcForce);
- double* bintern = (double*) PyCObject_AsVoidPtr(py_bintern);
- double* bresid = (double*) PyCObject_AsVoidPtr(py_bresid);
- double* bwink = (double*) PyCObject_AsVoidPtr(py_bwink);
- double* bwinkx = (double*) PyCObject_AsVoidPtr(py_bwinkx);
- double* dispVec = (double*) PyCObject_AsVoidPtr(py_dispVec);
- double* dprev = (double*) PyCObject_AsVoidPtr(py_dprev);
- int* nforce = (int*) PyCObject_AsVoidPtr(py_nforce);
- double* grav = (double*) PyCObject_AsVoidPtr(py_grav);
- double* x = (double*) PyCObject_AsVoidPtr(py_x);
- double* d = (double*) PyCObject_AsVoidPtr(py_d);
- double* deld = (double*) PyCObject_AsVoidPtr(py_deld);
- double* dcur = (double*) PyCObject_AsVoidPtr(py_dcur);
- int* id = (int*) PyCObject_AsVoidPtr(py_id);
- int* iwink = (int*) PyCObject_AsVoidPtr(py_iwink);
- double* wink = (double*) PyCObject_AsVoidPtr(py_wink);
- int* nsysdat = (int*) PyCObject_AsVoidPtr(py_nsysdat);
- int* iddmat = (int*) PyCObject_AsVoidPtr(py_iddmat);
- int* ibond = (int*) PyCObject_AsVoidPtr(py_ibond);
- double* bond = (double*) PyCObject_AsVoidPtr(py_bond);
- double* dx = (double*) PyCObject_AsVoidPtr(py_dx);
- double* deldx = (double*) PyCObject_AsVoidPtr(py_deldx);
- double* dxcur = (double*) PyCObject_AsVoidPtr(py_dxcur);
- double* diforc = (double*) PyCObject_AsVoidPtr(py_diforc);
- int* idx = (int*) PyCObject_AsVoidPtr(py_idx);
- int* iwinkx = (int*) PyCObject_AsVoidPtr(py_iwinkx);
- double* winkx = (double*) PyCObject_AsVoidPtr(py_winkx);
- int* idslp = (int*) PyCObject_AsVoidPtr(py_idslp);
- int* ipslp = (int*) PyCObject_AsVoidPtr(py_ipslp);
- int* idhist = (int*) PyCObject_AsVoidPtr(py_idhist);
- double* fault = (double*) PyCObject_AsVoidPtr(py_fault);
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
- double* dfault = (double*) PyCObject_AsVoidPtr(py_dfault);
- double* tfault = (double*) PyCObject_AsVoidPtr(py_tfault);
- double* s = (double*) PyCObject_AsVoidPtr(py_s);
- double* stemp = (double*) PyCObject_AsVoidPtr(py_stemp);
- double* state = (double*) PyCObject_AsVoidPtr(py_state);
- double* dstate = (double*) PyCObject_AsVoidPtr(py_dstate);
- double* state0 = (double*) PyCObject_AsVoidPtr(py_state0);
- double* dmat = (double*) PyCObject_AsVoidPtr(py_dmat);
- int* ien = (int*) PyCObject_AsVoidPtr(py_ien);
- int* lm = (int*) PyCObject_AsVoidPtr(py_lm);
- int* lmx = (int*) PyCObject_AsVoidPtr(py_lmx);
- int* lmf = (int*) PyCObject_AsVoidPtr(py_lmf);
- int* ivfamily = (int*) PyCObject_AsVoidPtr(py_ivfamily);
- int* npar = (int*) PyCObject_AsVoidPtr(py_npar);
- int* ielindx = (int*) PyCObject_AsVoidPtr(py_ielindx);
- int* tractionverts = (int*) PyCObject_AsVoidPtr(py_tractionverts);
- double* tractionvals = (double*) PyCObject_AsVoidPtr(py_tractionvals);
- double* gauss2d = (double*) PyCObject_AsVoidPtr(py_gauss2d);
- double* sh2d = (double*) PyCObject_AsVoidPtr(py_sh2d);
- int* infetype2d = (int*) PyCObject_AsVoidPtr(py_infetype2d);
- double* prop = (double*) PyCObject_AsVoidPtr(py_prop);
- int* infmatmod = (int*) PyCObject_AsVoidPtr(py_infmatmod);
- double* gauss = (double*) PyCObject_AsVoidPtr(py_gauss);
- double* sh = (double*) PyCObject_AsVoidPtr(py_sh);
- double* shj = (double*) PyCObject_AsVoidPtr(py_shj);
- int* infetype = (int*) PyCObject_AsVoidPtr(py_infetype);
- double* histry = (double*) PyCObject_AsVoidPtr(py_histry);
- double* rtimdat = (double*) PyCObject_AsVoidPtr(py_rtimdat);
- int* ntimdat = (int*) PyCObject_AsVoidPtr(py_ntimdat);
- int* nvisdat = (int*) PyCObject_AsVoidPtr(py_nvisdat);
- int* maxstp = (int*) PyCObject_AsVoidPtr(py_maxstp);
- double* delt = (double*) PyCObject_AsVoidPtr(py_delt);
- double* alfa = (double*) PyCObject_AsVoidPtr(py_alfa);
- int* maxit = (int*) PyCObject_AsVoidPtr(py_maxit);
- int* ntdinit = (int*) PyCObject_AsVoidPtr(py_ntdinit);
- int* lgdef = (int*) PyCObject_AsVoidPtr(py_lgdef);
- double* utol = (double*) PyCObject_AsVoidPtr(py_utol);
- double* ftol = (double*) PyCObject_AsVoidPtr(py_ftol);
- double* etol = (double*) PyCObject_AsVoidPtr(py_etol);
- int* itmax = (int*) PyCObject_AsVoidPtr(py_itmax);
- double* rgiter = (double*) PyCObject_AsVoidPtr(py_rgiter);
- double* skew = (double*) PyCObject_AsVoidPtr(py_skew);
- int* iprint = (int*) PyCObject_AsVoidPtr(py_iprint);
- int* ncodat = (int*) PyCObject_AsVoidPtr(py_ncodat);
- int* nunits = (int*) PyCObject_AsVoidPtr(py_nunits);
- int* nprint = (int*) PyCObject_AsVoidPtr(py_nprint);
- int* istatout = (int*) PyCObject_AsVoidPtr(py_istatout);
- int* nstatout = (int*) PyCObject_AsVoidPtr(py_nstatout);
-
- double gtol[4];
- if (PyList_Size(pyGtol) != 3) {
- return 0;
- }
- for(int v = 0; v < 3; v++) {
- PyObject *listitem = PyList_GetItem(pyGtol, v);
-
- if(!PyFloat_Check(listitem)) {
- return 0;
- }
- gtol[v] = PyFloat_AsDouble(listitem);
- }
-
- viscos_step_f(&A, // 1: Sparse matrix arrays
- &rhs,
- &sol,
- bextern, // Force vectors
- btraction,
- bgravity,
- bconcForce,
- bintern,
- bresid,
- bwink, // 10
- bwinkx,
- dispVec,
- dprev,
- nforce,
- grav,
- x, // Global arrays
- d,
- deld,
- dcur,
- id, // 20
- iwink,
- wink,
- nsysdat,
- iddmat,
- ibond, // Boundary condition arrays
- bond,
- dx, // Slippery node arrays
- deldx,
- dxcur,
- diforc, // 30
- idx,
- iwinkx,
- winkx,
- idslp,
- ipslp,
- idhist,
- fault, // Split node arrays
- nfault,
- dfault,
- tfault, // 40
- s, // Local stiffness matrix arrays
- stemp,
- state, // Element arrays
- dstate,
- state0,
- dmat,
- ien,
- lm,
- lmx,
- lmf, // 50
- ivfamily,
- npar,
- ielindx,
- tractionverts, // Traction BC arrays
- tractionvals,
- gauss2d,
- sh2d,
- infetype2d,
- prop, // Material property arrays
- infmatmod, // 60
- gauss, // Element type arrays
- sh,
- shj,
- infetype,
- histry, // Time information
- rtimdat,
- ntimdat,
- nvisdat,
- maxstp,
- delt, // 70
- alfa,
- maxit,
- ntdinit,
- lgdef,
- utol,
- ftol,
- etol,
- itmax,
- rgiter, // Iterative solution information
- skew, // 80: Skew rotation information
- iprint, // Input/output information
- ncodat,
- nunits,
- nprint,
- istatout,
- nstatout,
- ofile, // Output file names
- pfile,
- ucdroot,
- &viscousStage, // 90: PETSC logging
- &iterateEvent,
- &ntot,
- <im,
- &indexx,
- &jcyc,
- &i,
- &j,
- &skc,
- &nfirst,
- &nstep,
- &time,
- &deltp,
- &lgdefp,
- gtol,
- &errorcode, // Error codes
- errorstring,
- strlen(ofile), // String lengths
- strlen(pfile),
- strlen(ucdroot),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Setup the time-dependent solution.
-
-char pypylith3d_viscos_setup__doc__[] = "";
-char pypylith3d_viscos_setup__name__[] = "viscos_setup";
-
-PyObject * pypylith3d_viscos_setup(PyObject *, PyObject *args)
-{
- PyObject* py_nprint;
- PyObject* py_nunits;
- char* ofile; // Output file names
- char* pfile;
- int viscousStage;
-
- int ok = PyArg_ParseTuple(args, "OOssi:viscos_setup",
- &py_nprint,
- &py_nunits,
- &ofile, // Output file names
- &pfile,
- &viscousStage);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int *nprint = (int *) PyCObject_AsVoidPtr(py_nprint);
- int *nunits = (int *) PyCObject_AsVoidPtr(py_nunits);
-
- viscos_setup_f(nprint,
- nunits,
- ofile, // Output file names
- pfile,
- &viscousStage, // PETSC logging
- &errorcode, // Error codes
- errorstring,
- strlen(ofile), // String lengths
- strlen(pfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "ofile:" << ofile
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Cleanup the time-dependent solution.
-
-char pypylith3d_viscos_cleanup__doc__[] = "";
-char pypylith3d_viscos_cleanup__name__[] = "viscos_cleanup";
-
-PyObject * pypylith3d_viscos_cleanup(PyObject *, PyObject *args)
-{
- PyObject* py_ntimdat;
- PyObject* py_nprint;
- PyObject* py_nunits;
-
- int ok = PyArg_ParseTuple(args, "OOO:viscos_cleanup",&py_ntimdat, &py_nprint, &py_nunits);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int *ntimdat = (int *) PyCObject_AsVoidPtr(py_ntimdat);
- int *nprint = (int *) PyCObject_AsVoidPtr(py_nprint);
- int *nunits = (int *) PyCObject_AsVoidPtr(py_nunits);
-
- viscos_cleanup_f(ntimdat,
- nprint,
- nunits,
- &errorcode, // Error codes
- errorstring,
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-
-// Write boundary conditions
-
-char pypylith3d_write_bc__doc__[] = "";
-char pypylith3d_write_bc__name__[] = "write_bc";
-
-PyObject * pypylith3d_write_bc(PyObject *, PyObject *args)
-{
- PyObject* py_bond;
- PyObject* py_ibond;
- int numnp;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "OOiiis:write_bc",
- &py_bond,
- &py_ibond,
- &numnp,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* bond = (double*) PyCObject_AsVoidPtr(py_bond);
- int* ibond = (int*) PyCObject_AsVoidPtr(py_ibond);
-
- write_bc_f(bond,
- ibond,
- &numnp,
- &kw,
- &idout,
- ofile,
- &errorcode,
- errorstring,
- strlen(ofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numnp:" << numnp
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write connectivities
-
-char pypylith3d_write_connect__doc__[] = "";
-char pypylith3d_write_connect__name__[] = "write_connect";
-
-PyObject * pypylith3d_write_connect(PyObject *, PyObject *args)
-{
- PyObject* py_iens;
- PyObject* py_ivfamily;
- PyObject* py_indxiel;
- int nen;
- int ngauss;
- int numelv;
- int ietypev;
- int nvfamilies;
- int kw;
- int kp;
- int idout;
- int idsk;
- char* ofile;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "OOOiiiiiiiiiss:write_connect",
- &py_iens,
- &py_ivfamily,
- &py_indxiel,
- &nen,
- &ngauss,
- &numelv,
- &ietypev,
- &nvfamilies,
- &kw,
- &kp,
- &idout,
- &idsk,
- &ofile,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* iens = (int*) PyCObject_AsVoidPtr(py_iens);
- int* ivfamily = (int*) PyCObject_AsVoidPtr(py_ivfamily);
- int* indxiel = (int*) PyCObject_AsVoidPtr(py_indxiel);
-
- write_connect_f(iens,
- ivfamily,
- indxiel,
- &nen,
- &ngauss,
- &numelv,
- &ietypev,
- &nvfamilies,
- &kw,
- &kp,
- &idout,
- &idsk,
- ofile,
- pfile,
- &errorcode,
- errorstring,
- strlen(ofile),
- strlen(pfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numelv:" << numelv
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write coordinates
-
-char pypylith3d_write_coords__doc__[] = "";
-char pypylith3d_write_coords__name__[] = "write_coords";
-
-PyObject * pypylith3d_write_coords(PyObject *, PyObject *args)
-{
- PyObject* py_x;
- int numnp;
- int kw;
- int kp;
- int idout;
- int idsk;
- char* ofile;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "Oiiiiiss:write_coords",
- &py_x,
- &numnp,
- &kw,
- &kp,
- &idout,
- &idsk,
- &ofile,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* x = (double*) PyCObject_AsVoidPtr(py_x);
-
- write_coords_f(x,
- &numnp,
- &kw,
- &kp,
- &idout,
- &idsk,
- ofile,
- pfile,
- &errorcode,
- errorstring,
- strlen(ofile),
- strlen(pfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numnp:" << numnp
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write differential forces
-
-char pypylith3d_write_diff__doc__[] = "";
-char pypylith3d_write_diff__name__[] = "write_diff";
-
-PyObject * pypylith3d_write_diff(PyObject *, PyObject *args)
-{
- PyObject* py_diforc;
- PyObject* py_nslip;
- PyObject* py_idhist;
- int numslp;
- int numdif;
- int numnp;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "OOOiiiiis:write_diff",
- &py_diforc,
- &py_nslip,
- &py_idhist,
- &numslp,
- &numdif,
- &numnp,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* diforc = (double*) PyCObject_AsVoidPtr(py_diforc);
- int* nslip = (int*) PyCObject_AsVoidPtr(py_nslip);
- int* idhist = (int*) PyCObject_AsVoidPtr(py_idhist);
-
- write_diff_f(diforc,
- nslip,
- idhist,
- &numslp,
- &numdif,
- &numnp,
- &kw,
- &idout,
- ofile,
- &errorcode,
- errorstring,
- strlen(ofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numdif:" << numdif
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Write out element info
-
-char pypylith3d_write_element_info__doc__[] = "";
-char pypylith3d_write_element_info__name__[] = "write_element_info";
-
-PyObject * pypylith3d_write_element_info(PyObject *, PyObject *args)
-{
- int numelv;
- int nen;
- int ngauss;
- int ietypev;
- int intord;
- int ipstrs;
- int ipauto;
- double tpois;
- double tyoungs;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "iiiiiiiddiis:write_element_info",
- &numelv,
- &nen,
- &ngauss,
- &ietypev,
- &intord,
- &ipstrs,
- &ipauto,
- &tpois,
- &tyoungs,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- write_element_info_f(&numelv,
- &nen,
- &ngauss,
- &ietypev,
- &intord,
- &ipstrs,
- &ipauto,
- &tpois,
- &tyoungs,
- &kw,
- &idout,
- ofile,strlen(ofile));
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numelv:" << numelv
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write time steps at which full output is desired
-
-char pypylith3d_write_fuldat__doc__[] = "";
-char pypylith3d_write_fuldat__name__[] = "write_fuldat";
-
-PyObject * pypylith3d_write_fuldat(PyObject *, PyObject *args)
-{
- PyObject* py_iprint;
- int icontr;
- int icode;
- int ncycle;
- int lastep;
- int kw;
- int kp;
- int idout;
- int idsk;
- char* ofile;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "Oiiiiiiiiss:write_fuldat",
- &py_iprint,
- &icontr,
- &icode,
- &ncycle,
- &lastep,
- &kw,
- &kp,
- &idout,
- &idsk,
- &ofile,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* iprint = (int*) PyCObject_AsVoidPtr(py_iprint);
-
- write_fuldat_f(iprint,
- &icontr,
- &icode,
- &ncycle,
- &lastep,
- &kw,
- &kp,
- &idout,
- &idsk,
- ofile,
- pfile,
- &errorcode,
- errorstring,
- strlen(ofile),
- strlen(pfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "icontr:" << icontr
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write out global info
-
-char pypylith3d_write_global_info__doc__[] = "";
-char pypylith3d_write_global_info__name__[] = "write_global_info";
-
-PyObject * pypylith3d_write_global_info(PyObject *, PyObject *args)
-{
- char* title;
- int idout;
- int idsk;
- int numnp;
- int icode;
- int idebug;
- int kw;
- int kp;
- char* ofile;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "siiiiiiiss:write_global_info",
- &title,
- &idout,
- &idsk,
- &numnp,
- &icode,
- &idebug,
- &kw,
- &kp,
- &ofile,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- write_global_info_f(title,
- &idout,
- &idsk,
- &numnp,
- &icode,
- &idebug,
- &kw,
- &kp,
- ofile,
- pfile,
- strlen(title),
- strlen(ofile),
- strlen(pfile));
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "idebug:" << idebug
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write load histories
-
-char pypylith3d_write_hist__doc__[] = "";
-char pypylith3d_write_hist__name__[] = "write_hist";
-
-PyObject * pypylith3d_write_hist(PyObject *, PyObject *args)
-{
- PyObject* py_histry;
- PyObject* py_times;
- int nhist;
- int lastep;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "OOiiiis:write_hist",
- &py_histry,
- &py_times,
- &nhist,
- &lastep,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* histry = (double*) PyCObject_AsVoidPtr(py_histry);
- double* times = (double*) PyCObject_AsVoidPtr(py_times);
-
- write_hist_f(histry,
- times,
- &nhist,
- &lastep,
- &kw,
- &idout,
- ofile,
- &errorcode,
- errorstring,
- strlen(ofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nhist:" << nhist
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write out material property info
-
-char pypylith3d_write_props__doc__[] = "";
-char pypylith3d_write_props__name__[] = "write_props";
-
-PyObject * pypylith3d_write_props(PyObject *, PyObject *args)
-{
- PyObject* py_prop;
- PyObject* py_grav;
- PyObject* py_ivfamily;
- PyObject* py_infmatmod;
- int nvfamilies;
- int propertySize;
- int idout;
- int idsk;
- int kw;
- int kp;
- char* ofile;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "OOOOiiiiiiss:write_props",
- &py_prop,
- &py_grav,
- &py_ivfamily,
- &py_infmatmod,
- &nvfamilies,
- &propertySize,
- &idout,
- &idsk,
- &kw,
- &kp,
- &ofile,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* prop = (double*) PyCObject_AsVoidPtr(py_prop);
- double* grav = (double*) PyCObject_AsVoidPtr(py_grav);
- int* ivfamily = (int*) PyCObject_AsVoidPtr(py_ivfamily);
- int* infmatmod = (int*) PyCObject_AsVoidPtr(py_infmatmod);
-
- write_props_f(prop,
- grav,
- ivfamily,
- infmatmod,
- &nvfamilies,
- &propertySize,
- &idout,
- &idsk,
- &kw,
- &kp,
- ofile,
- pfile,
- &errorcode,
- errorstring,
- strlen(ofile),
- strlen(pfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nvfamilies:" << nvfamilies
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write local coordinate rotations
-
-char pypylith3d_write_skew__doc__[] = "";
-char pypylith3d_write_skew__name__[] = "write_skew";
-
-PyObject * pypylith3d_write_skew(PyObject *, PyObject *args)
-{
- PyObject* py_skew;
- int numrot;
- int iskopt;
- int numnp;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "Oiiiiis:write_skew",
- &py_skew,
- &numrot,
- &iskopt,
- &numnp,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* skew = (double*) PyCObject_AsVoidPtr(py_skew);
-
- write_skew_f(skew,
- &numrot,
- &iskopt,
- &numnp,
- &kw,
- &idout,
- ofile,
- &errorcode,
- errorstring,
- strlen(ofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numrot:" << numrot
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write slippery node entries
-
-char pypylith3d_write_slip__doc__[] = "";
-char pypylith3d_write_slip__name__[] = "write_slip";
-
-PyObject * pypylith3d_write_slip(PyObject *, PyObject *args)
-{
- PyObject* py_nslip;
- int numslp;
- int totalNumberSlipperyNodes;
- int kw;
- int kp;
- int idout;
- int idsk;
- char* ofile;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "Oiiiiiiss:write_slip",
- &py_nslip,
- &numslp,
- &totalNumberSlipperyNodes,
- &kw,
- &kp,
- &idout,
- &idsk,
- &ofile,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* nslip = (int*) PyCObject_AsVoidPtr(py_nslip);
-
- write_slip_f(nslip,
- &numslp,
- &totalNumberSlipperyNodes,
- &kw,
- &kp,
- &idout,
- &idsk,
- ofile,
- pfile,
- &errorcode,
- errorstring,
- strlen(ofile),
- strlen(pfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "totalNumberSlipperyNodes:" << totalNumberSlipperyNodes
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write out sparse matrix info
-
-char pypylith3d_write_sparse_info__doc__[] = "";
-char pypylith3d_write_sparse_info__name__[] = "write_sparse_info";
-
-PyObject * pypylith3d_write_sparse_info(PyObject *, PyObject *args)
-{
- int neq;
- int stiffnessMatrixSize;
- int nmin;
- int nmax;
- double wavg;
- int idout;
- int kw;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "iiiidiis:write_sparse_info",
- &neq,
- &stiffnessMatrixSize,
- &nmin,
- &nmax,
- &wavg,
- &idout,
- &kw,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- write_sparse_info_f(&neq,
- &stiffnessMatrixSize,
- &nmin,
- &nmax,
- &wavg,
- &idout,
- &kw,
- ofile,strlen(ofile));
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nmin:" << nmin
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write split node entries
-
-char pypylith3d_write_split__doc__[] = "";
-char pypylith3d_write_split__name__[] = "write_split";
-
-PyObject * pypylith3d_write_split(PyObject *, PyObject *args)
-{
- PyObject* py_fault;
- PyObject* py_nfault;
- int numfn;
- int kw;
- int kp;
- int idout;
- int idsk;
- char* ofile;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "OOiiiiiss:write_split",
- &py_fault,
- &py_nfault,
- &numfn,
- &kw,
- &kp,
- &idout,
- &idsk,
- &ofile,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* fault = (double*) PyCObject_AsVoidPtr(py_fault);
- int* nfault = (int*) PyCObject_AsVoidPtr(py_nfault);
-
- write_split_f(fault,
- nfault,
- &numfn,
- &kw,
- &kp,
- &idout,
- &idsk,
- ofile,
- pfile,
- &errorcode,
- errorstring,
- strlen(ofile),
- strlen(pfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numfn:" << numfn
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write split node entries for plot output
-
-char pypylith3d_write_split_plot__doc__[] = "";
-char pypylith3d_write_split_plot__name__[] = "write_split_plot";
-
-PyObject * pypylith3d_write_split_plot(PyObject *, PyObject *args)
-{
- PyObject* py_idftn;
- int totalNumberSplitNodes;
- int kp;
- int idsk;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "Oiiis:write_split_plot",
- &py_idftn,
- &totalNumberSplitNodes,
- &kp,
- &idsk,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- int* idftn = (int*) PyCObject_AsVoidPtr(py_idftn);
-
- write_split_plot_f(idftn,
- &totalNumberSplitNodes,
- &kp,
- &idsk,
- pfile,
- strlen(pfile));
-
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "totalNumberSplitNodes:" << totalNumberSplitNodes
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write state output information
-
-char pypylith3d_write_stateout__doc__[] = "";
-char pypylith3d_write_stateout__name__[] = "write_stateout";
-
-PyObject * pypylith3d_write_stateout(PyObject *, PyObject *args)
-{
- PyObject* py_istatout;
- PyObject* py_nstatout;
- int kw;
- int kp;
- int idout;
- int idsk;
- char* ofile;
- char* pfile;
-
- int ok = PyArg_ParseTuple(args, "OOiiiiss:write_stateout",
- &py_istatout,
- &py_nstatout,
- &kw,
- &kp,
- &idout,
- &idsk,
- &ofile,
- &pfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* istatout = (int*) PyCObject_AsVoidPtr(py_istatout);
- int* nstatout = (int*) PyCObject_AsVoidPtr(py_nstatout);
-
- write_stateout_f(istatout,
- nstatout,
- &kw,
- &kp,
- &idout,
- &idsk,
- ofile,
- pfile,
- &errorcode,
- errorstring,
- strlen(ofile),
- strlen(pfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "istatout:" << istatout
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write out stress integration parameters
-
-char pypylith3d_write_strscomp__doc__[] = "";
-char pypylith3d_write_strscomp__name__[] = "write_strscomp";
-
-PyObject * pypylith3d_write_strscomp(PyObject *, PyObject *args)
-{
- double stol;
- double dtol;
- double epert;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "dddiis:write_strscomp",
- &stol,
- &dtol,
- &epert,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- write_strscomp_f(&stol,
- &dtol,
- &epert,
- &kw,
- &idout,
- ofile,strlen(ofile));
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "epert:" << epert
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write out subiteration convergence parameters
-
-char pypylith3d_write_subiter__doc__[] = "";
-char pypylith3d_write_subiter__name__[] = "write_subiter";
-
-PyObject * pypylith3d_write_subiter(PyObject *, PyObject *args)
-{
- int nprevdflag;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "iiis:write_subiter",
- &nprevdflag,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
-
- write_subiter_f(&nprevdflag,
- &kw,
- &idout,
- ofile,strlen(ofile));
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nprevdflag:" << nprevdflag
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write time step data
-
-char pypylith3d_write_timdat__doc__[] = "";
-char pypylith3d_write_timdat__name__[] = "write_timdat";
-
-PyObject * pypylith3d_write_timdat(PyObject *, PyObject *args)
-{
- PyObject* py_delt;
- PyObject* py_alfa;
- PyObject* py_utol;
- PyObject* py_ftol;
- PyObject* py_etol;
- PyObject* py_times;
- PyObject* py_maxstp;
- PyObject* py_maxit;
- PyObject* py_ntdinit;
- PyObject* py_lgdef;
- PyObject* py_itmax;
- int nintg;
- int lastep;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "OOOOOOOOOOOiiiis:write_timdat",
- &py_delt,
- &py_alfa,
- &py_utol,
- &py_ftol,
- &py_etol,
- &py_times,
- &py_maxstp,
- &py_maxit,
- &py_ntdinit,
- &py_lgdef,
- &py_itmax,
- &nintg,
- &lastep,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* delt = (double*) PyCObject_AsVoidPtr(py_delt);
- double* alfa = (double*) PyCObject_AsVoidPtr(py_alfa);
- double* utol = (double*) PyCObject_AsVoidPtr(py_utol);
- double* ftol = (double*) PyCObject_AsVoidPtr(py_ftol);
- double* etol = (double*) PyCObject_AsVoidPtr(py_etol);
- double* times = (double*) PyCObject_AsVoidPtr(py_times);
- int* maxstp = (int*) PyCObject_AsVoidPtr(py_maxstp);
- int* maxit = (int*) PyCObject_AsVoidPtr(py_maxit);
- int* ntdinit = (int*) PyCObject_AsVoidPtr(py_ntdinit);
- int* lgdef = (int*) PyCObject_AsVoidPtr(py_lgdef);
- int* itmax = (int*) PyCObject_AsVoidPtr(py_itmax);
-
- write_timdat_f(delt,
- alfa,
- utol,
- ftol,
- etol,
- times,
- maxstp,
- maxit,
- ntdinit,
- lgdef,
- itmax,
- &nintg,
- &lastep,
- &kw,
- &idout,
- ofile,
- &errorcode,
- errorstring,
- strlen(ofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "lastep:" << lastep
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write traction BC
-
-char pypylith3d_write_tractions__doc__[] = "";
-char pypylith3d_write_tractions__name__[] = "write_tractions";
-
-PyObject * pypylith3d_write_tractions(PyObject *, PyObject *args)
-{
- PyObject* py_tractionverts;
- PyObject* py_tractionvals;
- int numtractions;
- int numberSurfaceElementNodes;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "OOiiiis:write_tractions",
- &py_tractionverts,
- &py_tractionvals,
- &numtractions,
- &numberSurfaceElementNodes,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int* tractionverts = (int*) PyCObject_AsVoidPtr(py_tractionverts);
- double* tractionvals = (double*) PyCObject_AsVoidPtr(py_tractionvals);
-
- write_tractions_f(tractionverts,
- tractionvals,
- &numtractions,
- &numberSurfaceElementNodes,
- &kw,
- &idout,
- ofile,
- &errorcode,
- errorstring,
- strlen(ofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numtractions:" << numtractions
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write mesh info to UCD file
-
-char pypylith3d_write_ucd_mesh__doc__[] = "";
-char pypylith3d_write_ucd_mesh__name__[] = "write_ucd_mesh";
-
-PyObject * pypylith3d_write_ucd_mesh(PyObject *, PyObject *args)
-{
- PyObject* py_x;
- int numnp;
- PyObject* py_iens;
- PyObject* py_ivfamily;
- int numelv;
- int nvfamilies;
- PyObject* py_sh;
- int nen;
- int ngauss;
- int ietypev;
- PyObject* py_istatout;
- PyObject* py_nstatout;
- int kucd;
- int iucd;
- char* ucdroot;
-
- int ok = PyArg_ParseTuple(args, "OiOOiiOiiiOOiis:write_ucd_mesh",
- &py_x,
- &numnp,
- &py_iens,
- &py_ivfamily,
- &numelv,
- &nvfamilies,
- &py_sh,
- &nen,
- &ngauss,
- &ietypev,
- &py_istatout,
- &py_nstatout,
- &kucd,
- &iucd,
- &ucdroot);
-
- if (!ok) {
- return 0;
- }
-
- double* x = (double*) PyCObject_AsVoidPtr(py_x);
- int* iens = (int*) PyCObject_AsVoidPtr(py_iens);
- int* ivfamily = (int*) PyCObject_AsVoidPtr(py_ivfamily);
- double* sh = (double*) PyCObject_AsVoidPtr(py_sh);
- int* istatout = (int*) PyCObject_AsVoidPtr(py_istatout);
- int* nstatout = (int*) PyCObject_AsVoidPtr(py_nstatout);
-
- write_ucd_mesh_f(x,
- &numnp,
- iens,
- ivfamily,
- &numelv,
- &nvfamilies,
- sh,
- &nen,
- &ngauss,
- &ietypev,
- istatout,
- nstatout,
- &kucd,
- &iucd,
- ucdroot,strlen(ucdroot));
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numelv:" << numelv
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write winkler BC
-
-char pypylith3d_write_wink__doc__[] = "";
-char pypylith3d_write_wink__name__[] = "write_wink";
-
-PyObject * pypylith3d_write_wink(PyObject *, PyObject *args)
-{
- PyObject* py_winkdef;
- PyObject* py_iwinkdef;
- PyObject* py_iwinkid;
- int nwinke;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "OOOiiis:write_wink",
- &py_winkdef,
- &py_iwinkdef,
- &py_iwinkid,
- &nwinke,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* winkdef = (double*) PyCObject_AsVoidPtr(py_winkdef);
- int* iwinkdef = (int*) PyCObject_AsVoidPtr(py_iwinkdef);
- int* iwinkid = (int*) PyCObject_AsVoidPtr(py_iwinkid);
-
- write_wink_f(winkdef,
- iwinkdef,
- iwinkid,
- &nwinke,
- &kw,
- &idout,
- ofile,
- &errorcode,
- errorstring,
- strlen(ofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nwinke:" << nwinke
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Write slippery winkler BC
-
-char pypylith3d_write_winkx__doc__[] = "";
-char pypylith3d_write_winkx__name__[] = "write_winkx";
-
-PyObject * pypylith3d_write_winkx(PyObject *, PyObject *args)
-{
- PyObject* py_winkxdef;
- PyObject* py_iwinkxdef;
- PyObject* py_iwinkxid;
- int nwinkxe;
- int kw;
- int idout;
- char* ofile;
-
- int ok = PyArg_ParseTuple(args, "OOOiiis:write_winkx",
- &py_winkxdef,
- &py_iwinkxdef,
- &py_iwinkxid,
- &nwinkxe,
- &kw,
- &idout,
- &ofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- double* winkxdef = (double*) PyCObject_AsVoidPtr(py_winkxdef);
- int* iwinkxdef = (int*) PyCObject_AsVoidPtr(py_iwinkxdef);
- int* iwinkxid = (int*) PyCObject_AsVoidPtr(py_iwinkxid);
-
- write_winkx_f(winkxdef,
- iwinkxdef,
- iwinkxid,
- &nwinkxe,
- &kw,
- &idout,
- ofile,
- &errorcode,
- errorstring,
- strlen(ofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nwinkxe:" << nwinkxe
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-// Scan boundary conditions
-
-char pypylith3d_scan_bc__doc__[] = "";
-char pypylith3d_scan_bc__name__[] = "scan_bc";
-
-PyObject * pypylith3d_scan_bc(PyObject *, PyObject *args)
-{
- int kr;
- char* displacement_units;
- char* velocity_units;
- char* force_units;
- char* bcInputFile;
-
- int ok = PyArg_ParseTuple(args, (char *) "issss:scan_bc",
- &kr,
- &displacement_units,
- &velocity_units,
- &force_units,
- &bcInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int numbc = 0;
-
- scan_bc_f(&numbc,
- &kr,
- displacement_units,
- velocity_units,
- force_units,
- bcInputFile,
- &errorcode,
- errorstring,
- strlen(displacement_units),
- strlen(velocity_units),
- strlen(force_units),
- strlen(bcInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numbc:" << numbc
- << journal::endl;
-
- // return
- return Py_BuildValue((char *) "i", numbc);
-}
-
-
-// Scan connectivities
-
-char pypylith3d_scan_connect__doc__[] = "";
-char pypylith3d_scan_connect__name__[] = "scan_connect";
-
-PyObject * pypylith3d_scan_connect(PyObject *, PyObject *args)
-{
- PyObject* py_numberElementNodesBase;
- PyObject* py_infmatmod;
- PyObject* py_infmat;
- PyObject* py_volumeElementFamilyList;
- int maxvfamilies;
- int numat;
- int kr;
- char* connectivityInputFile;
-
- int ok = PyArg_ParseTuple(args, (char *) "OOOOiiis:scan_connect",
- &py_numberElementNodesBase,
- &py_infmatmod,
- &py_infmat,
- &py_volumeElementFamilyList,
- &maxvfamilies,
- &numat,
- &kr,
- &connectivityInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int* neni = (int*) PyCObject_AsVoidPtr(py_numberElementNodesBase);
- int* infmatmod = (int*) PyCObject_AsVoidPtr(py_infmatmod);
- int* infmat = (int*) PyCObject_AsVoidPtr(py_infmat);
- int* ivflist = (int*) PyCObject_AsVoidPtr(py_volumeElementFamilyList);
- int numelv = 0;
- int nvfamilies = 0;
- int ietypev = 0;
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
-
- scan_connect_f(neni,
- infmatmod,
- infmat,
- ivflist,
- &maxvfamilies,
- &numat,
- &numelv,
- &nvfamilies,
- &ietypev,
- &kr,
- connectivityInputFile,
- &errorcode,
- errorstring,
- strlen(connectivityInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nvfamilies:" << nvfamilies
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "iii", numelv,
- nvfamilies,
- ietypev);
-}
-
-
-// Scan coordinates
-
-char pypylith3d_scan_coords__doc__[] = "";
-char pypylith3d_scan_coords__name__[] = "scan_coords";
-
-PyObject * pypylith3d_scan_coords(PyObject *, PyObject *args)
-{
- int kr;
- char *coord_units;
- char *coordinateInputFile;
-
- int ok = PyArg_ParseTuple(args, (char *) "iss:scan_coords",
- &kr,
- &coord_units,
- &coordinateInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int numnp = 0;
-
- scan_coords_f(&numnp,
- &kr,
- coord_units,
- coordinateInputFile,
- &errorcode,
- errorstring,
- strlen(coord_units),
- strlen(coordinateInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numnp:" << numnp
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "i", numnp);
-}
-
-
-// Scan differential forces
-
-char pypylith3d_scan_diff__doc__[] = "";
-char pypylith3d_scan_diff__name__[] = "scan_diff";
-
-PyObject * pypylith3d_scan_diff(PyObject *, PyObject *args)
-{
- int numslp;
- int kr;
- char* difile;
-
- int ok = PyArg_ParseTuple(args, (char *) "iis:scan_diff",
- &numslp,
- &kr,
- &difile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int numdif = 0;
-
- scan_diff_f(&numslp,
- &numdif,
- &kr,
- difile,
- &errorcode,
- errorstring,
- strlen(difile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numdif:" << numdif
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "i", numdif);
-}
-
-
-// Scan time steps at which full output is desired
-
-char pypylith3d_scan_fuldat__doc__[] = "";
-char pypylith3d_scan_fuldat__name__[] = "scan_fuldat";
-
-PyObject * pypylith3d_scan_fuldat(PyObject *, PyObject *args)
-{
- int icode;
- int lastep;
- int kr;
- char* fofile;
-
- int ok = PyArg_ParseTuple(args, (char *) "iiis:scan_fuldat",
- &icode,
- &lastep,
- &kr,
- &fofile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int icontr = 0;
-
- scan_fuldat_f(&icode,
- &lastep,
- &icontr,
- &kr,
- fofile,
- &errorcode,
- errorstring,
- strlen(fofile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "icontr:" << icontr
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "i", icontr);
-}
-
-
-// Scan load histories
-
-char pypylith3d_scan_hist__doc__[] = "";
-char pypylith3d_scan_hist__name__[] = "scan_hist";
-
-PyObject * pypylith3d_scan_hist(PyObject *, PyObject *args)
-{
- int kr;
- char* hfile;
-
- int ok = PyArg_ParseTuple(args, (char *) "is:scan_hist",
- &kr,
- &hfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int nhist = 0;
-
- scan_hist_f(&nhist,
- &kr,
- hfile,
- &errorcode,
- errorstring,
- strlen(hfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nhist:" << nhist
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "i", nhist);
-}
-
-
-// Scan element prestresses
-
- // char pypylith3d_scan_prestr__doc__[] = "";
- // char pypylith3d_scan_prestr__name__[] = "scan_prestr";
-
- // PyObject * pypylith3d_scan_prestr(PyObject *, PyObject *args)
- // {
- // int numberStressComponents;
- // int numberPrestressGaussPoints;
- // int numberElements;
- // int ipstrs;
- // int kr;
- // char* prestressInputFile;
-
- // int ok = PyArg_ParseTuple(args, "iiiiis:scan_prestr",
- // &numberStressComponents,
- // &numberPrestressGaussPoints,
- // &numberElements,
- // &ipstrs,
- // &kr,
- // &prestressInputFile);
-
- // if (!ok) {
- // return 0;
- // }
-
- // int errorcode = 0;
- // const int maxsize = 4096;
- // char errorstring[maxsize];
- // int numberPrestressEntries = 0;
-
- // scan_prestr_f(&numberStressComponents,
- // &numberPrestressGaussPoints,
- // &numberPrestressEntries,
- // &numberElements,
- // &ipstrs,
- // &kr,
- // &errorcode,
- // prestressInputFile,strlen(prestressInputFile));
-
- // if(0 != exceptionhandler(errorcode, errorstring)) {
- // return 0;
- // }
-
- // journal::debug_t debug("pylith3d");
- // debug
- // << journal::at(__HERE__)
- // << "numberPrestressEntries:" << numberPrestressEntries
- // << journal::endl;
-
- // return
- // Py_INCREF(Py_None);
- // return Py_BuildValue("i",numberPrestressEntries);
- // }
-
-
-// Scan local coordinate rotations
-
-char pypylith3d_scan_skew__doc__[] = "";
-char pypylith3d_scan_skew__name__[] = "scan_skew";
-
-PyObject * pypylith3d_scan_skew(PyObject *, PyObject *args)
-{
- int kr;
- char* rotation_units;
- char* skfile;
-
- int ok = PyArg_ParseTuple(args, (char *) "iss:scan_skew",
- &kr,
- &rotation_units,
- &skfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int numrot = 0;
-
- scan_skew_f(&numrot,
- &kr,
- rotation_units,
- skfile,
- &errorcode,
- errorstring,
- strlen(rotation_units),
- strlen(skfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numrot:" << numrot
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "i", numrot);
-}
-
-
-// Scan slippery node entries
-
-char pypylith3d_scan_slip__doc__[] = "";
-char pypylith3d_scan_slip__name__[] = "scan_slip";
-
-PyObject * pypylith3d_scan_slip(PyObject *, PyObject *args)
-{
- int kr;
- char* slfile;
-
- int ok = PyArg_ParseTuple(args, (char *) "is:scan_slip",
- &kr,
- &slfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int numslp = 0;
-
- scan_slip_f(&numslp,
- &kr,
- slfile,
- &errorcode,
- errorstring,
- strlen(slfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numslp:" << numslp
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "i", numslp);
-}
-
-
-// Scan split node entries
-
-char pypylith3d_scan_split__doc__[] = "";
-char pypylith3d_scan_split__name__[] = "scan_split";
-
-PyObject * pypylith3d_scan_split(PyObject *, PyObject *args)
-{
- int kr;
- char* spfile;
-
- int ok = PyArg_ParseTuple(args, (char *) "is:scan_split",
- &kr,
- &spfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int numfn = 0;
-
- scan_split_f(&numfn,
- &kr,
- spfile,
- &errorcode,
- errorstring,
- strlen(spfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numfn:" << numfn
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "i", numfn);
-}
-
-
-// Scan time step data
-
-char pypylith3d_scan_timdat__doc__[] = "";
-char pypylith3d_scan_timdat__name__[] = "scan_timdat";
-
-PyObject * pypylith3d_scan_timdat(PyObject *, PyObject *args)
-{
- int kr;
- char* time_units;
- char* timeStepInputFile;
-
- int ok = PyArg_ParseTuple(args, (char *) "iss:scan_timdat",
- &kr,
- &time_units,
- &timeStepInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int nintg = 0;
- int lastep = 0;
-
- scan_timdat_f(&lastep,
- &nintg,
- &kr,
- time_units,
- timeStepInputFile,
- &errorcode,
- errorstring,
- strlen(time_units),
- strlen(timeStepInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "lastep:" << lastep
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "ii", nintg,
- lastep);
-}
-
-
-
-// Scan traction BC
-
-char pypylith3d_scan_tractions__doc__[] = "";
-char pypylith3d_scan_tractions__name__[] = "scan_tractions";
-
-PyObject * pypylith3d_scan_tractions(PyObject *, PyObject *args)
-{
- int nsnodesmax;
- int kr;
- char *traction_units;
- char *tractionInputFile;
-
- int ok = PyArg_ParseTuple(args, (char *) "iiss:scan_tractions",
- &nsnodesmax,
- &kr,
- &traction_units,
- &tractionInputFile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int numtractions = 0;
-
- scan_tractions_f(&numtractions,
- &nsnodesmax,
- &kr,
- traction_units,
- tractionInputFile,
- &errorcode,
- errorstring,
- strlen(traction_units),
- strlen(tractionInputFile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "numtractions:" << numtractions
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "i", numtractions);
-}
-
-// Read winkler BC
-
-char pypylith3d_scan_wink__doc__[] = "";
-char pypylith3d_scan_wink__name__[] = "scan_wink";
-
-PyObject * pypylith3d_scan_wink(PyObject *, PyObject *args)
-{
- int kr;
- char* wfile;
-
- int ok = PyArg_ParseTuple(args, (char *) "is:scan_wink",
- &kr,
- &wfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int nwinke = 0;
- int nwink = 0;
-
- scan_wink_f(&nwinke,
- &nwink,
- &kr,
- wfile,
- &errorcode,
- errorstring,
- strlen(wfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nwink:" << nwink
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "ii", nwinke,
- nwink);
-}
-
-
-// Read winkler BC for slippery nodes
-
-char pypylith3d_scan_winkx__doc__[] = "";
-char pypylith3d_scan_winkx__name__[] = "scan_winkx";
-
-PyObject * pypylith3d_scan_winkx(PyObject *, PyObject *args)
-{
- int numslp;
- int kr;
- char* wxfile;
-
- int ok = PyArg_ParseTuple(args, (char *) "iis:scan_winkx",
- &numslp,
- &kr,
- &wxfile);
-
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
- int nwinkxe = 0;
- int nwinkx = 0;
-
- scan_winkx_f(&numslp,
- &nwinkxe,
- &nwinkx,
- &kr,
- wxfile,
- &errorcode,
- errorstring,
- strlen(wxfile),
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "nwinkx:" << nwinkx
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_BuildValue((char *) "ii", nwinkxe,
- nwinkx);
-}
-
-
-// Initialize material model info
-
-char pypylith3d_matmod_def__doc__[] = "";
-char pypylith3d_matmod_def__name__[] = "matmod_def";
-
-PyObject * pypylith3d_matmod_def(PyObject *, PyObject *args)
-{
- PyObject* py_infmatmod;
-
- int ok = PyArg_ParseTuple(args, "O:matmod_def",
- &py_infmatmod);
-
- if (!ok) {
- return 0;
- }
-
- int* infmatmod = (int*) PyCObject_AsVoidPtr(py_infmatmod);
-
- matmod_def_f(infmatmod);
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "infmatmod:" << infmatmod
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Precompute shape function info
-
-char pypylith3d_preshape__doc__[] = "";
-char pypylith3d_preshape__name__[] = "preshape";
-
-PyObject * pypylith3d_preshape(PyObject *, PyObject *args)
-{
- PyObject* py_sh;
- PyObject* py_shj;
- PyObject* py_gauss;
- int intord;
- int elementType;
- int nen;
- int ngauss;
-
- int ok = PyArg_ParseTuple(args, "OOOiiii:preshape",
- &py_sh,
- &py_shj,
- &py_gauss,
- &intord,
- &elementType,
- &nen,
- &ngauss);
-
- if (!ok) {
- return 0;
- }
-
- double* sh = (double*) PyCObject_AsVoidPtr(py_sh);
- double* shj = (double*) PyCObject_AsVoidPtr(py_shj);
- double* gauss = (double*) PyCObject_AsVoidPtr(py_gauss);
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
-
- preshape_f(sh,
- shj,
- gauss,
- &intord,
- &elementType,
- &nen,
- &ngauss,
- &errorcode,
- errorstring,
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "intord:" << intord
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Precompute shape function info for element faces
-
-char pypylith3d_preshape2d__doc__[] = "";
-char pypylith3d_preshape2d__name__[] = "preshape2d";
-
-PyObject * pypylith3d_preshape2d(PyObject *, PyObject *args)
-{
- PyObject* py_sh2d;
- PyObject* py_gauss2d;
- int intord;
- int elementType;
- int numberSurfaceElementNodes;
- int numberSurfaceElementGaussPoints;
-
- int ok = PyArg_ParseTuple(args, "OOiiii:preshape2d",
- &py_sh2d,
- &py_gauss2d,
- &intord,
- &elementType,
- &numberSurfaceElementNodes,
- &numberSurfaceElementGaussPoints);
-
- if (!ok) {
- return 0;
- }
-
- double* sh2d = (double*) PyCObject_AsVoidPtr(py_sh2d);
- double* gauss2d = (double*) PyCObject_AsVoidPtr(py_gauss2d);
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
-
- preshape2d_f(sh2d,
- gauss2d,
- &intord,
- &elementType,
- &numberSurfaceElementNodes,
- &numberSurfaceElementGaussPoints,
- &errorcode,
- errorstring,
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "intord:" << intord
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// try_binio
-
-char pypylith3d_try_binio__doc__[] = "";
-char pypylith3d_try_binio__name__[] = "try_binio";
-
-PyObject * pypylith3d_try_binio(PyObject *, PyObject *args)
-{
- int unit;
-
- int ok = PyArg_ParseTuple(args, "i:try_binio",
- &unit);
- if (!ok) {
- return 0;
- }
-
- int errorcode = 0;
- const int maxsize = 4096;
- char errorstring[maxsize];
-
- try_binio_f(&unit,
- &errorcode,
- errorstring,
- sizeof(errorstring));
-
- if(0 != exceptionhandler(errorcode, errorstring)) {
- return 0;
- }
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/libpylith3d.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/libpylith3d.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/libpylith3d.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,491 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pypylith3d_libpylith3d_h)
-#define pypylith3d_libpylith3d_h
-
-
-// Compute gravitational prestresses.
-extern char pypylith3d_autoprestr__name__[];
-extern char pypylith3d_autoprestr__doc__[];
-extern "C"
-PyObject * pypylith3d_autoprestr(PyObject *, PyObject *);
-
-
-// drive elastic solution
-extern char pypylith3d_elastc__name__[];
-extern char pypylith3d_elastc__doc__[];
-extern "C"
-PyObject * pypylith3d_elastc(PyObject *, PyObject *);
-
-
-// assign equation numbers for Winkler BC
-extern char pypylith3d_assign_wink__name__[];
-extern char pypylith3d_assign_wink__doc__[];
-extern "C"
-PyObject * pypylith3d_assign_wink(PyObject *, PyObject *);
-
-// create id array
-extern char pypylith3d_create_id__name__[];
-extern char pypylith3d_create_id__doc__[];
-extern "C"
-PyObject * pypylith3d_create_id(PyObject *, PyObject *);
-
-// form id array for split nodes
-extern char pypylith3d_id_split__name__[];
-extern char pypylith3d_id_split__doc__[];
-extern "C"
-PyObject * pypylith3d_id_split(PyObject *, PyObject *);
-
-// find closest fault neignbors for slippery nodes
-extern char pypylith3d_nfind__name__[];
-extern char pypylith3d_nfind__doc__[];
-extern "C"
-PyObject * pypylith3d_nfind(PyObject *, PyObject *);
-
-
-// read boundary conditions
-extern char pypylith3d_read_bc__name__[];
-extern char pypylith3d_read_bc__doc__[];
-extern "C"
-PyObject * pypylith3d_read_bc(PyObject *, PyObject *);
-
-// read connectivities
-extern char pypylith3d_read_connect__name__[];
-extern char pypylith3d_read_connect__doc__[];
-extern "C"
-PyObject * pypylith3d_read_connect(PyObject *, PyObject *);
-
-// read coordinates
-extern char pypylith3d_read_coords__name__[];
-extern char pypylith3d_read_coords__doc__[];
-extern "C"
-PyObject * pypylith3d_read_coords(PyObject *, PyObject *);
-
-// read differential forces
-extern char pypylith3d_read_diff__name__[];
-extern char pypylith3d_read_diff__doc__[];
-extern "C"
-PyObject * pypylith3d_read_diff(PyObject *, PyObject *);
-
-// read time steps at which full output is desired
-extern char pypylith3d_read_fuldat__name__[];
-extern char pypylith3d_read_fuldat__doc__[];
-extern "C"
-PyObject * pypylith3d_read_fuldat(PyObject *, PyObject *);
-
-// read time history info
-extern char pypylith3d_read_hist__name__[];
-extern char pypylith3d_read_hist__doc__[];
-extern "C"
-PyObject * pypylith3d_read_hist(PyObject *, PyObject *);
-
-// read material history info
-// these are not being used for now
-// extern char pypylith3d_read_mathist__name__[];
-// extern char pypylith3d_read_mathist__doc__[];
-// extern "C"
-// PyObject * pypylith3d_read_mathist(PyObject *, PyObject *);
-
-// read prestresses
-// extern char pypylith3d_read_prestr__name__[];
-// extern char pypylith3d_read_prestr__doc__[];
-// extern "C"
-// PyObject * pypylith3d_read_prestr(PyObject *, PyObject *);
-
-// read local coordinate rotations
-extern char pypylith3d_read_skew__name__[];
-extern char pypylith3d_read_skew__doc__[];
-extern "C"
-PyObject * pypylith3d_read_skew(PyObject *, PyObject *);
-
-// read slippery node definitions
-extern char pypylith3d_read_slip__name__[];
-extern char pypylith3d_read_slip__doc__[];
-extern "C"
-PyObject * pypylith3d_read_slip(PyObject *, PyObject *);
-
-// read split node definitions
-extern char pypylith3d_read_split__name__[];
-extern char pypylith3d_read_split__doc__[];
-extern "C"
-PyObject * pypylith3d_read_split(PyObject *, PyObject *);
-
-// read state output information
-extern char pypylith3d_read_stateout__name__[];
-extern char pypylith3d_read_stateout__doc__[];
-extern "C"
-PyObject * pypylith3d_read_stateout(PyObject *, PyObject *);
-
-// read time step group informations
-extern char pypylith3d_read_timdat__name__[];
-extern char pypylith3d_read_timdat__doc__[];
-extern "C"
-PyObject * pypylith3d_read_timdat(PyObject *, PyObject *);
-
-// read traction boundary conditions
-extern char pypylith3d_read_tractions__name__[];
-extern char pypylith3d_read_tractions__doc__[];
-extern "C"
-PyObject * pypylith3d_read_tractions(PyObject *, PyObject *);
-
-// read winkler force information
-extern char pypylith3d_read_wink__name__[];
-extern char pypylith3d_read_wink__doc__[];
-extern "C"
-PyObject * pypylith3d_read_wink(PyObject *, PyObject *);
-
-
-// sort elements into element families
-extern char pypylith3d_sort_elements__name__[];
-extern char pypylith3d_sort_elements__doc__[];
-extern "C"
-PyObject * pypylith3d_sort_elements(PyObject *, PyObject *);
-
-// Sort slippery nodes according to reordered elements
-extern char pypylith3d_sort_slip_nodes__name__[];
-extern char pypylith3d_sort_slip_nodes__doc__[];
-extern "C"
-PyObject * pypylith3d_sort_slip_nodes(PyObject *, PyObject *);
-
-// Sort split nodes according to reordered elements
-extern char pypylith3d_sort_split_nodes__name__[];
-extern char pypylith3d_sort_split_nodes__doc__[];
-extern "C"
-PyObject * pypylith3d_sort_split_nodes(PyObject *, PyObject *);
-
-
-// compute maximum number of nonzero entries in stiffness matrix
-extern char pypylith3d_cmp_stiffsz__name__[];
-extern char pypylith3d_cmp_stiffsz__doc__[];
-extern "C"
-PyObject * pypylith3d_cmp_stiffsz(PyObject *, PyObject *);
-
-// create linked list for sparse matrix
-extern char pypylith3d_lnklst__name__[];
-extern char pypylith3d_lnklst__doc__[];
-extern "C"
-PyObject * pypylith3d_lnklst(PyObject *, PyObject *);
-
-// localize id array for reference by element
-extern char pypylith3d_local__name__[];
-extern char pypylith3d_local__doc__[];
-extern "C"
-PyObject * pypylith3d_local(PyObject *, PyObject *);
-
-// localize nfault array for reference by element
-extern char pypylith3d_localf__name__[];
-extern char pypylith3d_localf__doc__[];
-extern "C"
-PyObject * pypylith3d_localf(PyObject *, PyObject *);
-
-// localize idx array for reference by element
-extern char pypylith3d_localx__name__[];
-extern char pypylith3d_localx__doc__[];
-extern "C"
-PyObject * pypylith3d_localx(PyObject *, PyObject *);
-
-// create sparse matrix in modified sparse row format
-extern char pypylith3d_makemsr__name__[];
-extern char pypylith3d_makemsr__doc__[];
-extern "C"
-PyObject * pypylith3d_makemsr(PyObject *, PyObject *);
-
-
-// drive time-dependent solution
-extern char pypylith3d_viscos__name__[];
-extern char pypylith3d_viscos__doc__[];
-extern "C"
-PyObject * pypylith3d_viscos(PyObject *, PyObject *);
-
-// setup time-dependent solution
-extern char pypylith3d_viscos_setup__name__[];
-extern char pypylith3d_viscos_setup__doc__[];
-extern "C"
-PyObject * pypylith3d_viscos_setup(PyObject *, PyObject *);
-
-// drive time-dependent solution
-extern char pypylith3d_viscos_step__name__[];
-extern char pypylith3d_viscos_step__doc__[];
-extern "C"
-PyObject * pypylith3d_viscos_step(PyObject *, PyObject *);
-
-// cleanup time-dependent solution
-extern char pypylith3d_viscos_cleanup__name__[];
-extern char pypylith3d_viscos_cleanup__doc__[];
-extern "C"
-PyObject * pypylith3d_viscos_cleanup(PyObject *, PyObject *);
-
-
-// write boundary conditions
-extern char pypylith3d_write_bc__name__[];
-extern char pypylith3d_write_bc__doc__[];
-extern "C"
-PyObject * pypylith3d_write_bc(PyObject *, PyObject *);
-
-// write element node array
-extern char pypylith3d_write_connect__name__[];
-extern char pypylith3d_write_connect__doc__[];
-extern "C"
-PyObject * pypylith3d_write_connect(PyObject *, PyObject *);
-
-// write nodal coordinates
-extern char pypylith3d_write_coords__name__[];
-extern char pypylith3d_write_coords__doc__[];
-extern "C"
-PyObject * pypylith3d_write_coords(PyObject *, PyObject *);
-
-// write differential forces
-extern char pypylith3d_write_diff__name__[];
-extern char pypylith3d_write_diff__doc__[];
-extern "C"
-PyObject * pypylith3d_write_diff(PyObject *, PyObject *);
-
-// write out element and prestress information
-extern char pypylith3d_write_element_info__name__[];
-extern char pypylith3d_write_element_info__doc__[];
-extern "C"
-PyObject * pypylith3d_write_element_info(PyObject *, PyObject *);
-
-// write time steps at which full output is desired
-extern char pypylith3d_write_fuldat__name__[];
-extern char pypylith3d_write_fuldat__doc__[];
-extern "C"
-PyObject * pypylith3d_write_fuldat(PyObject *, PyObject *);
-
-// write out global control information
-extern char pypylith3d_write_global_info__name__[];
-extern char pypylith3d_write_global_info__doc__[];
-extern "C"
-PyObject * pypylith3d_write_global_info(PyObject *, PyObject *);
-
-// write load histories
-extern char pypylith3d_write_hist__name__[];
-extern char pypylith3d_write_hist__doc__[];
-extern "C"
-PyObject * pypylith3d_write_hist(PyObject *, PyObject *);
-
-// write out material property info
-extern char pypylith3d_write_props__name__[];
-extern char pypylith3d_write_props__doc__[];
-extern "C"
-PyObject * pypylith3d_write_props(PyObject *, PyObject *);
-
-// write local coordinate rotations
-extern char pypylith3d_write_skew__name__[];
-extern char pypylith3d_write_skew__doc__[];
-extern "C"
-PyObject * pypylith3d_write_skew(PyObject *, PyObject *);
-
-// write slippery node entries
-extern char pypylith3d_write_slip__name__[];
-extern char pypylith3d_write_slip__doc__[];
-extern "C"
-PyObject * pypylith3d_write_slip(PyObject *, PyObject *);
-
-// write out sparse matrix information
-extern char pypylith3d_write_sparse_info__name__[];
-extern char pypylith3d_write_sparse_info__doc__[];
-extern "C"
-PyObject * pypylith3d_write_sparse_info(PyObject *, PyObject *);
-
-// write split node entries
-extern char pypylith3d_write_split__name__[];
-extern char pypylith3d_write_split__doc__[];
-extern "C"
-PyObject * pypylith3d_write_split(PyObject *, PyObject *);
-
-// write split node entries for plot output
-extern char pypylith3d_write_split_plot__name__[];
-extern char pypylith3d_write_split_plot__doc__[];
-extern "C"
-PyObject * pypylith3d_write_split_plot(PyObject *, PyObject *);
-
-// write state output information
-extern char pypylith3d_write_stateout__name__[];
-extern char pypylith3d_write_stateout__doc__[];
-extern "C"
-PyObject * pypylith3d_write_stateout(PyObject *, PyObject *);
-
-// write out stress computation information
-extern char pypylith3d_write_strscomp__name__[];
-extern char pypylith3d_write_strscomp__doc__[];
-extern "C"
-PyObject * pypylith3d_write_strscomp(PyObject *, PyObject *);
-
-// write out subiteration convergence information
-extern char pypylith3d_write_subiter__name__[];
-extern char pypylith3d_write_subiter__doc__[];
-extern "C"
-PyObject * pypylith3d_write_subiter(PyObject *, PyObject *);
-
-// write time step data
-extern char pypylith3d_write_timdat__name__[];
-extern char pypylith3d_write_timdat__doc__[];
-extern "C"
-PyObject * pypylith3d_write_timdat(PyObject *, PyObject *);
-
-// write traction BC
-extern char pypylith3d_write_tractions__name__[];
-extern char pypylith3d_write_tractions__doc__[];
-extern "C"
-PyObject * pypylith3d_write_tractions(PyObject *, PyObject *);
-
-// write mesh info to UCD file
-extern char pypylith3d_write_ucd_mesh__name__[];
-extern char pypylith3d_write_ucd_mesh__doc__[];
-extern "C"
-PyObject * pypylith3d_write_ucd_mesh(PyObject *, PyObject *);
-
-// write winkler BC
-extern char pypylith3d_write_wink__name__[];
-extern char pypylith3d_write_wink__doc__[];
-extern "C"
-PyObject * pypylith3d_write_wink(PyObject *, PyObject *);
-
-// write slippery winkler BC
-extern char pypylith3d_write_winkx__name__[];
-extern char pypylith3d_write_winkx__doc__[];
-extern "C"
-PyObject * pypylith3d_write_winkx(PyObject *, PyObject *);
-
-
-// scan boundary condition file
-extern char pypylith3d_scan_bc__name__[];
-extern char pypylith3d_scan_bc__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_bc(PyObject *, PyObject *);
-
-// scan connectivity file
-extern char pypylith3d_scan_connect__name__[];
-extern char pypylith3d_scan_connect__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_connect(PyObject *, PyObject *);
-
-// scan coordinates file
-extern char pypylith3d_scan_coords__name__[];
-extern char pypylith3d_scan_coords__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_coords(PyObject *, PyObject *);
-
-// scan differential forces file
-extern char pypylith3d_scan_diff__name__[];
-extern char pypylith3d_scan_diff__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_diff(PyObject *, PyObject *);
-
-// scan time step output info file
-extern char pypylith3d_scan_fuldat__name__[];
-extern char pypylith3d_scan_fuldat__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_fuldat(PyObject *, PyObject *);
-
-// scan time history definition file
-extern char pypylith3d_scan_hist__name__[];
-extern char pypylith3d_scan_hist__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_hist(PyObject *, PyObject *);
-
-// scan prestress file
-// extern char pypylith3d_scan_prestr__name__[];
-// extern char pypylith3d_scan_prestr__doc__[];
-// extern "C"
-// PyObject * pypylith3d_scan_prestr(PyObject *, PyObject *);
-
-// scan local coordinate rotations file
-extern char pypylith3d_scan_skew__name__[];
-extern char pypylith3d_scan_skew__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_skew(PyObject *, PyObject *);
-
-// scan slippery node definitions file
-extern char pypylith3d_scan_slip__name__[];
-extern char pypylith3d_scan_slip__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_slip(PyObject *, PyObject *);
-
-// scan split node definitions file
-extern char pypylith3d_scan_split__name__[];
-extern char pypylith3d_scan_split__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_split(PyObject *, PyObject *);
-
-// scan time step group info file
-extern char pypylith3d_scan_timdat__name__[];
-extern char pypylith3d_scan_timdat__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_timdat(PyObject *, PyObject *);
-
-// scan traction boundary conditions file
-extern char pypylith3d_scan_tractions__name__[];
-extern char pypylith3d_scan_tractions__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_tractions(PyObject *, PyObject *);
-
-// scan winkler forces info file
-extern char pypylith3d_scan_wink__name__[];
-extern char pypylith3d_scan_wink__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_wink(PyObject *, PyObject *);
-
-// scan winkler forces info file for slippery nodes
-extern char pypylith3d_scan_winkx__name__[];
-extern char pypylith3d_scan_winkx__doc__[];
-extern "C"
-PyObject * pypylith3d_scan_winkx(PyObject *, PyObject *);
-
-// Initialize material model info
-extern char pypylith3d_matmod_def__name__[];
-extern char pypylith3d_matmod_def__doc__[];
-extern "C"
-PyObject * pypylith3d_matmod_def(PyObject *, PyObject *);
-
-// Precompute shape function info
-extern char pypylith3d_preshape__name__[];
-extern char pypylith3d_preshape__doc__[];
-extern "C"
-PyObject * pypylith3d_preshape(PyObject *, PyObject *);
-
-// Precompute shape function info for element faces
-extern char pypylith3d_preshape2d__name__[];
-extern char pypylith3d_preshape2d__doc__[];
-extern "C"
-PyObject * pypylith3d_preshape2d(PyObject *, PyObject *);
-
-// try_binio
-extern char pypylith3d_try_binio__name__[];
-extern char pypylith3d_try_binio__doc__[];
-extern "C"
-PyObject * pypylith3d_try_binio(PyObject *, PyObject *);
-
-
-#endif // pypylith3d_libpylith3d_h
-
-// end of file
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -28,23 +28,26 @@
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
+#include "mesh.h"
+
+#include "config.h"
+
#include <Distribution.hh>
#include <petscmesh.h>
#include <src/dm/mesh/meshpylith.h>
#include <petscmat.h>
-#include <portinfo>
#include "journal/debug.h"
#include <Python.h>
-#include "mesh.h"
-#include "exceptionhandler.h"
#include <stdio.h>
#include <string.h>
+#include "PyLithMeshLib.h"
+
#undef __FUNCT__
#define __FUNCT__ "IgnoreComments_PyLith"
-PetscErrorCode IgnoreComments_PyLith(char *buf, PetscInt bufSize, FILE *f)
+static PetscErrorCode IgnoreComments_PyLith(char *buf, PetscInt bufSize, FILE *f)
{
PetscFunctionBegin;
while((fgets(buf, bufSize, f) != NULL) && ((buf[0] == '#') || (buf[0] == '\0'))) {}
@@ -53,7 +56,7 @@
#undef __FUNCT__
#define __FUNCT__ "ReadBoundary_PyLith"
-PetscErrorCode ReadBoundary_PyLith(const char *baseFilename, PetscTruth useZeroBase, PetscInt *numBoundaryVertices, PetscInt *numBoundaryComponents, PetscInt **boundaryVertices, PetscScalar **boundaryValues)
+static PetscErrorCode ReadBoundary_PyLith(const char *baseFilename, PetscTruth useZeroBase, PetscInt *numBoundaryVertices, PetscInt *numBoundaryComponents, PetscInt **boundaryVertices, PetscScalar **boundaryValues)
{
FILE *f;
PetscInt maxVerts= 1024, vertexCount = 0;
@@ -130,7 +133,7 @@
#undef __FUNCT__
#define __FUNCT__ "WriteBoundary_PyLith"
-PetscErrorCode WriteBoundary_PyLith(const char *baseFilename, const ALE::Obj<ALE::Mesh>& mesh)
+static PetscErrorCode WriteBoundary_PyLith(const char *baseFilename, const ALE::Obj<ALE::Mesh>& mesh)
{
ALE::Mesh::foliated_section_type::patch_type patch = 0;
const ALE::Obj<ALE::Mesh::numbering_type>& vNumbering = mesh->getFactory()->getLocalNumbering(mesh->getTopology(), patch, 0);
@@ -202,29 +205,12 @@
// Process mesh
-PetscErrorCode MeshView_Sieve(const ALE::Obj<ALE::Mesh>& mesh, PetscViewer viewer);
-
-char pypylith3d_processMesh__doc__[] = "";
-char pypylith3d_processMesh__name__[] = "processMesh";
-
-PyObject * pypylith3d_processMesh(PyObject *, PyObject *args)
+PyObject *PyLithMeshLib::Mesh::_processMesh(PyMeshObject *self)
{
- char *meshInputFile;
- char *meshBcFile;
- int interpolateMesh;
- char* partitioner;
-
- int ok = PyArg_ParseTuple(args, (char *) "ssis:processMesh", &meshBcFile, &meshInputFile, &interpolateMesh, &partitioner);
-
- if (!ok) {
- return 0;
- }
-
using ALE::Obj;
journal::debug_t debug("pylith3d");
MPI_Comm comm = PETSC_COMM_WORLD;
PetscMPIInt rank;
- Mesh mesh;
Obj<ALE::Mesh> m;
PetscViewer viewer;
PetscInt *boundaryVertices;
@@ -234,15 +220,15 @@
PetscErrorCode ierr;
ierr = MPI_Comm_rank(comm, &rank);
- ierr = MeshCreatePyLith(comm, 3, meshInputFile, PETSC_FALSE, (PetscTruth) interpolateMesh, &mesh);
- ierr = MeshGetMesh(mesh, m);
+ ierr = MeshCreatePyLith(comm, 3, self->meshInputFile, PETSC_FALSE, (PetscTruth) self->interpolateMesh, &self->mesh);
+ ierr = MeshGetMesh(self->mesh, m);
m->setDebug(debugFlag);
int numElements = m->getTopology()->heightStratum(0, 0)->size();
- debug << journal::at(__HERE__) << "[" << rank << "]Created new PETSc Mesh for " << meshInputFile << journal::endl;
- m = ALE::New::Distribution<ALE::Mesh::topology_type>::distributeMesh(m, partitioner);
- ierr = MeshSetMesh(mesh, m);
+ debug << journal::at(__HERE__) << "[" << rank << "]Created new PETSc Mesh for " << self->meshInputFile << journal::endl;
+ m = ALE::New::Distribution<ALE::Mesh::topology_type>::distributeMesh(m, self->partitioner);
+ ierr = MeshSetMesh(self->mesh, m);
debug << journal::at(__HERE__) << "[" << rank << "]Distributed PETSc Mesh" << journal::endl;
- ierr = ReadBoundary_PyLith(meshBcFile, PETSC_FALSE, &numBoundaryVertices, &numBoundaryComponents, &boundaryVertices, &boundaryValues);
+ ierr = ReadBoundary_PyLith(self->meshBcFile, PETSC_FALSE, &numBoundaryVertices, &numBoundaryComponents, &boundaryVertices, &boundaryValues);
const Obj<ALE::Mesh::foliated_section_type>& boundaries = m->getBoundariesNew();
ALE::Mesh::foliated_section_type::patch_type patch = 0;
@@ -284,7 +270,7 @@
if (refineMesh) {
double refinementLimit = 2.4e4*2.4e4*2.4e4*0.01*0.5;
bool interpolate = true;
- mesh = ALE::Generator::refine(mesh, refinementLimit, interpolate);
+ self->mesh = ALE::Generator::refine(self->mesh, refinementLimit, interpolate);
}
#endif
@@ -292,13 +278,13 @@
ierr = PetscViewerSetType(viewer, PETSC_VIEWER_ASCII);
ierr = PetscViewerSetFormat(viewer, PETSC_VIEWER_ASCII_PYLITH_LOCAL);
ierr = PetscViewerFileSetMode(viewer, FILE_MODE_READ);
- ierr = PetscExceptionTry1(PetscViewerFileSetName(viewer, meshInputFile), PETSC_ERR_FILE_OPEN);
+ ierr = PetscExceptionTry1(PetscViewerFileSetName(viewer, self->meshInputFile), PETSC_ERR_FILE_OPEN);
if (PetscExceptionValue(ierr)) {
/* this means that a caller above me has also tryed this exception so I don't handle it here, pass it up */
} else if (PetscExceptionCaught(ierr, PETSC_ERR_FILE_OPEN)) {
ierr = 0;
}
- ierr = MeshView(mesh, viewer);
+ ierr = MeshView(self->mesh, viewer);
ierr = PetscViewerDestroy(viewer);
char bcFilename[2048];
@@ -306,23 +292,23 @@
sprintf(suff, "%s%d%s", ".", rank, ".bc");
- int slen = std::strlen(meshBcFile);
- std::strncpy(bcFilename, meshBcFile, slen-3);
- // ierr = PetscStrcpy(bcFilename, meshBcFile.substr(0,slen-4));
+ int slen = std::strlen(self->meshBcFile);
+ std::strncpy(bcFilename, self->meshBcFile, slen-3);
+ // ierr = PetscStrcpy(bcFilename, self->meshBcFile.substr(0,slen-4));
ierr = PetscStrcat(bcFilename, suff);
debug << journal::at(__HERE__) << "[" << rank << "]Output new PyLith mesh into: " << bcFilename << journal::endl;
- ierr = WriteBoundary_PyLith(meshBcFile, m);
+ ierr = WriteBoundary_PyLith(self->meshBcFile, m);
debug << journal::at(__HERE__) << "[" << rank << "]Wrote PyLith boundary conditions" << journal::endl;
const Obj<ALE::Mesh::topology_type::label_sequence>& vertices = m->getTopology()->depthStratum(0, 0);
SectionReal section;
Obj<ALE::Mesh::real_section_type> s;
- ierr = MeshGetSectionReal(mesh, "default", §ion);
+ ierr = MeshGetSectionReal(self->mesh, "default", §ion);
ierr = PetscObjectSetName((PetscObject) section, "displacement");
- ierr = MeshSetSectionReal(mesh, section);
+ ierr = MeshSetSectionReal(self->mesh, section);
ierr = SectionRealGetSection(section, s);
s->setFiberDimensionByDepth(0, 0, 3);
for(ALE::Mesh::topology_type::label_sequence::iterator v_iter = vertices->begin(); v_iter != vertices->end(); ++v_iter) {
@@ -344,76 +330,61 @@
m->getFactory()->constructInverseOrder(m->getFactory()->getLocalNumbering(m->getTopology(), 0, m->getTopology()->depth()));
- // return
- PyObject *pyMesh = PyCObject_FromVoidPtr(mesh, NULL);
- //PyObject *pyMesh = PyCObject_FromVoidPtr(mesh.ptr(), NULL);
- //mesh.int_allocator->del(mesh.refCnt);
- //mesh.refCnt = NULL;
- return pyMesh;
+ Py_INCREF(Py_None);
+ return Py_None;
}
// Create a PETSc Mat
-char pypylith3d_createPETScMat__doc__[] = "";
-char pypylith3d_createPETScMat__name__[] = "createPETScMat";
-PyObject * pypylith3d_createPETScMat(PyObject *, PyObject *args)
+PyObject *PyLithMeshLib::Mesh::_createMat(PyMeshObject *self)
{
using ALE::Obj;
- PyObject *pyMesh, *pyA, *pyRhs, *pySol;
MPI_Comm comm = PETSC_COMM_WORLD;
- Mat A;
- Vec rhs, sol;
PetscErrorCode ierr;
- int ok = PyArg_ParseTuple(args, (char *) "O:createPETScMat", &pyMesh);
- if (!ok) {
- return 0;
- }
-
- Mesh mesh = (Mesh) PyCObject_AsVoidPtr(pyMesh);
Obj<ALE::Mesh> m;
- ierr = MeshGetMesh(mesh, m);
+ ierr = MeshGetMesh(self->mesh, m);
const ALE::Obj<ALE::Mesh::order_type>& offsets = m->getFactory()->getGlobalOrder(m->getTopology(), 0, "displacement", m->getRealSection("displacement")->getAtlas());
int localSize = offsets->getLocalSize();
int globalSize = offsets->getGlobalSize();
- if (MatCreate(comm, &A)) {
+ if (MatCreate(comm, &self->A)) {
PyErr_SetString(PyExc_RuntimeError, "Could not create PETSc Mat");
return 0;
}
- if (MatSetSizes(A, localSize, localSize, globalSize, globalSize)) {
+ if (MatSetSizes(self->A, localSize, localSize, globalSize, globalSize)) {
PyErr_SetString(PyExc_RuntimeError, "Could not set sizes for PETSc Mat");
return 0;
}
- if (VecCreate(comm, &rhs)) {
+ if (VecCreate(comm, &self->rhs)) {
PyErr_SetString(PyExc_RuntimeError, "Could not create PETSc Rhs");
return 0;
}
- if (VecSetSizes(rhs, localSize, globalSize)) {
+ if (VecSetSizes(self->rhs, localSize, globalSize)) {
PyErr_SetString(PyExc_RuntimeError, "Could not set sizes for PETSc Rhs");
return 0;
}
- if (VecSetFromOptions(rhs)) {
+ if (VecSetFromOptions(self->rhs)) {
PyErr_SetString(PyExc_RuntimeError, "Could not set options for PETSc Rhs");
return 0;
}
- if (VecDuplicate(rhs, &sol)) {
+ if (VecDuplicate(self->rhs, &self->sol)) {
PyErr_SetString(PyExc_RuntimeError, "Could not create PETSc Sol");
return 0;
}
- ierr = PetscObjectCompose((PetscObject) A, "mesh", (PetscObject) mesh);
+ ierr = PetscObjectCompose((PetscObject) self->A, "mesh", (PetscObject) self->mesh);
VecScatter injection = NULL;
- ierr = MeshGetGlobalScatter(mesh, &injection);
- ierr = PetscObjectCompose((PetscObject) rhs, "mesh", (PetscObject) mesh);
- ierr = PetscObjectCompose((PetscObject) rhs, "injection", (PetscObject) injection);
- ierr = PetscObjectCompose((PetscObject) sol, "mesh", (PetscObject) mesh);
- ierr = PetscObjectCompose((PetscObject) sol, "injection", (PetscObject) injection);
+ ierr = MeshGetGlobalScatter(self->mesh, &injection);
+ ierr = PetscObjectCompose((PetscObject) self->rhs, "mesh", (PetscObject) self->mesh);
+ ierr = PetscObjectCompose((PetscObject) self->rhs, "injection", (PetscObject) injection);
+ ierr = PetscObjectCompose((PetscObject) self->sol, "mesh", (PetscObject) self->mesh);
+ ierr = PetscObjectCompose((PetscObject) self->sol, "injection", (PetscObject) injection);
- ierr = MatSetFromOptions(A);
- ierr = preallocateMatrix(m->getTopology(), m->getRealSection("displacement")->getAtlas(), m->getFactory()->getGlobalOrder(m->getTopology(), 0, "displacement", m->getRealSection("displacement")->getAtlas()), A);
+ ierr = MatSetFromOptions(self->A);
+ ierr = preallocateMatrix(m->getTopology(), m->getRealSection("displacement")->getAtlas(), m->getFactory()->getGlobalOrder(m->getTopology(), 0, "displacement", m->getRealSection("displacement")->getAtlas()), self->A);
journal::debug_t debug("pylith3d");
debug
@@ -421,44 +392,31 @@
<< "Created PETSc Mat: " << localSize << " " << globalSize
<< journal::endl;
- // return Py_None;
- pyA = PyCObject_FromVoidPtr(A, NULL);
- pyRhs = PyCObject_FromVoidPtr(rhs, NULL);
- pySol = PyCObject_FromVoidPtr(sol, NULL);
- return Py_BuildValue((char *) "NNN", pyA, pyRhs, pySol);
+ Py_INCREF(Py_None);
+ return Py_None;
}
// Destroy a PETSc Mat
-char pypylith3d_destroyPETScMat__doc__[] = "";
-char pypylith3d_destroyPETScMat__name__[] = "destroyPETScMat";
-
-PyObject * pypylith3d_destroyPETScMat(PyObject *, PyObject *args)
+PyObject *PyLithMeshLib::Mesh::_destroyMat(PyMeshObject *self)
{
- PyObject *pyA,*pyRhs, *pySol;
- Mat A;
- Vec rhs, sol;
-
- int ok = PyArg_ParseTuple(args, (char *) "OOO:destroyPETScMat", &pyA, &pyRhs, &pySol);
- if (!ok) {
- return 0;
- }
-
- A = (Mat) PyCObject_AsVoidPtr(pyA);
- if (MatDestroy(A)) {
+ if (MatDestroy(self->A)) {
PyErr_SetString(PyExc_RuntimeError, "Could not destroy PETSc Mat");
return 0;
}
- rhs = (Vec) PyCObject_AsVoidPtr(pyRhs);
- if (VecDestroy(rhs)) {
+ self->A = 0;
+
+ if (VecDestroy(self->rhs)) {
PyErr_SetString(PyExc_RuntimeError, "Could not destroy PETSc Rhs");
return 0;
}
- sol = (Vec) PyCObject_AsVoidPtr(pySol);
- if (VecDestroy(sol)) {
+ self->rhs = 0;
+
+ if (VecDestroy(self->sol)) {
PyErr_SetString(PyExc_RuntimeError, "Could not destroy PETSc Sol");
return 0;
}
+ self->sol = 0;
journal::debug_t debug("pylith3d");
debug
@@ -466,7 +424,6 @@
<< "Destroyed PETSc Mat"
<< journal::endl;
- // return Py_None;
Py_INCREF(Py_None);
return Py_None;
}
@@ -541,47 +498,35 @@
PetscFunctionReturn(0);
}
-char pypylith3d_outputMesh__doc__[] = "";
-char pypylith3d_outputMesh__name__[] = "outputMesh";
-
-PyObject * pypylith3d_outputMesh(PyObject *, PyObject *args)
+PyObject *PyLithMeshLib::Mesh::_outputMesh(PyMeshObject *self, char *fileRoot)
{
using ALE::Obj;
- PyObject *pyMesh, *pySol;
- char *meshBaseFile;
- int ok = PyArg_ParseTuple(args, (char *) "sOO:outputMesh", &meshBaseFile, &pyMesh, &pySol);
- if (!ok) {
- return 0;
- }
-
- Mesh mesh = (Mesh) PyCObject_AsVoidPtr(pyMesh);
- Vec sol = (Vec) PyCObject_AsVoidPtr(pySol);
MPI_Comm comm;
SectionReal displacement, fullDisplacement;
- std::string filename(meshBaseFile);
+ std::string filename(fileRoot);
PetscViewer viewer;
//Vec partition;
PetscTruth hasMaterial;
PetscErrorCode ierr;
- ierr = PetscObjectGetComm((PetscObject) mesh, &comm);
- ierr = MeshGetSectionReal(mesh, "displacement", &displacement);
- ierr = updateDisplacement(displacement, sol);
- ierr = createFullDisplacement(mesh, &fullDisplacement);
+ ierr = PetscObjectGetComm((PetscObject) self->mesh, &comm);
+ ierr = MeshGetSectionReal(self->mesh, "displacement", &displacement);
+ ierr = updateDisplacement(displacement, self->sol);
+ ierr = createFullDisplacement(self->mesh, &fullDisplacement);
ierr = PetscViewerCreate(comm, &viewer);
ierr = PetscViewerSetType(viewer, PETSC_VIEWER_ASCII);
ierr = PetscViewerSetFormat(viewer, PETSC_VIEWER_ASCII_VTK);
filename += ".vtk";
ierr = PetscViewerFileSetName(viewer, filename.c_str());
- ierr = MeshView(mesh, viewer);
+ ierr = MeshView(self->mesh, viewer);
ierr = SectionRealView(fullDisplacement, viewer);
- ierr = MeshHasSectionInt(mesh, "material", &hasMaterial);
+ ierr = MeshHasSectionInt(self->mesh, "material", &hasMaterial);
if (hasMaterial) {
SectionInt material;
ierr = PetscViewerPushFormat(viewer, PETSC_VIEWER_ASCII_VTK_CELL);
- ierr = MeshGetSectionInt(mesh, "material", &material);
+ ierr = MeshGetSectionInt(self->mesh, "material", &material);
ierr = SectionIntView(material, viewer);
ierr = PetscViewerPopFormat(viewer);
ierr = SectionIntDestroy(material);
@@ -597,73 +542,9 @@
<< "Output PETSc Mesh and Solution"
<< journal::endl;
- // return Py_None;
Py_INCREF(Py_None);
return Py_None;
}
-#if 0
-#include "Numeric/arrayobject.h"
-char pypylith3d_interpolatePoints__doc__[] = "";
-char pypylith3d_interpolatePoints__name__[] = "interpolatePoints";
-
-PyObject * pypylith3d_interpolatePoints(PyObject *, PyObject *args)
-{
- using ALE::Obj;
- PyObject *pyMesh, *pySol;
- PyArrayObject *pyPoints;
-
- int ok = PyArg_ParseTuple(args, (char *) "OOO!:interpolatePoints", &pyMesh, &pySol, &PyArray_Type, &pyPoints);
- if (!ok) {
- return 0;
- }
- if ((pyPoints->nd != 2) || (pyPoints->descr->type_num != PyArray_DOUBLE)) {
- PyErr_SetString(PyExc_ValueError, "points must be a 2d array with double values");
- return 0;
- }
- if (pyPoints->dimensions[1] != 3) {
- PyErr_SetString(PyExc_ValueError, "points must be a 3d");
- return 0;
- }
- if ((pyPoints->strides[0] != 3 * sizeof(double)) || (pyPoints->strides[1] != sizeof(double))) {
- PyErr_SetString(PyExc_ValueError, "points must be a contiguous array");
- return 0;
- }
-
- Mesh mesh = (Mesh) PyCObject_AsVoidPtr(pyMesh);
- Vec sol = (Vec) PyCObject_AsVoidPtr(pySol);
- SectionReal displacement, fullDisplacement;
- const int numPoints = pyPoints->dimensions[0];
- double *values;
- PetscErrorCode ierr;
-
- ierr = MeshGetSectionReal(mesh, "displacement", &displacement);
- ierr = updateDisplacement(displacement, sol);
- ierr = createFullDisplacement(mesh, &fullDisplacement);
- ierr = MeshInterpolatePoints(mesh, fullDisplacement, numPoints, (double *) pyPoints->data, &values);
- ierr = SectionRealDestroy(displacement);
- ierr = PetscFree(values);
-
- int dims[2] = {numPoints, 3};
- PyArrayObject *pyValues = (PyArrayObject *) PyArray_FromDims(2, dims, PyArray_DOUBLE);
- double *data = (double *) pyValues->data;
-
- for(int p = 0; p < numPoints; ++p) {
- for(int d = 0; d < 3; d++) {
- data[p*3+d] = values[p*3+d];
- }
- }
-
- ierr = PetscFree(values);
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "Interpolated points"
- << journal::endl;
-
- return Py_BuildValue((char *) "N", pyValues);
-}
-#endif
-
// End of file
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -31,30 +31,34 @@
#if !defined(pypylith3d_mesh_h)
#define pypylith3d_mesh_h
-// process mesh
-extern char pypylith3d_processMesh__name__[];
-extern char pypylith3d_processMesh__doc__[];
-extern "C"
-PyObject * pypylith3d_processMesh(PyObject *, PyObject *);
-// create a PETSc Mat
-extern char pypylith3d_createPETScMat__name__[];
-extern char pypylith3d_createPETScMat__doc__[];
-extern "C"
-PyObject * pypylith3d_createPETScMat(PyObject *, PyObject *);
+#include <Python.h>
-// destroy a PETSc Mat
-extern char pypylith3d_destroyPETScMat__name__[];
-extern char pypylith3d_destroyPETScMat__doc__[];
-extern "C"
-PyObject * pypylith3d_destroyPETScMat(PyObject *, PyObject *);
-// output a PETSc Mesh and Fields
-extern char pypylith3d_outputMesh__name__[];
-extern char pypylith3d_outputMesh__doc__[];
-extern "C"
-PyObject * pypylith3d_outputMesh(PyObject *, PyObject *);
+struct PyMeshObject;
+
+namespace PyLithMeshLib {
+
+ namespace Mesh {
+
+ // process mesh
+ PyObject *_processMesh(PyMeshObject *self);
+
+ // create a PETSc Mat
+ PyObject *_createMat(PyMeshObject *self);
+
+ // destroy a PETSc Mat
+ PyObject *_destroyMat(PyMeshObject *self);
+
+ // output a PETSc Mesh and Fields
+ PyObject *_outputMesh(PyMeshObject *self, char *fileRoot);
+
+ }
+
+}
+
+
#endif
-// End of file
+// end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/misc.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/misc.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/misc.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,58 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#include <petscmat.h>
-#include <portinfo>
-#include "journal/debug.h"
-
-#include <Python.h>
-
-#include "misc.h"
-#include "exceptionhandler.h"
-
-
-// copyright
-
-char pypylith3d_copyright__doc__[] = "";
-char pypylith3d_copyright__name__[] = "copyright";
-
-static char pypylith3d_copyright_note[] =
- "pylith3d python module: Copyright (c) 2005 Rensselaer Polytechnic Institute";
-
-
-PyObject * pypylith3d_copyright(PyObject *, PyObject *)
-{
- return Py_BuildValue("s", pypylith3d_copyright_note);
-}
-
-// version
-// $Id: misc.cc,v 1.2 2005/03/31 23:27:57 willic3 Exp $
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/misc.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/misc.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/misc.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,45 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pypylith3d_misc_h)
-#define pypylith3d_misc_h
-
-// copyright
-extern char pypylith3d_copyright__name__[];
-extern char pypylith3d_copyright__doc__[];
-extern "C"
-PyObject * pypylith3d_copyright(PyObject *, PyObject *);
-
-#endif
-
-// version
-// $Id: misc.h,v 1.2 2005/03/31 23:27:58 willic3 Exp $
-
-// End of file
Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petsc.pxd
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petsc.pxd 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petsc.pxd 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,74 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+cdef extern from "const.h":
+ ctypedef char const_char # Pyrex v0.9.5 doesn't support 'const'
+
+
+cdef extern from "petsc.h":
+ ctypedef int PetscErrorCode
+ ctypedef int PetscEvent
+ ctypedef int PetscCookie
+ ctypedef int PetscInt
+ PetscErrorCode PetscInitialize(int *, char ***, const_char *, const_char *)
+ PetscErrorCode PetscFinalize()
+
+
+cdef extern from "petscerror.h":
+ PetscErrorCode PetscErrorMessage(int, const_char **, char **)
+
+
+cdef extern from "petscvec.h":
+ struct _p_Vec
+ ctypedef _p_Vec *Vec
+
+
+cdef extern from "petscmat.h":
+ struct _p_Mat
+ ctypedef _p_Mat *Mat
+
+
+cdef extern from "petscmeshfwd.h": # for compilation speed
+ struct _p_Mesh
+ ctypedef _p_Mesh *Mesh
+ PetscErrorCode MeshDestroy(Mesh)
+
+
+cdef extern from "petsclog.h":
+ PetscErrorCode PetscLogStageRegister(int *, char *)
+ PetscErrorCode PetscLogEventRegister(PetscEvent *, char *, PetscCookie)
+
+
+cdef extern from "petscsnes.h":
+ enum:
+ KSP_COOKIE
+
+
+# end of file
Added: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petscmeshfwd.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petscmeshfwd.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petscmeshfwd.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+//
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+//
+// Copyright (c) 2004-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.
+//
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+
+#if !defined(pypylith3d_petscmeshfwd_h)
+#define pypylith3d_petscmeshfwd_h
+
+
+#include <petsc.h>
+
+
+typedef struct _p_Mesh *Mesh;
+
+PetscErrorCode MeshDestroy(Mesh);
+
+
+#endif
+
+// end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3d_externs.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3d_externs.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3d_externs.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,1352 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pylith3d_externs_h)
-#define pylith3d_externs_h
-
-#include <stddef.h>
-#include <petscmat.h>
-
-#define assign_wink_f FC_FUNC_(assign_wink, ASSIGN_WINK)
-#define autoprestr_f FC_FUNC(autoprestr, AUTOPRESTR)
-#define cmp_stiffsz_f FC_FUNC_(cmp_stiffsz, CMP_STIFFSZ)
-#define create_id_f FC_FUNC_(create_id, CREATE_ID)
-#define elastc_f FC_FUNC(elastc, ELASTC)
-#define id_split_f FC_FUNC_(id_split, ID_SPLIT)
-#define lnklst_f FC_FUNC(lnklst, LNKLST)
-#define local_f FC_FUNC(local, LOCAL)
-#define localf_f FC_FUNC(localf, LOCALF)
-#define localx_f FC_FUNC(localx, LOCALX)
-#define makemsr_f FC_FUNC(makemsr, MAKEMSR)
-#define matmod_def_f FC_FUNC_(matmod_def, MATMOD_DEF)
-#define nfind_f FC_FUNC(nfind, NFIND)
-#define preshape_f FC_FUNC(preshape, PRESHAPE)
-#define preshape2d_f FC_FUNC(preshape2d, PRESHAPE2D)
-#define read_bc_f FC_FUNC_(read_bc, READ_BC)
-#define read_connect_f FC_FUNC_(read_connect, READ_CONNECT)
-#define read_coords_f FC_FUNC_(read_coords, READ_COORDS)
-#define read_diff_f FC_FUNC_(read_diff, READ_DIFF)
-#define read_fuldat_f FC_FUNC_(read_fuldat, READ_FULDAT)
-#define read_hist_f FC_FUNC_(read_hist, READ_HIST)
-// #define read_mathist_f FC_FUNC_(read_mathist, READ_MATHIST)
-// #define read_prestr_f FC_FUNC_(read_prestr, READ_PRESTR)
-#define read_skew_f FC_FUNC_(read_skew, READ_SKEW)
-#define read_slip_f FC_FUNC_(read_slip, READ_SLIP)
-#define read_split_f FC_FUNC_(read_split, READ_SPLIT)
-#define read_stateout_f FC_FUNC_(read_stateout, READ_STATEOUT)
-#define read_timdat_f FC_FUNC_(read_timdat, READ_TIMDAT)
-#define read_tractions_f FC_FUNC_(read_tractions, READ_TRACTIONS)
-#define read_wink_f FC_FUNC_(read_wink, READ_WINK)
-// #define read_winkx_f FC_FUNC_(read_winkx, READ_WINKX)
-#define scan_bc_f FC_FUNC_(scan_bc, SCAN_BC)
-#define scan_connect_f FC_FUNC_(scan_connect, SCAN_CONNECT)
-#define scan_coords_f FC_FUNC_(scan_coords, SCAN_COORDS)
-#define scan_diff_f FC_FUNC_(scan_diff, SCAN_DIFF)
-#define scan_fuldat_f FC_FUNC_(scan_fuldat, SCAN_FULDAT)
-#define scan_hist_f FC_FUNC_(scan_hist, SCAN_HIST)
-// #define scan_prestr_f FC_FUNC_(scan_prestr, SCAN_PRESTR)
-#define scan_skew_f FC_FUNC_(scan_skew, SCAN_SKEW)
-#define scan_slip_f FC_FUNC_(scan_slip, SCAN_SLIP)
-#define scan_split_f FC_FUNC_(scan_split, SCAN_SPLIT)
-#define scan_timdat_f FC_FUNC_(scan_timdat, SCAN_TIMDAT)
-#define scan_tractions_f FC_FUNC_(scan_tractions, SCAN_TRACTIONS)
-#define scan_wink_f FC_FUNC_(scan_wink, SCAN_WINK)
-#define scan_winkx_f FC_FUNC_(scan_winkx, SCAN_WINKX)
-#define sort_elements_f FC_FUNC_(sort_elements, SORT_ELEMENTS)
-#define sort_slip_nodes_f FC_FUNC_(sort_slip_nodes, SORT_SLIP_NODES)
-#define sort_split_nodes_f FC_FUNC_(sort_split_nodes, SORT_SPLIT_NODES)
-#define try_binio_f FC_FUNC_(try_binio, TRY_BINIO)
-#define viscos_f FC_FUNC(viscos, VISCOS)
-#define viscos_setup_f FC_FUNC_(viscos_setup, VISCOS_SETUP)
-#define viscos_step_f FC_FUNC_(viscos_step, VISCOS_STEP)
-#define viscos_cleanup_f FC_FUNC_(viscos_cleanup, VISCOS_CLEANUP)
-#define write_bc_f FC_FUNC_(write_bc, WRITE_BC)
-#define write_connect_f FC_FUNC_(write_connect, WRITE_CONNECT)
-#define write_coords_f FC_FUNC_(write_coords, WRITE_COORDS)
-#define write_diff_f FC_FUNC_(write_diff, WRITE_DIFF)
-#define write_element_info_f FC_FUNC_(write_element_info, WRITE_ELEMENT_INFO)
-#define write_fuldat_f FC_FUNC_(write_fuldat, WRITE_FULDAT)
-#define write_global_info_f FC_FUNC_(write_global_info, WRITE_GLOBAL_INFO)
-#define write_hist_f FC_FUNC_(write_hist, WRITE_HIST)
-#define write_props_f FC_FUNC_(write_props, WRITE_PROPS)
-#define write_skew_f FC_FUNC_(write_skew, WRITE_SKEW)
-#define write_slip_f FC_FUNC_(write_slip, WRITE_SLIP)
-#define write_sparse_info_f FC_FUNC_(write_sparse_info, WRITE_SPARSE_INFO)
-#define write_split_f FC_FUNC_(write_split, WRITE_SPLIT)
-#define write_split_plot_f FC_FUNC_(write_split_plot, WRITE_SPLIT_PLOT)
-#define write_stateout_f FC_FUNC_(write_stateout, WRITE_STATEOUT)
-#define write_strscomp_f FC_FUNC_(write_strscomp, WRITE_STRSCOMP)
-#define write_subiter_f FC_FUNC_(write_subiter, WRITE_SUBITER)
-#define write_timdat_f FC_FUNC_(write_timdat, WRITE_TIMDAT)
-#define write_tractions_f FC_FUNC_(write_tractions, WRITE_TRACTIONS)
-#define write_ucd_mesh_f FC_FUNC_(write_ucd_mesh, WRITE_UCD_MESH)
-#define write_wink_f FC_FUNC_(write_wink, WRITE_WINK)
-#define write_winkx_f FC_FUNC_(write_winkx, WRITE_WINKX)
-
-extern "C" {
-
- void assign_wink_f(double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *);
-
- void autoprestr_f(Mat *, // sparse
- Vec *,
- Vec *,
- double *, // force
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- int *,
- double *,
- double *, // global
- double *,
- double *,
- double *,
- int *,
- int *,
- double *,
- int *,
- int *,
- int *, // bc
- double *,
- double *, // slip
- double *,
- double *,
- double *,
- int *,
- int *,
- double *,
- int *,
- int *,
- int *,
- double *, // split
- int *,
- double *,
- double *,
- double *, // stiff
- double *,
- double *, // element
- double *,
- double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *, // traction
- double *,
- double *,
- double *,
- int *,
- double *, // material
- int *,
- double *, // element type
- double *,
- double *,
- int *,
- double *, // time data
- double *,
- int *,
- int *,
- int *,
- double *,
- double *,
- int *,
- int *,
- int *,
- double *,
- double *,
- double *,
- int *,
- double *, // iterations
- double *, // skew
- int *, // i/o info
- int *,
- int *,
- int *,
- int *,
- char *, // files
- char *,
- char *,
- int *, // PETSc logging
- int *,
- int *, // error codes
- char *,
- size_t, // string lengths
- size_t,
- size_t,
- size_t);
-
- void cmp_stiffsz_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,size_t);
-
- void create_id_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *);
-
- void elastc_f(Mat *, // sparse
- Vec *,
- Vec *,
- double *, // force
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- int *,
- double *,
- double *, // global
- double *,
- double *,
- double *,
- int *,
- int *,
- double *,
- int *,
- int *,
- int *, // bc
- double *,
- double *, // slip
- double *,
- double *,
- double *,
- int *,
- int *,
- double *,
- int *,
- int *,
- int *,
- double *, // split
- int *,
- double *,
- double *,
- double *, // stiff
- double *,
- double *, // element
- double *,
- double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *, // traction
- double *,
- double *,
- double *,
- int *,
- double *, // material
- int *,
- double *, // element type
- double *,
- double *,
- int *,
- double *, // time data
- double *,
- int *,
- int *,
- int *,
- double *,
- double *,
- int *,
- int *,
- int *,
- double *,
- double *,
- double *,
- int *,
- double *, // iterations
- double *, // skew
- int *, // i/o info
- int *,
- int *,
- int *,
- int *,
- char *, // files
- char *,
- char *,
- int *, // PETSc logging
- int *,
- int *, // error codes
- char *,
- size_t, // string lengths
- size_t,
- size_t,
- size_t);
-
- void id_split_f(int *,
- int *,
- int *,
- int *,
- int *);
-
- void lnklst_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- size_t);
-
- void local_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *);
-
- void localf_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *);
-
- void localx_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *);
-
- void makemsr_f(Mat *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- double *);
-
- void matmod_def_f(int *);
-
- void nfind_f(double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *);
-
- void preshape_f(double *,
- double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,size_t);
-
- void preshape2d_f(double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,size_t);
-
- void read_bc_f(double*,
- double*,
- double*,
- double*,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_connect_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_coords_f(double*,
- double*,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_diff_f(double*,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_fuldat_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_hist_f(double *,
- double *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- // void read_mathist_f(int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// char *,
-// char *,
-// char *,
-// int *,
-// char *,
-// size_t,
-// size_t,
-// size_t,
-// size_t);
-
- // void read_prestr_f(double *,
- // double *,
- // double *,
- // int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // char *,
- // char *,
- // size_t,
- // size_t);
-
- void read_skew_f(double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_slip_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_split_f(double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_stateout_f(int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_timdat_f(double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_tractions_f(int *,
- double *,
- double *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void read_wink_f(double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
-// void read_winkx_f(double *,
-// double *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// int *,
-// char *,
-// char *,
-// int *,
-// char *,
-// size_t,
-// size_t,
-// size_t);
-
- void scan_bc_f(int *,
- int *,
- char *,
- char *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t,
- size_t,
- size_t);
-
- void scan_connect_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void scan_coords_f(int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void scan_diff_f(int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void scan_fuldat_f(int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void scan_hist_f(int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- // void scan_prestr_f(int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // int *,
- // char *,size_t);
-
- void scan_skew_f(int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void scan_slip_f(int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void scan_split_f(int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void scan_timdat_f(int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void scan_tractions_f(int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void scan_wink_f(int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void scan_winkx_f(int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void sort_elements_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- size_t);
-
- void sort_slip_nodes_f(int *,
- int *,
- int *,
- int *);
-
- void sort_split_nodes_f(int *,
- int *,
- int *,
- int *);
-
- void try_binio_f(int *, int *, char *, size_t);
-
- void viscos_f(Mat *, // sparse
- Vec *,
- Vec *,
- double *, // force
- double *,
- double *,
- double *,
- double *,
- double *,
- double *, // 10
- double *,
- double *,
- double *,
- int *,
- double *,
- double *, // global
- double *,
- double *,
- double *,
- int *, // 20
- int *,
- double *,
- int *,
- int *,
- int *, // bc
- double *,
- double *, // slip
- double *,
- double *,
- double *, // 30
- int *,
- int *,
- double *,
- int *,
- int *,
- int *,
- double *, // split
- int *,
- double *,
- double *, // 40
- double *, // stiff
- double *,
- double *, // element
- double *,
- double *,
- double *,
- int *,
- int *,
- int *,
- int *, // 50
- int *,
- int *,
- int *,
- int *, // traction
- double *,
- double *,
- double *,
- int *,
- double *, // material
- int *, // 60
- double *, // element type
- double *,
- double *,
- int *,
- double *, // time data
- double *,
- int *,
- int *,
- int *,
- double *, // 70
- double *,
- int *,
- int *,
- int *,
- double *,
- double *,
- double *,
- int *,
- double *, // iterations
- double *, // 80: skew
- int *, // i/o info
- int *,
- int *,
- int *,
- int *,
- int *,
- char *, // files
- char *,
- char *,
- int *, // 90: PETSC logging
- int *,
- int *, // error codes
- char *,
- size_t, // string lengths
- size_t,
- size_t,
- size_t);
-
- void viscos_setup_f(int *,
- int *,
- char *,
- char *,
- int *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void viscos_step_f(Mat *, // sparse
- Vec *,
- Vec *,
- double *, // force
- double *,
- double *,
- double *,
- double *,
- double *,
- double *, // 10
- double *,
- double *,
- double *,
- int *,
- double *,
- double *, // global
- double *,
- double *,
- double *,
- int *, // 20
- int *,
- double *,
- int *,
- int *,
- int *, // bc
- double *,
- double *, // slip
- double *,
- double *,
- double *, // 30
- int *,
- int *,
- double *,
- int *,
- int *,
- int *,
- double *, // split
- int *,
- double *,
- double *, // 40
- double *, // stiff
- double *,
- double *, // element
- double *,
- double *,
- double *,
- int *,
- int *,
- int *,
- int *, // 50
- int *,
- int *,
- int *,
- int *, // traction
- double *,
- double *,
- double *,
- int *,
- double *, // material
- int *, // 60
- double *, // element type
- double *,
- double *,
- int *,
- double *, // time data
- double *,
- int *,
- int *,
- int *,
- double *, // 70
- double *,
- int *,
- int *,
- int *,
- double *,
- double *,
- double *,
- int *,
- double *, // iterations
- double *, // 80: skew
- int *, // i/o info
- int *,
- int *,
- int *,
- int *,
- int *,
- char *, // files
- char *,
- char *,
- int *, // 90: PETSC logging
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- double *,
- double *,
- int *,
- double *,
- int *, // error codes
- char *,
- size_t, // string lengths
- size_t,
- size_t,
- size_t);
-
- void viscos_cleanup_f(int *,
- int *,
- int *,
- int *,
- char *,
- size_t);
-
- void write_bc_f(double *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void write_connect_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void write_coords_f(double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void write_diff_f(double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void write_element_info_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- double *,
- double *,
- int *,
- int *,
- char *,size_t);
-
- void write_fuldat_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void write_global_info_f(char *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void write_hist_f(double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void write_props_f(double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void write_skew_f(double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void write_slip_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void write_sparse_info_f(int *,
- int *,
- int *,
- int *,
- double *,
- int *,
- int *,
- char *,size_t);
-
- void write_split_f(double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void write_split_plot_f(int *,
- int *,
- int *,
- int *,
- char *,size_t);
-
- void write_stateout_f(int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- char *,
- int *,
- char *,
- size_t,
- size_t,
- size_t);
-
- void write_strscomp_f(double *,
- double *,
- double *,
- int *,
- int *,
- char *,size_t);
-
- void write_subiter_f(int *,
- int *,
- int *,
- char *,size_t);
-
- void write_tractions_f(int *,
- double *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void write_timdat_f(double *,
- double *,
- double *,
- double *,
- double *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void write_ucd_mesh_f(double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,size_t);
-
- void write_wink_f(double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-
- void write_winkx_f(double *,
- int *,
- int *,
- int *,
- int *,
- int *,
- char *,
- int *,
- char *,
- size_t,
- size_t);
-}
-
-#endif // pylith3d_externs_h
-
-
-// version
-// $Id: pylith3d_externs.h,v 1.21 2005/06/24 20:17:43 willic3 Exp $
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3dmodule.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3dmodule.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3dmodule.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,76 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#include <portinfo>
-
-#include <Python.h>
-
-#include "pylith3dmodule.h"
-#include "exceptions.h"
-#include "bindings.h"
-
-
-char pypylith3d_module__doc__[] = "";
-
-void pypylith3d_init(const char *name)
-{
- // create the module and add the functions
- PyObject * m = Py_InitModule4(
- (char *)name, pypylith3d_methods,
- pypylith3d_module__doc__, 0, PYTHON_API_VERSION);
-
- // get its dictionary
- PyObject * d = PyModule_GetDict(m);
-
- // check for errors
- if (PyErr_Occurred()) {
- Py_FatalError("can't initialize module pylith3d");
- }
-
- // install the module exceptions
- pypylith3d_runtimeError = PyErr_NewException("pylith3d.runtime", 0, 0);
- PyDict_SetItemString(d, "RuntimeException", pypylith3d_runtimeError);
-
- return;
-}
-
-// Initialization function for the module (*must* be called initpylith3d)
-extern "C"
-void
-initpylith3d()
-{
- pypylith3d_init("pylith3d");
- return;
-}
-
-// version
-// $Id: pylith3dmodule.cc,v 1.2 2005/03/31 23:27:57 willic3 Exp $
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3dmodule.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3dmodule.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/pylith3dmodule.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,38 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pypylith3d_pylith3dmodule_h)
-#define pypylith3d_pylith3dmodule_h
-
-void pypylith3d_init(const char *name);
-
-#endif
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,146 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#include <petscsnes.h>
-#include <portinfo>
-#include "journal/debug.h"
-
-#include <Python.h>
-
-#include "setup.h"
-#include "exceptionhandler.h"
-#include <stdio.h>
-#include <string.h>
-
-
-// Initialize PETSc
-
-char pypylith3d_petsc_initialize__doc__[] = "";
-char pypylith3d_petsc_initialize__name__[] = "PetscInitialize";
-
-PyObject * pypylith3d_petsc_initialize(PyObject *, PyObject *args)
-{
- PyObject *argList;
- if (!PyArg_ParseTuple(args, "O:PetscInitialize", &argList)) {
- return 0;
- }
-
- int argc = PySequence_Length(argList);
- char **argv = (char **) malloc((argc + 1) * sizeof(char *));
- int a;
-
- for(a = 0; a < argc; a++) {
- char *arg = PyString_AsString(PyList_GetItem(argList, a));
-
- argv[a] = (char *) malloc((strlen(arg)+1)* sizeof(char));
- strcpy(argv[a], arg);
- }
- argv[argc] = NULL;
- if (PetscInitialize(&argc, &argv, NULL, "Pylith 3D")) {
- PyErr_SetString(PyExc_RuntimeError, "PETSc failed to initialize");
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "Initializing PETSc"
- << journal::endl;
-
- // Do not free 'argv' -- PETSc saves a reference to it ('PetscGlobalArgs').
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Finalize PETSc
-
-char pypylith3d_petsc_finalize__doc__[] = "";
-char pypylith3d_petsc_finalize__name__[] = "PetscFinalize";
-
-PyObject * pypylith3d_petsc_finalize(PyObject *, PyObject *)
-{
- if (PetscFinalize()) {
- PyErr_SetString(PyExc_RuntimeError, "PETSc failed to finalize");
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "Finalizing PETSc"
- << journal::endl;
-
- // return
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-// Setup PETSc Logging
-
-char pypylith3d_setup_petsc_logging__doc__[] = "";
-char pypylith3d_setup_petsc_logging__name__[] = "setupPETScLogging";
-
-PyObject * pypylith3d_setup_petsc_logging(PyObject *, PyObject *)
-{
- PetscInt autoprestrStage, elasticStage, viscousStage;
- PetscEvent iterateEvent;
- PyObject *_pyReturn;
-
- if (PetscLogStageRegister(&autoprestrStage, "AutoPrestress Solve")) {
- PyErr_SetString(PyExc_RuntimeError, "PETSc failed to create stage");
- return 0;
- }
- if (PetscLogStageRegister(&elasticStage, "Elastic Solve")) {
- PyErr_SetString(PyExc_RuntimeError, "PETSc failed to create stage");
- return 0;
- }
- if (PetscLogStageRegister(&viscousStage, "Viscous Solve")) {
- PyErr_SetString(PyExc_RuntimeError, "PETSc failed to create stage");
- return 0;
- }
- if (PetscLogEventRegister(&iterateEvent, "Iterate", KSP_COOKIE)) {
- PyErr_SetString(PyExc_RuntimeError, "PETSc failed to create event");
- return 0;
- }
-
- journal::debug_t debug("pylith3d");
- debug
- << journal::at(__HERE__)
- << "Setup PETSc logging"
- << journal::endl;
-
- // return logging handles
- _pyReturn = Py_BuildValue("iiii", autoprestrStage, elasticStage, viscousStage, iterateEvent);
- return _pyReturn;
-}
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.h 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.h 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,57 +0,0 @@
-// -*- C++ -*-
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-//
-// Copyright (c) 2004-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.
-//
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-
-#if !defined(pypylith3d_setup_h)
-#define pypylith3d_setup_h
-
-// Initialize PETSc
-extern char pypylith3d_petsc_initialize__doc__[];
-extern char pypylith3d_petsc_initialize__name__[];
-extern "C"
-PyObject * pypylith3d_petsc_initialize(PyObject *, PyObject *);
-
-// Finalize PETSc
-extern char pypylith3d_petsc_finalize__doc__[];
-extern char pypylith3d_petsc_finalize__name__[];
-extern "C"
-PyObject * pypylith3d_petsc_finalize(PyObject *, PyObject *);
-
-// Setup PETSc Logging
-extern char pypylith3d_setup_petsc_logging__doc__[];
-extern char pypylith3d_setup_petsc_logging__name__[];
-extern "C"
-PyObject * pypylith3d_setup_petsc_logging(PyObject *, PyObject *);
-
-#endif
-
-// version
-// $Id: setup.h,v 1.3 2005/03/31 23:27:58 willic3 Exp $
-
-// End of file
Copied: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.pyx (from rev 6546, short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.cc 2007-04-11 20:20:07 UTC (rev 6546)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/setup.pyx 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,128 @@
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+#cimport petsc
+
+cdef extern from "string.h":
+ char *strcpy(char *, char *)
+
+
+gfile = None
+ghelp = None
+
+
+def PetscInitialize(args, file=None, help=None):
+ cdef int argc
+ cdef char **cargs
+
+ argc = len(args)
+ cargs = <char **>malloc((argc + 1) * sizeof(char *))
+
+ cdef int i
+ cdef char *carg
+ for i from 0 <= i < argc:
+ arg = args[i]
+ carg = arg
+ cargs[i] = <char *>malloc((len(arg)+1) * sizeof(char))
+ strcpy(cargs[i], carg)
+
+ cargs[argc] = NULL
+
+ cdef char *cfile, *chelp
+ cfile = NULL
+ chelp = NULL
+ if file is not None:
+ global gfile
+ gfile = file # Py_INCREF
+ cfile = gfile
+ if help is not None:
+ global ghelp
+ ghelp = help # Py_INCREF
+ chelp = ghelp
+
+ cdef int errnum
+ cdef petsc.const_char *text
+ cdef char *specific
+ errnum = petsc.PetscInitialize(&argc, &cargs, cfile, chelp)
+ if errnum != 0:
+ petsc.PetscErrorMessage(errnum, &text, &specific)
+ raise RuntimeError("PetscInitialize: error %d: %s (%s)" %
+ (errnum, <char*>text, specific))
+
+ # Do not free 'cargs' -- PETSc saves a reference to it ('PetscGlobalArgs').
+
+ return
+
+
+def PetscFinalize():
+ cdef int errnum
+ cdef petsc.const_char *text
+ cdef char *specific
+
+ errnum = petsc.PetscFinalize()
+ if errnum != 0:
+ petsc.PetscErrorMessage(errnum, &text, &specific)
+ raise RuntimeError("PetscFinalize: error %d: %s (%s)" %
+ (errnum, <char*>text, specific))
+
+ return
+
+
+cdef petsc.PetscInt PetscLogStageRegister(sname):
+ cdef int errnum
+ cdef petsc.const_char *text
+ cdef char *specific
+ cdef petsc.PetscInt stage
+
+ errnum = petsc.PetscLogStageRegister(&stage, sname)
+ if errnum != 0:
+ petsc.PetscErrorMessage(errnum, &text, &specific)
+ raise RuntimeError("PetscLogStageRegister('%s'): error %d: %s (%s)" %
+ (sname, errnum, <char*>text, specific))
+
+ return stage
+
+
+cdef petsc.PetscEvent PetscLogEventRegister(name, petsc.PetscCookie cookie):
+ cdef int errnum
+ cdef petsc.const_char *text
+ cdef char *specific
+ cdef petsc.PetscEvent event
+
+ errnum = petsc.PetscLogEventRegister(&event, name, cookie)
+ if errnum != 0:
+ petsc.PetscErrorMessage(errnum, &text, &specific)
+ raise RuntimeError("PetscLogEventRegister('%s'): error %d: %s (%s)" %
+ (name, errnum, <char*>text, specific))
+
+ return event
+
+
+# end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/CodecKeyVal.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/CodecKeyVal.py 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/CodecKeyVal.py 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-#
-# Copyright (c) 2004-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.
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-
-from pyre.inventory.odb.Registry import Registry
-from pyre.odb.fs.CodecODB import CodecODB
-from KeyValParser import KeyValParser
-
-
-class CodecKeyVal(CodecODB):
-
- def __init__(self):
- CodecODB.__init__(self, encoding='keyval')
- return
-
- def _decode(self, shelf):
- stream = open(shelf.name, 'r')
- parser = KeyValParser()
- inventory = parser.parse(stream)
- shelf['inventory'] = inventory
- shelf._frozen = True
- return
-
-
-# End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/ElementTypeDef.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/ElementTypeDef.py 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/ElementTypeDef.py 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,194 +0,0 @@
-#!/usr/bin/env python
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-#
-# Copyright (c) 2004-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.
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-
-import constants
-
-
-class ElementTypeDef:
-
- def getdef(self,
- elementType,
- quadratureOrderInt):
-
- import pylith3d
-
- self.trace.log("Hello from ElementTypeDef.getdef!")
-
- self.nen = self.elementNodes[elementType - 1]
- self.nsnodes = self.elementNodes2d[elementType - 1]
-
- if quadratureOrderInt == 1:
- self.ngauss = self.elementFullGauss[elementType -1]
- self.numberSurfaceElementGaussPoints = self.elementFullGauss2d[elementType -1]
- elif quadratureOrderInt == 2:
- self.ngauss = self.elementReducedGauss[elementType -1]
- self.numberSurfaceElementGaussPoints = self.elementReducedGauss2d[elementType -1]
- elif quadratureOrderInt == 3:
- self.ngauss = self.elementFullGauss[elementType -1]
- self.numberSurfaceElementGaussPoints = self.elementFullGauss2d[elementType -1]
-
- self.nee = constants.numberDegreesFreedom * self.nen
-
- self.numberSurfaceElementEquations = (
- constants.numberDegreesFreedom *
- self.nsnodes
- )
-
- self.numberSurfaceElementCoordinates = (
- constants.numberSpaceDimensions *
- self.nsnodes
- )
-
- self.elementTypeInfo = [self.nen,
- self.ngauss,
- self.nee,
- self.numberVolumeElementCoordinates]
-
- self.elementTypeInfo2d = [self.nsnodes,
- self.numberSurfaceElementGaussPoints,
- self.numberSurfaceElementEquations,
- self.numberSurfaceElementCoordinates]
-
- self.sh = pylith3d.allocateDouble(
- (constants.numberSpaceDimensions+1)*
- self.nen*
- self.ngauss)
-
- self.sh2d = pylith3d.allocateDouble(
- constants.numberSpaceDimensions*
- self.nsnodes*
- self.numberSurfaceElementGaussPoints)
-
- self.shj = pylith3d.allocateDouble(
- (constants.numberSpaceDimensions+1)*
- self.nen*
- self.ngauss)
-
- self.gauss = pylith3d.allocateDouble(
- (constants.numberSpaceDimensions+1)*
- self.ngauss)
-
- self.gauss2d = pylith3d.allocateDouble(
- constants.numberSpaceDimensions*
- self.numberSurfaceElementGaussPoints)
-
- pylith3d.preshape(
- self.sh,
- self.shj,
- self.gauss,
- quadratureOrderInt,
- elementType,
- self.nen,
- self.ngauss)
-
- pylith3d.preshape2d(
- self.sh2d,
- self.gauss2d,
- quadratureOrderInt,
- elementType,
- self.nsnodes,
- self.numberSurfaceElementGaussPoints)
-
- return
-
-
- def __init__(self):
-
- import journal
- self.trace = journal.debug("pylith3d.trace")
-
- self.trace.log("Hello from ElementTypeDef.__init__!")
-
- self.nen = 0
- self.ngauss = 0
- self.nee = 0
- self.numberVolumeElementCoordinates = 0
- self.elementTypeInfo = [0, 0, 0, 0]
- self.pointerToListArrayElementTypeInfo = None
- self.sh = None
- self.shj = None
- self.gauss = None
- self.elementNodes = [ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 7, 6, 5,
- 4,20,20,20,20,20,20,20,20,20,
- 20,20,20,20,20,20,20,20,20,20,
- 20,20,20,20,20,20,20,20,18,15,
- 13,10]
- self.elementFullGauss = [ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 2, 5,
- 1,27,27,27,27,27,27,27,27,27,
- 27,27,27,27,27,27,27,27,27,27,
- 27,27,27,27,27,27,27,27,27, 9,
- 13, 4]
- self.elementReducedGauss = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 2,
- 5, 1]
- self.nsnodes = 0
- self.numberSurfaceElementGaussPoints = 0
- self.numberSurfaceElementEquations = 0
- self.numberSurfaceElementCoordinates = 0
- self.elementTypeInfo2d = [0, 0, 0, 0]
- self.pointerToListArrayElementTypeInfo2d = None
- self.sh2d = None
- self.gauss2d = None
- self.elementNodes2d = [ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 3,
- 3, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 6, 6]
- self.elementFullGauss2d = [ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
- 1, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
- 3, 3]
- self.elementReducedGauss2d = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 1, 1]
- return
-
-# version
-# $Id: ElementTypeDef.py,v 1.2 2005/04/01 23:40:46 willic3 Exp $
-
-# End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/KeyValParser.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/KeyValParser.py 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/KeyValParser.py 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-#
-# Copyright (c) 2004-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.
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-
-from pyre.inventory.odb.Registry import Registry
-import pyre.parsing.locators as locators
-
-
-class KeyValParser:
-
-
- def parse(self, stream):
- registry = Registry("root")
- node = registry.getNode("pylith3d")
- node = node.getNode("scanner")
- lineNumber = 1
- for line in stream:
- locator = locators.file(stream.name, lineNumber)
- self.parseLine(line, node, locator)
- lineNumber = lineNumber + 1
- return registry
-
-
- def parseLine(self, line, registry, locator):
- comment = line.find('#')
- line = line[:comment]
- if line:
- split = line.split('=')
- key = split[0].strip()
- value = "true"
- if len(split) > 1:
- value = '='.join(split[1:]).strip()
- registry.setProperty(key, value, locator)
- return
-
-
-# End of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLith.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLith.py 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLith.py 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,2453 +0,0 @@
-#!/usr/bin/env python
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-#
-# Copyright (c) 2004-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.
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-
-from cig.cs.petsc import PetscApplication
-import constants
-import os
-import pylith3d
-
-
-prestress = False # code for reading prestress input files is presently disabled
-
-
-class PyLith(PetscApplication):
-
-
- name = "pylith3d"
-
-
- #
- # properties
- #
-
- import pyre.inventory as pyre
- from cig.cs.petsc import PetscProperty
-
- MacroString = pyre.str
- OutputFile = pyre.str
- InputFile = pyre.str
-
- # declare PETSc options that are of interest to PyLith
- ksp_monitor = PetscProperty(default="true")
- ksp_view = PetscProperty(default="true")
- ksp_rtol = PetscProperty(default="1.0e-9")
- log_summary = PetscProperty(default="true")
- pc_type = PetscProperty(default="bjacobi")
- sub_pc_type = PetscProperty(default="ilu")
- start_in_debugger = PetscProperty()
- debugger_pause = PetscProperty()
-
- # Title
- title = pyre.str("title", default="PyLith-0.8 Simulation")
- title.meta['tip'] = "Title for this simulation"
-
- # Basename for all files (may be overridden by specific filename entries).
- fileRoot = pyre.str("fileRoot", default="pt1")
- fileRoot.meta['tip'] = "Root pathname for simulation (all filenames derive from this)."
- inputFileRoot = pyre.str("inputFileRoot", default="${fileRoot}")
- inputFileRoot.meta['tip'] = "Root input pathname for simulation (all input filenames derive from this)."
- outputFileRoot = pyre.str("outputFileRoot", default="${fileRoot}")
- outputFileRoot.meta['tip'] = "Root output pathname for simulation (all output filenames derive from this)."
-
- # Output filenames (all are optional).
- ofile = OutputFile("asciiOutputFile",default="${outputFileRoot}.ascii")
- ofile.meta['tip'] = "Pathname for ascii output file (overrides default from outputFileRoot)."
-
- pfile = OutputFile("plotOutputFile",default="${outputFileRoot}.plot")
- pfile.meta['tip'] = "Pathname for plot output file (overrides default from outputFileRoot)."
-
- ucdroot = MacroString("ucdOutputRoot",default="${outputFileRoot}")
- ucdroot.meta['tip'] = "Base name for UCD output files (overrides default from outputFileRoot)."
-
- # Required input files.
- coordinateInputFile = InputFile("coordinateInputFile",default="${inputFileRoot}.coord")
- coordinateInputFile.meta['tip'] = "Pathname for coordinate input file (overrides default from inputFileRoot)."
-
- bcfile = InputFile("bcInputFile",default="${inputFileRoot}.bc")
- bcfile.meta['tip'] = "Pathname for boundary condition input file (overrides default from inputFileRoot)."
-
- timeStepInputFile = InputFile("timeStepInputFile",default="${inputFileRoot}.time")
- timeStepInputFile.meta['tip'] = "Pathname for time step definitions input file (overrides default from inputFileRoot)."
-
- stfile = InputFile("stateVariableInputFile",default="${inputFileRoot}.statevar")
- stfile.meta['tip'] = "Pathname for file defining which state variables to output (overrides default from inputFileRoot)."
-
- materialPropertiesInputFile = InputFile("materialPropertiesInputFile",default="${inputFileRoot}.prop")
- materialPropertiesInputFile.meta['tip'] = "Pathname for file defining material properties (overrides default from inputFileRoot)."
-
- connectivityInputFile = InputFile("connectivityInputFile",default="${inputFileRoot}.connect")
- connectivityInputFile.meta['tip'] = "Pathname for connectivity input file (overrides default from inputFileRoot)."
-
- # This file is only required for time-dependent problems.
- fofile = InputFile("fullOutputInputFile",default="${inputFileRoot}.fuldat")
- fofile.meta['tip'] = "Pathname for file defining when to provide output (overrides default from inputFileRoot)."
-
- # These files are optional unless generating Green's functions, in which case they are required.
- sampleLocationFile = InputFile("sampleLocationFile",default="${inputFileRoot}.sample")
- sampleLocationFile.meta['tip'] = "Pathname for Green's function sample locations (overrides default from inputFileRoot)."
-
- spfile = InputFile("splitNodeInputFile",default="${inputFileRoot}.split")
- spfile.meta['tip'] = "Pathname for split node input file (overrides default from inputFileRoot)."
-
- # Optional input files.
- skfile = InputFile("rotationInputFile",default="${inputFileRoot}.skew")
- skfile.meta['tip'] = "Pathname for skew rotations input file (overrides default from inputFileRoot)."
-
- hfile = InputFile("loadHistoryInputFile",default="${inputFileRoot}.hist")
- hfile.meta['tip'] = "Pathname for file defining load histories (overrides default from inputFileRoot)."
-
- tractionInputFile = InputFile("tractionInputFile",default="${inputFileRoot}.traction")
- tractionInputFile.meta['tip'] = "Pathname for traction BC input file (overrides default from inputFileRoot)."
-
- # Unused input files.
- wfile = InputFile("winklerInputFile",default="${inputFileRoot}.wink")
- wfile.meta['tip'] = "Pathname for Winkler force input file (overrides default from inputFileRoot)."
-
- materialHistoryInputFile = InputFile("materialHistoryInputFile",default="${inputFileRoot}.mhist")
- materialHistoryInputFile.meta['tip'] = "Pathname for file defining material histories (overrides default from inputFileRoot -- presently unused)."
-
- prestressInputFile = InputFile("prestressInputFile",default="${inputFileRoot}.prestr")
- prestressInputFile.meta['tip'] = "Pathname for prestress input file (overrides default from inputFileRoot -- presently unused)."
-
- slfile = InputFile("slipperyNodeInputFile",default="${inputFileRoot}.slip")
- slfile.meta['tip'] = "Pathname for slippery node input file (overrides default from inputFileRoot -- presently unused)."
-
- difile = InputFile("differentialForceInputFile",default="${inputFileRoot}.diff")
- difile.meta['tip'] = "Pathname for file defining slippery node differential forces (overrides default from inputFileRoot -- presently unused)."
-
- wxfile = InputFile("slipperyWinklerInputFile",default="${inputFileRoot}.winkx")
- wxfile.meta['tip'] = "Pathname for file defining slippery node Winkler forces (overrides default from inputFileRoot -- presently unused)."
-
- # Output option flags.
- asciiOutput = pyre.str("asciiOutput",default="echo")
- asciiOutput.validator = pyre.choice(["none","echo","full"])
- asciiOutput.meta['tip'] = "Type of ascii output desired (none, echo, full)."
-
- plotOutput = pyre.str("plotOutput",default="none")
- plotOutput.validator = pyre.choice(["none","ascii","binary"])
- plotOutput.meta['tip'] = "Type of plot output desired (none, ascii, binary)."
-
- ucdOutput = pyre.str("ucdOutput",default=None)
- ucdOutput.validator = pyre.choice(["none","ascii","binary"])
- ucdOutput.meta['tip'] = "Type of UCD output desired (none, ascii, binary)."
-
- # Additional option flags.
- analysisType = pyre.str("analysisType",default="fullSolution")
- analysisType.validator = pyre.choice(["dataCheck","stiffnessFactor",
- "elasticSolution","fullSolution"])
- analysisType.meta['tip'] = "Type of analysis (dataCheck, stiffnessFactor, elasticSolution, fullSolution)."
-
- pythonTimestep = pyre.bool("pythonTimestep",default=False)
- pythonTimestep.meta['tip'] = "Whether to use python timestepping loop (enables VTK output for time-dependent solution)."
-
- generateGreen = pyre.bool("generateGreen",default=False)
- generateGreen.meta['tip'] = "Whether to generate Green's function results for the specified split node inputs."
-
- debuggingOutput = pyre.bool("debuggingOutput",default=False)
- debuggingOutput.meta['tip'] = "Whether to produce debugging output."
-
- ncycle = pyre.int("numberCycles",default=1)
- ncycle.meta['tip'] = "Number of cycles of the given timestep definitions to perform (default=1)."
-
- interpolateMesh = pyre.bool("interpolateMesh",default=False)
- interpolateMesh.meta['tip'] = "Create intermediate mesh entities, such as edges and faces."
-
- partitioner = pyre.str("partitioner",default="chaco")
- partitioner.validator = pyre.choice(["chaco","parmetis"])
- partitioner.meta['tip'] = "Partitioner (chaco, parmetis)."
-
- # Unused option flags.
- autoRotateSlipperyNodes = pyre.bool("autoRotateSlipperyNodes",default=True)
- autoRotateSlipperyNodes.meta['tip'] = "Whether to performa automatic rotation for slippery nodes (presently unused)."
-
- #
- # category 2 parameters formerly placed in *.keyval files
- #
-
- from pyre.units.pressure import Pa
- from pyre.units.length import m
- from pyre.units.time import s
-
- winklerScaleX = pyre.float("winklerScaleX", default=1.0)
- winklerScaleY = pyre.float("winklerScaleY", default=1.0)
- winklerScaleZ = pyre.float("winklerScaleZ", default=1.0)
-
- stol = pyre.dimensional("stressTolerance", default=1.0e-12*Pa)
- dtol = pyre.float("minimumStrainPerturbation", default=1.0e-7)
- epert = pyre.float("initialStrainPerturbation", default=1.0e-1)
-
- nprevdflag = pyre.int("usePreviousDisplacementFlag", default=0)
-
- quadratureOrder = pyre.str("quadratureOrder", default="Full")
- quadratureOrder.validator = pyre.choice(["Full", "Reduced", "Selective"])
-
- gravityX = pyre.dimensional("gravityX", default=0.0*m/(s*s))
- gravityY = pyre.dimensional("gravityY", default=0.0*m/(s*s))
- gravityZ = pyre.dimensional("gravityZ", default=0.0*m/(s*s))
-
- prestressAutoCompute = pyre.bool("prestressAutoCompute", default=False)
- prestressAutoChangeElasticProps = pyre.bool("prestressAutoChangeElasticProps", default=False)
- tpois = pyre.float("prestressAutoComputePoisson", default=0.49)
- tyoungs = pyre.dimensional("prestressAutoComputeYoungs", default=1.0e30*Pa)
-
- prestressScaleXx = pyre.float("prestressScaleXx", default=1.0)
- prestressScaleYy = pyre.float("prestressScaleYy", default=1.0)
- prestressScaleZz = pyre.float("prestressScaleZz", default=1.0)
- prestressScaleXy = pyre.float("prestressScaleXy", default=1.0)
- prestressScaleXz = pyre.float("prestressScaleXz", default=1.0)
- prestressScaleYz = pyre.float("prestressScaleYz", default=1.0)
-
- winklerSlipScaleX = pyre.float("winklerSlipScaleX", default=1.0)
- winklerSlipScaleY = pyre.float("winklerSlipScaleY", default=1.0)
- winklerSlipScaleZ = pyre.float("winklerSlipScaleZ", default=1.0)
-
- f77StandardInput = pyre.int("f77StandardInput", default=5)
- f77StandardOutput = pyre.int("f77StandardOutput", default=6)
- kr = pyre.int("f77FileInput", default=10)
- kw = pyre.int("f77AsciiOutput", default=11)
- kp = pyre.int("f77PlotOutput", default=12)
- kucd = pyre.int("f77UcdOutput", default=13)
-
-
-
-
- # Tell the framework where to find PETSc functions.
- import pylith3d as petsc
-
-
- # Use PETSc-style command line parsing.
- from cig.cs.petsc import PetscCommandlineParser as CommandlineParser
-
-
- # hack to recognize old 'pl3dscan.xxx' and 'scanner.xxx' options
- def applyConfiguration(self, context=None):
- # this mimics the standard Pyre order: <component-name>.xxx overrides <facility-name>.xxx
- for alias in ["scanner", "pl3dscan"]:
- node = self.inventory._priv_registry.extractNode(alias)
- if node:
- node.name = self.name
- self.updateConfiguration(node)
- return super(PyLith, self).applyConfiguration(context)
-
-
- def readSamplePoints(self, filename):
- '''Read in the sampling locations
- - One point per line, three values per line (x,y,z)
- - Returns a Numeric array'''
- import Numeric
- f = file(filename)
- points = []
- for line in f.readlines():
- points.append([float(v) for v in line.strip().split(' ')])
- f.close()
- return Numeric.array(points)
-
-
- def outputSampleValues(self, filename, impulseNode, values):
- '''impulse# sample# sample values'''
- # Computing normal to the fault:
- # Split nodes define the fault
- # Get all fault faces for a node
- # Area weighted average of normals
- f = file(filename, 'w')
- for v, values in enumerate(values):
- write(f, '%d %d %g %g %g' % (impulseNode, v, values[0], values[1], values[2]))
- f.close()
- return
-
-
- def greenFunction(self, points):
- """
- # Beginning of loop that loops over split node sets, creating
- # an 'impulse' for each one and outputting response values.
- # Below at present is a quasi-C version of the needed code.
-
- splitField = None
- m = None
-
- # Need bindings for these
- pylith3d.meshGetSectionPair(mesh, "split", splitField)
- pylith3d.meshGetMesh(self.mesh, m)
-
- # This is incorrect, but I need something like:
- topology = getTopology(m)
- patch = 0
- eNumbering = pylith3d.getLocalNumbering(topology, patch, ??)
- vNumbering = pylith3d.getLocalNumbering(topology, patch, 0)
-
-
- # Need to loop over global nodes
- for node in ??:
- # Need integer and double lists to hold split node info
- faultind = []
- faultvals = []
- indfault = None
- valfault = None
-
- # Need to find elements in the split node 'patch' that contain node.
- numSet = 0
- for elem in ??:
- # Not sure if this does what I want
- if (pylith3d.sieve.baseContains(elem)):
- # This is totally wrong, but I need to get local element and node numbers,
- # along with values
- numSet += 1
- faultind += [eNumbering.getIndex(elem)]
- faultind += [vNumbering.getIndex(node)]
-
- # Need to look up how to get field values
- faultvals += [value.x, value.y, value.z]
-
- # Create arrays to send to fortran code
- indfault = intListToArray(faultind)
- valfault = doubleListToArray(faultvals)
-
- # Call fortran routine to set specified split values and clear the rest
- pylith3d.setsplit(self.nfault, self.fault, numfn, indfault, valfault, numSet)
- # Solve
- pylith3d.solveElastic()
- values = self.interpolatePoints(points)
- self.outputSampleValues(self.fileRoot+'.output', values)
- return
-
-
-
- SectionReal splitField;
-
- # Need bindings for this
- ierr = MeshGetSectionPair(mesh, "split", &splitField);
- // Loop over split nodes
- for() {
- // Loop over elements
- for() {
- # Need bindings for this
- ierr = SectionPairSetFiberDimension(splitField, e, 1);
- }
- # Need bindings for this
- ierr = SectionPairAllocate(splitField);
- // Loop over elements
- for() {
- PetscPair value;
-
- value.i = node;
- value.x = ;
- value.y = ;
- value.z = ;
- # Need bindings for this
- ierr = SectionPairUpdate(splitField, e, &value);
- # Major problem right now: This just updates PETSc/Sieve's copy of splitField.
- # It does not change the values within PyLith, which have been read from
- # per-process input files.
- }
- // Solve
- pl3drun.solveElastic()
- # Need bindings for this
- ierr = SectionPairClear(splitField);
- }
- values = self.interpolatePoints(points)
- self.outputSampleValues(self.fileRoot+'.output', values)
- """
- return
-
-
- def main(self, *args, **kwds):
-
-# from time import clock as now
-# start = now()
-
- import journal
- self.trace = journal.debug("pylith3d.trace")
-
- from mpi import MPI_Comm_rank, MPI_COMM_WORLD
- self.rank = MPI_Comm_rank(MPI_COMM_WORLD)
-
- if self.generateGreen:
- points = self.readSamplePoints(self.macroString(self.metainventory.sampleLocationFile))
-
- self.mesh = pylith3d.processMesh(self.macroString(self.metainventory.bcfile),
- self.macroString(self.metainventory.inputFileRoot),
- self.interpolateMesh,
- self.partitioner)
-
- self.initialize()
-
- self.setup()
- self.read()
- self.numberequations()
- self.sortmesh()
- self.sparsesetup()
- self.allocateremaining()
- self.meshwrite()
-
- if self.generateGreen:
- self.greenFunction(points)
- else:
- self.runSimulation()
-# finish = now()
-# usertime = finish - start
-# print "Total user time: %g" % usertime
- return
-
-
- def _validate(self, context):
-
- super(PyLith, self)._validate(context)
-
- #
- # Open input files. Log I/O errors.
- #
-
- inputFile = lambda item, category: self.inputFile(item, category, context)
- outputFile = lambda item, category: self.outputFile(item, category, context)
- macroString = self.macroString
-
- # open? fatal? label
- optional = self.IOFileCategory(True, False, "optional")
- unused = self.IOFileCategory(False, False, "unused")
- required = self.IOFileCategory(True, True, None)
-
- Inventory = self.metainventory
-
- self.ofile = outputFile(Inventory.ofile, optional)
- self.pfile = outputFile(Inventory.pfile, optional)
- self.coordinateInputFile = inputFile(Inventory.coordinateInputFile, required)
- self.bcfile = inputFile(Inventory.bcfile, required)
- self.wfile = inputFile(Inventory.wfile, unused)
- self.skfile = inputFile(Inventory.skfile, optional)
- self.timeStepInputFile = inputFile(Inventory.timeStepInputFile, required)
- self.fofile = inputFile(Inventory.fofile, self.analysisType == "fullSolution" and required or unused)
- self.stfile = inputFile(Inventory.stfile, required)
- self.hfile = inputFile(Inventory.hfile, optional)
- self.materialPropertiesInputFile = inputFile(Inventory.materialPropertiesInputFile, required)
- self.materialHistoryInputFile = inputFile(Inventory.materialHistoryInputFile, unused)
- self.connectivityInputFile = inputFile(Inventory.connectivityInputFile, required)
- self.prestressInputFile = inputFile(Inventory.prestressInputFile, unused)
- self.tractionInputFile = inputFile(Inventory.tractionInputFile, optional)
- self.spfile = inputFile(Inventory.spfile, self.generateGreen and required or optional)
- # Slippery nodes are not yet implemented in PyLith-0.8.
- self.slfile = inputFile(Inventory.slfile, unused)
- self.difile = inputFile(Inventory.difile, unused)
- self.wxfile = inputFile(Inventory.wxfile, unused)
- self.sampleLocationFile = inputFile(Inventory.sampleLocationFile, self.generateGreen and required or unused)
- # The call to glob() is somewhat crude -- basically, determine
- # if any files might be in the way.
- self.ucdroot = macroString(Inventory.ucdroot)
-
- if False: # broken
- from glob import glob
- ucdFiles = ([self.ucdroot + ".mesh.inp",
- self.ucdroot + ".gmesh.inp",
- self.ucdroot + ".mesh.time.prest.inp",
- self.ucdroot + ".gmesh.time.prest.inp"]
- + glob(self.ucdroot + ".mesh.time.[0-9][0-9][0-9][0-9][0-9].inp")
- + glob(self.ucdroot + ".gmesh.time.[0-9][0-9][0-9][0-9][0-9].inp"))
- item = Inventory.ucdroot
- for ucdFile in ucdFiles:
- try:
- stream = os.fdopen(os.open(ucdFile, os.O_WRONLY|os.O_CREAT|os.O_EXCL), "w")
- except (OSError, IOError), error:
- context.error(error, items=[item])
- break
- else:
- stream.close()
- os.remove(ucdFile)
-
- return
-
-
-# derived or automatically-specified quantities (category 3)
-
- def initialize(self):
-
- from Materials import Materials
- import pyre.units
- import string
-
- inputFile = lambda item, category: self.inputFile(item, category, None)
- outputFile = lambda item, category: self.outputFile(item, category, None)
- macroString = self.macroString
- Inventory = self.metainventory
- optional = self.IOFileCategory(True, 0, "optional")
- required = self.IOFileCategory(True, 1, None)
-
- self.trace.log("Hello from pl3dscan.initialize (begin)!")
-
- self.trace.log("Scanning ascii files to determine dimensions:")
-
- # Get base file names
- self.ofile = outputFile(Inventory.ofile, optional)
- self.pfile = outputFile(Inventory.pfile, optional)
- self.ucdroot = macroString(Inventory.ucdroot)
- self.coordinateInputFile = inputFile(Inventory.coordinateInputFile, required)
- self.connectivityInputFile = inputFile(Inventory.connectivityInputFile, required)
- self.bcfile = inputFile(Inventory.bcfile, required)
- self.spfile = inputFile(Inventory.spfile, optional)
- self.tractionInputFile = inputFile(Inventory.tractionInputFile, optional)
-
- # Create filenames for each process
- for attr in ['ofile',
- 'pfile',
- 'ucdroot',
- 'coordinateInputFile',
- 'connectivityInputFile',
- 'bcfile',
- 'spfile',
- 'tractionInputFile']:
- filename = getattr(self, attr)
- s = filename.split('.')
- sieveFilename = ".".join(s[0:1] + [str(self.rank)] + s[1:])
- setattr(self, attr, sieveFilename)
-
- uparser = pyre.units.parser()
- matinfo = Materials()
-
-
- # poor man's allocation
- coord_units = "coordinateUnitsInitial12345678"
- displacement_units = "displacementUnitsInitial123456"
- velocity_units = "velocityUnitsInitial1234567890"
- force_units = "forceUnitsInitial1234567890123"
- rotation_units = "rotationUnitsInitial1234567890"
- time_units = "timeUnitsInitial12345678901234"
- traction_units = "tractionBcUnitsInitial12345678"
-
- # This is a test version where the geometry type is automatically
- # specified by using Pylith3d. The geometry type is only used for
- # f77 routines and not in pyre. An integer value is also defined
- # for use in f77 routines.
- # Define some integer values that are derived from string variables.
-
- # Invariant parameters related to element type
- self.maxElementEquations = constants.numberDegreesFreedom*constants.maxElementNodes
- self.neni = pylith3d.intListToArray(
- [8, 7, 6, 5, 4, 20, 18, 15, 13, 10])
-
- # Invariant parameters related to material model
- self.infmatmod = pylith3d.allocateInt(
- 6*constants.maxMaterialModels)
-
- pylith3d.matmod_def(self.infmatmod)
-
- # Parameters derived from values in the inventory or the
- # category 2 parameters above.
- analysisTypeMap = {
- "dataCheck": 0,
- "stiffnessFactor": 1,
- "elasticSolution": 2,
- "fullSolution": 3,
- }
- self.icode = analysisTypeMap[self.analysisType]
-
- if self.prestressAutoCompute:
- self.ipstrs = 1
- else:
- self.ipstrs = 0
-
- if self.prestressAutoChangeElasticProps:
- self.ipauto = 1
- else:
- self.ipauto = 0
-
- # Parameters derived from the number of entries in a file.
- self.numnp = pylith3d.scan_coords(
- self.kr,
- coord_units,
- self.coordinateInputFile)
-
- self.cscale = uparser.parse(string.strip(coord_units)).value
-
- self.numbc = pylith3d.scan_bc(
- self.kr,
- displacement_units,
- velocity_units,
- force_units,
- self.bcfile)
-
- if self.numbc > 0:
- self.dscale = uparser.parse(string.strip(displacement_units)).value
- self.vscale = uparser.parse(string.strip(velocity_units)).value
- self.fscale = uparser.parse(string.strip(force_units)).value
- else:
- self.dscale = 0.0
- self.vscale = 0.0
- self.fscale = 0.0
-
- winklerInfo = pylith3d.scan_wink(
- self.kr,
- self.wfile)
- self.nwinke = winklerInfo[0]
- self.nwink = winklerInfo[1]
-
- self.numrot = pylith3d.scan_skew(
- self.kr,
- rotation_units,
- self.skfile)
-
- if self.numrot != 0:
- self.runits = uparser.parse(string.strip(rotation_units)).value
- else:
- self.runits = 0.0
-
- timeStepInfo = pylith3d.scan_timdat(
- self.kr,
- time_units,
- self.timeStepInputFile)
- self.nintg = timeStepInfo[0]
- self.lastep = timeStepInfo[1]
-
- self.tunits = uparser.parse(string.strip(time_units)).value
-
- self.icontr = pylith3d.scan_fuldat(
- self.icode,
- self.lastep,
- self.kr,
- self.fofile)
-
- self.nhist = pylith3d.scan_hist(
- self.kr,
- self.hfile)
-
- self.numat = matinfo.readprop(self.materialPropertiesInputFile)
-
- self.materialModel = matinfo.materialModel
- self.prop = pylith3d.doubleListToArray(
- matinfo.propertyList)
-
- self.scan_connect()
-
- if prestress:
- self.numberPrestressEntries = pylith3d.scan_prestr(
- constants.stateVariableDimension,
- self.numberPrestressGaussPoints,
- self.numberElements,
- self.ipstrs,
- self.kr,
- self.prestressInputFile)
- else:
- self.numberPrestressEntries = 0
-
- self.numtractions = pylith3d.scan_tractions(
- constants.nsnodesmax,
- self.kr,
- traction_units,
- self.tractionInputFile)
-
- if self.numtractions != 0:
- self.tscale = uparser.parse(string.strip(traction_units)).value
- else:
- self.tscale = 0.0
-
- self.numfn = pylith3d.scan_split(
- self.kr,
- self.spfile)
-
- self.numslp = pylith3d.scan_slip(
- self.kr,
- self.slfile)
-
- self.numdif = pylith3d.scan_diff(
- self.numslp,
- self.kr,
- self.difile)
-
- slipperyWinklerInfo = pylith3d.scan_winkx(
- self.numslp,
- self.kr,
- self.wxfile)
- self.nwinkxe = slipperyWinklerInfo[0]
- self.nwinkx = slipperyWinklerInfo[1]
-
- self.trace.log("Hello from pl3dscan.initialize (end)!")
-
- return
-
-
- def scan_connect(self):
- infmat = pylith3d.intListToArray(
- self.materialModel)
-
- # At present, we assume that the number of element families is equal to
- # the number of material types used, since only one volume element type at a
- # time is allowed.
- self.maxvfamilies = constants.numberAllowedVolumeElementTypes* \
- self.numat
-
- self.ivflist = pylith3d.allocateInt(
- 3*self.maxvfamilies)
-
- volumeElementDimens = pylith3d.scan_connect(
- self.neni,
- self.infmatmod,
- infmat,
- self.ivflist,
- self.maxvfamilies,
- self.numat,
- self.kr,
- self.connectivityInputFile)
-
- self.numelv = volumeElementDimens[0]
- self.nvfamilies = volumeElementDimens[1]
- self.ietypev = volumeElementDimens[2]
-
- return
-
-
- class IOFileCategory(object):
- def __init__(self, tryOpen, isFatal, label):
- self.tryOpen = tryOpen
- self.isFatal = isFatal
- self.label = label
-
- def macroString(self, item):
- from pyre.util import expandMacros
- class InventoryAdapter(object):
- def __init__(self, inventory, builtins):
- self.inventory = inventory
- self.builtins = builtins
- def __getitem__(self, key):
- builtin = self.builtins.get(key)
- if builtin is None:
- return expandMacros(str(self.inventory.getTraitValue(key)), self)
- return builtin
- builtins = {}
- return expandMacros(item.value, InventoryAdapter(self.inventory, builtins))
-
- def ioFileStream(self, item, flags, mode, category, context):
- value = self.macroString(item)
- stream = None
- if category.tryOpen:
- try:
- stream = os.fdopen(os.open(value, flags), mode)
- except (OSError, IOError), error:
- if context is None:
- if category.isFatal:
- raise
- elif category.isFatal:
- context.error(error, items=[item])
- else:
- pass # warning?
- return value, stream
-
- def inputFile(self, item, category, context):
- value, stream = self.ioFileStream(item, os.O_RDONLY, "r", category, context)
- if stream is not None:
- stream.close()
- return value
-
- def inputFileStream(self, item, category, context):
- return self.ioFileStream(item, os.O_RDONLY, "r", category, context)[1]
-
- def outputFile(self, item, category, context):
- value, stream = self.ioFileStream(item, os.O_WRONLY|os.O_CREAT|os.O_EXCL, "w", category, context)
- if stream is not None:
- stream.close()
- os.remove(value)
- return value
-
-
-# The main function of this code is to emulate the original functionality of
-# input.f in the original version of TECTON. This code segment controls the
-# allocation of memory and the reading of the input file. Additional functions
-# covered by this code include the sparse matrix setup portion, which also does
-# some memory allocation. Additional code sections will call the main elastic
-# and time-dependent solution drivers, which are presently f77 subroutines.
-
-
- def setup(self):
-
- self.trace.log("Hello from pl3dsetup.initialize (begin)!")
-
- # Initialize and define some integer parameters based on string
- # or logical parameters in python
-
- self.intord = 0
- if self.quadratureOrder == "Full":
- self.intord = 1
- elif self.quadratureOrder == "Reduced":
- self.intord = 2
- elif self.quadratureOrder == "Selective":
- self.intord = 3
- else:
- self.intord = 1
-
- self.idout = 0
- if self.asciiOutput == "none":
- self.idout = 0
- elif self.asciiOutput == "echo":
- self.idout = 1
- else:
- self.idout = 2
-
- self.idsk = 0
- if self.plotOutput == "none":
- self.idsk = 0
- elif self.plotOutput == "ascii":
- self.idsk = 1
- else:
- self.idsk = 2
-
- binIOError = None
- try:
- pylith3d.try_binio(self.kucd)
- except RuntimeError, binIOError:
- self.iucd = 1
- else:
- self.iucd = 2
- if self.ucdOutput == "none":
- self.iucd = 0
- elif self.ucdOutput == "ascii":
- self.iucd = 1
- elif self.ucdOutput == "binary":
- if binIOError is None:
- self.iucd = 2
- else:
- import journal
- warning = journal.warning("pylith3d")
- warning.line("Forcing 'ucdOutput' to 'ascii'.")
- warning.line("Binary UCD output not supported for this Fortran compiler.")
- warning.log(binIOError)
-
- self.idebug = 0
- if self.debuggingOutput:
- self.idebug = 1
- else:
- self.idebug = 0
-
- self.iskopt = 0
- if self.autoRotateSlipperyNodes:
- self.iskopt = 2
- else:
- self.iskopt = 1
-
- self.trace.log("Hello from pl3dsetup.initialize (end)!")
-
- return
-
-
- def read(self):
-
- # This function reads all input and performs some memory allocation.
-
- from ElementTypeDef import ElementTypeDef
-
- self.trace.log("Hello from pl3dsetup.read (begin)!")
-
- print "Reading problem definition and allocating necessary storage:"
-
-
- eltype=ElementTypeDef()
-
- # Make lists that are used as arrays in the f77 function calls below.
- wscal = pylith3d.doubleListToArray(
- [self.winklerScaleX,
- self.winklerScaleY,
- self.winklerScaleZ])
-
- if prestress:
- self.prscal = pylith3d.doubleListToArray(
- [self.prestressScaleXx,
- self.prestressScaleYy,
- self.prestressScaleZz,
- self.prestressScaleXy,
- self.prestressScaleXz,
- self.prestressScaleYz])
-
- wxscal = pylith3d.doubleListToArray(
- [self.winklerSlipScaleX,
- self.winklerSlipScaleY,
- self.winklerSlipScaleZ])
-
- # Set up global integration info.
- eltype.getdef(
- self.ietypev,
- self.intord)
-
- self.sh = eltype.sh
- self.sh2d = eltype.sh2d
- self.shj = eltype.shj
- self.gauss = eltype.gauss
- self.gauss2d = eltype.gauss2d
- self.nen = eltype.nen
- self.ngauss = eltype.ngauss
- self.nee = eltype.nee
- self.nsnodes = eltype.nsnodes
- self.connectivitySize = self.numelv*self.nen
- self.infetype = pylith3d.intListToArray(
- eltype.elementTypeInfo)
- self.infetype2d = pylith3d.intListToArray(
- eltype.elementTypeInfo2d)
-
- # Node-based info (coordinates, displacement arrays, BC, and skew BC).
- self.x = pylith3d.allocateDouble(
- constants.numberSpaceDimensions*self.numnp)
- self.ibond = pylith3d.allocateInt(
- constants.numberDegreesFreedom*self.numnp)
- self.bond = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numnp)
- self.skew = pylith3d.allocateDouble(
- constants.numberSkewDimensions*self.numnp)
-
- pylith3d.read_coords(
- self.x,
- self.cscale,
- self.numnp,
- self.kr,
- self.coordinateInputFile)
-
- self.numberConcForces = pylith3d.read_bc(
- self.bond,
- self.dscale,
- self.vscale,
- self.fscale,
- self.ibond,
- self.numnp,
- self.numbc,
- self.kr,
- self.bcfile)
-
- pylith3d.read_skew(
- self.skew,
- self.runits,
- self.numrot,
- self.numnp,
- self.iskopt,
- self.kr,
- self.skfile)
-
- # Allocate and read time step, time output, and load history info.
- self.histry = pylith3d.allocateDouble(
- (self.lastep+1)*self.nhist)
- self.maxstp = pylith3d.allocateInt(
- self.nintg)
- self.delt = pylith3d.allocateDouble(
- self.nintg)
- self.alfa = pylith3d.allocateDouble(
- self.nintg)
- self.maxit = pylith3d.allocateInt(
- self.nintg)
- self.ntdinit = pylith3d.allocateInt(
- self.nintg)
- self.lgdef = pylith3d.allocateInt(
- self.nintg)
- self.utol = pylith3d.allocateDouble(
- self.nintg)
- self.ftol = pylith3d.allocateDouble(
- self.nintg)
- self.etol = pylith3d.allocateDouble(
- self.nintg)
- self.itmax = pylith3d.allocateInt(
- self.nintg)
- self.iprint = pylith3d.allocateInt(
- self.icontr)
-
- # Note that array Times is needed for output, if requested.
- self.times = pylith3d.allocateDouble(
- self.lastep+1)
- self.istatout = pylith3d.allocateInt(
- 3*constants.maxStateVariables)
- self.nstatout = pylith3d.allocateInt(3)
-
- pylith3d.read_timdat(
- self.delt,
- self.alfa,
- self.utol,
- self.ftol,
- self.etol,
- self.times,
- self.tunits,
- self.maxstp,
- self.maxit,
- self.ntdinit,
- self.lgdef,
- self.itmax,
- self.nintg,
- self.lastep,
- self.kr,
- self.timeStepInputFile)
-
- pylith3d.read_fuldat(
- self.iprint,
- self.icontr,
- self.icode,
- self.ncycle,
- self.lastep,
- self.kr,
- self.fofile)
-
- pylith3d.read_stateout(
- self.istatout,
- self.nstatout,
- self.kr,
- self.stfile)
-
- pylith3d.read_hist(
- self.histry,
- self.times,
- self.nhist,
- self.lastep,
- self.kr,
- self.hfile)
-
- # Allocate and read info on connectivities and prestresses
- self.ien = pylith3d.allocateInt(
- self.nen*self.numelv)
- self.mat = pylith3d.allocateInt(
- self.numelv)
- if self.numberPrestressEntries != 0 or self.ipstrs != 0:
- self.prestressFlag = 1
- else:
- self.prestressFlag = 0
-
- pylith3d.read_connect(
- self.ien,
- self.mat,
- self.nen,
- self.numelv,
- self.numnp,
- self.nvfamilies,
- self.kr,
- self.connectivityInputFile)
-
- if prestress:
- pylith3d.read_prestr(
- self.stn,
- self.st0,
- self.prscal,
- self.numberStressComponents,
- self.numberGaussPoints,
- self.numberPrestressGaussPoints,
- self.numberElements,
- self.numberPrestressEntries,
- self.ipstrs,
- self.idout,
- self.kr,
- self.kw,
- self.prestressInputFile,
- self.ofile)
-
- # Read traction BC
- self.tractionverts = pylith3d.allocateInt(
- self.nsnodes*self.numtractions)
- self.tractionvals = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numtractions)
-
- pylith3d.read_tractions(
- self.tractionverts,
- self.tractionvals,
- self.tscale,
- self.numtractions,
- self.nsnodes,
- self.kr,
- self.tractionInputFile)
-
- # Read split node info
- self.nfault = pylith3d.allocateInt(
- 3*self.numfn)
- self.fault = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numfn)
-
- self.numflt = pylith3d.read_split(
- self.fault,
- self.nfault,
- self.numfn,
- self.numnp,
- self.numelv,
- self.kr,
- self.spfile)
-
- # Read slippery node info
- # Note that array Nslip is also required in functions sortmesh and sparsesetup
- # before it can be deallocated.
- self.nslip = pylith3d.allocateInt(
- constants.numberSlipDimensions*self.numslp)
- self.idhist = pylith3d.allocateInt(
- self.numnp)
- self.diforc = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numnp)
-
- self.numsn = pylith3d.read_slip(
- self.nslip,
- self.numslp,
- self.numnp,
- self.iskopt,
- self.kr,
- self.slfile)
-
- pylith3d.read_diff(
- self.diforc,
- self.nslip,
- self.idhist,
- self.numslp,
- self.numdif,
- self.numnp,
- self.kr,
- self.difile)
-
- # Read Winkler forces and slippery Winkler forces.
- # All input is finished after this section.
- self.iwinkdef = pylith3d.allocateInt(
- constants.numberDegreesFreedom*self.nwinke)
- self.iwinkid = pylith3d.allocateInt(
- self.nwinke)
- self.winkdef = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.nwinke)
-
- self.iwinkxdef = pylith3d.allocateInt(
- constants.numberDegreesFreedom*self.nwinkxe)
- self.iwinkxid = pylith3d.allocateInt(
- self.nwinkxe)
- self.winkxdef = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.nwinkxe)
-
- pylith3d.read_wink(
- self.winkdef,
- wscal,
- self.iwinkdef,
- self.iwinkid,
- self.nwink,
- self.nwinke,
- self.kr,
- self.wfile)
-
- pylith3d.read_wink(
- self.winkxdef,
- wxscal,
- self.iwinkxdef,
- self.iwinkxid,
- self.nwinkx,
- self.nwinkxe,
- self.kr,
- self.wxfile)
-
- self.trace.log("Hello from pl3dsetup.read (end)!")
-
- return
-
- def numberequations(self):
-
- # This functions numbers equations based on BC and slippery node info.
-
- self.trace.log("Hello from pl3dsetup.numberequations (begin)!")
-
- print "Numbering global equations:"
-
- # Create Idftn array for split nodes. This can be deallocated after meshwrite function has been called.
- self.idftn = pylith3d.allocateInt(
- self.numflt)
-
- pylith3d.id_split(
- self.nfault,
- self.idftn,
- self.numnp,
- self.numfn,
- self.numflt)
-
- # Determine global equations and store equation numbers in Id and Idx.
- self.id = pylith3d.allocateInt(
- constants.numberSpaceDimensions*self.numnp)
- self.idx = pylith3d.allocateInt(
- constants.numberSpaceDimensions*self.numnp)
- self.idslp = pylith3d.allocateInt(
- self.numnp)
-
- # Number of equations
- self.neq = pylith3d.create_id(
- self.id,
- self.idx,
- self.ibond,
- self.nslip,
- self.idslp,
- self.numslp,
- self.numnp,
- self.numsn)
-
- self.ipslp = pylith3d.allocateInt(
- constants.numberSlipNeighbors*self.numsn)
-
- # If there are slippery nodes and the auto-rotation option is selected, find
- # neighboring nodes on the fault so that a best-fit plane can be determined at
- # each node.
- if self.numsn != 0 and self.iskopt == 2:
- self.nfind()
-
- # Assign appropriate equation numbers to Iwink array, and compact Wink
- # array to correspond to assigned BC.
- self.wink = pylith3d.allocateDouble(
- self.nwink)
- self.iwink = pylith3d.allocateInt(
- 2*self.nwink)
-
- pylith3d.assign_wink(
- self.winkdef,
- self.wink,
- self.iwinkdef,
- self.iwinkid,
- self.iwink,
- self.id,
- self.numnp,
- self.nwink,
- self.nwinke)
-
- # Assign appropriate equation numbers to Iwinkx array, and compact Winkx
- # array to correspond to assigned BC.
- self.winkx = pylith3d.allocateDouble(
- self.nwinkx)
- self.iwinkx = pylith3d.allocateInt(
- 2*self.nwinkx)
-
- pylith3d.assign_wink(
- self.winkxdef,
- self.winkx,
- self.iwinkxdef,
- self.iwinkxid,
- self.iwinkx,
- self.idx,
- self.numnp,
- self.nwinkx,
- self.nwinkxe)
-
- self.trace.log("Hello from pl3dsetup.numberequations (end)!")
-
- return
-
-
- def nfind(self):
- # Temporary arrays
- xtmp = pylith3d.allocateDouble(
- self.numsn)
- itmp = pylith3d.allocateInt(
- self.numsn)
- itmp1 = pylith3d.allocateInt(
- self.numsn)
- itmp2 = pylith3d.allocateInt(
- self.numsn)
-
- pylith3d.nfind(
- self.x,
- xtmp,
- self.idslp,
- self.ipslp,
- itmp,
- itmp1,
- itmp2,
- self.nslip,
- self.numslp,
- self.numsn,
- self.numnp)
-
- return
-
-
- def sortmesh(self):
-
- # This function sorts elements into families and sorts all other items that are
- # affected by this.
-
- self.trace.log("Hello from pl3dsetup.sortmesh (begin)!")
-
- print "Renumbering elements, split nodes, and slippery nodes:"
-
- self.sort_elements()
-
- self.stateSize = self.elementSizeInfo[0]
- self.state0Size = self.elementSizeInfo[1]
- self.propertySize = self.elementSizeInfo[2]
-
- # Sort split node entries.
- pylith3d.sort_split_nodes(
- self.nfault,
- self.indxiel,
- self.numfn,
- self.numelv)
-
- # Sort slippery node entries.
- pylith3d.sort_slip_nodes(
- self.nslip,
- self.indxiel,
- self.numslp,
- self.numelv)
-
- self.trace.log("Hello from pl3dsetup.sortmesh (end)!")
-
- return
-
-
- def sort_elements(self):
- # Sort elements into families. The sorted elements are contained
- # in array Iens, and the index array for the new ordering is
- # Indxiel. The index array for the original ordering is Ielindx.
- # The original element node array (Ien) and the associated
- # material type array (Mat) may be deallocated after sorting.
-
- self.iens = pylith3d.allocateInt(
- self.nen*self.numelv)
- self.ivfamily = pylith3d.allocateInt(
- 6*self.nvfamilies)
-
- self.indxiel = pylith3d.allocateInt(
- self.numelv)
-
- self.ielindx = pylith3d.allocateInt(
- self.numelv)
-
- ivftmp = pylith3d.allocateInt(
- self.nvfamilies)
-
- self.elementSizeInfo = pylith3d.sort_elements(
- self.ien,
- self.mat,
- self.infmatmod,
- self.ivflist,
- self.ivfamily,
- self.iens,
- ivftmp,
- self.indxiel,
- self.ielindx,
- self.nen,
- self.ngauss,
- self.maxvfamilies,
- self.nvfamilies,
- self.prestressFlag,
- self.numelv,
- self.numnp)
-
- self.ien = None ### DEALLOC
- self.mat = None ### DEALLOC
- self.ivflist = None ### DEALLOC
-
- return
-
-
- def sparsesetup(self):
-
- # This function sets up sparse matrix and associated storage.
-
- self.trace.log("Hello from pl3dsetup.sparsesetup (begin)!")
-
- print "Setting up sparse matrix storage:"
-
- self.autoprestrStage, \
- self.elasticStage, \
- self.viscousStage, \
- self.iterateEvent = pylith3d.setupPETScLogging()
-
- # Arrays to map element equation numbers to global
- # Localize global equation numbers in element index arrays.
- self.lm = pylith3d.allocateInt(
- constants.numberDegreesFreedom*self.connectivitySize)
- self.lmx = pylith3d.allocateInt(
- constants.numberDegreesFreedom*self.connectivitySize)
- self.lmf = pylith3d.allocateInt(
- self.connectivitySize)
-
- pylith3d.local(
- self.id,
- self.numnp,
- self.iens,
- self.lm,
- self.numelv,
- self.nen)
-
- pylith3d.localf(
- self.iens,
- self.lmf,
- self.numelv,
- self.nfault,
- self.numfn,
- self.nen)
-
- pylith3d.localx(
- self.idx,
- self.numnp,
- self.iens,
- self.lmx,
- self.numelv,
- self.nslip,
- self.numslp,
- self.nen)
-
- # Keeping this for now as it may be wanted for output
- # self.nslip = None ### DEALLOC
-
- # Allocate and populate sparse matrix arrays. Some of these are
- # temporary and are then deleted after use.
- iwork = pylith3d.cmp_stiffsz(
- self.neq,
- self.lm,
- self.lmx,
- self.numelv,
- self.numsn,
- self.nen)
-
- # Temporary arrays
- indx = pylith3d.allocateInt(
- self.neq)
- link = pylith3d.allocateInt(
- iwork)
- nbrs = pylith3d.allocateInt(
- iwork)
-
- stiffnessMatrixInfo = pylith3d.lnklst(
- self.neq,
- self.lm,
- self.lmx,
- self.numelv,
- self.nen,
- self.nee,
- indx,
- link,
- nbrs,
- iwork,
- self.numsn)
-
- self.nnz = stiffnessMatrixInfo[0]
-
- self.A, self.rhs, self.sol = pylith3d.createPETScMat(self.mesh)
-
- stiffnessMatrixStats = pylith3d.makemsr(
- self.A,
- indx,
- link,
- nbrs,
- self.neq,
- self.nnz,
- iwork)
-
- self.nmin = stiffnessMatrixStats[0]
- self.nmax = stiffnessMatrixStats[1]
- self.wavg = float(stiffnessMatrixStats[2])
-
- print ""
- print ""
- print "Sparse matrix information:"
- print ""
- print "numberGlobalEquations: %i" % self.neq
- print "workingArraySize: %i" % iwork
- print "stiffnessMatrixSize: %i" % (self.nnz-1)
- print "stiffnessOffDiagonalSize: %i" % stiffnessMatrixInfo[1]
- print "minimumNonzeroTermsPerRow: %i" % self.nmin
- print "maximumNonzeroTermsPerRow: %i" % self.nmax
- print "averageNonzeroTermsPerRow: %g" % self.wavg
- print ""
-
- self.trace.log("Hello from pl3dsetup.sparsesetup (end)!")
-
- return
-
- def allocateremaining(self):
-
- # This function allocates all remaining arrays that are needed for computations.
-
- self.trace.log("Hello from pl3dsetup.allocateremaining (begin)!")
-
- print "Allocating remaining storage:"
-
- # Create necessary lists and convert them to arrays
- self.grav = pylith3d.doubleListToArray(
- [self.gravityX.value,
- self.gravityY.value,
- self.gravityZ.value])
-
- # Allocate memory for all additional arrays
-
- # Force vectors
- if self.numtractions != 0:
- tractionFlag = 1
- else:
- tractionFlag = 0
- if self.gravityX.value != 0.0 or self.gravityY.value != 0.0 or self.gravityZ.value != 0.0:
- gravityFlag = 1
- else:
- gravityFlag = 0
- if self.numberConcForces != 0 or self.numdif != 0:
- concForceFlag = 1
- else:
- concForceFlag = 0
- if tractionFlag != 0 or gravityFlag != 0 or concForceFlag != 0:
- externFlag = 1
- else:
- externFlag = 0
- if self.nwink != 0:
- winklerFlag = 1
- else:
- winklerFlag = 0
- if self.nwinkx != 0:
- slipperyWinklerFlag = 1
- else:
- slipperyWinklerFlag = 0
-
- self.bextern = pylith3d.allocateDouble(
- externFlag*self.neq)
- self.btraction = pylith3d.allocateDouble(
- tractionFlag*self.neq)
- self.bgravity = pylith3d.allocateDouble(
- gravityFlag*self.neq)
- self.bconcForce = pylith3d.allocateDouble(
- concForceFlag*self.neq)
- self.bwink = pylith3d.allocateDouble(
- winklerFlag*self.neq)
- self.bwinkx = pylith3d.allocateDouble(
- slipperyWinklerFlag*self.neq)
- self.bintern = pylith3d.allocateDouble(
- self.neq)
- self.bresid = pylith3d.allocateDouble(
- self.neq)
- self.dispVec = pylith3d.allocateDouble(
- self.neq)
- self.dprev = pylith3d.allocateDouble(
- self.nprevdflag*self.neq)
-
- # Displacement arrays
- self.d = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numnp)
- self.deld = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numnp)
- self.dcur = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numnp)
-
- # Slippery node arrays
- self.dx = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numnp)
- self.deldx = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numnp)
- self.dxcur = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numnp)
-
- # Split node arrays
- self.dfault = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numfn)
- self.tfault = pylith3d.allocateDouble(
- constants.numberDegreesFreedom*self.numfn)
-
- # Local stiffness matrix arrays
- self.s = pylith3d.allocateDouble(
- self.maxElementEquations*self.maxElementEquations)
- self.stemp = pylith3d.allocateDouble(
- self.maxElementEquations*self.maxElementEquations)
-
- # Element arrays
- self.state = pylith3d.allocateDouble(
- self.stateSize)
- self.dstate = pylith3d.allocateDouble(
- self.stateSize)
- self.dmat = pylith3d.allocateDouble(
- constants.materialMatrixDimension*
- self.ngauss*
- self.numelv)
- self.iddmat = pylith3d.intListToArray(
- constants.listIddmat)
- self.state0 = pylith3d.allocateDouble(
- self.state0Size)
-
- # Create arrays from lists that will be needed for the solution
-
- # nforce array
- self.nforce = pylith3d.intListToArray(
- [externFlag,
- tractionFlag,
- gravityFlag,
- concForceFlag,
- self.prestressFlag,
- winklerFlag,
- slipperyWinklerFlag,
- self.nprevdflag])
-
- # ncodat array
- self.ncodat = pylith3d.intListToArray(
- [self.icode,
- self.idebug])
-
- # npar array
- self.npar = pylith3d.intListToArray(
- [self.numelv,
- self.numat,
- self.numtractions,
- self.numslp,
- self.numfn,
- self.ipstrs,
- self.ipauto,
- self.stateSize,
- self.state0Size,
- self.nvfamilies,
- self.numdif,
- self.intord])
-
- # nprint array
- self.nprint = pylith3d.intListToArray(
- [self.icontr,
- self.idout,
- self.idsk,
- self.iucd])
-
- # nsysdat array
- self.nsysdat = pylith3d.intListToArray(
- [self.numnp,
- self.neq,
- self.nnz,
- self.numrot,
- self.numberPrestressEntries,
- self.numsn,
- self.numflt,
- self.propertySize,
- self.nwink,
- self.nwinkx,
- self.iskopt])
-
- # nunits array
- self.nunits = pylith3d.intListToArray(
- [self.f77StandardInput,
- self.f77StandardOutput,
- self.kr,
- self.kw,
- self.kp,
- self.kucd])
-
- # nvisdat array
- self.nvisdat = pylith3d.intListToArray(
- [self.ncycle,
- self.nintg,
- self.lastep,
- self.nhist])
-
- # rgiter array
- self.rgiter = pylith3d.doubleListToArray(
- [self.stol.value,
- self.dtol,
- self.epert])
-
- # rtimdat array
- self.rtimdat = pylith3d.doubleListToArray(
- [0.0, # currentTimeStepSize
- 0.0, # currentAlfaParameter
- self.tpois,
- self.tyoungs.value])
-
- # ntimdat array
- self.ntimdat = pylith3d.intListToArray(
- [0, # currentTimeStep
- 0, # currentIterationsBetweenReform
- 0, # currentStepsBetweenReform
- 0, # currentLargeDeformationFlag
- 0, # currentMaximumIterations
- 0, # currentNumberTotalIterations
- 0, # currentNumberReforms
- 0, # currentNumberTotalPcgIterations
- 0, # reformFlagInt
- ])
-
- self.trace.log("Hello from pl3dsetup.allocateremaining (end)!")
-
- return
-
-
- def meshwrite(self):
-
- # This function outputs mesh information.
- # In the near future, this needs to be broken into classes for
- # Ascii output, plot output, UCD output, etc.
-
- self.trace.log("Hello from pl3dsetup.meshwriteascii (begin)!")
-
- print "Outputting Ascii mesh information:"
-
- # Write out global parameters
- pylith3d.write_global_info(
- self.title,
- self.idout,
- self.idsk,
- self.numnp,
- self.icode,
- self.idebug,
- self.kw,
- self.kp,
- self.ofile,
- self.pfile)
-
- # Write out nodal coordinates
- pylith3d.write_coords(
- self.x,
- self.numnp,
- self.kw,
- self.kp,
- self.idout,
- self.idsk,
- self.ofile,
- self.pfile)
-
- # Write out nodal boundary condition info
- pylith3d.write_bc(
- self.bond,
- self.ibond,
- self.numnp,
- self.kw,
- self.idout,
- self.ofile)
-
- # Write out local coordinate rotations
- pylith3d.write_skew(
- self.skew,
- self.numrot,
- self.iskopt,
- self.numnp,
- self.kw,
- self.idout,
- self.ofile)
-
- # Write stress computation and subiteration parameters.
- pylith3d.write_strscomp(
- self.stol.value,
- self.dtol,
- self.epert,
- self.kw,
- self.idout,
- self.ofile)
-
- pylith3d.write_subiter(
- self.nprevdflag,
- self.kw,
- self.idout,
- self.ofile)
-
- # Write out time step information
- pylith3d.write_timdat(
- self.delt,
- self.alfa,
- self.utol,
- self.ftol,
- self.etol,
- self.times,
- self.maxstp,
- self.maxit,
- self.ntdinit,
- self.lgdef,
- self.itmax,
- self.nintg,
- self.lastep,
- self.kw,
- self.idout,
- self.ofile)
-
- # Write out timesteps when full output is desired
- pylith3d.write_fuldat(
- self.iprint,
- self.icontr,
- self.icode,
- self.ncycle,
- self.lastep,
- self.kw,
- self.kp,
- self.idout,
- self.idsk,
- self.ofile,
- self.pfile)
-
- # Write out state variables desired for output
- pylith3d.write_stateout(
- self.istatout,
- self.nstatout,
- self.kw,
- self.kp,
- self.idout,
- self.idsk,
- self.ofile,
- self.pfile)
-
- # Write out load history information and deallocate Times array
- pylith3d.write_hist(
- self.histry,
- self.times,
- self.nhist,
- self.lastep,
- self.kw,
- self.idout,
- self.ofile)
-
- self.times = None ### DEALLOC
-
- # Write element info
- pylith3d.write_element_info(
- self.numelv,
- self.nen,
- self.ngauss,
- self.ietypev,
- self.intord,
- self.ipstrs,
- self.ipauto,
- self.tpois,
- self.tyoungs.value,
- self.kw,
- self.idout,
- self.ofile)
-
- # Write element node array and deallocate Indxiel
- pylith3d.write_connect(
- self.iens,
- self.ivfamily,
- self.indxiel,
- self.nen,
- self.ngauss,
- self.numelv,
- self.ietypev,
- self.nvfamilies,
- self.kw,
- self.kp,
- self.idout,
- self.idsk,
- self.ofile,
- self.pfile)
-
- self.indxiel = None ### DEALLOC
-
- # Write material properties
- pylith3d.write_props(
- self.prop,
- self.grav,
- self.ivfamily,
- self.infmatmod,
- self.nvfamilies,
- self.propertySize,
- self.idout,
- self.idsk,
- self.kw,
- self.kp,
- self.ofile,
- self.pfile)
-
- # Write mesh info to UCD file, if requested
- if self.iucd >= 0:
- pylith3d.write_ucd_mesh(
- self.x,
- self.numnp,
- self.iens,
- self.ivfamily,
- self.numelv,
- self.nvfamilies,
- self.sh,
- self.nen,
- self.ngauss,
- self.ietypev,
- self.istatout,
- self.nstatout,
- self.kucd,
- self.iucd,
- self.ucdroot)
-
- # Write traction info
- pylith3d.write_tractions(
- self.tractionverts,
- self.tractionvals,
- self.numtractions,
- self.nsnodes,
- self.kw,
- self.idout,
- self.ofile)
-
- # Write split node info
- pylith3d.write_split(
- self.fault,
- self.nfault,
- self.numfn,
- self.kw,
- self.kp,
- self.idout,
- self.idsk,
- self.ofile,
- self.pfile)
-
- # Write slippery node info
- pylith3d.write_slip(
- self.nslip,
- self.numslp,
- self.numsn,
- self.kw,
- self.kp,
- self.idout,
- self.idsk,
- self.ofile,
- self.pfile)
-
- # Write differential force info and deallocate Nslip
- pylith3d.write_diff(
- self.diforc,
- self.nslip,
- self.idhist,
- self.numslp,
- self.numdif,
- self.numnp,
- self.kw,
- self.idout,
- self.ofile)
-
- self.nslip = None ### DEALLOC
-
- # Write split nodes to plot file, if requested and deallocate Idftn
- pylith3d.write_split_plot(
- self.idftn,
- self.numflt,
- self.kp,
- self.idsk,
- self.pfile)
-
- self.idftn = None ### DEALLOC
-
- # Write Winkler force info and deallocate definition arrays
- pylith3d.write_wink(
- self.winkdef,
- self.iwinkdef,
- self.iwinkid,
- self.nwinke,
- self.kw,
- self.idout,
- self.ofile)
-
- self.winkdef = None ### DEALLOC
- self.iwinkdef = None ### DEALLOC
-
- # Write slippery node Winkler force info and deallocate definition arrays
- pylith3d.write_winkx(
- self.winkxdef,
- self.iwinkxdef,
- self.iwinkxid,
- self.nwinkxe,
- self.kw,
- self.idout,
- self.ofile)
-
- self.winkxdef = None ### DEALLOC
- self.iwinkxdef = None ### DEALLOC
-
- # Write sparse matrix info
- pylith3d.write_sparse_info(
- self.neq,
- self.nnz,
- self.nmin,
- self.nmax,
- self.wavg,
- self.idout,
- self.kw,
- self.ofile)
-
- self.trace.log("Hello from pl3dsetup.meshwrite (end)!")
-
- return
-
-
-# The function of this code is to call the elastic and time-dependent solution
-# drivers. To do this, a number of previously-defined parameters need to be
-# bundled into lists.
-
-
- def solveElastic(self):
- pylith3d.elastc(
- self.A, # sparse
- self.rhs,
- self.sol,
- self.bextern, # force
- self.btraction,
- self.bgravity,
- self.bconcForce,
- self.bintern,
- self.bresid,
- self.bwink,
- self.bwinkx,
- self.dispVec,
- self.dprev,
- self.nforce,
- self.grav,
- self.x, # global
- self.d,
- self.deld,
- self.dcur,
- self.id,
- self.iwink,
- self.wink,
- self.nsysdat,
- self.iddmat,
- self.ibond, # BC
- self.bond,
- self.dx, # slip
- self.deldx,
- self.dxcur,
- self.diforc,
- self.idx,
- self.iwinkx,
- self.winkx,
- self.idslp,
- self.ipslp,
- self.idhist,
- self.fault, # fault
- self.nfault,
- self.dfault,
- self.tfault,
- self.s, # stiff
- self.stemp,
- self.state, # element
- self.dstate,
- self.state0,
- self.dmat,
- self.iens,
- self.lm,
- self.lmx,
- self.lmf,
- self.ivfamily,
- self.npar,
- self.ielindx,
- self.tractionverts, # traction
- self.tractionvals,
- self.gauss2d,
- self.sh2d,
- self.infetype2d,
- self.prop, # material
- self.infmatmod,
- self.gauss, # eltype
- self.sh,
- self.shj,
- self.infetype,
- self.histry, # timdat
- self.rtimdat,
- self.ntimdat,
- self.nvisdat,
- self.maxstp,
- self.delt,
- self.alfa,
- self.maxit,
- self.ntdinit,
- self.lgdef,
- self.utol,
- self.ftol,
- self.etol,
- self.itmax,
- self.rgiter, # stresscmp
- self.skew, # skew
- self.ncodat, # ioinfo
- self.nunits,
- self.nprint,
- self.istatout,
- self.nstatout,
- self.ofile, # files
- self.pfile,
- self.ucdroot,
- self.elasticStage, # PETSc logging
- self.iterateEvent)
- return
-
- def interpolatePoints(self, points):
- return pylith3d.interpolatePoints(self.mesh, self.sol, points)
-
- def runSimulation(self):
- # First define all of the lists that maintain variable values. The
- # variables in these lists are altered during the running of the code
- # and should not be accessed directly except as a member of the list.
- # They should not have been defined previously.
-
- self.trace.log("Hello from pl3drun.run (begin)!")
-
- print "Beginning problem solution:"
-
- if False: # Temporarily out-of-order
- # Output approximate memory usage
- self.memorySizeMB =0.0
- self.memorySizeMB=self.memorySize/(1024.0*1024.0)
-
- print ""
- print "Approximate memory allocation for f77 arrays (MB): %g" % self.memorySizeMB
-
- # print "Just before pylith3d.autoprestr:"
-
- # Compute gravitational prestresses, if requested.
- if self.analysisType == "elasticSolution" or self.analysisType == "fullSolution":
- if self.ipstrs == 1:
- pylith3d.autoprestr(
- self.A, # sparse
- self.rhs,
- self.sol,
- self.bextern, # force
- self.btraction,
- self.bgravity,
- self.bconcForce,
- self.bintern,
- self.bresid,
- self.bwink,
- self.bwinkx,
- self.dispVec,
- self.dprev,
- self.nforce,
- self.grav,
- self.x, # global
- self.d,
- self.deld,
- self.dcur,
- self.id,
- self.iwink,
- self.wink,
- self.nsysdat,
- self.iddmat,
- self.ibond, # BC
- self.bond,
- self.dx, # slip
- self.deldx,
- self.dxcur,
- self.diforc,
- self.idx,
- self.iwinkx,
- self.winkx,
- self.idslp,
- self.ipslp,
- self.idhist,
- self.fault, # split
- self.nfault,
- self.dfault,
- self.tfault,
- self.s, # stiff
- self.stemp,
- self.state, # element
- self.dstate,
- self.state0,
- self.dmat,
- self.iens,
- self.lm,
- self.lmx,
- self.lmf,
- self.ivfamily,
- self.npar,
- self.ielindx,
- self.tractionverts, # traction
- self.tractionvals,
- self.gauss2d,
- self.sh2d,
- self.infetype2d,
- self.prop, # material
- self.infmatmod,
- self.gauss, # eltype
- self.sh,
- self.shj,
- self.infetype,
- self.histry, # timdat
- self.rtimdat,
- self.ntimdat,
- self.nvisdat,
- self.maxstp,
- self.delt,
- self.alfa,
- self.maxit,
- self.ntdinit,
- self.lgdef,
- self.utol,
- self.ftol,
- self.etol,
- self.itmax,
- self.rgiter, # stresscmp
- self.skew, # skew
- self.ncodat, # ioinfo
- self.nunits,
- self.nprint,
- self.istatout,
- self.nstatout,
- self.ofile, # files
- self.pfile,
- self.ucdroot,
- self.autoprestrStage, # PETSc logging
- self.iterateEvent)
-
- # Perform elastic solution, if requested.
- self.solveElastic()
- pylith3d.outputMesh(self.fileRoot, self.mesh, self.sol)
-
- # Perform time-dependent solution, if requested.
-
- if self.analysisType == "fullSolution" and self.nintg > 1:
- if self.pythonTimestep:
- # Setup timestepping
- # Open output files
- pylith3d.viscos_setup(self.nprint,
- self.nunits,
- self.ofile,
- self.pfile,
- self.viscousStage)
- numCycles = pylith3d.intListRef(self.nvisdat, 0)
- numTimeStepGroups = pylith3d.intListRef(self.nvisdat, 1)
- numslp = pylith3d.intListRef(self.npar, 3)
- iskopt = pylith3d.intListRef(self.nsysdat, 10)
- icontr = pylith3d.intListRef(self.nprint, 0)
- indexx = 1 # Fortran index
- totalSteps = 0 # This is ntot
- for cycle in range(numCycles):
- if numCycles > 1: print ' working on cycle %d' % cycle
- nextStartStep = 0 # This is naxstp
- timeStep = 0 # This is nstep
- startStep = 0 # This is nfirst
- time = 0.0
-
- for tsGroup in range(1, numTimeStepGroups):
- # Define constants
- dt = pylith3d.doubleListRef(self.delt, tsGroup) # This is deltp
- pylith3d.doubleListSet(self.rtimdat, 0, dt)
- alfap = pylith3d.doubleListRef(self.alfa, tsGroup)
- pylith3d.doubleListSet(self.rtimdat, 1, alfap)
- pylith3d.intListSet(self.ntimdat, 0, timeStep)
- maxitp = pylith3d.intListRef(self.maxit, tsGroup)
- pylith3d.intListSet(self.ntimdat, 1, maxitp)
- ntdinitp = pylith3d.intListRef(self.ntdinit, tsGroup)
- pylith3d.intListSet(self.ntimdat, 2, ntdinitp)
- lgdefp = pylith3d.intListRef(self.lgdef, tsGroup)
- pylith3d.intListSet(self.ntimdat, 3, lgdefp)
- itmaxp = pylith3d.intListRef(self.itmax, tsGroup)
- pylith3d.intListSet(self.ntimdat, 4, itmaxp)
- gtol = [pylith3d.doubleListRef(self.utol, tsGroup),
- pylith3d.doubleListRef(self.ftol, tsGroup),
- pylith3d.doubleListRef(self.etol, tsGroup)]
- startStep = nextStartStep + 1
- nextStartStep = startStep + pylith3d.intListRef(self.maxstp, tsGroup) - 1
-
- ltim = 1
-
- for j in range(startStep, nextStartStep+1):
- totalSteps += 1
- timeStep += 1
- pylith3d.intListSet(self.ntimdat, 0, timeStep)
- time += dt
- skc = (numslp != 0 and (iskopt == 2 or (iskopt <= 0 and abs(iskopt) == timeStep)))
-
- pylith3d.viscos_step(
- self.A, # sparse
- self.rhs,
- self.sol,
- self.bextern, # force
- self.btraction,
- self.bgravity,
- self.bconcForce,
- self.bintern,
- self.bresid,
- self.bwink,
- self.bwinkx,
- self.dispVec,
- self.dprev,
- self.nforce,
- self.grav,
- self.x, # global
- self.d,
- self.deld,
- self.dcur,
- self.id,
- self.iwink,
- self.wink,
- self.nsysdat,
- self.iddmat,
- self.ibond, # BC
- self.bond,
- self.dx, # slip
- self.deldx,
- self.dxcur,
- self.diforc,
- self.idx,
- self.iwinkx,
- self.winkx,
- self.idslp,
- self.ipslp,
- self.idhist,
- self.fault, # fault
- self.nfault,
- self.dfault,
- self.tfault,
- self.s, # stiff
- self.stemp,
- self.state, # element
- self.dstate,
- self.state0,
- self.dmat,
- self.iens,
- self.lm,
- self.lmx,
- self.lmf,
- self.ivfamily,
- self.npar,
- self.ielindx,
- self.tractionverts, # traction
- self.tractionvals,
- self.gauss2d,
- self.sh2d,
- self.infetype2d,
- self.prop, # material
- self.infmatmod,
- self.gauss, # eltype
- self.sh,
- self.shj,
- self.infetype,
- self.histry, # timdat
- self.rtimdat,
- self.ntimdat,
- self.nvisdat,
- self.maxstp,
- self.delt,
- self.alfa,
- self.maxit,
- self.ntdinit,
- self.lgdef,
- self.utol,
- self.ftol,
- self.etol,
- self.itmax,
- self.rgiter, # stresscmp
- self.skew, # skew
- self.iprint, # ioinfo
- self.ncodat,
- self.nunits,
- self.nprint,
- self.istatout,
- self.nstatout,
- self.ofile, # files
- self.pfile,
- self.ucdroot,
- self.viscousStage, # PETSc logging
- self.iterateEvent,
- totalSteps,
- ltim,
- indexx,
- cycle,
- tsGroup,
- j,
- skc,
- startStep,
- timeStep,
- time,
- dt,
- lgdefp,
- gtol)
- ltim = 0
- if (totalSteps == pylith3d.intListRef(self.iprint, indexx-1)):
- pylith3d.outputMesh(self.fileRoot+'.'+str(totalSteps), self.mesh, self.sol)
- indexx += 1
- if (indexx > icontr): indexx = icontr
- print " Total number of equilibrium iterations =",pylith3d.intListRef(self.ntimdat, 5)
- print " Total number of stiffness matrix reformations =",pylith3d.intListRef(self.ntimdat, 6)
- print " Total number of displacement subiterations =",pylith3d.intListRef(self.ntimdat, 7)
- pylith3d.viscos_cleanup(self.ntimdat, self.nprint, self.nunits)
- else:
- pylith3d.viscos(
- self.A, # sparse
- self.rhs,
- self.sol,
- self.bextern, # force
- self.btraction,
- self.bgravity,
- self.bconcForce,
- self.bintern,
- self.bresid,
- self.bwink,
- self.bwinkx,
- self.dispVec,
- self.dprev,
- self.nforce,
- self.grav,
- self.x, # global
- self.d,
- self.deld,
- self.dcur,
- self.id,
- self.iwink,
- self.wink,
- self.nsysdat,
- self.iddmat,
- self.ibond, # BC
- self.bond,
- self.dx, # slip
- self.deldx,
- self.dxcur,
- self.diforc,
- self.idx,
- self.iwinkx,
- self.winkx,
- self.idslp,
- self.ipslp,
- self.idhist,
- self.fault, # fault
- self.nfault,
- self.dfault,
- self.tfault,
- self.s, # stiff
- self.stemp,
- self.state, # element
- self.dstate,
- self.state0,
- self.dmat,
- self.iens,
- self.lm,
- self.lmx,
- self.lmf,
- self.ivfamily,
- self.npar,
- self.ielindx,
- self.tractionverts, # traction
- self.tractionvals,
- self.gauss2d,
- self.sh2d,
- self.infetype2d,
- self.prop, # material
- self.infmatmod,
- self.gauss, # eltype
- self.sh,
- self.shj,
- self.infetype,
- self.histry, # timdat
- self.rtimdat,
- self.ntimdat,
- self.nvisdat,
- self.maxstp,
- self.delt,
- self.alfa,
- self.maxit,
- self.ntdinit,
- self.lgdef,
- self.utol,
- self.ftol,
- self.etol,
- self.itmax,
- self.rgiter, # stresscmp
- self.skew, # skew
- self.iprint, # ioinfo
- self.ncodat,
- self.nunits,
- self.nprint,
- self.istatout,
- self.nstatout,
- self.ofile, # files
- self.pfile,
- self.ucdroot,
- self.viscousStage, # PETSc logging
- self.iterateEvent)
- pylith3d.destroyPETScMat(self.A,self.rhs,self.sol)
-
- self.trace.log("Hello from pl3drun.run (end)!")
-
- return
-
-
-# end of file
Copied: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLithApp.py (from rev 6509, short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLith.py)
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLith.py 2007-04-05 21:54:55 UTC (rev 6509)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/PyLithApp.py 2007-04-14 02:02:55 UTC (rev 6570)
@@ -0,0 +1,626 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
+#
+# Copyright (c) 2004-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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+from cig.cs.petsc import PetscApplication
+import os
+import PyLithLib
+import PyLithMeshLib
+
+from pyre.units.pressure import Pa
+from pyre.units.length import m
+from pyre.units.time import s
+
+
+QuadratureOrder = dict(
+ Full = 1,
+ Reduced = 2,
+ Selective = 3,
+ )
+
+
+AsciiOutput = dict(
+ none = 0,
+ echo = 1,
+ full = 2,
+ )
+
+
+PlotOutput = dict(
+ none = 0,
+ ascii = 1,
+ binary = 2,
+ )
+
+
+AnalysisType = dict(
+ dataCheck = 0,
+ stiffnessFactor = 1,
+ elasticSolution = 2,
+ fullSolution = 3,
+ )
+
+
+def enumConverter(enum):
+ def converter(pylithApp, value):
+ return enum[value]
+ return converter
+
+
+def ucdOutputConverter(pylithApp, ucdOutput):
+ binIOError = None
+ try:
+ PyLithLib.try_binio(pylithApp.kucd)
+ except RuntimeError, binIOError:
+ iucd = 1
+ else:
+ iucd = 2
+ if ucdOutput == "none":
+ iucd = 0
+ elif ucdOutput == "ascii":
+ iucd = 1
+ elif ucdOutput == "binary":
+ if binIOError is None:
+ iucd = 2
+ else:
+ import journal
+ warning = journal.warning("pylith3d")
+ warning.line("Forcing 'ucdOutput' to 'ascii'.")
+ warning.line("Binary UCD output not supported for this Fortran compiler.")
+ warning.log(binIOError)
+ return iucd
+
+
+identity = lambda self, value: value
+
+
+class PyLithApp(PetscApplication):
+
+
+ name = "pylith3d"
+
+
+ #
+ # properties
+ #
+
+ import pyre.inventory as pyre
+ from cig.cs.petsc import PetscProperty
+
+ MacroString = pyre.str
+ OutputFile = pyre.str
+ InputFile = pyre.str
+
+ # declare PETSc options that are of interest to PyLith
+ ksp_monitor = PetscProperty(default="true")
+ ksp_view = PetscProperty(default="true")
+ ksp_rtol = PetscProperty(default="1.0e-9")
+ log_summary = PetscProperty(default="true")
+ pc_type = PetscProperty(default="bjacobi")
+ sub_pc_type = PetscProperty(default="ilu")
+ start_in_debugger = PetscProperty()
+ debugger_pause = PetscProperty()
+
+ # Title
+ title = pyre.str("title", default="PyLith-0.8 Simulation")
+ title.meta['tip'] = "Title for this simulation"
+ title.__converter = identity
+
+ # Basename for all files (may be overridden by specific filename entries).
+ fileRoot = pyre.str("fileRoot", default="pt1")
+ fileRoot.meta['tip'] = "Root pathname for simulation (all filenames derive from this)."
+ fileRoot.__converter = identity
+ inputFileRoot = pyre.str("inputFileRoot", default="${fileRoot}")
+ inputFileRoot.meta['tip'] = "Root input pathname for simulation (all input filenames derive from this)."
+ outputFileRoot = pyre.str("outputFileRoot", default="${fileRoot}")
+ outputFileRoot.meta['tip'] = "Root output pathname for simulation (all output filenames derive from this)."
+
+ # Output filenames (all are optional).
+ ofile = OutputFile("asciiOutputFile",default="${outputFileRoot}.ascii")
+ ofile.meta['tip'] = "Pathname for ascii output file (overrides default from outputFileRoot)."
+ ofile.__converter = identity
+
+ pfile = OutputFile("plotOutputFile",default="${outputFileRoot}.plot")
+ pfile.meta['tip'] = "Pathname for plot output file (overrides default from outputFileRoot)."
+ pfile.__converter = identity
+
+ ucdroot = MacroString("ucdOutputRoot",default="${outputFileRoot}")
+ ucdroot.meta['tip'] = "Base name for UCD output files (overrides default from outputFileRoot)."
+ ucdroot.__converter = identity
+
+ # Required input files.
+ coordinateInputFile = InputFile("coordinateInputFile",default="${inputFileRoot}.coord")
+ coordinateInputFile.meta['tip'] = "Pathname for coordinate input file (overrides default from inputFileRoot)."
+ coordinateInputFile.__converter = identity
+
+ bcfile = InputFile("bcInputFile",default="${inputFileRoot}.bc")
+ bcfile.meta['tip'] = "Pathname for boundary condition input file (overrides default from inputFileRoot)."
+ bcfile.__converter = identity
+
+ timeStepInputFile = InputFile("timeStepInputFile",default="${inputFileRoot}.time")
+ timeStepInputFile.meta['tip'] = "Pathname for time step definitions input file (overrides default from inputFileRoot)."
+ timeStepInputFile.__converter = identity
+
+ stfile = InputFile("stateVariableInputFile",default="${inputFileRoot}.statevar")
+ stfile.meta['tip'] = "Pathname for file defining which state variables to output (overrides default from inputFileRoot)."
+ stfile.__converter = identity
+
+ materialPropertiesInputFile = InputFile("materialPropertiesInputFile",default="${inputFileRoot}.prop")
+ materialPropertiesInputFile.meta['tip'] = "Pathname for file defining material properties (overrides default from inputFileRoot)."
+
+ connectivityInputFile = InputFile("connectivityInputFile",default="${inputFileRoot}.connect")
+ connectivityInputFile.meta['tip'] = "Pathname for connectivity input file (overrides default from inputFileRoot)."
+ connectivityInputFile.__converter = identity
+
+ # This file is only required for time-dependent problems.
+ fofile = InputFile("fullOutputInputFile",default="${inputFileRoot}.fuldat")
+ fofile.meta['tip'] = "Pathname for file defining when to provide output (overrides default from inputFileRoot)."
+ fofile.__converter = identity
+
+ # These files are optional unless generating Green's functions, in which case they are required.
+ sampleLocationFile = InputFile("sampleLocationFile",default="${inputFileRoot}.sample")
+ sampleLocationFile.meta['tip'] = "Pathname for Green's function sample locations (overrides default from inputFileRoot)."
+ sampleLocationFile.__converter = identity
+
+ spfile = InputFile("splitNodeInputFile",default="${inputFileRoot}.split")
+ spfile.meta['tip'] = "Pathname for split node input file (overrides default from inputFileRoot)."
+ spfile.__converter = identity
+
+ # Optional input files.
+ skfile = InputFile("rotationInputFile",default="${inputFileRoot}.skew")
+ skfile.meta['tip'] = "Pathname for skew rotations input file (overrides default from inputFileRoot)."
+ skfile.__converter = identity
+
+ hfile = InputFile("loadHistoryInputFile",default="${inputFileRoot}.hist")
+ hfile.meta['tip'] = "Pathname for file defining load histories (overrides default from inputFileRoot)."
+ hfile.__converter = identity
+
+ tractionInputFile = InputFile("tractionInputFile",default="${inputFileRoot}.traction")
+ tractionInputFile.meta['tip'] = "Pathname for traction BC input file (overrides default from inputFileRoot)."
+ tractionInputFile.__converter = identity
+
+ # Unused input files.
+ wfile = InputFile("winklerInputFile",default="${inputFileRoot}.wink")
+ wfile.meta['tip'] = "Pathname for Winkler force input file (overrides default from inputFileRoot)."
+ wfile.__converter = identity
+
+ materialHistoryInputFile = InputFile("materialHistoryInputFile",default="${inputFileRoot}.mhist")
+ materialHistoryInputFile.meta['tip'] = "Pathname for file defining material histories (overrides default from inputFileRoot -- presently unused)."
+ materialHistoryInputFile.__converter = identity
+
+ prestressInputFile = InputFile("prestressInputFile",default="${inputFileRoot}.prestr")
+ prestressInputFile.meta['tip'] = "Pathname for prestress input file (overrides default from inputFileRoot -- presently unused)."
+ prestressInputFile.__converter = identity
+
+ slfile = InputFile("slipperyNodeInputFile",default="${inputFileRoot}.slip")
+ slfile.meta['tip'] = "Pathname for slippery node input file (overrides default from inputFileRoot -- presently unused)."
+ slfile.__converter = identity
+
+ difile = InputFile("differentialForceInputFile",default="${inputFileRoot}.diff")
+ difile.meta['tip'] = "Pathname for file defining slippery node differential forces (overrides default from inputFileRoot -- presently unused)."
+ difile.__converter = identity
+
+ wxfile = InputFile("slipperyWinklerInputFile",default="${inputFileRoot}.winkx")
+ wxfile.meta['tip'] = "Pathname for file defining slippery node Winkler forces (overrides default from inputFileRoot -- presently unused)."
+ wxfile.__converter = identity
+
+ # Output option flags.
+ idout = pyre.str("asciiOutput",default="echo")
+ idout.validator = pyre.choice(["none","echo","full"])
+ idout.meta['tip'] = "Type of ascii output desired (none, echo, full)."
+ idout.__converter = enumConverter(AsciiOutput)
+
+ idsk = pyre.str("plotOutput",default="none")
+ idsk.validator = pyre.choice(["none","ascii","binary"])
+ idsk.meta['tip'] = "Type of plot output desired (none, ascii, binary)."
+ idsk.__converter = enumConverter(PlotOutput)
+
+ iucd = pyre.str("ucdOutput",default=None) # default is 'binary' if available; 'ascii' otherwise
+ iucd.validator = pyre.choice(["none","ascii","binary"])
+ iucd.meta['tip'] = "Type of UCD output desired (none, ascii, binary)."
+ iucd.__converter = ucdOutputConverter
+
+ # Additional option flags.
+ icode = pyre.str("analysisType",default="fullSolution")
+ icode.validator = pyre.choice(["dataCheck","stiffnessFactor",
+ "elasticSolution","fullSolution"])
+ icode.meta['tip'] = "Type of analysis (dataCheck, stiffnessFactor, elasticSolution, fullSolution)."
+ icode.__converter = enumConverter(AnalysisType)
+
+ pythonTimestep = pyre.bool("pythonTimestep",default=False)
+ pythonTimestep.meta['tip'] = "Whether to use python timestepping loop (enables VTK output for time-dependent solution)."
+ pythonTimestep.__converter = identity
+
+ generateGreen = pyre.bool("generateGreen",default=False)
+ generateGreen.meta['tip'] = "Whether to generate Green's function results for the specified split node inputs."
+ generateGreen.__converter = identity
+
+ idebug = pyre.bool("debuggingOutput",default=False)
+ idebug.meta['tip'] = "Whether to produce debugging output."
+ idebug.__converter = lambda self, value: int(value)
+
+ ncycle = pyre.int("numberCycles",default=1)
+ ncycle.meta['tip'] = "Number of cycles of the given timestep definitions to perform (default=1)."
+ ncycle.__converter = identity
+
+ interpolateMesh = pyre.bool("interpolateMesh",default=False)
+ interpolateMesh.meta['tip'] = "Create intermediate mesh entities, such as edges and faces."
+
+ partitioner = pyre.str("partitioner",default="chaco")
+ partitioner.validator = pyre.choice(["chaco","parmetis"])
+ partitioner.meta['tip'] = "Partitioner (chaco, parmetis)."
+
+ # Unused option flags.
+ iskopt = pyre.bool("autoRotateSlipperyNodes",default=True)
+ iskopt.meta['tip'] = "Whether to performa automatic rotation for slippery nodes (presently unused)."
+ iskopt.__converter = lambda self, value: int(value) + 1
+
+ #
+ # category 2 parameters formerly placed in *.keyval files
+ #
+
+ stol = pyre.dimensional("stressTolerance", default=1.0e-12*Pa)
+ stol.__converter = lambda self, value: value / Pa # convert to Pa
+ dtol = pyre.float("minimumStrainPerturbation", default=1.0e-7)
+ dtol.__converter = identity
+ epert = pyre.float("initialStrainPerturbation", default=1.0e-1)
+ epert.__converter = identity
+
+ nprevdflag = pyre.int("usePreviousDisplacementFlag", default=0)
+ nprevdflag.__converter = identity
+
+ intord = pyre.str("quadratureOrder", default="Full")
+ intord.validator = pyre.choice(["Full", "Reduced", "Selective"])
+ intord.__converter = enumConverter(QuadratureOrder)
+
+ ipstrs = pyre.bool("prestressAutoCompute", default=False)
+ ipstrs.__converter = lambda self, value: int(value)
+ ipauto = pyre.bool("prestressAutoChangeElasticProps", default=False)
+ ipauto.__converter = lambda self, value: int(value)
+ tpois = pyre.float("prestressAutoComputePoisson", default=0.49)
+ tpois.__converter = identity
+ tyoungs = pyre.dimensional("prestressAutoComputeYoungs", default=1.0e30*Pa)
+ tyoungs.__converter = lambda self, value: value / Pa # convert to Pa
+
+ gravityX = pyre.dimensional("gravityX", default=0.0*m/(s*s))
+ gravityY = pyre.dimensional("gravityY", default=0.0*m/(s*s))
+ gravityZ = pyre.dimensional("gravityZ", default=0.0*m/(s*s))
+
+ prestressScaleXx = pyre.float("prestressScaleXx", default=1.0)
+ prestressScaleYy = pyre.float("prestressScaleYy", default=1.0)
+ prestressScaleZz = pyre.float("prestressScaleZz", default=1.0)
+ prestressScaleXy = pyre.float("prestressScaleXy", default=1.0)
+ prestressScaleXz = pyre.float("prestressScaleXz", default=1.0)
+ prestressScaleYz = pyre.float("prestressScaleYz", default=1.0)
+
+ winklerScaleX = pyre.float("winklerScaleX", default=1.0)
+ winklerScaleY = pyre.float("winklerScaleY", default=1.0)
+ winklerScaleZ = pyre.float("winklerScaleZ", default=1.0)
+
+ winklerSlipScaleX = pyre.float("winklerSlipScaleX", default=1.0)
+ winklerSlipScaleY = pyre.float("winklerSlipScaleY", default=1.0)
+ winklerSlipScaleZ = pyre.float("winklerSlipScaleZ", default=1.0)
+
+ kti = pyre.int("f77StandardInput", default=5)
+ kti.__converter = identity
+ kto = pyre.int("f77StandardOutput", default=6)
+ kto.__converter = identity
+ kr = pyre.int("f77FileInput", default=10)
+ kr.__converter = identity
+ kw = pyre.int("f77AsciiOutput", default=11)
+ kw.__converter = identity
+ kp = pyre.int("f77PlotOutput", default=12)
+ kp.__converter = identity
+ kucd = pyre.int("f77UcdOutput", default=13)
+ kucd.__converter = identity
+
+
+
+
+ # Tell the framework where to find PETSc functions.
+ import PyLithLib as petsc
+
+
+ # Use PETSc-style command line parsing.
+ from cig.cs.petsc import PetscCommandlineParser as CommandlineParser
+
+
+ # hack to recognize old 'pl3dscan.xxx' and 'scanner.xxx' options
+ def applyConfiguration(self, context=None):
+ # this mimics the standard Pyre order: <component-name>.xxx overrides <facility-name>.xxx
+ for alias in ["scanner", "pl3dscan"]:
+ node = self.inventory._priv_registry.extractNode(alias)
+ if node:
+ node.name = self.name
+ self.updateConfiguration(node)
+ return super(PyLithApp, self).applyConfiguration(context)
+
+
+ def _validate(self, context):
+
+ super(PyLithApp, self)._validate(context)
+
+ #
+ # Open input files. Log I/O errors.
+ #
+
+ inputFile = lambda item, category: self.inputFile(item, category, context)
+ outputFile = lambda item, category: self.outputFile(item, category, context)
+ macroString = self.macroString
+
+ # open? fatal? label
+ optional = self.IOFileCategory(True, False, "optional")
+ unused = self.IOFileCategory(False, False, "unused")
+ required = self.IOFileCategory(True, True, None)
+
+ Inventory = self.metainventory
+
+ self.ofile = outputFile(Inventory.ofile, optional)
+ self.pfile = outputFile(Inventory.pfile, optional)
+ self.coordinateInputFile = inputFile(Inventory.coordinateInputFile, required)
+ self.bcfile = inputFile(Inventory.bcfile, required)
+ self.wfile = inputFile(Inventory.wfile, unused)
+ self.skfile = inputFile(Inventory.skfile, optional)
+ self.timeStepInputFile = inputFile(Inventory.timeStepInputFile, required)
+ self.fofile = inputFile(Inventory.fofile, self.icode == "fullSolution" and required or unused)
+ self.stfile = inputFile(Inventory.stfile, required)
+ self.hfile = inputFile(Inventory.hfile, optional)
+ self.materialPropertiesInputFile = inputFile(Inventory.materialPropertiesInputFile, required)
+ self.materialHistoryInputFile = inputFile(Inventory.materialHistoryInputFile, unused)
+ self.connectivityInputFile = inputFile(Inventory.connectivityInputFile, required)
+ self.prestressInputFile = inputFile(Inventory.prestressInputFile, unused)
+ self.tractionInputFile = inputFile(Inventory.tractionInputFile, optional)
+ self.spfile = inputFile(Inventory.spfile, self.generateGreen and required or optional)
+ # Slippery nodes are not yet implemented in PyLith-0.8.
+ self.slfile = inputFile(Inventory.slfile, unused)
+ self.difile = inputFile(Inventory.difile, unused)
+ self.wxfile = inputFile(Inventory.wxfile, unused)
+ self.sampleLocationFile = inputFile(Inventory.sampleLocationFile, self.generateGreen and required or unused)
+ # The call to glob() is somewhat crude -- basically, determine
+ # if any files might be in the way.
+ self.ucdroot = macroString(Inventory.ucdroot)
+
+ if False: # broken
+ from glob import glob
+ ucdFiles = ([self.ucdroot + ".mesh.inp",
+ self.ucdroot + ".gmesh.inp",
+ self.ucdroot + ".mesh.time.prest.inp",
+ self.ucdroot + ".gmesh.time.prest.inp"]
+ + glob(self.ucdroot + ".mesh.time.[0-9][0-9][0-9][0-9][0-9].inp")
+ + glob(self.ucdroot + ".gmesh.time.[0-9][0-9][0-9][0-9][0-9].inp"))
+ item = Inventory.ucdroot
+ for ucdFile in ucdFiles:
+ try:
+ stream = os.fdopen(os.open(ucdFile, os.O_WRONLY|os.O_CREAT|os.O_EXCL), "w")
+ except (OSError, IOError), error:
+ context.error(error, items=[item])
+ break
+ else:
+ stream.close()
+ os.remove(ucdFile)
+
+ return
+
+
+ def _init(self):
+ super(PyLithApp, self)._init()
+
+ pylith = PyLithLib.PyLith()
+ self.pylith = pylith
+
+ # Copy my traits to native code.
+ for trait in self.properties():
+ value = self.getTraitValue(trait.name)
+ converter = getattr(trait, '_PyLithApp__converter', None)
+ if converter:
+ value = converter(self, value)
+ setattr(pylith, trait.attr, value)
+
+ # Copy traits which have a many-to-one mapping.
+
+ pylith.grav = (
+ self.gravityX / (m/(s*s)),
+ self.gravityY / (m/(s*s)),
+ self.gravityZ / (m/(s*s)),
+ )
+
+ pylith.prscal = (
+ self.prestressScaleXx,
+ self.prestressScaleYy,
+ self.prestressScaleZz,
+ self.prestressScaleXy,
+ self.prestressScaleXz,
+ self.prestressScaleYz,
+ )
+
+ pylith.wscal = (
+ self.winklerScaleX,
+ self.winklerScaleY,
+ self.winklerScaleZ,
+ )
+
+ pylith.wxscal = (
+ self.winklerSlipScaleX,
+ self.winklerSlipScaleY,
+ self.winklerSlipScaleZ,
+ )
+
+ self.readMaterialProperties()
+
+ return
+
+
+ def readMaterialProperties(self):
+ from Materials import Materials
+
+ matinfo = Materials()
+ pylith = self.pylith
+
+ pylith.numat = matinfo.readprop(self.materialPropertiesInputFile)
+ pylith.prop = matinfo.propertyList
+ pylith.infmat = matinfo.materialModel
+
+ return
+
+
+ def main(self, *args, **kwds):
+
+ timer = False
+ if timer:
+ from time import clock as now
+ start = now()
+
+ from mpi import MPI_Comm_rank, MPI_COMM_WORLD
+ self.rank = MPI_Comm_rank(MPI_COMM_WORLD)
+
+ points = None
+ if self.generateGreen:
+ points = self.readSamplePoints(self.macroString(self.metainventory.sampleLocationFile))
+
+ self.pylith.mesh = PyLithMeshLib.Mesh(self.macroString(self.metainventory.inputFileRoot),
+ self.macroString(self.metainventory.bcfile),
+ self.interpolateMesh,
+ self.partitioner)
+
+ self.initialize()
+
+ self.pylith.run(points)
+
+ if timer:
+ finish = now()
+ usertime = finish - start
+ print "Total user time: %g" % usertime
+
+ return
+
+
+ def readSamplePoints(self, filename):
+ '''Read in the sampling locations
+ - One point per line, three values per line (x,y,z)
+ - Returns a Numeric array'''
+ import Numeric
+ f = file(filename)
+ points = []
+ for line in f.readlines():
+ points.append([float(v) for v in line.strip().split(' ')])
+ f.close()
+ return Numeric.array(points)
+
+
+ def initialize(self):
+
+ inputFile = lambda item, category: self.inputFile(item, category, None)
+ outputFile = lambda item, category: self.outputFile(item, category, None)
+ macroString = self.macroString
+ Inventory = self.metainventory
+ optional = self.IOFileCategory(True, 0, "optional")
+ required = self.IOFileCategory(True, 1, None)
+
+ # Get base file names
+ self.ofile = outputFile(Inventory.ofile, optional)
+ self.pfile = outputFile(Inventory.pfile, optional)
+ self.ucdroot = macroString(Inventory.ucdroot)
+ self.coordinateInputFile = inputFile(Inventory.coordinateInputFile, required)
+ self.connectivityInputFile = inputFile(Inventory.connectivityInputFile, required)
+ self.bcfile = inputFile(Inventory.bcfile, required)
+ self.spfile = inputFile(Inventory.spfile, optional)
+ self.tractionInputFile = inputFile(Inventory.tractionInputFile, optional)
+
+ # Create filenames for each process
+ for attr in ['ofile',
+ 'pfile',
+ 'ucdroot',
+ 'coordinateInputFile',
+ 'connectivityInputFile',
+ 'bcfile',
+ 'spfile',
+ 'tractionInputFile']:
+ filename = getattr(self, attr)
+ s = filename.split('.')
+ sieveFilename = ".".join(s[0:1] + [str(self.rank)] + s[1:])
+ setattr(self.pylith, attr, sieveFilename)
+
+ return
+
+
+ class IOFileCategory(object):
+ def __init__(self, tryOpen, isFatal, label):
+ self.tryOpen = tryOpen
+ self.isFatal = isFatal
+ self.label = label
+
+ def macroString(self, item):
+ from pyre.util import expandMacros
+ class InventoryAdapter(object):
+ def __init__(self, inventory, builtins):
+ self.inventory = inventory
+ self.builtins = builtins
+ def __getitem__(self, key):
+ builtin = self.builtins.get(key)
+ if builtin is None:
+ return expandMacros(str(self.inventory.getTraitValue(key)), self)
+ return builtin
+ builtins = {}
+ return expandMacros(item.value, InventoryAdapter(self.inventory, builtins))
+
+ def ioFileStream(self, item, flags, mode, category, context):
+ value = self.macroString(item)
+ stream = None
+ if category.tryOpen:
+ try:
+ stream = os.fdopen(os.open(value, flags), mode)
+ except (OSError, IOError), error:
+ if context is None:
+ if category.isFatal:
+ raise
+ elif category.isFatal:
+ context.error(error, items=[item])
+ else:
+ pass # warning?
+ return value, stream
+
+ def inputFile(self, item, category, context):
+ value, stream = self.ioFileStream(item, os.O_RDONLY, "r", category, context)
+ if stream is not None:
+ stream.close()
+ return value
+
+ def inputFileStream(self, item, category, context):
+ return self.ioFileStream(item, os.O_RDONLY, "r", category, context)[1]
+
+ def outputFile(self, item, category, context):
+ value, stream = self.ioFileStream(item, os.O_WRONLY|os.O_CREAT|os.O_EXCL, "w", category, context)
+ if stream is not None:
+ stream.close()
+ os.remove(value)
+ return value
+
+
+# end of file
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/__init__.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/__init__.py 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/__init__.py 2007-04-14 02:02:55 UTC (rev 6570)
@@ -29,15 +29,7 @@
#
-import sys
-
-# if we are embedding, insert the extension module in the
-# 'pylith3d' package
-try:
- import builtin_pylith3d
- sys.modules['pylith3d.pylith3d'] = builtin_pylith3d
-except ImportError:
- pass
+from PyLithApp import PyLithApp
def copyright():
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/constants.py
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/constants.py 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/constants.py 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# PyLith by Charles A. Williams, Brad Aagaard, and Matt Knepley
-#
-# Copyright (c) 2004-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.
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-
-# Parameters that are invariant for this geometry type
-numberSpaceDimensions = 3
-numberDegreesFreedom = 3
-stateVariableDimension = 6
-materialMatrixDimension = 21
-numberSkewDimensions = 2
-numberSlipDimensions = 5
-numberSlipNeighbors = 4
-
-# self.listIddmat = [
-# 1, 2, 3, 4, 5, 6,
-# 2, 7, 8, 9,10,11,
-# 3, 8,12,13,14,15,
-# 4, 9,13,16,17,18,
-# 5,10,14,17,19,20,
-# 6,11,15,18,20,21]
-# Changed this to correspond to BLAS packed symmetric matrix format.
-listIddmat = [
- 1, 2, 4, 7,11,16,
- 2, 3, 5, 8,12,17,
- 4, 5, 6, 9,13,18,
- 7, 8, 9,10,14,19,
- 11,12,13,14,15,20,
- 16,17,18,19,20,21]
-
-
-# Invariant parameters related to element type
-maxElementNodes = 20
-nsnodesmax = 4
-
-
-# Invariant parameters related to material model
-maxMaterialModels = 20
-maxStateVariables = 30
-
-
-numberAllowedVolumeElementTypes = 1
-
-
-# end of file
Deleted: short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/scan_parameter.defs
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/scan_parameter.defs 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pylith3d/scan_parameter.defs 2007-04-14 02:02:55 UTC (rev 6570)
@@ -1,84 +0,0 @@
-# Correspondences between python variables and their f77 equivalents.
-#
-# Python f77
-# Geometry invariants
-_numberSpaceDimensions nsd
-_numberDegreesFreedom ndof
-_stateVariableDimension nstr
-_geometryTypeInt ngem
-_materialMatrixDimension nddmat
-_numberSkewDimensions nskdim
-_numberSlipDimensions nsdim
-_numberSlipNeighbors npdim
-_numberTractionDirections npdir
-# Element type definition invariants
-_maxElementNodes nenmax
-_maxGaussPoints ngaussmax
--- neemax
-_numberElementTypes netypes
-_numberElementTypesBase netypesi
-_numberElementNodesBase neni(netypesi)
- _pointerToListArrayNumberElementNodesBase
-_pointerToElementTypeInfo infetype(4,netypes)
-# Material model definition invariants
-_maxMaterialModels nmatmodmax
-_maxStateVariables nstatesmax
-_pointerToMaterialModelInfo infmatmod(5,nmatmodmax)
-_pointerToMaterialModelStates ismatmod(nstatesmax,nmatmodmax)
-# Parameters derived from inventory or category 2 params
-_analysisTypeInt icode
-_quadratureOrderInt intord
-_prestressAutoComputeInt ipstrs
-_pointerToSh sh(nsd+1,nenmax,ngaussmax,netypes)
-_pointerToShj shj(nsd+1,nenmax,ngaussmax,netypes)
-_pointerToGauss gauss(nsd+1,ngaussmax,netypes)
-# Parameters derived from number of file entries
-_numberNodes numnp
-_coordinateScaleFactor cscale
-
-_numberBcEntries numbc
-_displacementScaleFactor dscale
-_velocityScaleFactor vscale
-_forceScaleFactor fscale
-
-_numberWinklerEntries nwinke
-_numberWinklerForces nwink
-
-_numberRotationEntries numrot
-_rotationScaleFactor runits
-
-_numberTimeStepGroups nintg
- _timeStepInfo[0]
-_totalNumberTimeSteps lastep
- _timeStepInfo[1]
-_timeScaleFactor tunits
-
-_numberFullOutputs icontr
-
-_numberLoadHistories nhist
-
-_numberMaterials numat
-_propertyListSize npropsz
-_propertyList prop(npropsz)
- _pointerToListArrayPropertyList
-_propertyListIndex indprop(numat)
- _pointerToListArrayPropertyListIndex
-_materialModel matmodel(numat)
- _pointerToListArrayMaterialModel
-_pointerToMaterialInfo infmat(3,numat)
-
-_numberElements numelt
-_connectivitySize nconsz
-
-_numberPrestressEntries nprestr
-
-_numberTractionBc numpr
-_tractionBcScaleFactor trunits
-
-_numberSplitNodeEntries numfn
-
-_numberSlipperyNodeEntries numslp
-_numberDifferentialForceEntries numdif
-_numberSlipperyWinklerEntries nwinkxe
-_numberSlipperyWinklerForces nwinkx
-
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/pypylith3d.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/pypylith3d.cc 2007-04-14 00:26:30 UTC (rev 6569)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/pypylith3d.cc 2007-04-14 02:02:55 UTC (rev 6570)
@@ -30,7 +30,6 @@
#include <Python.h>
#include <stdio.h>
-#include "pylith3dmodule.h"
#define COMMAND \
"import sys; " \
@@ -47,15 +46,15 @@
/* include the implementation of _mpi */
#include "mpi/_mpi.c"
-static void init_builtin_pylith3d()
-{
- pypylith3d_init("builtin_pylith3d");
- return;
+extern "C" {
+ void initPyLithLib();
+ void initPyLithMeshLib();
}
struct _inittab inittab[] = {
{ "_mpi", init_mpi },
- { "builtin_pylith3d", init_builtin_pylith3d },
+ { "PyLithLib", initPyLithLib },
+ { "PyLithMeshLib", initPyLithMeshLib },
{ 0, 0 }
};
More information about the cig-commits
mailing list