[cig-commits] r13418 - in cs/spatialdata-0.1/trunk: . libsrc libsrc/units modulesrc modulesrc/units spatialdata spatialdata/units tests/libtests tests/libtests/units tests/pytests tests/pytests/spatialdb tests/pytests/units
brad at geodynamics.org
brad at geodynamics.org
Thu Nov 27 14:02:03 PST 2008
Author: brad
Date: 2008-11-27 14:02:02 -0800 (Thu, 27 Nov 2008)
New Revision: 13418
Added:
cs/spatialdata-0.1/trunk/libsrc/units/
cs/spatialdata-0.1/trunk/libsrc/units/Makefile.am
cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.cc
cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.hh
cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.icc
cs/spatialdata-0.1/trunk/modulesrc/units/
cs/spatialdata-0.1/trunk/modulesrc/units/Makefile.am
cs/spatialdata-0.1/trunk/modulesrc/units/units.pyxe.src
cs/spatialdata-0.1/trunk/spatialdata/units/
cs/spatialdata-0.1/trunk/spatialdata/units/NondimElastic.py
cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticDynamic.py
cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticQuasistatic.py
cs/spatialdata-0.1/trunk/spatialdata/units/__init__.py
cs/spatialdata-0.1/trunk/tests/libtests/units/
cs/spatialdata-0.1/trunk/tests/libtests/units/Makefile.am
cs/spatialdata-0.1/trunk/tests/libtests/units/TestNondimElastic.cc
cs/spatialdata-0.1/trunk/tests/libtests/units/TestNondimElastic.hh
cs/spatialdata-0.1/trunk/tests/libtests/units/testunits.cc
cs/spatialdata-0.1/trunk/tests/pytests/units/
cs/spatialdata-0.1/trunk/tests/pytests/units/Makefile.am
cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElastic.py
cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticDynamic.py
cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticQuasistatic.py
cs/spatialdata-0.1/trunk/tests/pytests/units/testunits.py
Modified:
cs/spatialdata-0.1/trunk/configure.ac
cs/spatialdata-0.1/trunk/libsrc/Makefile.am
cs/spatialdata-0.1/trunk/modulesrc/Makefile.am
cs/spatialdata-0.1/trunk/spatialdata/Makefile.am
cs/spatialdata-0.1/trunk/tests/libtests/Makefile.am
cs/spatialdata-0.1/trunk/tests/pytests/Makefile.am
cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py
Log:
Added manager of scales used for nondimensionalization.
Modified: cs/spatialdata-0.1/trunk/configure.ac
===================================================================
--- cs/spatialdata-0.1/trunk/configure.ac 2008-11-27 01:41:07 UTC (rev 13417)
+++ cs/spatialdata-0.1/trunk/configure.ac 2008-11-27 22:02:02 UTC (rev 13418)
@@ -25,7 +25,7 @@
# PYTHIA w/pythia
AC_ARG_ENABLE([pythia],
- [ --enable-pythia Enable use of Pythia (requires pythia) [[default=no]]],
+ [ --enable-pythia Enable use of Pythia (requires pythia) [[default=yes]]],
[enable_pythia=yes],
[enable_pythia=no])
@@ -149,10 +149,12 @@
libsrc/geocoords/Makefile
libsrc/geocoords/data/Makefile
libsrc/spatialdb/Makefile
+ libsrc/units/Makefile
libsrc/utils/Makefile
modulesrc/Makefile
modulesrc/geocoords/Makefile
modulesrc/spatialdb/Makefile
+ modulesrc/units/Makefile
modulesrc/utils/Makefile
spatialdata/Makefile
tests/Makefile
@@ -161,12 +163,14 @@
tests/libtests/geocoords/data/Makefile
tests/libtests/spatialdb/Makefile
tests/libtests/spatialdb/data/Makefile
+ tests/libtests/units/Makefile
tests/libtests/utils/Makefile
tests/libtests/utils/data/Makefile
tests/pytests/Makefile
tests/pytests/geocoords/Makefile
tests/pytests/spatialdb/Makefile
tests/pytests/spatialdb/data/Makefile
+ tests/pytests/units/Makefile
tests/pytests/utils/Makefile
applications/Makefile
templates/Makefile
Modified: cs/spatialdata-0.1/trunk/libsrc/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/Makefile.am 2008-11-27 01:41:07 UTC (rev 13417)
+++ cs/spatialdata-0.1/trunk/libsrc/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -13,13 +13,12 @@
SUBDIRS = \
geocoords \
spatialdb \
+ units \
utils
lib_LTLIBRARIES = libspatialdata.la
libspatialdata_la_SOURCES = \
- utils/LineParser.cc \
- utils/PointsStream.cc \
geocoords/Converter.cc \
geocoords/CoordSys.cc \
geocoords/CSCart.cc \
@@ -39,7 +38,10 @@
spatialdb/SimpleIO.cc \
spatialdb/SimpleIOAscii.cc \
spatialdb/UniformDB.cc \
- spatialdb/cspatialdb.cc
+ spatialdb/cspatialdb.cc \
+ units/NondimElastic.cc \
+ utils/LineParser.cc \
+ utils/PointsStream.cc
libspatialdata_la_LDFLAGS = $(AM_LDFLAGS)
Added: cs/spatialdata-0.1/trunk/libsrc/units/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/units/Makefile.am (rev 0)
+++ cs/spatialdata-0.1/trunk/libsrc/units/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,27 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = units
+include $(top_srcdir)/subpackage.am
+
+subpkginclude_HEADERS = \
+ NondimElastic.hh \
+ NondimElastic.icc
+
+noinst_HEADERS =
+
+# export
+clean-local: clean-subpkgincludeHEADERS
+BUILT_SOURCES = export-subpkgincludeHEADERS
+CLEANFILES = export-subpkgincludeHEADERS
+
+# End of file
Added: cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.cc (rev 0)
+++ cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.cc 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,219 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "NondimElastic.hh" // implementation of class methods
+
+#include <sstream> // USES std::ostringstream
+#include <stdexcept> // USES std::runtime_error
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor
+spatialdata::units::NondimElastic::NondimElastic(void) :
+ _length(1.0),
+ _pressure(1.0),
+ _time(1.0),
+ _density(1.0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor
+spatialdata::units::NondimElastic::~NondimElastic(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Copy constructor.
+spatialdata::units::NondimElastic::NondimElastic(const NondimElastic& dim) :
+ _length(dim._length),
+ _pressure(dim._pressure),
+ _time(dim._time),
+ _density(dim._density)
+{ // copy constructor
+} // copy constructor
+
+// ----------------------------------------------------------------------
+// Assignment operator.
+const spatialdata::units::NondimElastic&
+spatialdata::units::NondimElastic::operator=(const NondimElastic& dim)
+{ // operator=
+ if (this != &dim) {
+ _length = dim._length;
+ _pressure = dim._pressure;
+ _time = dim._time;
+ _density = dim._density;
+ } // if
+
+ return *this;
+} // operator=
+
+// ----------------------------------------------------------------------
+// Set value to nondimensionalize length scale in meters (SI units).
+void
+spatialdata::units::NondimElastic::lengthScale(const double value)
+{ // lengthScale
+ if (value <= 0.0) {
+ std::ostringstream msg;
+ msg << "Length scale (" << value << ") must be positive.";
+ throw std::runtime_error(msg.str());
+ } // if
+ _length = value;
+} // lengthScale
+
+// ----------------------------------------------------------------------
+// Set value to nondimensionalize pressure scale in Pascals (SI units).
+void
+spatialdata::units::NondimElastic::pressureScale(const double value)
+{ // pressureScale
+ if (value <= 0.0) {
+ std::ostringstream msg;
+ msg << "Pressure scale (" << value << ") must be positive.";
+ throw std::runtime_error(msg.str());
+ } // if
+ _pressure = value;
+} // pressureScale
+
+// ----------------------------------------------------------------------
+// Set value to nondimensionalize time scale in seconds (SI units).
+void
+spatialdata::units::NondimElastic::timeScale(const double value)
+{ // timeScale
+ if (value <= 0.0) {
+ std::ostringstream msg;
+ msg << "Time scale (" << value << ") must be positive.";
+ throw std::runtime_error(msg.str());
+ } // if
+ _time = value;
+} // timeScale
+
+// ----------------------------------------------------------------------
+// Set value to nondimensionalize density scale in kg/m^3 (SI units).
+void
+spatialdata::units::NondimElastic::densityScale(const double value)
+{ // densityScale
+ if (value <= 0.0) {
+ std::ostringstream msg;
+ msg << "Density scale (" << value << ") must be positive.";
+ throw std::runtime_error(msg.str());
+ } // if
+ _density = value;
+} // densityScale
+
+// ----------------------------------------------------------------------
+// Make length scales dimensionless.
+void
+spatialdata::units::NondimElastic::utonLength(double* const values,
+ const int nvalues) const
+{ // utonLength
+ assert( (0 < nvalues && 0 != values) ||
+ (0 == nvalues && 0 == values) );
+
+ for (int i=0; i < nvalues; ++i)
+ values[i] /= _length;
+} // utonLength
+
+// ----------------------------------------------------------------------
+// Add dimensions to length scale.
+void
+spatialdata::units::NondimElastic::ntouLength(double* const values,
+ const int nvalues) const
+{ // ntouLength
+ assert( (0 < nvalues && 0 != values) ||
+ (0 == nvalues && 0 == values) );
+
+ for (int i=0; i < nvalues; ++i)
+ values[i] *= _length;
+} // ntouLength
+
+// ----------------------------------------------------------------------
+// Make pressure scales dimensionless.
+void
+spatialdata::units::NondimElastic::utonPressure(double* const values,
+ const int nvalues) const
+{ // utonPressure
+ assert( (0 < nvalues && 0 != values) ||
+ (0 == nvalues && 0 == values) );
+
+ for (int i=0; i < nvalues; ++i)
+ values[i] /= _pressure;
+} // utonPressure
+
+// ----------------------------------------------------------------------
+// Add dimensions to pressure scale.
+void
+spatialdata::units::NondimElastic::ntouPressure(double* const values,
+ const int nvalues) const
+{ // ntouPressure
+ assert( (0 < nvalues && 0 != values) ||
+ (0 == nvalues && 0 == values) );
+
+ for (int i=0; i < nvalues; ++i)
+ values[i] *= _pressure;
+} // ntouPressure
+
+// ----------------------------------------------------------------------
+// Make time scales dimensionless.
+void
+spatialdata::units::NondimElastic::utonTime(double* const values,
+ const int nvalues) const
+{ // utonTime
+ assert( (0 < nvalues && 0 != values) ||
+ (0 == nvalues && 0 == values) );
+
+ for (int i=0; i < nvalues; ++i)
+ values[i] /= _time;
+} // utonTime
+
+// ----------------------------------------------------------------------
+// Add dimensions to time scale.
+void
+spatialdata::units::NondimElastic::ntouTime(double* const values,
+ const int nvalues) const
+{ // ntouTime
+ assert( (0 < nvalues && 0 != values) ||
+ (0 == nvalues && 0 == values) );
+
+ for (int i=0; i < nvalues; ++i)
+ values[i] *= _time;
+} // ntouTime
+
+// ----------------------------------------------------------------------
+// Make density scales dimensionless.
+void
+spatialdata::units::NondimElastic::utonDensity(double* const values,
+ const int nvalues) const
+{ // utonDensity
+ assert( (0 < nvalues && 0 != values) ||
+ (0 == nvalues && 0 == values) );
+
+ for (int i=0; i < nvalues; ++i)
+ values[i] /= _density;
+} // utonDensity
+
+// ----------------------------------------------------------------------
+// Add dimensions to density scale.
+void
+spatialdata::units::NondimElastic::ntouDensity(double* const values,
+ const int nvalues) const
+{ // ntouDensity
+ assert( (0 < nvalues && 0 != values) ||
+ (0 == nvalues && 0 == values) );
+
+ for (int i=0; i < nvalues; ++i)
+ values[i] *= _density;
+} // ntouDensity
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.hh (rev 0)
+++ cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.hh 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,217 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file libsrc/units/NondimElastic.hh
+ *
+ * @brief C++ Nondimensionalization for elasticity.
+ *
+ * C++ object for managing scales associated with elasticity.
+ */
+
+#if !defined(spatialdata_units_nondimelastic_hh)
+#define spatialdata_units_nondimelastic_hh
+
+namespace spatialdata {
+ namespace units {
+ class NondimElastic;
+
+ class TestNondimElastic; // Unit testing
+ } // units
+} // spatialdata
+
+/// C++ object for managing parameters defining a coordinate system
+class spatialdata::units::NondimElastic
+{ // class NondimElastic
+ friend class TestNondimElastic; // Unit testing
+
+public :
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+
+ /// Default constructor
+ NondimElastic(void);
+
+ /// Default destructor
+ ~NondimElastic(void);
+
+ /** Copy constructor.
+ *
+ * @param dim Object to copy.
+ */
+ NondimElastic(const NondimElastic& dim);
+
+ /** Assignment operator.
+ *
+ * @param dim Object to copy.
+ * @returns Copy of this.
+ */
+ const NondimElastic& operator=(const NondimElastic& dim);
+
+ /** Set value to nondimensionalize length scale in meters (SI units).
+ *
+ * @param value Length scale in meters (SI units).
+ */
+ void lengthScale(const double value);
+
+ /** Set value to nondimensionalize pressure scale in Pascals (SI units).
+ *
+ * @param value Pressure scale in Pascals (SI units).
+ */
+ void pressureScale(const double value);
+
+ /** Set value to nondimensionalize time scale in seconds (SI units).
+ *
+ * @param value Time scale in seconds (SI units).
+ */
+ void timeScale(const double value);
+
+ /** Set value to nondimensionalize density scale in kg/m^3 (SI units).
+ *
+ * @param value Density scale in kg/m^3 (SI units).
+ */
+ void densityScale(const double value);
+
+ /** Make length scale dimensionless.
+ *
+ * @param value Length in meters (SI units).
+ * @returns Dimensionless length.
+ */
+ double utonLength(const double value) const;
+
+ /** Make length scales dimensionless.
+ *
+ * @param values Array of lengths in meters (SI units).
+ * @param int Number of values.
+ */
+ void utonLength(double* const values,
+ const int nvalues) const;
+
+ /** Add dimensions to length scale.
+ *
+ * @param value Dimensionless length.
+ * @returns Length in meters (SI units).
+ */
+ double ntouLength(const double value) const;
+
+ /** Add dimensions to length scale.
+ *
+ * @param values Array of dimensionless lengths.
+ * @param int Number of values.
+ */
+ void ntouLength(double* const values,
+ const int nvalues) const;
+
+ /** Make pressure scale dimensionless.
+ *
+ * @param value Pressure in Pascals (SI units).
+ * @returns Dimensionless pressure.
+ */
+ double utonPressure(const double value) const;
+
+ /** Make pressure scales dimensionless.
+ *
+ * @param values Array of pressures in Pascals (SI units).
+ * @param int Number of values.
+ */
+ void utonPressure(double* const values,
+ const int nvalues) const;
+
+ /** Add dimensions to pressure scale.
+ *
+ * @param value Dimensionless pressure.
+ * @returns Pressure in meters (SI units).
+ */
+ double ntouPressure(const double value) const;
+
+ /** Add dimensions to pressure scale.
+ *
+ * @param values Array of dimensionless pressures.
+ * @param int Number of values.
+ */
+ void ntouPressure(double* const values,
+ const int nvalues) const;
+
+ /** Make time scale dimensionless.
+ *
+ * @param value Time in seconds (SI units).
+ * @returns Dimensionless time.
+ */
+ double utonTime(const double value) const;
+
+ /** Make time scales dimensionless.
+ *
+ * @param values Array of times in seconds (SI units).
+ * @param int Number of values.
+ */
+ void utonTime(double* const values,
+ const int nvalues) const;
+
+ /** Add dimensions to time scale.
+ *
+ * @param value Dimensionless time.
+ * @returns Time in meters (SI units).
+ */
+ double ntouTime(const double value) const;
+
+ /** Add dimensions to time scale.
+ *
+ * @param values Array of dimensionless times.
+ * @param int Number of values.
+ */
+ void ntouTime(double* const values,
+ const int nvalues) const;
+
+ /** Make density scale dimensionless.
+ *
+ * @param value Density in kg/m^3 (SI units).
+ * @returns Dimensionless density.
+ */
+ double utonDensity(const double value) const;
+
+ /** Make density scales dimensionless.
+ *
+ * @param values Array of densities in kg/m^3 (SI units).
+ * @param int Number of values.
+ */
+ void utonDensity(double* const values,
+ const int nvalues) const;
+
+ /** Add dimensions to density scale.
+ *
+ * @param value Dimensionless density.
+ * @returns Density in meters (SI units).
+ */
+ double ntouDensity(const double value) const;
+
+ /** Add dimensions to density scale.
+ *
+ * @param values Array of dimensionless densities.
+ * @param int Number of values.
+ */
+ void ntouDensity(double* const values,
+ const int nvalues) const;
+
+private :
+ // PRIVATE MEMBERS ////////////////////////////////////////////////////
+
+ double _length; ///< Length scale
+ double _pressure; ///< Pressure scale
+ double _time; ///< Time scale
+ double _density; ///< Density scale
+
+}; // class NondimElastic
+
+#include "NondimElastic.icc" // inline methods
+
+#endif // spatialdata_units_nondimelastic_hh
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.icc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.icc (rev 0)
+++ cs/spatialdata-0.1/trunk/libsrc/units/NondimElastic.icc 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(spatialdata_units_nondimelastic_hh)
+#error "NondimElastic.icc must only be included from NondimElastic.hh"
+#endif
+
+// Make length scale dimensionless.
+inline
+double
+spatialdata::units::NondimElastic::utonLength(const double value) const {
+ return value / _length;
+} // utonLength
+
+// Add dimensions to length scale.
+inline
+double
+spatialdata::units::NondimElastic::ntouLength(const double value) const {
+ return value * _length;
+} // ntouLength
+
+// Make pressure scale dimensionless.
+inline
+double
+spatialdata::units::NondimElastic::utonPressure(const double value) const {
+ return value / _pressure;
+} // utonPressure
+
+// Add dimensions to pressure scale.
+inline
+double
+spatialdata::units::NondimElastic::ntouPressure(const double value) const {
+ return value * _pressure;
+} // ntouPressure
+
+// Make time scale dimensionless.
+inline
+double
+spatialdata::units::NondimElastic::utonTime(const double value) const {
+ return value / _time;
+} // utonTime
+
+// Add dimensions to time scale.
+inline
+double
+spatialdata::units::NondimElastic::ntouTime(const double value) const {
+ return value * _time;
+} // ntouTime
+
+// Make density scale dimensionless.
+inline
+double
+spatialdata::units::NondimElastic::utonDensity(const double value) const {
+ return value / _density;
+} // utonDensity
+
+// Add dimensions to density scale.
+inline
+double
+spatialdata::units::NondimElastic::ntouDensity(const double value) const {
+ return value * _density;
+} // ntouDensity
+
+
+// End of file
Modified: cs/spatialdata-0.1/trunk/modulesrc/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/Makefile.am 2008-11-27 01:41:07 UTC (rev 13417)
+++ cs/spatialdata-0.1/trunk/modulesrc/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -13,6 +13,7 @@
SUBDIRS = \
geocoords \
spatialdb \
+ units \
utils
Added: cs/spatialdata-0.1/trunk/modulesrc/units/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/units/Makefile.am (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/units/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,49 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = units
+include $(top_srcdir)/subpackage.am
+
+
+subpkgpyexec_LTLIBRARIES = unitsmodule.la
+
+unitsmodule_la_LDFLAGS = -module -avoid-version \
+ $(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
+
+dist_unitsmodule_la_SOURCES = units.pyxe.src
+
+nodist_unitsmodule_la_SOURCES = \
+ units.pyxe \
+ units.c units_embed.cpp units_embed.h
+
+unitsmodule_la_LIBADD = \
+ $(top_builddir)/libsrc/libspatialdata.la
+if NO_UNDEFINED
+unitsmodule_la_LIBADD += \
+ $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
+endif
+
+INCLUDES += -I$(PYTHON_INCDIR)
+
+units.pyx units_embed.cpp units_embed.h: units.pyxe
+ pyrexembed units.pyxe
+units.pyxe: $(srcdir)/units.pyxe.src
+ cp $(srcdir)/units.pyxe.src $@
+units_embed.cpp: units_embed.h
+units_embed.h: units.pyx
+
+.pyx.c:
+ pyrexc $<
+
+CLEANFILES = units.pyx units.pyxe units.c *_embed.*
+
+# End of file
Added: cs/spatialdata-0.1/trunk/modulesrc/units/units.pyxe.src
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/units/units.pyxe.src (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/units/units.pyxe.src 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,145 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+#header{
+#include "spatialdata/units/NondimElastic.hh"
+
+#include <stdexcept>
+#include <Python.h>
+#}header
+
+# ----------------------------------------------------------------------
+cdef extern from "Python.h":
+ object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
+ void* PyCObject_AsVoidPtr(object)
+
+cdef void* ptrFromHandle(obj):
+ """Extract pointer from PyCObject."""
+ return PyCObject_AsVoidPtr(obj.handle)
+
+cdef extern from "stdlib.h":
+ ctypedef unsigned long size_t
+ void* malloc(size_t size)
+ void free(void* mem)
+
+cdef void NondimElastic_destructor(void* obj):
+ """
+ Destroy NondimElastic object.
+ """
+ # create shim for destructor
+ #embed{ void NondimElastic_destructor_cpp(void* pObj)
+ spatialdata::units::NondimElastic* pDim =
+ (spatialdata::units::NondimElastic*) pObj;
+ delete pDim;
+ #}embed
+ NondimElastic_destructor_cpp(obj)
+ return
+
+
+# ----------------------------------------------------------------------
+cdef class NondimElastic:
+
+ cdef void* thisptr # Pointer to C++ object
+ cdef readonly object handle # PyCObject holding pointer to C++ object
+ cdef readonly object name # Identifier for object base type
+
+ def __init__(self):
+ """Constructor."""
+ # create shim for constructor
+ #embed{ void* NondimElastic_constructor()
+ return (void*)(new spatialdata::units::NondimElastic);
+ #}embed
+
+ self.name = "spatialdata_units_NondimElastic"
+ self.thisptr = NondimElastic_constructor()
+ self.handle = self._createHandle()
+ return
+
+
+ property length:
+ def __set__(self, value):
+ """Set value to nondimensionalize length scale in meters (SI units)."""
+ # create shim for method 'length'
+ #embed{ void NondimElastic_length_set(void* pObj, double value)
+ try {
+ ((spatialdata::units::NondimElastic*) pObj)->lengthScale(value);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ NondimElastic_length_set(self.thisptr, value)
+
+
+ property pressure:
+ def __set__(self, value):
+ """Set value to nondimensionalize pressure scale in Pascals (SI units)."""
+ # create shim for method 'pressure'
+ #embed{ void NondimElastic_pressure_set(void* pObj, double value)
+ try {
+ ((spatialdata::units::NondimElastic*) pObj)->pressureScale(value);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ NondimElastic_pressure_set(self.thisptr, value)
+
+
+ property time:
+ def __set__(self, value):
+ """Set value to nondimensionalize time scale in seconds (SI units)."""
+ # create shim for method 'time'
+ #embed{ void NondimElastic_time_set(void* pObj, double value)
+ try {
+ ((spatialdata::units::NondimElastic*) pObj)->timeScale(value);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ NondimElastic_time_set(self.thisptr, value)
+
+
+ property density:
+ def __set__(self, value):
+ """Set value to nondimensionalize density scale in kg/m^3 (SI units)."""
+ # create shim for method 'density'
+ #embed{ void NondimElastic_density_set(void* pObj, double value)
+ try {
+ ((spatialdata::units::NondimElastic*) pObj)->densityScale(value);
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ #}embed
+ NondimElastic_density_set(self.thisptr, value)
+
+
+ def _createHandle(self):
+ """Wrap pointer to C++ object in PyCObject."""
+ return PyCObject_FromVoidPtr(self.thisptr, NondimElastic_destructor)
+
+
+# End of file
Modified: cs/spatialdata-0.1/trunk/spatialdata/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/Makefile.am 2008-11-27 01:41:07 UTC (rev 13417)
+++ cs/spatialdata-0.1/trunk/spatialdata/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -36,6 +36,10 @@
spatialdb/generator/Value.py \
spatialdb/generator/Values.py \
spatialdb/generator/__init__.py \
+ units/__init__.py \
+ units/NondimElastic.py \
+ units/NondimElasticQuasistatic.py \
+ units/NondimElasticDynamic.py \
utils/ChangeCoordSys.py \
utils/ConvertApp.py \
utils/CppData.py \
Added: cs/spatialdata-0.1/trunk/spatialdata/units/NondimElastic.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/units/NondimElastic.py (rev 0)
+++ cs/spatialdata-0.1/trunk/spatialdata/units/NondimElastic.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,161 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file spatialdata/units/NondimElastic.py
+##
+## @brief Python manager for nondimensionalizing elasticity problems.
+##
+## Factory: nondimensional
+
+from pyre.components.Component import Component
+
+# NondimElastic class
+class NondimElastic(Component):
+ """
+ Python manager for nondimensionalizing elasticity problems.
+
+ Factory: nondimensional
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Component.Inventory):
+ """Python object for managing NondimElastic facilities and properties."""
+
+ ## @class Inventory
+ ## Python object for managing NondimElastic facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li None
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="nondimelastic"):
+ """
+ Constructor.
+ """
+ Component.__init__(self, name, facility="nondimelastic")
+
+ self.cppHandle = None
+ from pyre.units.length import meter
+ from pyre.units.pressure import pascal
+ from pyre.units.time import second
+ from pyre.units.mass import kilogram
+
+ self._length = 1.0*meter
+ self._pressure = 1.0*pascal
+ self._time = 1.0*second
+ self._density = 1.0*kilogram/meter**3
+ return
+
+
+ def initialize(self):
+ """
+ Initialize coordinate system.
+ """
+ self._createCppHandle()
+ self.cppHandle.length = self._length.value
+ self.cppHandle.pressure = self._pressure.value
+ self.cppHandle.time = self._time.value
+ self.cppHandle.density = self._density.value
+ return
+
+
+ def utonLength(self, value):
+ """
+ Make length scale dimensionless.
+ """
+ return value / self._length
+
+
+ def ntouLength(self, value):
+ """
+ Add dimensions to length scale.
+ """
+ return value * self._length
+
+
+ def utonPressure(self, value):
+ """
+ Make pressure scale dimensionless.
+ """
+ return value / self._pressure
+
+
+ def ntouPressure(self, value):
+ """
+ Add dimensions to pressure scale.
+ """
+ return value * self._pressure
+
+
+ def utonTime(self, value):
+ """
+ Make time scale dimensionless.
+ """
+ return value / self._time
+
+
+ def ntouTime(self, value):
+ """
+ Add dimensions to time scale.
+ """
+ return value * self._time
+
+
+ def utonDensity(self, value):
+ """
+ Make density scale dimensionless.
+ """
+ return value / self._density
+
+
+ def ntouDensity(self, value):
+ """
+ Add dimensions to density scale.
+ """
+ return value * self._density
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Component._configure(self)
+ return
+
+
+ def _createCppHandle(self):
+ """
+ Create handle to C++ object.
+ """
+ if None == self.cppHandle:
+ import spatialdata.units.units as bindings
+ self.cppHandle = bindings.NondimElastic()
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def nondimensional():
+ """
+ Factory associated with NondimElastic.
+ """
+ return NondimElastic()
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticDynamic.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticDynamic.py (rev 0)
+++ cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticDynamic.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,108 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file spatialdata/units/NondimElasticDynamic.py
+##
+## @brief Python manager for nondimensionalizing dynamic
+## elasticity problems.
+##
+## Factory: nondimensional
+
+from NondimElastic import NondimElastic
+
+# NondimElasticDynamic class
+class NondimElasticDynamic(NondimElastic):
+ """
+ Python manager for nondimensionalizing dynamic elasticity problems.
+
+ Factory: nondimensional
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(NondimElastic.Inventory):
+ """
+ Python object for managing NondimElasticDynamic facilities and
+ properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing NondimElasticDynamic facilities and
+ ## properties.
+ ##
+ ## \b Properties
+ ## @li \b shear_wave_speed Shear wave speed to nondimensionalize problem.
+ ## @li \b mass_density Mass density to nondimensionalize problem.
+ ## @li \b wave_period Period of wave to nondimensionalize problem.
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ from pyre.units.length import meter
+ from pyre.units.time import second
+ from pyre.units.mass import kg
+ shearWaveSpeed = pyre.inventory.dimensional("shear_wave_speed",
+ default=3.0e+3*meter/second,
+ validator=pyre.inventory.greater(0.0*meter/second))
+ shearWaveSpeed.meta['tip'] = "Shear wave speed to nondimensionalize problem."
+
+ massDensity = pyre.inventory.dimensional("mass_density",
+ default=3.0e+3*kg/meter**3,
+ validator=pyre.inventory.greater(0.0*kg/meter**3))
+ massDensity.meta['tip'] = "Mass density to nondimensionalize problem"
+
+ wavePeriod = pyre.inventory.dimensional("wave_period",
+ default=1.0*second,
+ validator=pyre.inventory.greater(0.0*second))
+ wavePeriod.meta['tip'] = "Period of wave to nondimensionalize problem."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="nondimelastic"):
+ """
+ Constructor.
+ """
+ NondimElastic.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ NondimElastic._configure(self)
+ vs = self.inventory.shearWaveSpeed
+ period = self.inventory.wavePeriod
+ density = self.inventory.massDensity
+ self._length = vs * period
+ self._pressure = vs**2 * density
+ self._time = period
+ self._density = density
+
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def nondimensional():
+ """
+ Factory associated with NondimElasticDynamic.
+ """
+ return NondimElasticDynamic()
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticQuasistatic.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticQuasistatic.py (rev 0)
+++ cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticQuasistatic.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file spatialdata/units/NondimElasticQuasistatic.py
+##
+## @brief Python manager for nondimensionalizing quasi-static
+## elasticity problems.
+##
+## Factory: nondimensional
+
+from NondimElastic import NondimElastic
+
+# NondimElasticQuasistatic class
+class NondimElasticQuasistatic(NondimElastic):
+ """
+ Python manager for nondimensionalizing quasi-static elasticity problems.
+
+ Factory: nondimensional
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(NondimElastic.Inventory):
+ """
+ Python object for managing NondimElasticQuasistatic facilities and
+ properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing NondimElasticQuasistatic facilities and
+ ## properties.
+ ##
+ ## \b Properties
+ ## @li \b shear_modulus Shear modulus to nondimensionalize pressure.
+ ## @li \b length_scale Value to nondimensionalize length scale.
+ ## @li \b relaxation_time Relaxation time to nondimensionalize time.
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ from pyre.units.length import meter
+ lengthScale = pyre.inventory.dimensional("length_scale",
+ default=1.0e+3*meter,
+ validator=pyre.inventory.greater(0.0*meter))
+ lengthScale.meta['tip'] = "Value to nondimensionalize length scale."
+
+ from pyre.units.pressure import pascal
+ shearModulus = pyre.inventory.dimensional("shear_modulus",
+ default=3.0e+10*pascal,
+ validator=pyre.inventory.greater(0.0*pascal))
+ shearModulus.meta['tip'] = "Shear modulus to nondimensionalize pressure."
+
+ from pyre.units.time import year
+ relaxationTime = pyre.inventory.dimensional("relaxation_time",
+ default=1.0*year,
+ validator=pyre.inventory.greater(0.0*year))
+ relaxationTime.meta['tip'] = "Relaxatim time to nondimensionalize time."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="nondimelastic"):
+ """
+ Constructor.
+ """
+ NondimElastic.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ NondimElastic._configure(self)
+ self._length = self.inventory.lengthScale
+ self._pressure = self.inventory.shearModulus
+ self._time = self.inventory.relaxationTime
+
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def nondimensional():
+ """
+ Factory associated with NondimElasticQuasistatic.
+ """
+ return NondimElasticQuasistatic()
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/spatialdata/units/__init__.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/units/__init__.py (rev 0)
+++ cs/spatialdata-0.1/trunk/spatialdata/units/__init__.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file spatialdata/units/__init__.py
+##
+## @brief Python spatialdata units module initialization.
+
+__all__ = ['NondimElastic',
+ 'NondimElasticQuasistatic',
+ 'NondimElasticDynamic',
+ ]
+
+
+# End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/Makefile.am 2008-11-27 01:41:07 UTC (rev 13417)
+++ cs/spatialdata-0.1/trunk/tests/libtests/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -13,9 +13,8 @@
SUBDIRS = \
geocoords \
spatialdb \
+ units \
utils
-# version
-# $Id$
# End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/units/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/units/Makefile.am (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/units/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,34 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = units
+include $(top_srcdir)/subpackage.am
+
+TESTS = testunits
+
+check_PROGRAMS = testunits
+
+testunits_SOURCES = \
+ TestNondimElastic.cc \
+ testunits.cc
+
+noinst_HEADERS = \
+ TestNondimElastic.hh
+
+testunits_LDFLAGS =
+
+testunits_LDADD = \
+ -lcppunit -ldl \
+ $(top_builddir)/libsrc/libspatialdata.la
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/units/TestNondimElastic.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/units/TestNondimElastic.cc (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/units/TestNondimElastic.cc 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,398 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestNondimElastic.hh" // Implementation of class methods
+
+#include "spatialdata/units/NondimElastic.hh" // USES NondimElastic
+
+#include <valarray> // USES std::valarray
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::units::TestNondimElastic );
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+spatialdata::units::TestNondimElastic::testConstructor(void)
+{ // testConstructor
+ NondimElastic dim;
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._length);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._pressure);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._time);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._density);
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test copy constructor.
+void
+spatialdata::units::TestNondimElastic::testCopyConstructor(void)
+{ // testCopyConstructor
+ NondimElastic dim;
+ dim._length = 2.0;
+ dim._pressure = 3.0;
+ dim._time = 4.0;
+ dim._density = 5.0;
+
+ NondimElastic dim2(dim);
+ CPPUNIT_ASSERT_EQUAL(2.0, dim2._length);
+ CPPUNIT_ASSERT_EQUAL(3.0, dim2._pressure);
+ CPPUNIT_ASSERT_EQUAL(4.0, dim2._time);
+ CPPUNIT_ASSERT_EQUAL(5.0, dim2._density);
+} // testCopyConstructor
+
+// ----------------------------------------------------------------------
+// Test assignment.
+void
+spatialdata::units::TestNondimElastic::testAssignment(void)
+{ // testAssignment
+ NondimElastic dim;
+ dim._length = 2.0;
+ dim._pressure = 3.0;
+ dim._time = 4.0;
+ dim._density = 5.0;
+
+ NondimElastic dim2;
+ dim2 = dim;
+ CPPUNIT_ASSERT_EQUAL(2.0, dim2._length);
+ CPPUNIT_ASSERT_EQUAL(3.0, dim2._pressure);
+ CPPUNIT_ASSERT_EQUAL(4.0, dim2._time);
+ CPPUNIT_ASSERT_EQUAL(5.0, dim2._density);
+} // testAssignment
+
+// ----------------------------------------------------------------------
+// Test lengthScale().
+void
+spatialdata::units::TestNondimElastic::testLengthScale(void)
+{ // testLengthScale
+ NondimElastic dim;
+
+ const double scale = 4.0;
+ dim.lengthScale(scale);
+ CPPUNIT_ASSERT_EQUAL(scale, dim._length);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._pressure);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._time);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._density);
+} // testLengthScale
+
+// ----------------------------------------------------------------------
+// Test pressureScale().
+void
+spatialdata::units::TestNondimElastic::testPressureScale(void)
+{ // testPressureScale
+ NondimElastic dim;
+
+ const double scale = 4.0;
+ dim.pressureScale(scale);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._length);
+ CPPUNIT_ASSERT_EQUAL(scale, dim._pressure);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._time);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._density);
+} // testPressureScale
+
+// ----------------------------------------------------------------------
+// Test timeScale().
+void
+spatialdata::units::TestNondimElastic::testTimeScale(void)
+{ // testTimeScale
+ NondimElastic dim;
+
+ const double scale = 4.0;
+ dim.timeScale(scale);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._length);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._pressure);
+ CPPUNIT_ASSERT_EQUAL(scale, dim._time);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._density);
+} // testTimeScale
+
+// ----------------------------------------------------------------------
+// Test densityScale().
+void
+spatialdata::units::TestNondimElastic::testDensityScale(void)
+{ // testDensityScale
+ NondimElastic dim;
+
+ const double scale = 4.0;
+ dim.densityScale(scale);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._length);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._pressure);
+ CPPUNIT_ASSERT_EQUAL(1.0, dim._time);
+ CPPUNIT_ASSERT_EQUAL(scale, dim._density);
+} // testDensityScale
+
+// ----------------------------------------------------------------------
+// Test utonLength().
+void
+spatialdata::units::TestNondimElastic::testUtonLength(void)
+{ // testUtonLength
+ const double scale = 4.0;
+ const double value = 3.0;
+ const double valueE = 0.75;
+
+ NondimElastic dim;
+ dim.lengthScale(scale);
+ CPPUNIT_ASSERT_EQUAL(valueE, dim.utonLength(value));
+} // testUtonLength
+
+// ----------------------------------------------------------------------
+// Test ntouLength().
+void
+spatialdata::units::TestNondimElastic::testNtouLength(void)
+{ // testNtouLength
+ const double scale = 4.0;
+ const double value = 0.75;
+ const double valueE = 3.0;
+
+ NondimElastic dim;
+ dim.lengthScale(scale);
+ CPPUNIT_ASSERT_EQUAL(valueE, dim.ntouLength(value));
+} // testNtouLength
+
+// ----------------------------------------------------------------------
+// Test utonLength() with arrays.
+void
+spatialdata::units::TestNondimElastic::testUtonLengthArray(void)
+{ // testUtonLengthArray
+ const double scale = 10.0;
+ const int nvalues = 3;
+ const double values[] = { 2.0, 5.0, 7.0 };
+ const double valuesE[] = { 0.2, 0.5, 0.7 };
+
+ NondimElastic dim;
+ dim.lengthScale(scale);
+ std::valarray<double> v(values, nvalues);
+ dim.utonLength(&v[0], nvalues);
+
+ for (int i=0; i < nvalues; ++i)
+ CPPUNIT_ASSERT_EQUAL(valuesE[i], v[i]);
+} // testUtonLengthArray
+
+// ----------------------------------------------------------------------
+// Test ntouLength() with arrays.
+void
+spatialdata::units::TestNondimElastic::testNtouLengthArray(void)
+{ // testNtouLengthArray
+ const double scale = 10.0;
+ const int nvalues = 3;
+ const double values[] = { 0.2, 0.5, 0.7 };
+ const double valuesE[] = { 2.0, 5.0, 7.0 };
+
+ NondimElastic dim;
+ dim.lengthScale(scale);
+ std::valarray<double> v(values, nvalues);
+ dim.ntouLength(&v[0], nvalues);
+
+ for (int i=0; i < nvalues; ++i)
+ CPPUNIT_ASSERT_EQUAL(valuesE[i], v[i]);
+} // testNtouLengthArray
+
+// ----------------------------------------------------------------------
+// Test utonPressure().
+void
+spatialdata::units::TestNondimElastic::testUtonPressure(void)
+{ // testUtonPressure
+ const double scale = 4.0;
+ const double value = 3.0;
+ const double valueE = 0.75;
+
+ NondimElastic dim;
+ dim.pressureScale(scale);
+ CPPUNIT_ASSERT_EQUAL(valueE, dim.utonPressure(value));
+} // testUtonPressure
+
+// ----------------------------------------------------------------------
+// Test ntouPressure().
+void
+spatialdata::units::TestNondimElastic::testNtouPressure(void)
+{ // testNtouPressure
+ const double scale = 4.0;
+ const double value = 0.75;
+ const double valueE = 3.0;
+
+ NondimElastic dim;
+ dim.pressureScale(scale);
+ CPPUNIT_ASSERT_EQUAL(valueE, dim.ntouPressure(value));
+} // testNtouPressure
+
+// ----------------------------------------------------------------------
+// Test utonPressure() with arrays.
+void
+spatialdata::units::TestNondimElastic::testUtonPressureArray(void)
+{ // testUtonPressureArray
+ const double scale = 10.0;
+ const int nvalues = 3;
+ const double values[] = { 2.0, 5.0, 7.0 };
+ const double valuesE[] = { 0.2, 0.5, 0.7 };
+
+ NondimElastic dim;
+ dim.pressureScale(scale);
+ std::valarray<double> v(values, nvalues);
+ dim.utonPressure(&v[0], nvalues);
+
+ for (int i=0; i < nvalues; ++i)
+ CPPUNIT_ASSERT_EQUAL(valuesE[i], v[i]);
+} // testUtonPressureArray
+
+// ----------------------------------------------------------------------
+// Test ntouPressure() with arrays.
+void
+spatialdata::units::TestNondimElastic::testNtouPressureArray(void)
+{ // testNtouPressureArray
+ const double scale = 10.0;
+ const int nvalues = 3;
+ const double values[] = { 0.2, 0.5, 0.7 };
+ const double valuesE[] = { 2.0, 5.0, 7.0 };
+
+ NondimElastic dim;
+ dim.pressureScale(scale);
+ std::valarray<double> v(values, nvalues);
+ dim.ntouPressure(&v[0], nvalues);
+
+ for (int i=0; i < nvalues; ++i)
+ CPPUNIT_ASSERT_EQUAL(valuesE[i], v[i]);
+} // testNtouPressureArray
+
+// ----------------------------------------------------------------------
+// Test utonTime().
+void
+spatialdata::units::TestNondimElastic::testUtonTime(void)
+{ // testUtonTime
+ const double scale = 4.0;
+ const double value = 3.0;
+ const double valueE = 0.75;
+
+ NondimElastic dim;
+ dim.timeScale(scale);
+ CPPUNIT_ASSERT_EQUAL(valueE, dim.utonTime(value));
+} // testUtonTime
+
+// ----------------------------------------------------------------------
+// Test ntouTime().
+void
+spatialdata::units::TestNondimElastic::testNtouTime(void)
+{ // testNtouTime
+ const double scale = 4.0;
+ const double value = 0.75;
+ const double valueE = 3.0;
+
+ NondimElastic dim;
+ dim.timeScale(scale);
+ CPPUNIT_ASSERT_EQUAL(valueE, dim.ntouTime(value));
+} // testNtouTime
+
+// ----------------------------------------------------------------------
+// Test utonTime() with arrays.
+void
+spatialdata::units::TestNondimElastic::testUtonTimeArray(void)
+{ // testUtonTimeArray
+ const double scale = 10.0;
+ const int nvalues = 3;
+ const double values[] = { 2.0, 5.0, 7.0 };
+ const double valuesE[] = { 0.2, 0.5, 0.7 };
+
+ NondimElastic dim;
+ dim.timeScale(scale);
+ std::valarray<double> v(values, nvalues);
+ dim.utonTime(&v[0], nvalues);
+
+ for (int i=0; i < nvalues; ++i)
+ CPPUNIT_ASSERT_EQUAL(valuesE[i], v[i]);
+} // testUtonTimeArray
+
+// ----------------------------------------------------------------------
+// Test ntouTime() with arrays.
+void
+spatialdata::units::TestNondimElastic::testNtouTimeArray(void)
+{ // testNtouTimeArray
+ const double scale = 10.0;
+ const int nvalues = 3;
+ const double values[] = { 0.2, 0.5, 0.7 };
+ const double valuesE[] = { 2.0, 5.0, 7.0 };
+
+ NondimElastic dim;
+ dim.timeScale(scale);
+ std::valarray<double> v(values, nvalues);
+ dim.ntouTime(&v[0], nvalues);
+
+ for (int i=0; i < nvalues; ++i)
+ CPPUNIT_ASSERT_EQUAL(valuesE[i], v[i]);
+} // testNtouTimeArray
+
+// ----------------------------------------------------------------------
+// Test utonDensity().
+void
+spatialdata::units::TestNondimElastic::testUtonDensity(void)
+{ // testUtonDensity
+ const double scale = 4.0;
+ const double value = 3.0;
+ const double valueE = 0.75;
+
+ NondimElastic dim;
+ dim.densityScale(scale);
+ CPPUNIT_ASSERT_EQUAL(valueE, dim.utonDensity(value));
+} // testUtonDensity
+
+// ----------------------------------------------------------------------
+// Test ntouDensity().
+void
+spatialdata::units::TestNondimElastic::testNtouDensity(void)
+{ // testNtouDensity
+ const double scale = 4.0;
+ const double value = 0.75;
+ const double valueE = 3.0;
+
+ NondimElastic dim;
+ dim.densityScale(scale);
+ CPPUNIT_ASSERT_EQUAL(valueE, dim.ntouDensity(value));
+} // testNtouDensity
+
+// ----------------------------------------------------------------------
+// Test utonDensity() with arrays.
+void
+spatialdata::units::TestNondimElastic::testUtonDensityArray(void)
+{ // testUtonDensityArray
+ const double scale = 10.0;
+ const int nvalues = 3;
+ const double values[] = { 2.0, 5.0, 7.0 };
+ const double valuesE[] = { 0.2, 0.5, 0.7 };
+
+ NondimElastic dim;
+ dim.densityScale(scale);
+ std::valarray<double> v(values, nvalues);
+ dim.utonDensity(&v[0], nvalues);
+
+ for (int i=0; i < nvalues; ++i)
+ CPPUNIT_ASSERT_EQUAL(valuesE[i], v[i]);
+} // testUtonDensityArray
+
+// ----------------------------------------------------------------------
+// Test ntouDensity() with arrays.
+void
+spatialdata::units::TestNondimElastic::testNtouDensityArray(void)
+{ // testNtouDensityArray
+ const double scale = 10.0;
+ const int nvalues = 3;
+ const double values[] = { 0.2, 0.5, 0.7 };
+ const double valuesE[] = { 2.0, 5.0, 7.0 };
+
+ NondimElastic dim;
+ dim.densityScale(scale);
+ std::valarray<double> v(values, nvalues);
+ dim.ntouDensity(&v[0], nvalues);
+
+ for (int i=0; i < nvalues; ++i)
+ CPPUNIT_ASSERT_EQUAL(valuesE[i], v[i]);
+} // testNtouDensityArray
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/units/TestNondimElastic.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/units/TestNondimElastic.hh (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/units/TestNondimElastic.hh 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,142 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file tests/libtests/units/TestNondimElastic.hh
+ *
+ * @brief C++ TestNondimElastic object
+ *
+ * C++ unit testing for NondimElastic.
+ */
+
+#if !defined(spatialdata_units_testnondimelastic_hh)
+#define spatialdata_units_testnondimelastic_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for spatialdata package
+namespace spatialdata {
+ namespace units {
+ class TestNondimElastic;
+ } // units
+} // spatialdata
+
+/// C++ unit testing for NondimElastic
+class spatialdata::units::TestNondimElastic : public CppUnit::TestFixture
+{ // class TestNondimElastic
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestNondimElastic );
+
+ CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testCopyConstructor );
+ CPPUNIT_TEST( testAssignment );
+ CPPUNIT_TEST( testLengthScale );
+ CPPUNIT_TEST( testPressureScale );
+ CPPUNIT_TEST( testTimeScale );
+ CPPUNIT_TEST( testDensityScale );
+ CPPUNIT_TEST( testUtonLength );
+ CPPUNIT_TEST( testNtouLength );
+ CPPUNIT_TEST( testUtonLengthArray );
+ CPPUNIT_TEST( testNtouLengthArray );
+ CPPUNIT_TEST( testUtonPressure );
+ CPPUNIT_TEST( testNtouPressure );
+ CPPUNIT_TEST( testUtonPressureArray );
+ CPPUNIT_TEST( testNtouPressureArray );
+ CPPUNIT_TEST( testUtonTime );
+ CPPUNIT_TEST( testNtouTime );
+ CPPUNIT_TEST( testUtonTimeArray );
+ CPPUNIT_TEST( testNtouTimeArray );
+ CPPUNIT_TEST( testUtonDensity );
+ CPPUNIT_TEST( testNtouDensity );
+ CPPUNIT_TEST( testUtonDensityArray );
+ CPPUNIT_TEST( testNtouDensityArray );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test constructor.
+ void testConstructor(void);
+
+ /// Test copy constructor.
+ void testCopyConstructor(void);
+
+ /// Test assignment.
+ void testAssignment(void);
+
+ /// Test lengthScale().
+ void testLengthScale(void);
+
+ /// Test pressureScale().
+ void testPressureScale(void);
+
+ /// Test timeScale().
+ void testTimeScale(void);
+
+ /// Test densityScale().
+ void testDensityScale(void);
+
+ /// Test utonLength().
+ void testUtonLength(void);
+
+ /// Test ntouLength().
+ void testNtouLength(void);
+
+ /// Test utonLength() with arrays.
+ void testUtonLengthArray(void);
+
+ /// Test ntouLength() with arrays.
+ void testNtouLengthArray(void);
+
+ /// Test utonPressure().
+ void testUtonPressure(void);
+
+ /// Test ntouPressure().
+ void testNtouPressure(void);
+
+ /// Test utonPressure() with arrays.
+ void testUtonPressureArray(void);
+
+ /// Test ntouPressure() with arrays.
+ void testNtouPressureArray(void);
+
+ /// Test utonTime().
+ void testUtonTime(void);
+
+ /// Test ntouTime().
+ void testNtouTime(void);
+
+ /// Test utonTime() with arrays.
+ void testUtonTimeArray(void);
+
+ /// Test ntouTime() with arrays.
+ void testNtouTimeArray(void);
+
+ /// Test utonDensity().
+ void testUtonDensity(void);
+
+ /// Test ntouDensity().
+ void testNtouDensity(void);
+
+ /// Test utonDensity() with arrays.
+ void testUtonDensityArray(void);
+
+ /// Test ntouDensity() with arrays.
+ void testNtouDensityArray(void);
+
+}; // class TestNondimElastic
+
+#endif // spatialdata_units_testnondimelastic_hh
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/units/testunits.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/units/testunits.cc (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/units/testunits.cc 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include <cppunit/BriefTestProgressListener.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TestRunner.h>
+#include <cppunit/TextOutputter.h>
+
+int
+main(int argc,
+ char* argv[])
+{ // main
+ // Create event manager and test controller
+ CppUnit::TestResult controller;
+
+ // Add listener to collect test results
+ CppUnit::TestResultCollector result;
+ controller.addListener(&result);
+
+ // Add listener to show progress as tests run
+ CppUnit::BriefTestProgressListener progress;
+ controller.addListener(&progress);
+
+ // Add top suite to test runner
+ CppUnit::TestRunner runner;
+ runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
+ runner.run(controller);
+
+ // Print tests
+ CppUnit::TextOutputter outputter(&result, std::cerr);
+ outputter.write();
+
+ return (result.wasSuccessful() ? 0 : 1);
+} // main
+
+
+// End of file
Modified: cs/spatialdata-0.1/trunk/tests/pytests/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/Makefile.am 2008-11-27 01:41:07 UTC (rev 13417)
+++ cs/spatialdata-0.1/trunk/tests/pytests/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -13,9 +13,8 @@
SUBDIRS = \
geocoords \
spatialdb \
+ units \
utils
-# version
-# $Id$
# End of file
Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py 2008-11-27 01:41:07 UTC (rev 13417)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -20,7 +20,7 @@
from spatialdata.spatialdb.SCECCVMH import SCECCVMH
db = SCECCVMH()
db._configure()
- db.dataDir = "/home/brad/data/sceccvm-h/vx53/bin"
+ db.dataDir = "/Users/brad/data/sceccvm-h/vx52/bin"
db.initialize()
self._db = db
return
Added: cs/spatialdata-0.1/trunk/tests/pytests/units/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/units/Makefile.am (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/pytests/units/Makefile.am 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,24 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+TESTS = testunits.py
+dist_check_SCRIPTS = testunits.py
+
+TESTS_ENVIRONMENT = $(PYTHON)
+
+noinst_PYTHON = \
+ TestNondimElastic.py
+ TestNondimElasticQuasistati.py \
+ TestNondimElasticDynamic.py
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElastic.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElastic.py (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElastic.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,157 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+import unittest
+
+from spatialdata.units.NondimElastic import NondimElastic
+
+from pyre.units.length import meter
+from pyre.units.pressure import pascal
+from pyre.units.time import second
+from pyre.units.mass import kilogram
+
+class TestNondimElastic(unittest.TestCase):
+
+ def test_constructor(self):
+ dim = NondimElastic()
+ dim._configure()
+
+ self.assertEqual(1.0*meter, dim._length)
+ self.assertEqual(1.0*pascal, dim._pressure)
+ self.assertEqual(1.0*second, dim._time)
+ self.assertEqual(1.0*kilogram/meter**3, dim._density)
+
+ return
+
+
+ def test_initialize(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ self.failIf(dim.cppHandle is None)
+ return
+
+
+ def test_utonLength(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ scale = 8.0*meter
+ value = 2.0*meter
+ valueE = 0.25
+
+ dim._length = scale
+ self.assertEqual(valueE, dim.utonLength(value))
+ return
+
+
+ def test_ntouLength(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ scale = 8.0*meter
+ valueE = 2.0*meter
+ value = 0.25
+
+ dim._length = scale
+ self.assertEqual(valueE, dim.ntouLength(value))
+ return
+
+
+ def test_utonPressure(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ scale = 8.0*pascal
+ value = 2.0*pascal
+ valueE = 0.25
+
+ dim._pressure = scale
+ self.assertEqual(valueE, dim.utonPressure(value))
+ return
+
+
+ def test_ntouPressure(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ scale = 8.0*pascal
+ valueE = 2.0*pascal
+ value = 0.25
+
+ dim._pressure = scale
+ self.assertEqual(valueE, dim.ntouPressure(value))
+ return
+
+
+ def test_utonTime(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ scale = 8.0*second
+ value = 2.0*second
+ valueE = 0.25
+
+ dim._time = scale
+ self.assertEqual(valueE, dim.utonTime(value))
+ return
+
+
+ def test_ntouTime(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ scale = 8.0*second
+ valueE = 2.0*second
+ value = 0.25
+
+ dim._time = scale
+ self.assertEqual(valueE, dim.ntouTime(value))
+ return
+
+
+ def test_utonDensity(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ scale = 8.0*kilogram/meter**3
+ value = 2.0*kilogram/meter**3
+ valueE = 0.25
+
+ dim._density = scale
+ self.assertEqual(valueE, dim.utonDensity(value))
+ return
+
+
+ def test_ntouDensity(self):
+ dim = NondimElastic()
+ dim._configure()
+ dim.initialize()
+
+ scale = 8.0*kilogram/meter**3
+ valueE = 2.0*kilogram/meter**3
+ value = 0.25
+
+ dim._density = scale
+ self.assertEqual(valueE, dim.ntouDensity(value))
+ return
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticDynamic.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticDynamic.py (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticDynamic.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+import unittest
+
+from spatialdata.units.NondimElasticDynamic import NondimElasticDynamic
+
+from pyre.units.length import meter
+from pyre.units.pressure import pascal
+from pyre.units.time import second
+from pyre.units.mass import kilogram
+
+class TestNondimElasticDynamic(unittest.TestCase):
+
+ def test_constructor(self):
+ dim = NondimElasticDynamic()
+ dim._configure()
+
+ vs = 3.0e+3*meter/second
+ density = 3.0e+3*kilogram/meter**3
+ period = 1.0*second
+
+ shearModulus = density*vs**2
+ wavelength = vs*period
+
+ self.assertEqual(wavelength, dim._length)
+ self.assertEqual(shearModulus, dim._pressure)
+ self.assertEqual(period, dim._time)
+ self.assertEqual(density, dim._density)
+
+ return
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticQuasistatic.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticQuasistatic.py (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticQuasistatic.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+import unittest
+
+from spatialdata.units.NondimElasticQuasistatic import NondimElasticQuasistatic
+
+from pyre.units.length import meter
+from pyre.units.pressure import pascal
+from pyre.units.time import year
+from pyre.units.mass import kilogram
+
+class TestNondimElasticQuasistatic(unittest.TestCase):
+
+ def test_constructor(self):
+ dim = NondimElasticQuasistatic()
+ dim._configure()
+
+ self.assertEqual(1.0e+3*meter, dim._length)
+ self.assertEqual(3.0e+10*pascal, dim._pressure)
+ self.assertEqual(1.0*year, dim._time)
+ self.assertEqual(1.0*kilogram/meter**3, dim._density)
+
+ return
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/tests/pytests/units/testunits.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/units/testunits.py (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/pytests/units/testunits.py 2008-11-27 22:02:02 UTC (rev 13418)
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+import unittest
+
+def suite():
+
+ suite = unittest.TestSuite()
+
+ from TestNondimElastic import TestNondimElastic
+ suite.addTest(unittest.makeSuite(TestNondimElastic))
+
+ from TestNondimElasticQuasistatic import TestNondimElasticQuasistatic
+ suite.addTest(unittest.makeSuite(TestNondimElasticQuasistatic))
+
+ from TestNondimElasticDynamic import TestNondimElasticDynamic
+ suite.addTest(unittest.makeSuite(TestNondimElasticDynamic))
+
+ return suite
+
+
+def main():
+ unittest.TextTestRunner(verbosity=2).run(suite())
+ return
+
+
+if __name__ == '__main__':
+ main()
+
+
+# End of file
Property changes on: cs/spatialdata-0.1/trunk/tests/pytests/units/testunits.py
___________________________________________________________________
Name: svn:executable
+ *
More information about the CIG-COMMITS
mailing list