[cig-commits] r7653 - short/3D/PyLith/trunk/playpen/memcheck

brad at geodynamics.org brad at geodynamics.org
Thu Jul 12 15:09:37 PDT 2007


Author: brad
Date: 2007-07-12 15:09:37 -0700 (Thu, 12 Jul 2007)
New Revision: 7653

Added:
   short/3D/PyLith/trunk/playpen/memcheck/Makefile.am
   short/3D/PyLith/trunk/playpen/memcheck/setup.py
   short/3D/PyLith/trunk/playpen/memcheck/tidy.sh
Modified:
   short/3D/PyLith/trunk/playpen/memcheck/configure.ac
   short/3D/PyLith/trunk/playpen/memcheck/runtet4.cc
Log:
Initial implementation of test runner.

Added: short/3D/PyLith/trunk/playpen/memcheck/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/playpen/memcheck/Makefile.am	2007-07-12 22:09:02 UTC (rev 7652)
+++ short/3D/PyLith/trunk/playpen/memcheck/Makefile.am	2007-07-12 22:09:37 UTC (rev 7653)
@@ -0,0 +1,32 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+ACLOCAL_AMFLAGS = -I ./m4
+
+bin_PROGRAMS = runtet4
+
+# Primary source files
+runtet4_SOURCES = \
+	runtet4.cc
+
+AM_CPPFLAGS = \
+	$(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE) \
+	-I$(PYTHON_INCDIR) $(PYTHON_EGG_CPPFLAGS)
+
+runtet4_LDADD = \
+	-lpylith \
+	-lspatialdata \
+	$(PETSC_LIB) $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
+
+CLEANFILES = $(bin_PROGRAMS)
+
+# End of file 

Modified: short/3D/PyLith/trunk/playpen/memcheck/configure.ac
===================================================================
--- short/3D/PyLith/trunk/playpen/memcheck/configure.ac	2007-07-12 22:09:02 UTC (rev 7652)
+++ short/3D/PyLith/trunk/playpen/memcheck/configure.ac	2007-07-12 22:09:37 UTC (rev 7653)
@@ -27,6 +27,15 @@
 	[enable_cubit=no])
 AM_CONDITIONAL([ENABLE_CUBIT], [test "$enable_cubit" = yes])
 
+# PETSc w/TetGen
+AC_ARG_ENABLE([tetgen],
+    [AC_HELP_STRING([--enable-tetgen],
+        [enable generating simple meshes w/TetGen via PETSc @<:@default=no@:>@])],
+	[enable_tetgen=yes
+	CXXFLAGS="-DENABLE_TETGEN $CXXFLAGS"; export CXXFLAGS],
+	[enable_tetgen=no])
+AM_CONDITIONAL([ENABLE_TETGEN], [test "$enable_tetgen" = yes])
+
 # ----------------------------------------------------------------------
 # C/C++/libtool/install
 AC_PROG_CXX
@@ -43,6 +52,11 @@
 
 AC_PROG_INSTALL
 
+# PYTHON
+#CIT_PATH_NEMESIS
+AM_PATH_PYTHON([2.3])
+CIT_PYTHON_SYSCONFIG
+
 # MPI
 AC_LANG(C++)
 #CIT_PROG_MPICXX
@@ -58,20 +72,21 @@
 # Check for Python modules and packages.
 CIT_PYTHON_EGG_SETUP
 
-# CUBIT (netcdf)
-if test "$enable_cubit" = "yes" ; then
+# TETGEN
+if test "$enable_tetgen" = "yes" ; then
+  AC_REQUIRE_CPP
   AC_LANG(C++)
-  AC_CHECK_HEADER([netcdfcpp.h], [], [
-    AC_MSG_ERROR([netcdf C++ header not found; try CPPFLAGS="-I<netcdf include dir>"])
+  CPPFLAGS="$PETSC_INCLUDE $PETSC_CXX_INCLUDE $CPPFLAGS"
+  AC_CHECK_HEADER([tetgen.h], [], [
+    AC_MSG_ERROR([tetgen header not found; check PETSc installation.])
   ])
-  AC_MSG_CHECKING([for NcFile in -lnetcdfc++])
-  AC_REQUIRE_CPP
+  AC_MSG_CHECKING([for tetgenbehavior in -ltetgen])
   AC_COMPILE_IFELSE(
-    [AC_LANG_PROGRAM([[#include <netcdfcpp.h>]],
-	             [[NcFile ncfile("filename");]])],
+    [AC_LANG_PROGRAM([[#include <tetgen.h>]],
+	             [[tetgenbehavior  behavior;]])],
     [AC_MSG_RESULT(yes)],
     [AC_MSG_RESULT(no)
-     AC_MSG_ERROR([netcdfc++ library not found; try LDFLAGS="-L<netcdf lib dir>"])
+     AC_MSG_ERROR([tetgen library not found; check PETSc installation.])
   ])
 fi
 

Modified: short/3D/PyLith/trunk/playpen/memcheck/runtet4.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/memcheck/runtet4.cc	2007-07-12 22:09:02 UTC (rev 7652)
+++ short/3D/PyLith/trunk/playpen/memcheck/runtet4.cc	2007-07-12 22:09:37 UTC (rev 7653)
@@ -15,10 +15,20 @@
 #include <petsc.h>
 #include <Python.h>
 
-#include "pylith/meshio/MeshIOLagrit.hh"
 #include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
 #include "pylith/utils/array.hh" // USES int_array
 
+#include "pylith/meshio/MeshIOLagrit.hh"
+
+#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
+#include "pylith/feassemble/Quadrature3D.hh" // USES Quadrature3D
+
+#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
+#include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii
+#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
+
+#include <iostream>
+
 int
 main(int argc,
      char** argv)
@@ -37,15 +47,74 @@
     pylith::meshio::MeshIOLagrit iohandler;
     iohandler.filenameGmv(filenameGmv);
     iohandler.filenamePset(filenamePset);
-    ALE::Obj<Mesh> mesh;
+    ALE::Obj<pylith::Mesh> mesh;
     iohandler.read(&mesh);
 
+    spatialdata::geocoords::CSCart cs;
+    cs.initialize();
+
+    pylith::feassemble::Quadrature3D quadrature;
+    const int cellDim = 3;
+    const int numCorners = 4;
+    const int numQuadPts = 1;
+    const int spaceDim = 3;
+    const double verticesRef[] = {
+      -1.0, -1.0, -1.0,
+       1.0, -1.0, -1.0,
+      -1.0,  1.0, -1.0,
+      -1.0, -1.0,  1.0
+    };
+    const double basis[] = { 0.25, 0.25, 0.25, 0.25 };
+    const double basisDeriv[] = {
+      -0.5, -0.5, -0.5,
+       0.5,  0.0,  0.0,
+       0.0,  0.5,  0.0,
+       0.0,  0.0,  0.5
+    };
+    const double quadPtsRef[] = { -0.5, -0.5, -0.5 };
+    const double quadWts[] = { 1.33333333333  };
+    quadrature.initialize(verticesRef, basis, basisDeriv, quadPtsRef, quadWts,
+			  cellDim, numCorners, numQuadPts, spaceDim);
+
+    pylith::materials::ElasticIsotropic3D materialA;
+    pylith::materials::ElasticIsotropic3D materialB;
+    pylith::materials::ElasticIsotropic3D materialC;
+    pylith::materials::ElasticIsotropic3D materialD;
+
+    spatialdata::spatialdb::SimpleDB db;
+    spatialdata::spatialdb::SimpleIOAscii dbiohandler;
+    dbiohandler.filename("mat_elastic.spatialdb");
+    db.ioHandler(&dbiohandler);
+    db.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+      
+    materialA.db(&db);
+    materialA.id(1);
+    materialA.label("elastic xpos");
+    materialA.initialize(mesh, &cs, &quadrature);
+
+    materialB.db(&db);
+    materialB.id(2);
+    materialB.label("elastic xpos");
+    materialB.initialize(mesh, &cs, &quadrature);
+
+    materialC.db(&db);
+    materialC.id(3);
+    materialC.label("elastic xpos");
+    materialC.initialize(mesh, &cs, &quadrature);
+
+    materialD.db(&db);
+    materialD.id(4);
+    materialD.label("elastic xpos");
+    materialD.initialize(mesh, &cs, &quadrature);
+
     // Finalize Python
     Py_Finalize();
 
     // Finalize PETSc
     err = PetscFinalize();
     CHKERRQ(err);
+  } catch (const std::exception& err) {
+    std::cerr << err.what() << std::endl;
   } catch (...) {
     abort();
   } // catch

Added: short/3D/PyLith/trunk/playpen/memcheck/setup.py
===================================================================
--- short/3D/PyLith/trunk/playpen/memcheck/setup.py	2007-07-12 22:09:02 UTC (rev 7652)
+++ short/3D/PyLith/trunk/playpen/memcheck/setup.py	2007-07-12 22:09:37 UTC (rev 7653)
@@ -0,0 +1,26 @@
+
+from archimedes import use_merlin
+use_merlin()
+
+from merlin import setup, find_packages
+
+setup(
+    
+    name = 'PyLith', 
+    version = '1.0',
+
+    zip_safe = False,
+    packages = find_packages(),
+    
+    install_requires = [
+    'spatialdata',
+    'pythia[mpi] >= 0.8.1.4, < 0.8.2a',
+    ],
+
+    author = 'Brad Aagaard, Charles A. Williams, and Matt Knepley',
+    author_email = 'cig-short at geodynamics.org',
+    description = """A finite element code for the solution of crustal deformation problems associated with earthquakes, including kinematic ruptures, spontaneous ruptures, and pre- and post-seismic deformation.""",
+    license = 'other',
+    url = 'http://www.geodynamics.org/cig/software/packages/short/pylith/',
+
+)

Added: short/3D/PyLith/trunk/playpen/memcheck/tidy.sh
===================================================================
--- short/3D/PyLith/trunk/playpen/memcheck/tidy.sh	2007-07-12 22:09:02 UTC (rev 7652)
+++ short/3D/PyLith/trunk/playpen/memcheck/tidy.sh	2007-07-12 22:09:37 UTC (rev 7653)
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+# Remove autoconf stuff
+autoconf_files="aclocal.m4 configure portinfo.in"
+autoconf_dirs="autom4te.cache aux-config"
+rm -r $autoconf_dirs
+rm $autoconf_files
+rm `find . -name Makefile.in`
+
+# Remove emacs backup stuff
+rm `find . -name "*~"`
+
+# Remove compiled python
+rm `find . -name "*.pyc"`
+
+# version
+# $Id: tidy.sh,v 1.1 2005/10/10 17:21:19 brad Exp $
+
+# End of file


Property changes on: short/3D/PyLith/trunk/playpen/memcheck/tidy.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the cig-commits mailing list