[cig-commits] r13878 - in cs/spatialdata-0.1/trunk: . libsrc libsrc/geocoords libsrc/spatialdb libsrc/utils modulesrc modulesrc/geocoords modulesrc/include modulesrc/spatialdb modulesrc/units modulesrc/utils spatialdata spatialdata/geocoords spatialdata/spatialdb spatialdata/spatialdb/generator spatialdata/units spatialdata/utils tests/libtests/geocoords tests/libtests/spatialdb tests/libtests/spatialdb/data tests/pytests/geocoords tests/pytests/spatialdb tests/pytests/units tests/pytests/utils

brad at geodynamics.org brad at geodynamics.org
Sun Jan 18 16:08:26 PST 2009


Author: brad
Date: 2009-01-18 16:08:26 -0800 (Sun, 18 Jan 2009)
New Revision: 13878

Added:
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.cc
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.hh
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.icc
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSCart.i
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeo.i
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeoLocalCart.i
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeoProj.i
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/Converter.i
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/CoordSys.i
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/Projector.i
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.i
   cs/spatialdata-0.1/trunk/modulesrc/include/
   cs/spatialdata-0.1/trunk/modulesrc/include/chararray.i
   cs/spatialdata-0.1/trunk/modulesrc/include/numpy.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/CompositeDB.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/GravityField.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SCECCVMH.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleDB.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleDBData.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleIO.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleIOAscii.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SpatialDBObj.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/UniformDB.i
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.i
   cs/spatialdata-0.1/trunk/modulesrc/units/Nondimensional.i
   cs/spatialdata-0.1/trunk/modulesrc/units/units.i
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDBObj.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBData.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBData.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestData.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestData.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSimpleDB.py
Removed:
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.hh
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.icc
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe.src
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pxd.src
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe.src
   cs/spatialdata-0.1/trunk/modulesrc/units/units.pyxe.src
   cs/spatialdata-0.1/trunk/modulesrc/utils/Makefile.am
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDB.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py
   cs/spatialdata-0.1/trunk/tests/pytests/utils/TestPointsStream.py
   cs/spatialdata-0.1/trunk/tests/pytests/utils/TestSimpleArray.py
Modified:
   cs/spatialdata-0.1/trunk/TODO
   cs/spatialdata-0.1/trunk/configure.ac
   cs/spatialdata-0.1/trunk/libsrc/Makefile.am
   cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.hh
   cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.icc
   cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc
   cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc
   cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.cc
   cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.hh
   cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.cc
   cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.hh
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/Makefile.am
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.cc
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.hh
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.cc
   cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.hh
   cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.hh
   cs/spatialdata-0.1/trunk/modulesrc/Makefile.am
   cs/spatialdata-0.1/trunk/modulesrc/geocoords/Makefile.am
   cs/spatialdata-0.1/trunk/modulesrc/spatialdb/Makefile.am
   cs/spatialdata-0.1/trunk/modulesrc/units/Makefile.am
   cs/spatialdata-0.1/trunk/spatialdata/Makefile.am
   cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSCart.py
   cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeo.py
   cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoLocalCart.py
   cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoProj.py
   cs/spatialdata-0.1/trunk/spatialdata/geocoords/Converter.py
   cs/spatialdata-0.1/trunk/spatialdata/geocoords/CoordSys.py
   cs/spatialdata-0.1/trunk/spatialdata/geocoords/Projector.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/CompositeDB.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/GravityField.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SCECCVMH.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleDB.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleIO.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleIOAscii.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/UniformDB.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/__init__.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/GenSimpleDBApp.py
   cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Shaper.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/Nondimensional.py
   cs/spatialdata-0.1/trunk/spatialdata/utils/PointsStream.py
   cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestProjector.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBApp.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryApp.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.cc
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.hh
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.py
   cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/generate.sh
   cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSCart.py
   cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeo.py
   cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoLocalCart.py
   cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoProj.py
   cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestConverter.py
   cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestProjector.py
   cs/spatialdata-0.1/trunk/tests/pytests/geocoords/testgeocoords.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestCompositeDB.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestGenSimpleDBApp.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestGravityField.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py.in
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSimpleIOAscii.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestUniformDB.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/test_sceccvmh.py
   cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/testspatial.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/TestNondimensional.py
   cs/spatialdata-0.1/trunk/tests/pytests/utils/Makefile.am
   cs/spatialdata-0.1/trunk/tests/pytests/utils/TestChangeCoordSys.py
   cs/spatialdata-0.1/trunk/tests/pytests/utils/TestConvertApp.py
   cs/spatialdata-0.1/trunk/tests/pytests/utils/testutils.py
Log:
Switched from Pyrex/Pyrexembed to SWIG for Python/C++ interface. Python objects now inherit from module objects. Replaced SimpleDBTypes with full SimpleDBData class.

Modified: cs/spatialdata-0.1/trunk/TODO
===================================================================
--- cs/spatialdata-0.1/trunk/TODO	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/TODO	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,3 +1,16 @@
+SWIG CONVERSION
+
+geocoords
+
+  bindings for Converter
+  Python Converter
+  Test of bindings for Converter
+
+spatialdb
+
+  bindings
+  Python objects
+
 UTILS
 
   Ignore comment lines in PointsStream.

Modified: cs/spatialdata-0.1/trunk/configure.ac
===================================================================
--- cs/spatialdata-0.1/trunk/configure.ac	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/configure.ac	2009-01-19 00:08:26 UTC (rev 13878)
@@ -112,21 +112,12 @@
   CIT_PYTHON_EGG_SETUP
   AM_PATH_PYTHON([2.3])
 
-  # PYREX/PYREXEMBED
-  AC_CHECK_PROG([have_pyrex],
-    [pyrexc],
-    [yes],
-    [no])
-  if test "$have_pyrex" = "no"; then
-    AC_MSG_ERROR([Pyrex not found in current path.])
-  fi
-  AC_CHECK_PROG([have_pyrexembed],
-    [pyrexembed],
-    [yes],
-    [no])
-  if test "$have_pyrexembed" = "no"; then
-    AC_MSG_ERROR([Pyrexembed not found in current path.])
-  fi
+  # NUMPY
+  CIT_NUMPY_PYTHON_MODULE
+  CIT_NUMPY_INCDIR
+
+  # SWIG
+  AC_PROG_SWIG
 fi
 
 # DOXYGEN
@@ -156,7 +147,6 @@
 	modulesrc/geocoords/Makefile
 	modulesrc/spatialdb/Makefile
 	modulesrc/units/Makefile
-	modulesrc/utils/Makefile
 	spatialdata/Makefile
 	tests/Makefile
 	tests/libtests/Makefile

Modified: cs/spatialdata-0.1/trunk/libsrc/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -34,6 +34,7 @@
 	spatialdb/SCECCVMH.cc \
 	spatialdb/SimpleDB.cc \
 	spatialdb/SpatialDB.cc \
+	spatialdb/SimpleDBData.cc \
 	spatialdb/SimpleDBQuery.cc \
 	spatialdb/SimpleIO.cc \
 	spatialdb/SimpleIOAscii.cc \

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -31,7 +31,7 @@
 } // spatialdata
 
 #include "proj4fwd.h" // Proj4 forward declaration
-#include <string> // USES std::string
+#include <string> // HASA std::string
 
 /// C++ object for managing parameters defining geographic coordinate systems
 class spatialdata::geocoords::CSGeo : public CoordSys
@@ -60,7 +60,7 @@
    *
    * @param name Name of reference ellipsoid
    */
-  void ellipsoid(const std::string& name);
+  void ellipsoid(const char* name);
 
   /** Get reference ellipsoid.
    *
@@ -72,7 +72,7 @@
    *
    * @param name Name of horizontal datum
    */
-  void datumHoriz(const std::string& name);
+  void datumHoriz(const char* name);
 
   /** Get horizontal datum.
    *
@@ -84,7 +84,7 @@
    *
    * @param name Name of vertical datum
    */
-  void datumVert(const std::string& name);
+  void datumVert(const char* name);
 
   /** Get vertical datum.
    *

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.icc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.icc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeo.icc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -24,7 +24,7 @@
 // Set reference ellipsoid.
 inline
 void
-spatialdata::geocoords::CSGeo::ellipsoid(const std::string& name)
+spatialdata::geocoords::CSGeo::ellipsoid(const char* name)
 { _ellipsoid = name; }
 
 // Get reference ellipsoid.
@@ -36,7 +36,7 @@
 // Set horizontal datum.
 inline
 void 
-spatialdata::geocoords::CSGeo::datumHoriz(const std::string& name)
+spatialdata::geocoords::CSGeo::datumHoriz(const char* name)
 { _datumHoriz = name; }
 
 // Get horizontal datum.
@@ -48,7 +48,7 @@
 // Set vertical datum.
 inline
 void 
-spatialdata::geocoords::CSGeo::datumVert(const std::string& name)
+spatialdata::geocoords::CSGeo::datumVert(const char* name)
 { _datumVert = name; }
 
 // Get vertical datum.

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoLocalCart.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -482,7 +482,7 @@
       toMeters(val);
     } else if (0 == strcasecmp(token.c_str(), "ellipsoid")) {
       buffer >> name;
-      ellipsoid(name);
+      ellipsoid(name.c_str());
     } else if (0 == strcasecmp(token.c_str(), "datum-horiz")) {
       buffer >> std::ws;
       buffer.get(cbuffer, maxIgnore, '\n');

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/CSGeoProj.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -87,15 +87,7 @@
     throw std::runtime_error(msg.str());
   } // if
 
-  const int size = numLocs * numDims;
-  for (int i=0; i < size; i += numDims) {
-    double lon = 0;
-    double lat = 0;
-    _pProjector->invproject(&lon, &lat, coords[i  ], coords[i+1]);
-    coords[i  ] = lon;
-    coords[i+1] = lat;
-  } // for
-
+  _pProjector->invproject(coords, numLocs, numDims);
   CSGeo::toProjForm(coords, numLocs, numDims);
 } // toProjForm
   
@@ -119,15 +111,7 @@
   } // if
 
   CSGeo::fromProjForm(coords, numLocs, numDims);
-
-  const int size = numLocs * numDims;
-  for (int i=0; i < size; i += numDims) {
-    double x = 0;
-    double y = 0;
-    _pProjector->project(&x, &y, coords[i  ], coords[i+1]);
-    coords[i  ] = x;
-    coords[i+1] = y;
-  } // for
+  _pProjector->project(coords, numLocs, numDims);
 } // fromProjForm
   
 // ----------------------------------------------------------------------
@@ -171,7 +155,7 @@
       toMeters(val);
     } else if (0 == strcasecmp(token.c_str(), "ellipsoid")) {
       buffer >> name;
-      ellipsoid(name);
+      ellipsoid(name.c_str());
     } else if (0 == strcasecmp(token.c_str(), "datum-horiz")) {
       buffer >> std::ws;
       buffer.get(cbuffer, maxIgnore, '\n');

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -63,16 +63,16 @@
       { // GEOGRAPHIC
 	const CSGeo* pGeoDest = dynamic_cast<const CSGeo*>(pCSDest);
 	const CSGeo* pGeoSrc = dynamic_cast<const CSGeo*>(pCSSrc);
-	_convert(coords, numLocs, numDims, *pGeoDest, *pGeoSrc);
+	_convert(coords, numLocs, numDims, pGeoDest, pGeoSrc);
 	break;
       } // GEOGRAPHIC
     case spatialdata::geocoords::CoordSys::CARTESIAN :
-      { // GEOGRAPHIC
+      { // CARTESIAN
 	const CSCart* pCartDest = dynamic_cast<const CSCart*>(pCSDest);
 	const CSCart* pCartSrc = dynamic_cast<const CSCart*>(pCSSrc);
-	_convert(coords, numLocs, numDims, *pCartDest, *pCartSrc);
+	_convert(coords, numLocs, numDims, pCartDest, pCartSrc);
 	break;
-      } // GEOGRAPHIC
+      } // CARTESIAN
     default :
       throw std::runtime_error("Could not parse coordinate system type.");
     } // switch
@@ -85,22 +85,24 @@
 spatialdata::geocoords::Converter::_convert(double* coords,
 					    const int numLocs,
 					    const int numDims,
-					    const CSGeo& csDest,
-					    const CSGeo& csSrc)
+					    const CSGeo* csDest,
+					    const CSGeo* csSrc)
 { // convert
-  assert(0 != csSrc.projCoordSys());
-  assert(0 != csDest.projCoordSys());
+  assert(0 != csDest);
+  assert(0 != csSrc);
+  assert(0 != csSrc->projCoordSys());
+  assert(0 != csDest->projCoordSys());
   assert( (0 < numLocs && 0 != coords) ||
 	  (0 == numLocs && 0 == coords));
 
-  csSrc.toProjForm(coords, numLocs, numDims);
+  csSrc->toProjForm(coords, numLocs, numDims);
 
   double* pX = (numDims >= 1) ? coords + 0 : 0; // lon
   double* pY = (numDims >= 2) ? coords + 1 : 0; // lat
   double* pZ = (numDims >= 3) ? coords + 2 : 0; // elev
 
-  const char* srcDatumVert = csSrc.projDatumVert();
-  const char* destDatumVert = csDest.projDatumVert();
+  const char* srcDatumVert = csSrc->projDatumVert();
+  const char* destDatumVert = csDest->projDatumVert();
   if (numDims > 2 && 0 != strcasecmp(srcDatumVert, destDatumVert)) {
     bool isMSLToWGS84 = true;
     if (0 == strcasecmp(srcDatumVert, "mean sea level") &&
@@ -126,7 +128,7 @@
 	  << "  " << pj_strerrno(pj_errno) << "\n";
       throw std::runtime_error(msg.str());
     } // if
-    int pjerrno = pj_transform(csSrc.projCoordSys(), csWGS84,
+    int pjerrno = pj_transform(csSrc->projCoordSys(), csWGS84,
 			       numLocs, numDims, 
 			       pX, pY, pZ);
     if (0 != pjerrno) {
@@ -142,7 +144,7 @@
       coords[i+2] += (isMSLToWGS84) ? geoidHt : -geoidHt;
     } // for
 
-    pjerrno = pj_transform(csWGS84, csDest.projCoordSys(), 
+    pjerrno = pj_transform(csWGS84, csDest->projCoordSys(), 
 			   numLocs, numDims, pX, pY, pZ);
     if (0 != pjerrno) {
       std::ostringstream msg;
@@ -154,7 +156,7 @@
     pj_free(csWGS84);
   } else {
     const int pjerrno = 
-      pj_transform(csSrc.projCoordSys(), csDest.projCoordSys(),
+      pj_transform(csSrc->projCoordSys(), csDest->projCoordSys(),
 		   numLocs, numDims, pX, pY, pZ);
     if (0 != pjerrno) {
       std::ostringstream msg;
@@ -164,7 +166,7 @@
     } // if
   } // else
 
-  csDest.fromProjForm(coords, numLocs, numDims);
+  csDest->fromProjForm(coords, numLocs, numDims);
 } // convert
 
 // ----------------------------------------------------------------------
@@ -174,14 +176,16 @@
 spatialdata::geocoords::Converter::_convert(double* coords,
 					    const int numLocs,
 					    const int numDims,
-					    const CSCart& csDest,
-					    const CSCart& csSrc)
+					    const CSCart* csDest,
+					    const CSCart* csSrc)
 { // convert
+  assert(0 != csDest);
+  assert(0 != csSrc);
   assert( (0 < numLocs && 0 != coords) ||
 	  (0 == numLocs && 0 == coords));
 
   const int size = numLocs*numDims;
-  const double scale = csSrc.toMeters() / csDest.toMeters();
+  const double scale = csSrc->toMeters() / csDest->toMeters();
   for (int i=0; i < size; ++i)
     coords[i] *= scale;
 } // convert

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/Converter.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -65,8 +65,8 @@
   static void _convert(double* coords,
 		       const int numLocs,
 		       const int numDims,
-		       const CSGeo& csDest,
-		       const CSGeo& csSrc);
+		       const CSGeo* csDest,
+		       const CSGeo* csSrc);
 
   /** Convert coordinates from source Cartesian coordinate system to
    * destination Cartesian coordinate system.
@@ -80,8 +80,8 @@
   static void _convert(double* coords,
 		       const int numLocs,
 		       const int numDims,
-		       const CSCart& csDest,
-		       const CSCart& csSrc);
+		       const CSCart* csDest,
+		       const CSCart* csSrc);
 
 }; // class Converter
 

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -91,65 +91,66 @@
 // ----------------------------------------------------------------------
 // Project geographic coordinates.
 void
-spatialdata::geocoords::Projector::project(double* pX,
-					   double* pY,
-					   const double lon,
-					   const double lat)
+spatialdata::geocoords::Projector::project(double* coords,
+					   const int numLocs,
+					   const int numDims)
 { // project
-  assert(0 != pX);
-  assert(0 != pY);
+  assert(0 != coords);
   assert(0 != _pProj);
   
   projUV lonlat;
   const double degToRad = M_PI / 180.0;
-  lonlat.u = lon * degToRad;
-  lonlat.v = lat * degToRad;
-  projUV xy = pj_fwd(lonlat, _pProj);
-  if (HUGE_VAL == xy.u) {
-    std::ostringstream msg;
-    msg << "Error while projecting location.\n"
-	<< "  " << pj_strerrno(pj_errno) << "\n"
-	<< "  projection: " << _projection << "\n"
-	<< "  units: " << _units << "\n"
-	<< "  proj options: " << _projOptions << "\n";
-    throw std::runtime_error(msg.str());
-  } // if
-  *pX = xy.u;
-  *pY = xy.v;
+  for (int i=0; i < numLocs; ++i) {
+    lonlat.u = coords[i*numDims  ] * degToRad;
+    lonlat.v = coords[i*numDims+1] * degToRad;
+    projUV xy = pj_fwd(lonlat, _pProj);
+    if (HUGE_VAL == xy.u) {
+      std::ostringstream msg;
+      msg << "Error while projecting location.\n"
+	  << "  " << pj_strerrno(pj_errno) << "\n"
+	  << "  projection: " << _projection << "\n"
+	  << "  units: " << _units << "\n"
+	  << "  proj options: " << _projOptions << "\n"
+	  << "  lon: " << lonlat.u << "\n"
+	  << "  lat: " << lonlat.v << "\n";
+      throw std::runtime_error(msg.str());
+    } // if
+    coords[i*numDims  ] = xy.u;
+    coords[i*numDims+1] = xy.v;
+  } // for
 } // project
 
 // ----------------------------------------------------------------------
 // Get geographic coordinates of projected location.
 void
-spatialdata::geocoords::Projector::invproject(double* pLon,
-				   double* pLat,
-				   const double x,
-				   const double y)
+spatialdata::geocoords::Projector::invproject(double* coords,
+					      const int numLocs,
+					      const int numDims)
 { // invproject
-  assert(0 != pLon);
-  assert(0 != pLat);
+  assert(0 != coords);
   assert(0 != _pProj);
   
+  const double radToDeg = 180.0 / M_PI;
   projUV xy;
-  xy.u = x;
-  xy.v = y;
-  projUV lonlat = pj_inv(xy, _pProj);
-  if (HUGE_VAL == lonlat.u) {
-    std::ostringstream msg;
-    msg << "Error while getting geographic coordinates of projected "
-      "location.\n"
-	<< "  " << pj_strerrno(pj_errno) << "\n"
-	<< "  projection: " << _projection << "\n"
-	<< "  units: " << _units << "\n"
-	<< "  proj options: " << _projOptions << "\n"
-	<< "  x: " << x << "\n"
-	<< "  y: " << y << "\n";
-    throw std::runtime_error(msg.str());
-  } // if
-
-  const double radToDeg = 180.0 / M_PI;
-  *pLon = lonlat.u * radToDeg;
-  *pLat = lonlat.v * radToDeg;
+  for (int i=0; i < numLocs; ++i) {
+    xy.u = coords[i*numDims  ];
+    xy.v = coords[i*numDims+1];
+    projUV lonlat = pj_inv(xy, _pProj);
+    if (HUGE_VAL == lonlat.u) {
+      std::ostringstream msg;
+      msg << "Error while getting geographic coordinates of projected "
+	"location.\n"
+	  << "  " << pj_strerrno(pj_errno) << "\n"
+	  << "  projection: " << _projection << "\n"
+	  << "  units: " << _units << "\n"
+	  << "  proj options: " << _projOptions << "\n"
+	  << "  x: " << xy.u << "\n"
+	  << "  y: " << xy.v << "\n";
+      throw std::runtime_error(msg.str());
+    } // if
+    coords[i*numDims  ] = lonlat.u * radToDeg;
+    coords[i*numDims+1] = lonlat.v * radToDeg;
+  } // for
 } // invproject
 
 // ----------------------------------------------------------------------

Modified: cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/geocoords/Projector.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -91,27 +91,23 @@
 
   /** Project geographic coordinates.
    *
-   * @param pX Pointer to x coordinate of location (output)
-   * @param pY Pointer to y coordinate of location (output)
-   * @param lon Longitude of location
-   * @param lat Latitude of location
+   * @param coords Array of coordinates (input/output).
+   * @param numLocs Number of location.
+   * @param numDims Number of spatial dimensions in coordinates.
    */
-  void project(double* pX,
-	       double* pY,
-	       const double lon,
-	       const double lat);
+  void project(double* coords,
+	       const int numLocs,
+	       const int numDims);
 
   /** Get geographic coordinates of projected location.
    *
-   * @param pLon Pointer to longitude of location (output)
-   * @param pLat Pointer to latitude of location (output)
-   * @param x X coordinate of location
-   * @param y Y coordinate of location
+   * @param coords Array of coordinates (input/output).
+   * @param numLocs Number of location.
+   * @param numDims Number of spatial dimensions in coordinates.
    */
-  void invproject(double* pLon,
-		  double* pLat,
-		  const double x,
-		  const double y);
+  void invproject(double* coords,
+		  const int numLocs,
+		  const int numDims);
 
   /** Pickle coordinate system to ascii stream.
    *

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -32,8 +32,8 @@
 	SimpleIOAscii.icc \
 	cspatialdb.h \
 	SimpleDBQuery.hh \
-	SimpleDBTypes.hh \
-	SimpleDBTypes.icc \
+	SimpleDBData.hh \
+	SimpleDBData.icc \
 	UniformDB.hh \
 	UniformDB.icc
 

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,8 +16,8 @@
 #include "SimpleDB.hh" // Implementation of class methods
 
 #include "SimpleIO.hh" // USES SimpleIO
+#include "SimpleDBData.hh" // USES SimpleDBData
 #include "SimpleDBQuery.hh" // USES SimpleDBQuery
-#include "SimpleDBTypes.hh" // USES SimpleDBTypes
 
 #include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
 
@@ -30,9 +30,9 @@
 // ----------------------------------------------------------------------
 /// Default constructor
 spatialdata::spatialdb::SimpleDB::SimpleDB(void) :
+  _data(0),
   _iohandler(0),
   _query(0),
-  _data(0),
   _cs(0)
 { // constructor
 } // constructor
@@ -41,9 +41,9 @@
 /// Constructor with label
 spatialdata::spatialdb::SimpleDB::SimpleDB(const char* label) :
   SpatialDB(label),
+  _data(0),
   _iohandler(0),
   _query(0),
-  _data(0),
   _cs(0)
 { // constructor
 } // constructor
@@ -52,15 +52,9 @@
 /// Default destructor
 spatialdata::spatialdb::SimpleDB::~SimpleDB(void)
 { // destructor
-  delete _query; _query = 0;
-  if (0 != _data) {
-    delete[] _data->data; _data->data = 0;
-    delete[] _data->valNames; _data->valNames = 0;
-    delete[] _data->valUnits; _data->valUnits = 0;
-  } // if
   delete _data; _data = 0;
   delete _iohandler; _iohandler = 0;
-
+  delete _query; _query = 0;
   delete _cs; _cs = 0;
 } // destructor
 
@@ -73,10 +67,7 @@
 
   // Read data
   if (0 == _data) {
-    _data = new DataStruct;
-    _data->data = 0;
-    _data->valNames = 0;
-    _data->valUnits = 0;
+    _data = new SimpleDBData;
     _iohandler->read(_data, &_cs);
   } // if
 
@@ -90,13 +81,8 @@
 void
 spatialdata::spatialdb::SimpleDB::close(void)
 { // close
-  delete _query; _query = 0;
-  if (0 != _data) {
-    delete[] _data->data; _data->data = 0;
-    delete[] _data->valNames; _data->valNames = 0;
-    delete[] _data->valUnits; _data->valUnits = 0;
-  } // if
   delete _data; _data = 0;
+  delete _query; _query = 0;
 } // close
 
 // ----------------------------------------------------------------------

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -18,14 +18,14 @@
 #if !defined(spatialdata_spatialdb_simpledb_hh)
 #define spatialdata_spatialdb_simpledb_hh
 
-#include "SpatialDB.hh"
+#include "SpatialDB.hh" // ISA Spatialdb
 
 namespace spatialdata {
   namespace spatialdb {
   class SpatialDB; // ISA SpatialDB
   class SimpleDB;
   class SimpleIO; // USES SimpleIO
-  class SimpleDBTypes; // helper
+  class SimpleDBData; // helper
   class SimpleDBQuery; // helper
   class TestSimpleDB; // unit testing
   class TestSimpleDBQuery; // unit testing
@@ -36,7 +36,6 @@
 class spatialdata::spatialdb::SimpleDB : public SpatialDB
 { // class SimpleDB
   friend class SimpleDBQuery; // helper
-  friend class SimpleDBTypes; // helper
   friend class TestSimpleDB; // unit testing
   friend class TestSimpleDBQuery; // unit testing
 
@@ -44,16 +43,19 @@
   // PUBLIC ENUM ////////////////////////////////////////////////////////
 
   /** Topology of spatial data */
-  enum TopoEnum { POINT, LINE, AREA, VOLUME };
+  enum TopoEnum {
+    POINT=0,
+    LINE=1,
+    AREA=2,
+    VOLUME=3
+  };
 
   /** Type of query */
-  enum QueryEnum { NEAREST=0, LINEAR=1 };
+  enum QueryEnum {
+    NEAREST=0,
+    LINEAR=1
+  };
 
-  // PUBLIC MEMBERS /////////////////////////////////////////////////////
-
-  /** Structure used to store data in database */
-  struct DataStruct;
-  
  public :
   // PUBLIC METHODS /////////////////////////////////////////////////////
 
@@ -125,15 +127,11 @@
   SimpleDB(const SimpleDB& data); ///< Not implemented
   const SimpleDB& operator=(const SimpleDB& data); ///< Not implemented
   
-protected :
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-  
-  DataStruct* _data; ///< Pointer to data  
-
 private :
  // PRIVATE MEMBERS /////////////////////////////////////////////////////
    
- SimpleIO* _iohandler; ///< I/O handler
+  SimpleDBData* _data; ///< Pointer to data  
+  SimpleIO* _iohandler; ///< I/O handler
   SimpleDBQuery* _query; ///< Query handler
   spatialdata::geocoords::CoordSys* _cs; ///< Coordinate system
 

Added: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.cc	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,160 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "SimpleDBData.hh" // Implementation of class methods
+
+#include <stdexcept> // USES std::runtime_error
+
+#include <sstream> // USES std::ostringsgream
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Default constructor
+spatialdata::spatialdb::SimpleDBData::SimpleDBData(void) :
+  _data(0),
+  _coordinates(0),
+  _names(0),
+  _units(0),
+  _numLocs(0),
+  _numValues(0),
+  _dataDim(0),
+  _spaceDim(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Default destructor
+spatialdata::spatialdb::SimpleDBData::~SimpleDBData(void)
+{ // destructor
+  delete[] _data; _data = 0;
+  delete[] _coordinates; _coordinates = 0;
+  delete[] _names; _names = 0;
+  delete[] _units; _units = 0;
+  _numLocs = 0;
+  _numValues = 0;
+  _dataDim = 0;
+  _spaceDim = 0;
+} // destructor
+
+// ----------------------------------------------------------------------
+// Allocate data structues.
+void
+spatialdata::spatialdb::SimpleDBData::allocate(const int numLocs,
+					       const int numValues,
+					       const int spaceDim,
+					       const int dataDim)
+{ // allocate
+  delete[] _data; _data = 0;
+  delete[] _coordinates; _coordinates = 0;
+  delete[] _names; _names = 0;
+  delete[] _units; _units = 0;
+
+  if (numLocs <= 0) {
+    std::ostringstream msg;
+    msg << "Number of locations (" << numLocs
+	<< ") must be positive.";
+    throw std::runtime_error(msg.str());
+  } // if
+  if (numValues <= 0) {
+    std::ostringstream msg;
+    msg << "Number of values (" << numValues
+	<< ") must be positive.";
+    throw std::runtime_error(msg.str());
+  } // if
+  if (spaceDim <= 0) {
+    std::ostringstream msg;
+    msg << "Number of spatial dimensions (" << spaceDim
+	<< ") must be positive.";
+    throw std::runtime_error(msg.str());
+  } // if
+  if (dataDim < 0 || dataDim > 3) {
+    std::ostringstream msg;
+    msg << "Spatial dimension of data (" << dataDim
+	<< ") must be in the range [0,3].";
+    throw std::runtime_error(msg.str());
+  } // if
+
+
+  int size = numLocs*numValues;
+  _data = (size > 0) ? new double[size] : 0;
+
+  size = numLocs*spaceDim;
+  _coordinates = (size > 0) ? new double[size] : 0;
+
+  size = numValues;
+  _names = (size > 0) ? new std::string[size] : 0;
+  _units = (size > 0) ? new std::string[size] : 0; 
+
+  _numLocs = numLocs;
+  _numValues = numValues;
+  _spaceDim = spaceDim;
+  _dataDim = dataDim;
+} // allocate
+
+// ----------------------------------------------------------------------
+// Set data values.
+void
+spatialdata::spatialdb::SimpleDBData::data(const double* values,
+					   const int numLocs,
+					   const int numValues)
+{ // data
+  assert(0 != values);
+  assert(numLocs == _numLocs);
+  assert(numValues == _numValues);
+ 
+  memcpy(_data, values, numLocs*numValues*sizeof(double));
+} // data
+
+// ----------------------------------------------------------------------
+// Set coordinates of locations.
+void
+spatialdata::spatialdb::SimpleDBData::coordinates(const double* values,
+						  const int numLocs,
+						  const int spaceDim)
+{ // coordinates
+  assert(0 != values);
+  assert(numLocs == _numLocs);
+  assert(spaceDim == _spaceDim);
+
+  memcpy(_coordinates, values, numLocs*spaceDim*sizeof(double));
+} // coordinates
+
+// ----------------------------------------------------------------------
+// Set names of values.
+void
+spatialdata::spatialdb::SimpleDBData::names(const char** const values,
+					    const int numValues)
+{ // names
+  assert(0 != values);
+  assert(numValues == _numValues);
+
+  for (int i=0; i < numValues; ++i)
+    _names[i] = values[i];
+} // names
+
+// ----------------------------------------------------------------------
+// Set units of values.
+void
+spatialdata::spatialdb::SimpleDBData::units(const char** const values,
+					    const int numValues)
+{ // units
+  assert(0 != values);
+  assert(numValues == _numValues);
+
+  for (int i=0; i < numValues; ++i)
+    _units[i] = values[i];
+} // units
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.hh	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,185 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file libsrc/spatialdb/SimpleDBData.hh
+ *
+ * @brief C++ data in simple spatial database.
+ */
+
+#if !defined(spatialdata_spatialdb_simpledbdata_hh)
+#define spatialdata_spatialdb_simpledbdata_hh
+
+#include <string> // USES std::string
+
+namespace spatialdata {
+  namespace spatialdb {
+    class SimpleDBData;
+
+    class TestSimpleDBData; // unit testing
+  } // spatialdb
+} // spatialdata
+
+class spatialdata::spatialdb::SimpleDBData
+{ // SimpleDBData
+  friend class TestSimpleDBData; // unit testing
+
+public :
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+
+  /// Default constructor
+  SimpleDBData(void);
+
+  /// Default destructor
+  ~SimpleDBData(void);
+
+  /** Allocate data structues.
+   *
+   * @param numLocs Number of locations.
+   * @param numValues Number of values.
+   * @param spaceDim Spatial dimension of domain.
+   * @param dataDim Spatial dimension of data distribution.
+   */
+  void allocate(const int numLocs,
+		const int numValues,
+		const int spaceDim,
+		const int dataDim);
+
+  /** Set data values.
+   *
+   * @pre Must call allocate() before setData().
+   *
+   * @param values Array of data values [numLocs*numValues].
+   * @param numLocs Number of locations.
+   * @param numValues Number of values.
+   */
+  void data(const double* values,
+	    const int numLocs,
+	    const int numValues);
+
+  /** Set coordinates of locations.
+   *
+   * @pre Must call allocate() before setLocations().
+   *
+   * @param values Array of coordinates of locations [numLocs*spaceDim].
+   * @param numLocs Number of locations.
+   * @param spaceDim Spatial dimension of coordinates.
+   */
+  void coordinates(const double* values,
+		   const int numLocs,
+		   const int spaceDim);
+
+  /** Set names of values.
+   *
+   * @pre Must call allocate() before setNames().
+   *
+   * @param names Array of names of values [numValues].
+   * @param numValues Number of values.
+   */
+  void names(const char** const values,
+	     const int numValues);
+
+  /** Set units of values.
+   *
+   * @pre Must call allocate() before setUnits().
+   *
+   * @param units Array of units of values [numValues].
+   * @param numValues Number of values.
+   */
+  void units(const char** const values,
+	     const int numValues);
+
+  /** Get number of locations for data.
+   *
+   * @returns Number of locations.
+   */
+  int numLocs(void) const;
+
+  /** Get number of values for data.
+   *
+   * @returns Number of values.
+   */
+  int numValues(void) const;
+
+  /** Get spatial dimension of data distribution.
+   *
+   * @returns Spatial dimension.
+   */
+  int dataDim(void) const;
+
+  /** Get spatial dimension of locations.
+   *
+   * @returns Spatial dimension.
+   */
+  int spaceDim(void) const;
+
+  /** Get coordinates of location in database.
+   *
+   * @param index Index of location in database
+   * @returns Coordinates of location.
+   */
+  const double* coordinates(const int index) const;
+
+  /** Get coordinates of location in database.
+   *
+   * @param index Index of location in database
+   * @returns Coordinates of location.
+   */
+  double* coordinates(const int index);
+
+  /** Get data values at location in database.
+   *
+   * @param index Index of location in database.
+   * @returns Data values at location.
+   */
+  const double* data(const int index) const;
+
+  /** Get data values at location in database.
+   *
+   * @param index Index of location in database.
+   * @returns Data values at location.
+   */
+  double* data(const int index);
+
+  /** Get name of value.
+   *
+   * @param index Index of value.
+   * @returns Name of value.
+   */
+  const char* name(const int index) const;
+
+  /** Get units of value.
+   *
+   * @param index Index of value.
+   * @returns Units of value.
+   */
+  const char* units(const int index) const;
+
+private :
+// PRIVATE METHODS ////////////////////////////////////////////////////
+
+  double* _data; ///< Array of data values.
+  double* _coordinates; ///< Array of coordinates of locations.
+  std::string* _names; ///< Names of data values.
+  std::string* _units; ///< Units of values.
+  int _numLocs; ///< Number of locations.
+  int _numValues; ///< Number of values.
+  int _dataDim; ///< Spatial dimension of data distribution.
+  int _spaceDim; ///< Spatial dimension of coordinate locations.
+
+}; // class SpatialDBData
+
+#include "SimpleDBData.icc" // inline methods
+
+#endif // spatialdata_spatialdb_simpledbdata_hh
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.icc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.icc	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBData.icc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(spatialdata_spatialdb_simpledbdata_hh)
+#error "SimpleDBData.icc must only be included from SimpleDBData.hh"
+#endif
+
+// Get number of locations for data.
+inline
+int
+spatialdata::spatialdb::SimpleDBData::numLocs(void) const {
+  return _numLocs;
+}
+
+// Get number of values for data.
+inline
+int
+spatialdata::spatialdb::SimpleDBData::numValues(void) const {
+  return _numValues;
+}
+
+// Get spatial dimension of data distribution.
+inline
+int
+spatialdata::spatialdb::SimpleDBData::dataDim(void) const {
+  return _dataDim;
+}
+
+// Get spatial dimension of locations.
+inline
+int
+spatialdata::spatialdb::SimpleDBData::spaceDim(void) const {
+  return _spaceDim;
+}
+
+// Get coordinates of location in database.
+inline
+const double*
+spatialdata::spatialdb::SimpleDBData::coordinates(const int index) const {
+  assert(index >= 0 & index < _numLocs);
+  return &_coordinates[index*_spaceDim];
+}
+
+// Get coordinates of location in database.
+inline
+double*
+spatialdata::spatialdb::SimpleDBData::coordinates(const int index) {
+  assert(index >= 0 & index < _numLocs);
+  return &_coordinates[index*_spaceDim];
+}
+
+// Get data values at location in database.
+inline
+const double*
+spatialdata::spatialdb::SimpleDBData::data(const int index) const {
+  assert(index >= 0 && index < _numLocs);
+  return &_data[index*_numValues];
+}
+
+// Get data values at location in database.
+inline
+double*
+spatialdata::spatialdb::SimpleDBData::data(const int index) {
+  assert(index >= 0 && index < _numLocs);
+  return &_data[index*_numValues];
+}
+
+// Get name of value.
+inline
+const char*
+spatialdata::spatialdb::SimpleDBData::name(const int index) const {
+  assert(index >= 0 && index < _numValues);
+  return _names[index].c_str();
+}
+    
+// Get units of value.
+inline
+const char*
+spatialdata::spatialdb::SimpleDBData::units(const int index) const {
+  assert(index >= 0 && index < _numValues);
+  return _units[index].c_str();
+}
+
+
+// End of file 

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,7 +16,7 @@
 #include "SimpleDB.hh" // USES SimpleDB
 #include "SimpleDBQuery.hh" // implementation of class methods
 
-#include "SimpleDBTypes.hh" // USEs SimpleDB::DataStruct
+#include "SimpleDBData.hh" // USEs SimpleDBData
 
 #include "spatialdata/geocoords/Converter.hh" // USES Converter
 
@@ -78,9 +78,9 @@
   delete[] _queryVals; _queryVals = new int[numVals];
   for (int iVal=0; iVal < numVals; ++iVal) {
     int iName = 0;
-    const int numNames = _db._data->numVals;
+    const int numNames = _db._data->numValues();
     while (iName < numNames) {
-      if (0 == strcasecmp(names[iVal], _db._data->valNames[iName].c_str()))
+      if (0 == strcasecmp(names[iVal], _db._data->name(iName)))
 	break;
       ++iName;
     } // while
@@ -90,7 +90,7 @@
 	<< "Could not find value " << names[iVal] << " in spatial database\n"
 	<< _db.label() << ". Available values are:";
       for (int iName=0; iName < numNames; ++iName)
-	msg << "\n  " << _db._data->valNames[iName];
+	msg << "\n  " << _db._data->name(iName);
       msg << "\n";
       throw std::runtime_error(msg.str());
     } // if
@@ -160,24 +160,22 @@
   assert(numVals == _querySize);
 
   int iNear = 0;
-  const int spaceDim = _db._data->spaceDim;
-
+  const int spaceDim = _db._data->spaceDim();
   double pt[3];
-  pt[0] = 0.0;
-  pt[1] = 0.0;
-  pt[2] = 0.0;
-  SimpleDBTypes::dataCoords(pt, 3, *_db._data, iNear);
+  _setPoint3(pt, _db._data->coordinates(iNear), spaceDim);
   double nearDist = _distSquared(_q, pt);
-  const int numLocs = _db._data->numLocs;
+
+  const int numLocs = _db._data->numLocs();
   for (int iLoc=1; iLoc < numLocs; ++iLoc) {
-    SimpleDBTypes::dataCoords(pt, 3, *_db._data, iLoc);    
+    _setPoint3(pt, _db._data->coordinates(iLoc), spaceDim);
     const double dist = _distSquared(_q, pt);
     if (dist < nearDist) {
       nearDist = dist;
       iNear = iLoc;
     } // if
   } // for
-  const double* nearVals = SimpleDBTypes::dataVals(*_db._data, iNear);
+
+  const double* nearVals = _db._data->data(iNear);
   const int querySize = _querySize;
   for (int iVal=0; iVal < querySize; ++iVal)
     vals[iVal] = nearVals[_queryVals[iVal]];
@@ -194,9 +192,9 @@
   assert(0 != _db._data);
   assert(numVals == _querySize);
 
-  if (0 == _db._data->dataDim) {
+  if (0 == _db._data->dataDim()) {
     const int index = 0;
-    const double* nearVals = SimpleDBTypes::dataVals(*_db._data, index);
+    const double* nearVals = _db._data->data(index);
     const int querySize = _querySize;
     for (int iVal=0; iVal < querySize; ++iVal)
       vals[iVal] = nearVals[_queryVals[iVal]];
@@ -215,7 +213,7 @@
       double val = 0;
       for (int iWt=0; iWt < numWts; ++iWt) {
 	const int iLoc = _nearest[weights[iWt].nearIndex];
-	const double* locVals = SimpleDBTypes::dataVals(*_db._data, iLoc);
+	const double* locVals = _db._data->data(iLoc);
 	val += weights[iWt].wt * locVals[_queryVals[iVal]];
       } // for
       vals[iVal] = val;
@@ -230,7 +228,7 @@
   assert(0 != _db._data);
 
   const int maxnear = 100;
-  const int numLocs = _db._data->numLocs;
+  const int numLocs = _db._data->numLocs();
   const int nearSize = (numLocs < maxnear) ? numLocs : maxnear;
   _nearest.resize(nearSize);
   std::fill(_nearest.begin(), _nearest.end(), -1);
@@ -240,12 +238,10 @@
   
   // find closest nearSize points
   double pt[3];
-  pt[0] = 0.0;
-  pt[1] = 0.0;
-  pt[2] = 0.0;
+  const int spaceDim = _db._data->spaceDim();
   for (int iLoc=0; iLoc < numLocs; ++iLoc) {
     // use square of distance to find closest
-    SimpleDBTypes::dataCoords(pt, 3, *_db._data, iLoc);
+    _setPoint3(pt, _db._data->coordinates(iLoc), spaceDim);
     const double dist2 = _distSquared(_q, pt);
 
     // find place in nearest list if it exists
@@ -287,22 +283,22 @@
    * interpolation, etc.
    */
   
-  if (0 == _db._data->dataDim) {
+  if (0 == _db._data->dataDim()) {
     const int numWts = 1;
     pWeights->resize(numWts);
     _findPointPt(pWeights);
-  } else if (1 == _db._data->dataDim) {
+  } else if (1 == _db._data->dataDim()) {
     const int numWts = 2;
     pWeights->resize(numWts);
     _findPointPt(pWeights);
     _findLinePt(pWeights);
-  } else if (2 == _db._data->dataDim) {
+  } else if (2 == _db._data->dataDim()) {
     const int numWts = 3;
     pWeights->resize(numWts);
     _findPointPt(pWeights);
     _findLinePt(pWeights);
     _findAreaPt(pWeights);
-  } else if (3 == _db._data->dataDim) {
+  } else if (3 == _db._data->dataDim()) {
     const int numWts = 4;
     pWeights->resize(numWts);
     _findPointPt(pWeights);
@@ -331,7 +327,7 @@
   assert(0 != _db._data);
   assert(0 != pWeights);
   
-  const int spaceDim = _db._data->spaceDim;
+  const int spaceDim = _db._data->spaceDim();
 
   // best case is to use next nearest pt
   const int nearIndexA = (*pWeights)[0].nearIndex;
@@ -339,23 +335,17 @@
 
   const int locIndexA = _nearest[nearIndexA];
   double ptA[3];
-  ptA[0] = 0.0;
-  ptA[1] = 0.0;
-  ptA[2] = 0.0;
-  SimpleDBTypes::dataCoords(ptA, 3, *_db._data, locIndexA);
+  _setPoint3(ptA, _db._data->coordinates(locIndexA), spaceDim);
 
   double wtA = 0;
   double wtB = 0;
+  double ptB[3];
 
   // find nearest pt where we can interpolate
   const int nearSize = _nearest.size();
-  double ptB[3];
-  ptB[0] = 0.0;
-  ptB[1] = 0.0;
-  ptB[2] = 0.0;
   while (nearIndexB < nearSize) {
     const int locIndexB = _nearest[nearIndexB];
-    SimpleDBTypes::dataCoords(ptB, 3, *_db._data, locIndexB);
+    _setPoint3(ptB, _db._data->coordinates(locIndexB), spaceDim);
 
     // wtA = DotProduct(pb, ab) / DotProduct(ab, ab)
     // wtB = DotProduct(ap, ab) / DotProduct(ab, ab)
@@ -392,42 +382,33 @@
   assert(0 != _db._data);
   assert(0 != pWeights);
 
-  const int numCoords = 3;
+  const int spaceDim = _db._data->spaceDim();
 
   // best case is to use next nearest pt
   const int nearIndexA = (*pWeights)[0].nearIndex;
   const int locIndexA = _nearest[nearIndexA];
   double ptA[3];
-  ptA[0] = 0.0;
-  ptA[1] = 0.0;
-  ptA[2] = 0.0;
-  SimpleDBTypes::dataCoords(ptA, 3, *_db._data, locIndexA);
+  _setPoint3(ptA, _db._data->coordinates(locIndexA), spaceDim);
 
   const int nearIndexB = (*pWeights)[1].nearIndex;
   const int locIndexB = _nearest[nearIndexB];
   double ptB[3];
-  ptB[0] = 0.0;
-  ptB[1] = 0.0;
-  ptB[2] = 0.0;
-  SimpleDBTypes::dataCoords(ptB, 3, *_db._data, locIndexB);
+  _setPoint3(ptB, _db._data->coordinates(locIndexB), spaceDim);
 
   double wtA = 0;
   double wtB = 0;
   double wtC = 0;
+  double ptC[3];
 
   // find nearest pt where we can interpolate
   const int nearSize = _nearest.size();
   int nearIndexC = nearIndexB + 1;
-  double ptC[3];
-  ptC[0] = 0.0;
-  ptC[1] = 0.0;
-  ptC[2] = 0.0;
   while (nearIndexC < nearSize) {
     const int locIndexC = _nearest[nearIndexC];
-    SimpleDBTypes::dataCoords(ptC, 3, *_db._data, locIndexC);
+    _setPoint3(ptC, _db._data->coordinates(locIndexC), spaceDim);
 
     double areaABC = 0;
-    double dirABC[numCoords];
+    double dirABC[3];
     _area(&areaABC, dirABC, ptA, ptB, ptC);
 
 #if 0
@@ -435,8 +416,8 @@
     // Compute unit vectors AB and AC, then compute the dot product.
     // If the absolute value of the dot product is somewhat less than 1,
     // the points are not collinear.
-    double vecAB[numCoords];
-    double vecAC[numCoords];
+    double vecAB[3];
+    double vecAC[3];
     double magAB = 0.0;
     double magAC = 0.0;
     for (int iDir=0; iDir < numCoords; ++iDir) {
@@ -468,7 +449,7 @@
     if (areaABC > tolerance*ab2) {
 #endif
       // project P onto abc plane
-      double qProj[numCoords];
+      double qProj[3];
       const double qmod = 
 	dirABC[0]*_q[0] + dirABC[1]*_q[1] + dirABC[2]*_q[2];
       qProj[0] = _q[0] - dirABC[0]*qmod;
@@ -477,7 +458,7 @@
 
       // wtA = areaBCQ / areaABC * DotProduct(dirBCQ, dirABC);
       double areaBCQ = 0;
-      double dirBCQ[numCoords];
+      double dirBCQ[3];
       _area(&areaBCQ, dirBCQ, ptB, ptC, qProj);
       wtA = areaBCQ/areaABC * (dirBCQ[0]*dirABC[0] + 
 			       dirBCQ[1]*dirABC[1] +
@@ -485,7 +466,7 @@
 
       // wtB = areaCAQ / areaABC * DotProduct(dirCAQ, dirABC);
       double areaCAQ = 0;
-      double dirCAQ[numCoords];
+      double dirCAQ[3];
       _area(&areaCAQ, dirCAQ, ptC, ptA, qProj);
       wtB = areaCAQ/areaABC * (dirCAQ[0]*dirABC[0] + 
 			       dirCAQ[1]*dirABC[1] +
@@ -493,7 +474,7 @@
 
       // wtC = areaABQ / areaABC * DotProduct(dirABQ, dirABC);
       double areaABQ = 0;
-      double dirABQ[numCoords];
+      double dirABQ[3];
       _area(&areaABQ, dirABQ, ptA, ptB, qProj);
       wtC = areaABQ/areaABC * (dirABQ[0]*dirABC[0] + 
 			       dirABQ[1]*dirABC[1] +
@@ -526,46 +507,35 @@
 
   // best case is to use next nearest pt
 
+  const int spaceDim = _db._data->spaceDim();
+
   const int nearIndexA = (*pWeights)[0].nearIndex;
   const int locIndexA = _nearest[nearIndexA];
   double ptA[3];
-  ptA[0] = 0.0;
-  ptA[1] = 0.0;
-  ptA[2] = 0.0;
-  SimpleDBTypes::dataCoords(ptA, 3, *_db._data, locIndexA);
+  _setPoint3(ptA, _db._data->coordinates(locIndexA), spaceDim);
 
   const int nearIndexB = (*pWeights)[1].nearIndex;
   const int locIndexB = _nearest[nearIndexB];
   double ptB[3];
-  ptB[0] = 0.0;
-  ptB[1] = 0.0;
-  ptB[2] = 0.0;
-  SimpleDBTypes::dataCoords(ptB, 3, *_db._data, locIndexB);
+  _setPoint3(ptB, _db._data->coordinates(locIndexB), spaceDim);
 
   const int nearIndexC = (*pWeights)[2].nearIndex;
   const int locIndexC = _nearest[nearIndexC];
   double ptC[3];
-  ptC[0] = 0.0;
-  ptC[1] = 0.0;
-  ptC[2] = 0.0;
-  SimpleDBTypes::dataCoords(ptC, 3, *_db._data, locIndexC);
+  _setPoint3(ptC, _db._data->coordinates(locIndexC), spaceDim);
 
-
   double wtA = 0;
   double wtB = 0;
   double wtC = 0;
   double wtD = 0;
+  double ptD[3];
 
   // find nearest pt where we can interpolate
   const int nearSize = _nearest.size();
   int nearIndexD = nearIndexC + 1;
-  double ptD[3];
-  ptD[0] = 0.0;
-  ptD[1] = 0.0;
-  ptD[2] = 0.0;
   while (nearIndexD < nearSize) {
     const int locIndexD = _nearest[nearIndexD];
-    SimpleDBTypes::dataCoords(ptD, 3, *_db._data, locIndexD);
+    _setPoint3(ptD, _db._data->coordinates(locIndexD), spaceDim);
     
     // make sure A,B,C,D are not coplanar by checking if volume of
     // tetrahedron ABCD is not a tiny fraction of the distance AB
@@ -623,6 +593,20 @@
 } // _findVolumePt
 
 // ----------------------------------------------------------------------
+// Set coordiantes of point in 3-D space using coordinates in
+// current coordinate system.
+void
+spatialdata::spatialdb::SimpleDBQuery::_setPoint3(double pt3[3],
+						  const double* pt,
+						  const int spaceDim)
+{ // _setPoint3
+  pt3[0] = 0.0;
+  pt3[1] = 0.0;
+  pt3[2] = 0.0;
+  memcpy(pt3, pt, spaceDim*sizeof(double));
+} // _setPoint3
+
+// ----------------------------------------------------------------------
 // Compute square of distance between points A and B.
 double
 spatialdata::spatialdb::SimpleDBQuery::_distSquared(const double a[3],

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -142,6 +142,18 @@
    */
   void _findVolumePt(std::vector<WtStruct>* pWeights);
 
+  /** Set coordiantes of point in 3-D space using coordinates in
+   * current coordinate system.
+   *
+   * @param pt3 Coordinates of point in 3-D space [output].
+   * @param pt Cooridinates of point in current coordinate sytem.
+   * @param spaceDim Spatial dimension of current coordinate system.
+   */
+  static
+  void _setPoint3(double* const pt3,
+		  const double* pt,
+		  const int spaceDim);
+
   /** Compute square of distance between points A and B.
    *
    * @param a Coordinates of point A

Deleted: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/** @file libsrc/spatialdb/SimpleDBTypes.hh
- *
- * @brief C++ types used in simple spatial database.
- */
-
-#if !defined(spatialdata_spatialdb_simpledbtypes_hh)
-#define spatialdata_spatialdb_simpledbtypes_hh
-
-#include <string> // USES std::string
-
-struct spatialdata::spatialdb::SimpleDB::DataStruct {
-  double* data;
-  std::string* valNames;
-  std::string* valUnits;
-  int numLocs;
-  int numVals;
-  int dataDim;
-  int spaceDim;
-}; // DataStruct
-
-namespace spatialdata {
-  namespace spatialdb {
-  class SpatialDBTypes;
-  } // spatialdb
-} // spatialdata
-
-class spatialdata::spatialdb::SimpleDBTypes
-{ // SimpleDBTypes
-
-public :
-  // PUBLIC METHODS /////////////////////////////////////////////////////
-
-  /** Get coordinates of location in database.
-   *
-   * @param data Datain database
-   * @param index Index of location in database
-   */
-  static double* dataCoords(const SimpleDB::DataStruct& data,
-			    const int index);
-
-  /** Get coordinates of location in database.
-   *
-   * @param coords Array for coordinates of location
-   * @param spaceDim Number of dimensions for coordinates
-   * @param data Datain database
-   * @param index Index of location in database
-   */
-  static void dataCoords(double* const coords,
-			 const int spaceDim,
-			 const SimpleDB::DataStruct& data,
-			 const int index);
-
-  /** Get values of location in database.
-   *
-   * @param data Datain database
-   * @param index Index of location in database
-   */
-  static double* dataVals(const SimpleDB::DataStruct& data,
-			  const int index);
-
-}; // class SpatialDBTypes
-
-#include "SimpleDBTypes.icc" // inline methods
-
-#endif // spatialdata_spatialdb_simpledbtypes_hh
-
-
-// End of file 

Deleted: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.icc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.icc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.icc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,51 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// <LicenseText>
-//
-// ----------------------------------------------------------------------
-//
-
-#if !defined(spatialdata_spatialdb_simpledbtypes_hh)
-#error "SimpleDBTypes.icc must only be included from SimpleDBTypes.hh"
-#endif
-
-#include <assert.h>
-
-// Get coordinates of location in database.
-inline
-double*
-spatialdata::spatialdb::SimpleDBTypes::dataCoords(
-					  const SimpleDB::DataStruct& data,
-					  const int index) {
-  return data.data+(index*(data.spaceDim+data.numVals));
-}
-
-// Get values of location in database.
-inline
-double* 
-spatialdata::spatialdb::SimpleDBTypes::dataVals(
-					  const SimpleDB::DataStruct& data,
-					  const int index)
-{ return data.data+(index*(data.spaceDim+data.numVals)+data.spaceDim); }
-
-
-// Get coordinates of location in database.
-inline
-void
-spatialdata::spatialdb::SimpleDBTypes::dataCoords(
-					  double* const coords,
-					  const int spaceDim,
-					  const SimpleDB::DataStruct& data,
-					  const int index) {
-  assert(spaceDim >= data.spaceDim);
-  const int offset = data.spaceDim+data.numVals;
-  for (int i=0; i < data.spaceDim; ++i)
-    coords[i] = data.data[index*offset+i];
-}
-
-// End of file 

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -18,7 +18,7 @@
 #include "SimpleIO.hh" // Implementation of class methods
 
 #include <string> // USES std::string
-#include "SimpleDBTypes.hh" // USES SimpleDBTypes
+#include "SimpleDBData.hh" // USES SimpleDBData
 
 #include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
 
@@ -41,14 +41,14 @@
 // ----------------------------------------------------------------------
 void
 spatialdata::spatialdb::SimpleIO::checkCompatibility(
-			      const SimpleDB::DataStruct& data,
+			      const SimpleDBData& data,
 			      const spatialdata::geocoords::CoordSys* pCS)
 { // checkCompatibility
   assert(0 != pCS);
 
-  const int numLocs = data.numLocs;
-  const int spaceDim = data.spaceDim;
-  const int dataDim = data.dataDim;
+  const int numLocs = data.numLocs();
+  const int spaceDim = data.spaceDim();
+  const int dataDim = data.dataDim();
   if (numLocs < 1 + dataDim) {
     std::ostringstream msg;
     msg << "Spatial distribution with data dimensions of " << dataDim 

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -24,7 +24,11 @@
   namespace spatialdb {
     class SimpleIO;
     class SimpleDB; // USES SimpleDB
+    class SimpleDBData; // USES SimpleDBData
   } // spatialdb
+  namespace geocoords {
+    class CoordSys; // USES CoordSys
+  } // geocoords
 } // spatialdata
 
 /// C++ manager for simple spatial database.
@@ -65,7 +69,7 @@
    * @param pData Database data
    * @param ppCS Pointer to coordinate system
    */
-  virtual void read(SimpleDB::DataStruct* pData,
+  virtual void read(SimpleDBData* pData,
 		    spatialdata::geocoords::CoordSys** ppCS) = 0;
 
   /** Write the database.
@@ -73,7 +77,7 @@
    * @param data Database data
    * @param pCS Pointer to coordinate system
    */
-  virtual void write(const SimpleDB::DataStruct& data,
+  virtual void write(const SimpleDBData& data,
 		     const spatialdata::geocoords::CoordSys* pCS) = 0;
 
 protected :
@@ -89,7 +93,7 @@
    * @param data Database data
    * @param pCS Pointer to coordinate system
    */
-  static void checkCompatibility(const SimpleDB::DataStruct& data,
+  static void checkCompatibility(const SimpleDBData& data,
 				 const spatialdata::geocoords::CoordSys* pCS);
 
 private :

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -12,13 +12,12 @@
 
 #include <portinfo>
 
+#include "SimpleIOAscii.hh" // implementation of class methods
+
 #include "SpatialDB.hh" // USES SimpleDB
 #include "SimpleDB.hh" // USES SimpleDB
 
-#include "SimpleIO.hh" // ISA SimpleIO
-#include "SimpleIOAscii.hh" // implementation of class methods
-
-#include "SimpleDBTypes.hh" // USES SimpleDBTypes
+#include "SimpleDBData.hh" // USES SimpleDBData
 #include "spatialdata/geocoords/CoordSys.hh" // USES CSCart
 #include "spatialdata/geocoords/CSCart.hh" // USES CSCart
 #include "spatialdata/geocoords/CSPicklerAscii.hh" // USES CSPicklerAscii
@@ -35,13 +34,14 @@
 #include <assert.h> // USES assert()
 
 // ----------------------------------------------------------------------
-const char* spatialdata::spatialdb::SimpleIOAscii::HEADER =  "#SPATIAL.ascii";
+const char* spatialdata::spatialdb::SimpleIOAscii::HEADER =
+  "#SPATIAL.ascii";
 
 // ----------------------------------------------------------------------
 // Read ascii database file.
 void
 spatialdata::spatialdb::SimpleIOAscii::read(
-				   SimpleDB::DataStruct* pData,
+				   SimpleDBData* pData,
 				   spatialdata::geocoords::CoordSys** ppCS)
 { // read
   assert(0 != pData);
@@ -112,7 +112,7 @@
 // Read ascii database file.
 void
 spatialdata::spatialdb::SimpleIOAscii::_readV1(
-				     SimpleDB::DataStruct* pData,
+				     SimpleDBData* pData,
 				     spatialdata::geocoords::CoordSys** ppCS,
 				     std::istream& filein)
 { // ReadV1
@@ -120,12 +120,7 @@
   assert(0 != ppCS);
 
   // Clear memory and set default values
-  delete[] pData->valNames; pData->valNames = 0;
-  delete[] pData->valUnits; pData->valUnits = 0;
-  delete[] pData->data; pData->data = 0;
   delete *ppCS; *ppCS = new spatialdata::geocoords::CSCart();
-  pData->dataDim = 0;
-  pData->spaceDim = 3;
 
   utils::LineParser parser(filein, "//");
   parser.eatwhitespace(true);
@@ -143,42 +138,47 @@
     throw std::runtime_error(msg.str());
   } // else
 
-  int numVals = 0;
+  int numValues = 0;
+  int numLocs = 0;
+  int spaceDim = 3; // default
+  int dataDim = 0;
+  std::string* names = 0;
+  std::string* units = 0;
+
   buffer.str(parser.next());
   buffer.clear();
   buffer >> token;
   while (buffer.good() && token != "}") {
     if (0 == strcasecmp(token.c_str(), "num-values")) {
       buffer.ignore(maxIgnore, '=');
-      buffer >> numVals;
-      pData->numVals = numVals;
+      buffer >> numValues;
     } else if (0 == strcasecmp(token.c_str(), "num-locs")) {
       buffer.ignore(maxIgnore, '=');
-      buffer >> pData->numLocs;
+      buffer >> numLocs;
     } else if (0 == strcasecmp(token.c_str(), "value-names")) {
-      if (numVals > 0)
-	pData->valNames = new std::string[numVals];
+      if (numValues > 0)
+	names = new std::string[numValues];
       else
 	throw std::runtime_error("Number of values must be specified BEFORE "
 				 "names of values in SimpleDB file.");
       buffer.ignore(maxIgnore, '=');
-      for (int iVal=0; iVal < numVals; ++iVal)
-	buffer >> pData->valNames[iVal];
+      for (int iVal=0; iVal < numValues; ++iVal)
+	buffer >> names[iVal];
     } else if (0 == strcasecmp(token.c_str(), "value-units")) {
-      if (numVals > 0)
-	pData->valUnits = new std::string[numVals];
+      if (numValues > 0)
+	units = new std::string[numValues];
       else
 	throw std::runtime_error("Number of values must be specified BEFORE "
 				 "units of values in SimpleDB file.");
       buffer.ignore(maxIgnore, '=');
-      for (int iVal=0; iVal < numVals; ++iVal)
-	buffer >> pData->valUnits[iVal];
+      for (int iVal=0; iVal < numValues; ++iVal)
+	buffer >> units[iVal];
     } else if (0 == strcasecmp(token.c_str(), "data-dim")) {
       buffer.ignore(maxIgnore, '=');
-      buffer >> pData->dataDim;
+      buffer >> dataDim;
     } else if (0 == strcasecmp(token.c_str(), "space-dim")) {
       buffer.ignore(maxIgnore, '=');
-      buffer >> pData->spaceDim;
+      buffer >> spaceDim;
     } else if (0 == strcasecmp(token.c_str(), "cs-data")) {
       buffer.ignore(maxIgnore, '=');
       std::string rbuffer(buffer.str());
@@ -207,35 +207,44 @@
 
   bool ok = true;
   std::ostringstream msg;
-  if (0 == pData->numVals) {
+  if (0 == numValues) {
     ok = false;
     msg << "SimpleDB settings must include 'num-values'.\n";
   } // if
-  if (0 == pData->numLocs) {
+  if (0 == numLocs) {
     ok = false;
     msg << "SimpleDB settings must include 'num-locs'.\n";
   } // if
-  if (0 == pData->valNames) {
+  if (0 == names) {
     ok = false;
       msg << "SimpleDB settings must include 'value-names'.\n";
   } // if
-  if (0 == pData->valUnits) {
+  if (0 == units) {
     ok = false;
     msg << "SimpleDB settings must include 'value-units'.\n";
   } // if
   if (!ok)
     throw std::runtime_error(msg.str());
   
-  
-  const int dataLocSize = pData->spaceDim + pData->numVals;
-  const int dataTotalSize = pData->numLocs * dataLocSize;
-  delete[] pData->data; 
-  pData->data = (dataTotalSize > 0) ? new double[dataTotalSize] : 0;
-  for (int iLoc=0, i=0; iLoc < pData->numLocs; ++iLoc) {
+  pData->allocate(numLocs, numValues, spaceDim, dataDim);
+  char** cnames = (numValues > 0) ? new char*[numValues] : 0;
+  char** cunits = (numValues > 0) ? new char*[numValues] : 0;
+  for (int i=0; i < numValues; ++i) {
+    cnames[i] = const_cast<char*>(names[i].c_str());
+    cunits[i] = const_cast<char*>(units[i].c_str());
+  } // for
+  pData->names(const_cast<const char**>(cnames), numValues);
+  pData->units(const_cast<const char**>(cunits), numValues);
+
+  for (int iLoc=0; iLoc < numLocs; ++iLoc) {
     buffer.str(parser.next());
     buffer.clear();
-    for (int iVal=0; iVal < dataLocSize; ++iVal)
-      buffer >> pData->data[i++];
+    double* coordinates = pData->coordinates(iLoc);
+    for (int iDim=0; iDim < spaceDim; ++iDim)
+      buffer >> coordinates[iDim];
+    double* data = pData->data(iLoc);
+    for (int iVal=0; iVal < numValues; ++iVal)
+      buffer >> data[iVal];
   } // for
   if (!filein.good())
     throw std::runtime_error("I/O error while reading SimpleDB data.");
@@ -245,13 +254,13 @@
   checkCompatibility(*pData, *ppCS);
   
   (*ppCS)->initialize();
-} // ReadV1
+} // _readV1
 
 // ----------------------------------------------------------------------
 // Write ascii database file.
 void
 spatialdata::spatialdb::SimpleIOAscii::write(
-				const SimpleDB::DataStruct& data,
+				const SimpleDBData& data,
 				const spatialdata::geocoords::CoordSys* pCS)
 { // write
   try {
@@ -264,25 +273,27 @@
     } // if
     
     const int version = 1;
-    const int numLocs = data.numLocs;
-    const int numVals = data.numVals;
+    const int numLocs = data.numLocs();
+    const int numValues = data.numValues();
+    const int spaceDim = data.spaceDim();
+    const int dataDim = data.dataDim();
     
     fileout
       << HEADER << " " << version << "\n"
       << "SimpleDB {\n"
-      << "  num-values = " << std::setw(6) << numVals << "\n"
+      << "  num-values = " << std::setw(6) << numValues << "\n"
       << "  value-names =";
-    for (int iVal=0; iVal < numVals; ++iVal)
-      fileout << "  " << data.valNames[iVal];
+    for (int iVal=0; iVal < numValues; ++iVal)
+      fileout << "  " << data.name(iVal);
     fileout << "\n";
     fileout << "  value-units =";
-    for (int iVal=0; iVal < numVals; ++iVal)
-      fileout << "  " << data.valUnits[iVal];
+    for (int iVal=0; iVal < numValues; ++iVal)
+      fileout << "  " << data.units(iVal);
     fileout << "\n";
     fileout
       << "  num-locs = " << std::setw(6) << numLocs << "\n"
-      << "  data-dim = " << std::setw(4) << data.dataDim << "\n"
-      << "  space-dim = " << std::setw(4) << data.spaceDim << "\n"
+      << "  data-dim = " << std::setw(4) << dataDim << "\n"
+      << "  space-dim = " << std::setw(4) << spaceDim << "\n"
       << "  cs-data = ";
     spatialdata::geocoords::CSPicklerAscii::pickle(fileout, pCS);
     fileout << "}\n";
@@ -293,14 +304,13 @@
       << std::resetiosflags(std::ios::fixed)
       << std::setiosflags(std::ios::scientific)
       << std::setprecision(6);
-    const int numCoords = data.spaceDim;
     for (int iLoc=0; iLoc < numLocs; ++iLoc) {
-      const double* pCoords = SimpleDBTypes::dataCoords(data, iLoc);
-      for (int iCoord=0; iCoord < numCoords; ++iCoord)
-	fileout << std::setw(14) << pCoords[iCoord];
-      const double* pVals = SimpleDBTypes::dataVals(data, iLoc);
-      for (int iVal=0; iVal < numVals; ++iVal)
-	fileout << std::setw(14) << pVals[iVal];
+      const double* coordinates = data.coordinates(iLoc);
+      for (int iCoord=0; iCoord < spaceDim; ++iCoord)
+	fileout << std::setw(14) << coordinates[iCoord];
+      const double* values = data.data(iLoc);
+      for (int iVal=0; iVal < numValues; ++iVal)
+	fileout << std::setw(14) << values[iVal];
       fileout << "\n";
     } // for
     if (!fileout.good())

Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -18,7 +18,7 @@
 #if !defined(spatialdata_spatialdb_simpleioascii_hh)
 #define spatialdata_spatialdb_simpleioascii_hh
 
-#include "SimpleIO.hh"
+#include "SimpleIO.hh" // ISA SimpleIO
 
 #include <iosfwd> // USES std::istream
 
@@ -52,7 +52,7 @@
    * @param pData Database data
    * @param ppCS Pointer to coordinate system
    */
-  void read(SimpleDB::DataStruct* pData,
+  void read(SimpleDBData* pData,
 	    spatialdata::geocoords::CoordSys** ppCS);
 
   /** Write the database.
@@ -60,7 +60,7 @@
    * @param data Database data
    * @param pCS Pointer to coordinate system
    */
-  void write(const SimpleDB::DataStruct& data,
+  void write(const SimpleDBData& data,
 	     const spatialdata::geocoords::CoordSys* pCS);
 
 private :
@@ -72,7 +72,7 @@
    * @param ppCS Pointer to coordinate system
    * @param filein File input stream
    */
-  static void _readV1(SimpleDB::DataStruct* pData,
+  static void _readV1(SimpleDBData* pData,
 		      spatialdata::geocoords::CoordSys** ppCS,
 		      std::istream& filein);
 

Modified: cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/libsrc/utils/PointsStream.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -133,9 +133,7 @@
 
 #include "PointsStream.icc" // inline methods
 
-#endif // spatialdata_geocoodrs_csgeo_hh
+#endif // spatialdata_geocoords_csgeo_hh
 
-// version
-// $Id$
 
 // End of file 

Modified: cs/spatialdata-0.1/trunk/modulesrc/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -13,8 +13,7 @@
 SUBDIRS = \
 	geocoords \
 	spatialdb \
-	units \
-	utils
+	units
 
 
 # End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSCart.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSCart.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSCart.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/geocoords/CSCart.i
+ *
+ * @brief SWIG interface to C++ CSCart object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+    
+    class CSCart : public CoordSys
+    { // class CSCart
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor
+      CSCart(void);
+
+      /// Default destructor
+      virtual ~CSCart(void);
+
+      /** Clone coordinate system.
+       *
+       * @returns Pointer to copy
+       */
+      virtual CoordSys* clone(void) const;
+
+      /// Initialize the coordinate system.
+      virtual void initialize(void);
+
+      /** Set scale factor for converting coordinates to SI units
+       * (meters).
+       *
+       * @param scale Scale factor
+       */
+      void toMeters(const double scale);
+
+      /** Get scale factor to convert coordinates to SI units (meters).
+       *
+       * @returns Scale factor
+       */
+      double toMeters(void) const;
+      
+      /** Pickle coordinate system to ascii stream.
+       *
+       * @param s Output stream
+       */
+      virtual void pickle(std::ostream& s) const;
+      
+      /** Unpickle coordinate system from ascii stream.
+       *
+       * @param s Input stream
+       */
+      virtual void unpickle(std::istream& s);
+      
+    }; // class CSCart
+    
+  } // geocoords
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeo.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeo.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeo.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,145 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/geocoords/CSGeo.i
+ *
+ * @brief SWIG interface to C++ CSGeo object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+
+  class Geoid;
+
+    class CSGeo : public CoordSys
+    { // class CSGeo
+      friend class TestCSGeo;
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor
+      CSGeo(void);
+
+      /// Default destructor
+      virtual
+      ~CSGeo(void);
+
+      /** Clone coordinate system.
+       *
+       * @returns Pointer to copy
+       */
+      virtual
+      CoordSys* clone(void) const;
+      
+      /// Initialize the coordinate system.
+      virtual
+      void initialize(void);
+      
+      /** Set reference ellipsoid.
+       *
+       * @param name Name of reference ellipsoid
+       */
+      void ellipsoid(const char* name);
+
+      /** Get reference ellipsoid.
+       *
+       * @returns Name of reference ellipsoid
+       */
+      const char* ellipsoid(void) const;
+
+      /** Set horizontal datum.
+       *
+       * @param name Name of horizontal datum
+       */
+      void datumHoriz(const char* name);
+
+      /** Get horizontal datum.
+       *
+       * @returns Name of datum
+       */
+      const char* datumHoriz(void) const;
+
+      /** Set vertical datum.
+       *
+       * @param name Name of vertical datum
+       */
+      void datumVert(const char* name);
+
+      /** Get vertical datum.
+       *
+       * @returns Name of datum
+       */
+      const char* datumVert(void) const;
+
+      /** Set geocentric flag.
+       *
+       * @param geocentric True if geocentric, false if lon/lat
+       */
+      virtual
+      void isGeocentric(bool geocentric);
+
+      /** Get geocentric flag.
+       *
+       * @returns True if geocentric, false if lon/lat
+       */
+      bool isGeocentric(void) const;
+
+      /** Set factor to convert Cartesian coordinates to meters.
+       *
+       * @param factor Factor to convert Cartesian coordinates to meters.
+       */
+      void toMeters(const double factor);
+
+      /** Get factor to convert Cartesian coordinates to meters.
+       *
+       * @returns Factor to convert Cartesian coordinates to meters.
+       */
+      double toMeters(void) const;
+
+      /** Set number of spatial dimensions in coordinate system.
+       *
+       * @param ndims Number of dimensions
+       */
+      virtual
+      void setSpaceDim(const int ndims);
+
+      /** Get radial outward direction.
+       *
+       * dir and coords
+       *   size = numLocs * numDims
+       *   index = iLoc*numDims + iDim
+       *
+       * @param dir Array of direction cosines for outward radial direction.
+       * @param coords Array of coordinates for locations.
+       * @param numLocs Number of locations.
+       * @param numDims Number of dimensions in coordinates.
+       */
+      virtual
+      void radialDir(double* dir,
+		     const double* coords,
+		     const int numLocs,
+		     const int numDims) const;
+
+      /** Get geoid.
+       *
+       * @returns Geoid
+       */
+      static Geoid& geoid(void);
+  
+    }; // class CSGeo
+
+  } // geocoords
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeoLocalCart.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeoLocalCart.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeoLocalCart.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/geocoords/CSGeoLocalCart.i
+ *
+ * @brief SWIG interface to C++ CSGeoLocalCart object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+
+    class CSGeoLocalCart : public CSGeo
+    { // class CSGeoLocalCart
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor
+      CSGeoLocalCart(void);
+
+      /// Default destructor
+      ~CSGeoLocalCart(void);
+
+      /** Clone coordinate system.
+       *
+       * @returns Pointer to copy
+       */
+      virtual
+      CoordSys* clone(void) const;
+
+      /// Initialize the coordinate system.
+      void initialize(void);
+
+      /** Set origin of local cartesian coordinate system.
+       *
+       * Units of elevation should be consistent with conversion factor to
+       * meters.
+       *
+       * @param lon Longitude of origin (degrees)
+       * @param lat Latitude of origin (degrees)
+       * @param elev Elevation (wrt vertical datum) of origin
+       */
+      void origin(const double lon,
+		  const double lat,
+		  const double elev);
+
+      /** Get origin of local cartesian coordinate system.
+       *
+       * @param pLon Pointer to longitude of origin (degrees)
+       * @param pLat Pointer to latitude of origin (degrees)
+       * @param pElev Pointer to elevation (wrt vertical datum) of origin
+       */
+      %apply double* OUTPUT { double* pLon, double* pLat, double* pElev };
+      void origin(double* pLon,
+		  double* pLat,
+		  double* pElev);
+      
+      /** Get radial outward direction.
+       *
+       * dir and coords
+       *   size = numLocs * numDims
+       *   index = iLoc*numDims + iDim
+       *
+       * @param dir Array of direction cosines for outward radial direction.
+       * @param coords Array of coordinates for locations.
+       * @param numLocs Number of locations.
+       * @param numDims Number of dimensions in coordinates.
+       */
+      void radialDir(double* dir,
+		     const double* coords,
+		     const int numLocs,
+		     const int numDims) const;
+      
+    }; // class CSGeoLocalCart
+    
+  } // geocoords
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeoProj.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeoProj.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/CSGeoProj.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/geocoords/CSGeoProj.i
+ *
+ * @brief SWIG interface to C++ CSGeoProj object
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+    class Projector; // foward declaration
+    
+    class CSGeoProj : public CSGeo
+    { // class CSGeoProj
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor
+      CSGeoProj(void);
+
+      /// Default destructor
+      ~CSGeoProj(void);
+
+      /** Clone coordinate system.
+       *
+       * @returns Pointer to copy
+       */
+      virtual
+      CoordSys* clone(void) const;
+
+      /// Initialize the coordinate system.
+      void initialize(void);
+
+      /** Set projector.
+       *
+       * @param projector Geographic coordinate projector
+       */
+      void projector(const Projector& projector);
+
+    }; // class CSGeoProj
+
+  } // geocoords
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/geocoords/Converter.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/Converter.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/Converter.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/geocoords/Converter.i
+ *
+ * @brief SWIG interface to C++ Converter object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+    class CoordSys; // forward declaration
+
+    class Converter
+    { // class Converter
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /** Convert coordinates from source coordinate system to destination
+       * coordinate system.
+       *
+       * @param coords Array of coordinates
+       * @param numLocs Number of location
+       * @param numDims Number of spatial dimensions in coordinates
+       * @param pCSDest Pointer to destination coordinate system
+       * @param pCSSrc Pointer to source coordinate system
+       */
+      %apply(double* INPLACE_ARRAY2, int DIM1, int DIM2) {
+	(double* coords,
+	 const int numLocs,
+	 const int numDims)
+	  };
+      static void convert(double* coords,
+			  const int numLocs,
+			  const int numDims,
+			  const CoordSys* pCSDest,
+			  const CoordSys* pCSSrc);
+      %clear(double* coords, const int numLocs, const int numDims);
+
+    }; // class Converter
+
+  } // geocoords
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/geocoords/CoordSys.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/CoordSys.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/CoordSys.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/geocoords/CoordSys.i
+ *
+ * @brief SWIG interface to C++ CoordSys object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+
+    class CoordSys
+    { // class CoordSys
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Type of coordinate system
+      enum CSTypeEnum {
+	CARTESIAN, ///< Cartesian coordinate system
+	GEOGRAPHIC ///< Geographic coordinate system
+      };
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor
+      CoordSys(void);
+
+      /// Default destructor
+      virtual
+      ~CoordSys(void);
+
+      /** Clone coordinate system.
+       *
+       * @returns Copy of *this
+       */
+      virtual
+      CoordSys* clone(void) const = 0;
+
+      /** Set number of spatial dimensions in coordinate system.
+       *
+       * @param ndims Number of dimensions
+       */
+      virtual
+      void setSpaceDim(const int ndims);
+
+      /** Get number of spatial dimensions in coordinate system.
+       *
+       * @returns Number of dimensions
+       */
+      int spaceDim(void) const;
+
+      /// Initialize the coordinate system.
+      virtual
+      void initialize(void) = 0;
+
+      /// Get type of coordinate system
+      CSTypeEnum csType(void) const;
+
+    }; // class CoordSys
+
+  } // geocoords
+} // spatialdata
+
+
+// End of file 

Modified: cs/spatialdata-0.1/trunk/modulesrc/geocoords/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -13,37 +13,44 @@
 subpackage = geocoords
 include $(top_srcdir)/subpackage.am
 
+subpkgpyexec_LTLIBRARIES = _geocoordsmodule.la
+subpkgpyexec_PYTHON = geocoords.py
 
-subpkgpyexec_LTLIBRARIES = geocoordsmodule.la
+swig_sources = \
+	geocoords.i \
+	CoordSys.i \
+	CSCart.i \
+	CSGeo.i \
+	CSGeoProj.i \
+	CSGeoLocalCart.i \
+	Projector.i \
+	Converter.i
 
-geocoordsmodule_la_LDFLAGS = -module -avoid-version \
+swig_generated = \
+	geocoords_wrap.cxx \
+	geocoords.py
+
+_geocoordsmodule_la_LDFLAGS = -module -avoid-version \
 	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
 
-dist_geocoordsmodule_la_SOURCES = geocoords.pyxe.src
+dist__geocoordsmodule_la_SOURCES = $(swig_sources) $(swig_generated)
 
-nodist_geocoordsmodule_la_SOURCES = \
-	geocoords.pyxe \
-	geocoords.c geocoords_embed.cpp geocoords_embed.h
-
-geocoordsmodule_la_LIBADD = \
+_geocoordsmodule_la_LIBADD = \
 	$(top_builddir)/libsrc/libspatialdata.la
 if NO_UNDEFINED
-geocoordsmodule_la_LIBADD += \
+_geocoordsmodule_la_LIBADD += \
 	$(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
 endif
 
-INCLUDES += -I$(PYTHON_INCDIR)
+INCLUDES += -I$(NUMPY_INCDIR) -I$(PYTHON_INCDIR)
 
-geocoords.pyx geocoords_embed.cpp  geocoords_embed.h: geocoords.pyxe
-	pyrexembed geocoords.pyxe
-geocoords.pyxe: $(srcdir)/geocoords.pyxe.src
-	cp $(srcdir)/geocoords.pyxe.src $@
-geocoords_embed.cpp: geocoords_embed.h
-geocoords_embed.h: geocoords.pyx
+$(srcdir)/geocoords_wrap.cxx $(srcdir)/geocoords.py: $(swig_sources)
+	$(SWIG) -Wall -c++ -python $<
 
-.pyx.c:
-	pyrexc $<
 
-CLEANFILES = geocoords.pyx geocoords.pyxe geocoords.c *_embed.*
+MAINTAINERCLEANFILES = \
+	$(srcdir)/geocoords_wrap.cxx \
+	$(srcdir)/geocoords.py
 
+
 # End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/geocoords/Projector.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/Projector.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/Projector.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/geocoords/Projector.i
+ *
+ * @brief SWIG interface to C++ Projector object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+
+    class Projector
+    { // class Projector
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor
+      Projector(void);
+
+      /// Default destructor
+      ~Projector(void);
+
+      /** Set projection.
+       *
+       * @param projection Name of projection
+       */
+      void projection(const char* name);
+
+      /** Get projection.
+       *
+       * @returns Name of projection
+       */
+      const char* projection(void) const;
+
+      /** Set units of projection.
+       *
+       * @param name Name of units
+       */
+      void units(const char* name);
+
+      /** Get units of projection.
+       *
+       * @returns Name of units
+       */
+      const char* units(void) const;
+
+      /** Set proj options.
+       *
+       * @param options
+       */
+      void projOptions(const char* options);
+
+      /** Get proj options.
+       *
+       * @returns Proj options
+       */
+      const char* projOptions(void) const;
+
+      /** Initialize projector.
+       *
+       * @param csGeo Geographic coordinate system
+       */
+      void initialize(const CSGeo& csGeo);
+
+    }; // class Projector
+
+  } // geocoords
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// SWIG interface
+%module geocoords
+
+// Header files for module C++ code
+%{
+#include <iosfwd>
+#include <string> // USES std::string
+#include "spatialdata/geocoords/proj4fwd.h" // Proj4 forward declaration
+
+// Headers for interfaces
+#include "spatialdata/geocoords/CoordSys.hh"
+#include "spatialdata/geocoords/CSCart.hh"
+#include "spatialdata/geocoords/CSGeo.hh"
+#include "spatialdata/geocoords/CSGeoProj.hh"
+#include "spatialdata/geocoords/CSGeoLocalCart.hh"
+
+#include "spatialdata/geocoords/Projector.hh"
+#include "spatialdata/geocoords/Converter.hh"
+%}
+
+%include "exception.i"
+%exception {
+  try {
+    $action
+  } catch (const std::exception& err) {
+    SWIG_exception(SWIG_RuntimeError, err.what());
+  } // try/catch
+ } // exception
+
+%include "typemaps.i"
+
+// Numpy interface stuff
+%{
+#define SWIG_FILE_WITH_INIT
+%}
+%include "../include/numpy.i"
+%init %{
+import_array();
+%}
+
+// Interfaces
+%include "CoordSys.i"
+%include "CSCart.i"
+%include "CSGeo.i"
+%include "CSGeoProj.i"
+%include "CSGeoLocalCart.i"
+
+%include "Projector.i"
+%include "Converter.i"
+
+// End of file

Deleted: cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe.src
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe.src	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe.src	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,744 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-#header{
-#include "spatialdata/geocoords/CoordSys.hh"
-#include "spatialdata/geocoords/CSCart.hh"
-#include "spatialdata/geocoords/CSGeo.hh"
-#include "spatialdata/geocoords/CSGeoLocalCart.hh"
-#include "spatialdata/geocoords/CSGeoProj.hh"
-#include "spatialdata/geocoords/Projector.hh"
-#include "spatialdata/geocoords/Converter.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 CoordSys_destructor(void* obj):
-  """
-  Destroy CoordSys object.
-  """
-  # create shim for destructor
-  #embed{ void CoordSys_destructor_cpp(void* pObj)
-  spatialdata::geocoords::CoordSys* pCS =
-  (spatialdata::geocoords::CoordSys*) pObj;
-  delete pCS;
-  #}embed
-  CoordSys_destructor_cpp(obj)
-  return
-
-cdef void Projector_destructor(void* obj):
-  """
-  Destroy Projector object.
-  """
-  # create shim for destructor
-  #embed{ void Projector_destructor_cpp(void* pObj)
-  spatialdata::geocoords::Projector* pProj =
-    (spatialdata::geocoords::Projector*) pObj;
-  delete pProj;
-  #}embed
-  Projector_destructor_cpp(obj)
-  return
-
-  
-# ----------------------------------------------------------------------
-cdef class CoordSys:
-
-  cdef void* thisptr # Pointer to C++ object
-  cdef readonly object handle # PyCObject holding pointer to C++ object
-  cdef readonly object name # Identifier for object base type
-
-  def __init__(self):
-    """Constructor."""
-    self.handle = None
-    self.thisptr = NULL
-    self.name = "spatialdata_geocoords_CoordSys"
-    return
-
-
-  def initialize(self):
-    """Initialize the coordinate system."""
-    # create shim for method 'initialize'
-    #embed{ void CoordSys_initialize(void* pObj)
-    try {
-      ((spatialdata::geocoords::CoordSys*) pObj)->initialize();
-    } 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
-
-    CoordSys_initialize(self.thisptr)
-    return
-
-
-  def _createHandle(self):
-    """Wrap pointer to C++ object in PyCObject."""
-    return PyCObject_FromVoidPtr(self.thisptr, CoordSys_destructor)
-
-
-  property spaceDim:
-    def __set__(self, ndims):
-      """Set number of dimensions for coordinates."""
-      # create shim for method 'spaceDim'
-      #embed{ void CoordSys_spaceDim_set(void* pObj, int ndims)
-      try {
-        ((spatialdata::geocoords::CoordSys*) pObj)->setSpaceDim(ndims);
-      } 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
-      CoordSys_spaceDim_set(self.thisptr, ndims)
-
-    def __get__(self):
-      """Get number of dimensions for coordinates."""
-      # create shim for method 'spaceDim'
-      #embed{ int CoordSys_spaceDim_get(void* pObj)
-      int dim = 0;
-      try {
-        dim = ((spatialdata::geocoords::CoordSys*) pObj)->spaceDim();
-      } 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
-      return dim;
-      #}embed
-      return CoordSys_spaceDim_get(self.thisptr)
-
-
-# ----------------------------------------------------------------------
-cdef class CSCart(CoordSys):
-
-  def __init__(self):
-    """Constructor."""
-    # create shim for constructor
-    #embed{ void* CSCart_constructor()
-      return (void*)(new spatialdata::geocoords::CSCart);
-    #}embed
-
-    CoordSys.__init__(self)
-    self.thisptr = CSCart_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  property toMeters:
-    def __set__(self, scale):
-      """Set scale factor for converting coordinates to SI units (meters)."""
-      # create shim for method 'toMeters'
-      #embed{ void CSCart_toMeters_set(void* pObj, double scale)
-      try {
-        ((spatialdata::geocoords::CSCart*) pObj)->toMeters(scale);
-      } 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
-      CSCart_toMeters_set(self.thisptr, scale)
-
-    def __get__(self):
-      """Get scale factor for converting coordinates to SI units (meters)."""
-      # create shim for method 'toMeters'
-      #embed{ double CSCart_toMeters_get(void* pObj)
-      double value = 0;
-      try {
-        value = ((spatialdata::geocoords::CSCart*) pObj)->toMeters();
-      } 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
-      return value;
-      #}embed
-      return CSCart_toMeters_get(self.thisptr)
-
-
-# ----------------------------------------------------------------------
-cdef class CSGeo(CoordSys):
-
-  def __init__(self):
-    """Constructor."""
-    # create shim for constructor
-    #embed{ void* CSGeo_constructor()
-      return (void*)(new spatialdata::geocoords::CSGeo);
-    #}embed
-
-    CoordSys.__init__(self)
-    self.thisptr = CSGeo_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  property ellipsoid:
-    def __set__(self, name):
-      """Set reference ellipsoid."""
-      # create shim for method 'ellipsoid'
-      #embed{ void CSGeo_ellipsoid_set(void* pObj, char* name)
-      try {
-        ((spatialdata::geocoords::CSGeo*) pObj)->ellipsoid(name);
-      } 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
-      CSGeo_ellipsoid_set(self.thisptr, name)
-
-    def __get__(self):
-      """Fet reference ellipsoid."""
-      # create shim for method 'ellipsoid'
-      #embed{ char* CSGeo_ellipsoid_get(void* pObj)
-      char* name = 0;
-      try {      
-        name = (char*) ((spatialdata::geocoords::CSGeo*) pObj)->ellipsoid();
-      } 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
-      return name;
-      #}embed
-      return CSGeo_ellipsoid_get(self.thisptr)
-
-
-  property datumHoriz:
-    def __set__(self, name):
-      """Set horizontal datum."""
-      # create shim for method 'datumHoriz'
-      #embed{ void CSGeo_datumHoriz_set(void* pObj, char* name)
-      try {
-        ((spatialdata::geocoords::CSGeo*) pObj)->datumHoriz(name);
-      } 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
-      CSGeo_datumHoriz_set(self.thisptr, name)
-      
-    def __get__(self):
-      """Get horizontal datum."""
-      # create shim for method 'datumHoriz'
-      #embed{ char* CSGeo_datumHoriz_get(void* pObj)
-      char* name = 0;
-      try {
-        name = (char*) ((spatialdata::geocoords::CSGeo*) pObj)->datumHoriz();
-      } 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
-      return name;
-      #}embed
-      return CSGeo_datumHoriz_get(self.thisptr)
-
-
-  property datumVert:
-    def __set__(self, name):
-      """Set vertical datum."""
-      # create shim for method 'datumVert'
-      #embed{ void CSGeo_datumVert_set(void* pObj, char* name)
-      try {
-        ((spatialdata::geocoords::CSGeo*) pObj)->datumVert(name);
-      } 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
-      CSGeo_datumVert_set(self.thisptr, name)
-
-    def __get__(self):
-      """Get vertical datum."""
-      # create shim for method 'datumVert'
-      #embed{ char* CSGeo_datumVert_get(void* pObj)
-      char* name = 0;
-      try {
-        name = (char*) ((spatialdata::geocoords::CSGeo*) pObj)->datumVert();
-      } 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
-      return name;
-      #}embed
-      return CSGeo_datumVert_get(self.thisptr)
-
-
-  property isGeocentric:
-    def __set__(self, flag):
-      """Set geocentric flag."""
-      # create shim for method 'isGeocentric'
-      #embed{ void CSGeo_isGeocentric_set(void* pObj, int flag)
-      try {
-        ((spatialdata::geocoords::CSGeo*) pObj)->isGeocentric(flag);
-      } 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
-      CSGeo_isGeocentric_set(self.thisptr, flag)
-
-    def __get__(self):
-      """Get geocentric flag."""
-      # create shim for method 'isGeocentric'
-      #embed{ int CSGeo_isGeocentric_get(void* pObj)
-      int value = 0;
-      try {
-        value = ((spatialdata::geocoords::CSGeo*) pObj)->isGeocentric();
-      } 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
-      return value;
-      #}embed
-      return CSGeo_isGeocentric_get(self.thisptr)
-      
-
-  property toMeters:
-    def __set__(self, scale):
-      """Set factor to convert Cartesian coordinates to meters."""
-      # create shim for method 'toMeters'
-      #embed{ void CSGeo_toMeters_set(void* pObj, double scale)
-      try {
-        ((spatialdata::geocoords::CSGeo*) pObj)->toMeters(scale);
-      } 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
-      CSGeo_toMeters_set(self.thisptr, scale)
-
-    def __get__(self):
-      """Get factor to convert Cartesian coordinates to meters."""
-      # create shim for method 'toMeters'
-      #embed{ double CSGeo_toMeters_get(void* pObj)
-      double value = 0.0;
-      try {
-        value = ((spatialdata::geocoords::CSGeo*) pObj)->toMeters();
-      } 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
-      return value;
-      #}embed
-      return CSGeo_toMeters_get(self.thisptr)
-
-
-# ----------------------------------------------------------------------
-cdef class CSGeoLocalCart(CSGeo):
-
-  def __init__(self):
-    """Constructor."""
-    # create shim for constructor
-    #embed{ void* CSGeoLocalCart_constructor()
-      return (void*)(new spatialdata::geocoords::CSGeoLocalCart);
-    #}embed
-
-    CSGeo.__init__(self)
-    self.thisptr = CSGeoLocalCart_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  def origin(self, lon, lat, elev):
-    """Set origin of local cartesian coordinate system."""
-    # create shim for method 'origin'
-    #embed{ void CSGeoLocalCart_origin(void* pObj, double lon, double lat, double elev)
-    try {
-      ((spatialdata::geocoords::CSGeoLocalCart*) pObj)->origin(lon, lat, elev);
-    } 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
-    CSGeoLocalCart_origin(self.thisptr, lon, lat, elev)
-
-
-  def getOrigin(self):
-    """Get origin of local cartesian coordinate system."""
-    # create shim for method 'origin'
-    #embed{ void CSGeoLocalCart_getOrigin(void* pObj, double* pLon, double* pLat, double* pElev)
-    try {
-      ((spatialdata::geocoords::CSGeoLocalCart*) pObj)->origin(pLon, pLat, pElev);
-    } 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
-    cdef double lon, lat, elev
-    CSGeoLocalCart_getOrigin(self.thisptr, &lon, &lat, &elev)
-    return (lon, lat, elev)
-
-
-# ----------------------------------------------------------------------
-cdef class CSGeoProj(CSGeo):
-
-  def __init__(self):
-    """Constructor."""
-    # create shim for constructor
-    #embed{ void* CSGeoProj_constructor()
-      return (void*)(new spatialdata::geocoords::CSGeoProj);
-    #}embed
-
-    CSGeo.__init__(self)
-    self.thisptr = CSGeoProj_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  property projector:
-    def __set__(self, proj):
-      """Set projector."""
-      # create shim for method 'projector'
-      #embed{ void CSGeoProj_projector(void* pObj, void* pProjObj)
-      try {
-        const spatialdata::geocoords::Projector* pProj =
-        (spatialdata::geocoords::Projector*) pProjObj;
-        ((spatialdata::geocoords::CSGeoProj*) pObj)->projector(*pProj);
-      } 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
-      if not proj.name == "spatialdata_geocoords_Projector":
-        raise TypeError, \
-              "Argument must be extension module type 'Projector'."
-      CSGeoProj_projector(self.thisptr, ptrFromHandle(proj))
-
-
-# ----------------------------------------------------------------------
-cdef class Projector:
-
-  cdef void* thisptr # Pointer to C++ object
-  cdef readonly object handle # PyCObject holding pointer to C++ object
-  cdef readonly object name # Identifier for type of object
-
-  def __init__(self):
-    """Constructor."""
-    # create shim for constructor
-    #embed{ void* Projector_constructor()
-    return (void*)(new spatialdata::geocoords::Projector);
-    #}embed
-
-    self.thisptr = Projector_constructor()
-    self.handle = self._createHandle()
-    self.name = "spatialdata_geocoords_Projector"
-    return
-
-
-  property projection:
-    def __set__(self, name):
-      """Set projection."""
-      # create shim for method 'projection'
-      #embed{ void Projector_projection_set(void* pObj, char* name)
-      try {
-        ((spatialdata::geocoords::Projector*) pObj)->projection(name);
-      } 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
-      Projector_projection_set(self.thisptr, name)
-
-    def __get__(self):
-      """Get projection."""
-      # create shim for method 'projection'
-      #embed{ char* Projector_projection_get(void* pObj)
-      char* name = 0;
-      try {
-        name = (char*) ((spatialdata::geocoords::Projector*) pObj)->projection();
-      } 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
-      return name;
-      #}embed
-      return Projector_projection_get(self.thisptr)
-
-
-  property units:
-    def __set__(self, name):
-      """Set units of projection."""
-      # create shim for method 'units'
-      #embed{ void Projector_units_set(void* pObj, char* name)
-      try {
-        ((spatialdata::geocoords::Projector*) pObj)->units(name);
-      } 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
-      Projector_units_set(self.thisptr, name)
-
-    def __get__(self):
-      """Get units of projection."""
-      # create shim for method 'units'
-      #embed{ char* Projector_units_get(void* pObj)
-      char* name = 0;
-      try {
-        name = (char*) ((spatialdata::geocoords::Projector*) pObj)->units();
-      } 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
-      return name;
-      #}embed
-      return Projector_units_get(self.thisptr)
-
-  property projOptions:
-    def __set__(self, options):
-      """Set proj.4 options for projector."""
-      # create shim for method 'projOptions'
-      #embed{ void Projector_projOptions_set(void* pObj, char* options)
-      try {
-        ((spatialdata::geocoords::Projector*) pObj)->projOptions(options);
-      } 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
-      Projector_projOptions_set(self.thisptr, options)
-
-    def __get__(self):
-      """Set proj.4 options for projector."""
-      # create shim for method 'projOptions'
-      #embed{ char* Projector_projOptions_get(void* pObj)
-      char* name = 0;
-      try {
-        name = (char*) ((spatialdata::geocoords::Projector*) pObj)->projOptions();
-      } 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
-      return name;
-      #}embed
-      return Projector_projOptions_get(self.thisptr)
-
-
-  def initialize(self, csGeo):
-    """Initialize projector."""
-    # create shim for method 'initialize'
-    #embed{ void Projector_initialize(void* pObj, void* pCSObj)
-    try {
-      const spatialdata::geocoords::CoordSys* pCS =
-        (spatialdata::geocoords::CoordSys*) pCSObj;
-      const spatialdata::geocoords::CSGeo* pCSGeo =
-        dynamic_cast<const spatialdata::geocoords::CSGeo*>(pCS);
-      ((spatialdata::geocoords::Projector*) pObj)->initialize(*pCSGeo);
-    } 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
-
-    if not csGeo.name == "spatialdata_geocoords_CoordSys":
-      raise TypeError, \
-            "Argument 'csGeo' must be extension module type 'CSGeo'."
-
-    Projector_initialize(self.thisptr, ptrFromHandle(csGeo))
-    return
-  
-
-  def project(self, lonlat):
-    """Project geographic coordinates."""
-    # create shim for method 'project'
-    #embed{ void Projector_project(void* pObj, double* pX, double* pY, double lon, double lat)
-    try {
-      ((spatialdata::geocoords::Projector*) pObj)->project(pX, pY, lon, lat);
-    } 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
-
-    cdef double x
-    cdef double y
-    npts = len(lonlat)
-    xy = []
-    for i from 0 <= i < npts:
-      lon = lonlat[i][0]
-      lat = lonlat[i][1]
-      Projector_project(self.thisptr, &x, &y, lon, lat)
-      xy.append([x, y])
-    return xy
-  
-
-  def invproject(self, xy):
-    """Get geographics coordinates for projected location."""
-    # create shim for method 'invproject'
-    #embed{ void Projector_invproject(void* pObj, double* pLon, double* pLat, double x, double y)
-    try {
-      ((spatialdata::geocoords::Projector*) pObj)->invproject(pLon, pLat, x, y);
-    } 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
-
-    cdef double lon
-    cdef double lat
-    npts = len(xy)
-    lonlat = []
-    for i from 0 <= i < npts:
-      x = xy[i][0]
-      y = xy[i][1]
-      Projector_invproject(self.thisptr, &lon, &lat, x, y)
-      lonlat.append([lon, lat])
-    return lonlat
-  
-
-  def _createHandle(self):
-    """Wrap pointer to C++ object in PyCObject."""
-    return PyCObject_FromVoidPtr(self.thisptr, Projector_destructor)
-
-
-# ----------------------------------------------------------------------
-# create shim for Converter method 'convert'
-#embed{ void CppConverter_convert(double* coords, int numLocs, int numDims, void* pCSDestObj, void* pCSSrcObj)
-try {
-  spatialdata::geocoords::CoordSys* pCSDest =
-    (spatialdata::geocoords::CoordSys*) pCSDestObj;
-  spatialdata::geocoords::CoordSys* pCSSrc =
-    (spatialdata::geocoords::CoordSys*) pCSSrcObj;
-  spatialdata::geocoords::Converter::convert(coords, numLocs, numDims,
-                                             pCSDest, pCSSrc);
-} 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
-
-def Converter_convert(coordsSrc, csDest, csSrc):
-  """Convert coordinates from source coordinate system 'csSrc' to
-  destination coordinate system 'csDest'."""
-
-  import spatialdata.utils.simplearray
-  coordsSrc = spatialdata.utils.simplearray.objAsSimpleArray(coordsSrc)
-  if not coordsSrc.isCompatible(nd=2,
-                                simpletype="double",
-                                writeable=True,
-                                contiguous=True,
-                                notswapped=True):
-    raise TypeError, \
-          "Argument 'coordsSrc' must be a contiguous, writeable, 2-D array " \
-          "of type double."
-
-  if not csDest.name == "spatialdata_geocoords_CoordSys":
-    raise TypeError, \
-          "Argument 'csDest' must be extension module type 'CSGeo'."
-  if not csSrc.name == "spatialdata_geocoords_CoordSys":
-    raise TypeError, \
-          "Argument 'csSrc' must be extension module type 'CSGeo'."
-
-  (numLocs, numDims) = coordsSrc.shape
-
-  cdef double* vals
-  vals = <double*> PyCObject_AsVoidPtr(coordsSrc.data)
-  CppConverter_convert(vals, numLocs, numDims,
-                       ptrFromHandle(csDest), ptrFromHandle(csSrc))
-  return
-
-
-# End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/include/chararray.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/include/chararray.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/include/chararray.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// Treat const char** as a special case.
+%typemap(in) (const char** string_list) {
+  // Check to make sure input is a list.
+  if (PyList_Check($input)) {
+    const int size = PyList_Size($input);
+    $1 = (size > 0) ? new char*[size] : 0;
+    for (int i = 0; i < size; i++) {
+      PyObject *s = PyList_GetItem($input,i);
+      if (PyString_Check(s))
+	$1[i] = PyString_AsString(PyList_GetItem($input,i));
+      else {
+	PyErr_SetString(PyExc_TypeError, "List must contain strings.");
+	delete[] $1;
+	return NULL;
+      } // else
+    } // for
+  } else {
+    PyErr_SetString(PyExc_TypeError, "Expected list of strings.");
+    return NULL;
+  } // if/else
+} // typemap(in) const char**
+
+// This cleans up the char** array we malloc'd before the function call
+%typemap(freearg) (const char** string_list) {
+  delete[] $1;
+}
+
+
+// Treat const char** as a special case.
+%typemap(in) (const char** string_list, const int list_len) {
+  // Check to make sure input is a list.
+  if (PyList_Check($input)) {
+    const int size = PyList_Size($input);
+    $2 = size;
+    $1 = (size > 0) ? new char*[size] : 0;
+    for (int i = 0; i < size; i++) {
+      PyObject *s = PyList_GetItem($input,i);
+      if (PyString_Check(s))
+	$1[i] = PyString_AsString(PyList_GetItem($input,i));
+      else {
+	PyErr_SetString(PyExc_TypeError, "List must contain strings.");
+	delete[] $1;
+	return NULL;
+      } // else
+    } // for
+  } else {
+    PyErr_SetString(PyExc_TypeError, "Expected list of strings.");
+    return NULL;
+  } // if/else
+} // typemap(in) const char**
+
+// This cleans up the char** array we malloc'd before the function call
+%typemap(freearg) (const char** string_list, const int list_len) {
+  delete[] $1;
+}
+
+
+// End of file

Added: cs/spatialdata-0.1/trunk/modulesrc/include/numpy.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/include/numpy.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/include/numpy.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,984 @@
+/* -*- C -*-  (not really, but good for syntax highlighting) */
+#ifdef SWIGPYTHON
+
+%{
+#ifndef SWIG_FILE_WITH_INIT
+#  define NO_IMPORT_ARRAY
+#endif
+#include "stdio.h"
+#include <numpy/arrayobject.h>
+
+/* The following code originally appeared in
+ * enthought/kiva/agg/src/numeric.i written by Eric Jones.  It was
+ * translated from C++ to C by John Hunter.  Bill Spotz has modified
+ * it slightly to fix some minor bugs, upgrade to numpy (all
+ * versions), add some comments and some functionality.
+ */
+
+/* Macros to extract array attributes.
+ */
+#define is_array(a)            ((a) && PyArray_Check((PyArrayObject *)a))
+#define array_type(a)          (int)(PyArray_TYPE(a))
+#define array_numdims(a)       (((PyArrayObject *)a)->nd)
+#define array_dimensions(a)    (((PyArrayObject *)a)->dimensions)
+#define array_size(a,i)        (((PyArrayObject *)a)->dimensions[i])
+#define array_data(a)          (((PyArrayObject *)a)->data)
+#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(a))
+#define array_is_native(a)     (PyArray_ISNOTSWAPPED(a))
+
+/* Support older NumPy data type names
+*/
+#if NDARRAY_VERSION < 0x01000000
+#define NPY_BOOL        PyArray_BOOL
+#define NPY_BYTE        PyArray_BYTE
+#define NPY_UBYTE       PyArray_UBYTE
+#define NPY_SHORT       PyArray_SHORT
+#define NPY_USHORT      PyArray_USHORT
+#define NPY_INT         PyArray_INT
+#define NPY_UINT        PyArray_UINT
+#define NPY_LONG        PyArray_LONG
+#define NPY_ULONG       PyArray_ULONG
+#define NPY_LONGLONG    PyArray_LONGLONG
+#define NPY_ULONGLONG   PyArray_ULONGLONG
+#define NPY_FLOAT       PyArray_FLOAT
+#define NPY_DOUBLE      PyArray_DOUBLE
+#define NPY_LONGDOUBLE  PyArray_LONGDOUBLE
+#define NPY_CFLOAT      PyArray_CFLOAT
+#define NPY_CDOUBLE     PyArray_CDOUBLE
+#define NPY_CLONGDOUBLE PyArray_CLONGDOUBLE
+#define NPY_OBJECT      PyArray_OBJECT
+#define NPY_STRING      PyArray_STRING
+#define NPY_UNICODE     PyArray_UNICODE
+#define NPY_VOID        PyArray_VOID
+#define NPY_NTYPES      PyArray_NTYPES
+#define NPY_NOTYPE      PyArray_NOTYPE
+#define NPY_CHAR        PyArray_CHAR
+#define NPY_USERDEF     PyArray_USERDEF
+#define npy_intp        intp
+#endif
+
+/* Given a PyObject, return a string describing its type.
+ */
+char* pytype_string(PyObject* py_obj) {
+  if (py_obj == NULL          ) return "C NULL value";
+  if (py_obj == Py_None       ) return "Python None" ;
+  if (PyCallable_Check(py_obj)) return "callable"    ;
+  if (PyString_Check(  py_obj)) return "string"      ;
+  if (PyInt_Check(     py_obj)) return "int"         ;
+  if (PyFloat_Check(   py_obj)) return "float"       ;
+  if (PyDict_Check(    py_obj)) return "dict"        ;
+  if (PyList_Check(    py_obj)) return "list"        ;
+  if (PyTuple_Check(   py_obj)) return "tuple"       ;
+  if (PyFile_Check(    py_obj)) return "file"        ;
+  if (PyModule_Check(  py_obj)) return "module"      ;
+  if (PyInstance_Check(py_obj)) return "instance"    ;
+
+  return "unkown type";
+}
+
+/* Given a NumPy typecode, return a string describing the type.
+ */
+char* typecode_string(int typecode) {
+  static char* type_names[25] = {"bool", "byte", "unsigned byte",
+				 "short", "unsigned short", "int",
+				 "unsigned int", "long", "unsigned long",
+				 "long long", "unsigned long long",
+				 "float", "double", "long double",
+				 "complex float", "complex double",
+				 "complex long double", "object",
+				 "string", "unicode", "void", "ntypes",
+				 "notype", "char", "unknown"};
+  return typecode < 24 ? type_names[typecode] : type_names[24];
+}
+
+/* Make sure input has correct numpy type.  Allow character and byte
+ * to match.  Also allow int and long to match.  This is deprecated.
+ * You should use PyArray_EquivTypenums() instead.
+ */
+int type_match(int actual_type, int desired_type) {
+  return PyArray_EquivTypenums(actual_type, desired_type);
+}
+
+/* Given a PyObject pointer, cast it to a PyArrayObject pointer if
+ * legal.  If not, set the python error string appropriately and
+ * return NULL.
+ */
+PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) {
+  PyArrayObject* ary = NULL;
+  if (is_array(input) && (typecode == NPY_NOTYPE ||
+			  PyArray_EquivTypenums(array_type(input), typecode))) {
+    ary = (PyArrayObject*) input;
+  }
+  else if is_array(input) {
+    char* desired_type = typecode_string(typecode);
+    char* actual_type  = typecode_string(array_type(input));
+    PyErr_Format(PyExc_TypeError, 
+		 "Array of type '%s' required.  Array of type '%s' given", 
+		 desired_type, actual_type);
+    ary = NULL;
+  }
+  else {
+    char * desired_type = typecode_string(typecode);
+    char * actual_type  = pytype_string(input);
+    PyErr_Format(PyExc_TypeError, 
+		 "Array of type '%s' required.  A '%s' was given", 
+		 desired_type, actual_type);
+    ary = NULL;
+  }
+  return ary;
+}
+
+/* Convert the given PyObject to a NumPy array with the given
+ * typecode.  On success, return a valid PyArrayObject* with the
+ * correct type.  On failure, the python error string will be set and
+ * the routine returns NULL.
+ */
+PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode,
+                                             int* is_new_object) {
+  PyArrayObject* ary = NULL;
+  PyObject* py_obj;
+  if (is_array(input) && (typecode == NPY_NOTYPE ||
+			  PyArray_EquivTypenums(array_type(input),typecode))) {
+    ary = (PyArrayObject*) input;
+    *is_new_object = 0;
+  }
+  else {
+    py_obj = PyArray_FromObject(input, typecode, 0, 0);
+    /* If NULL, PyArray_FromObject will have set python error value.*/
+    ary = (PyArrayObject*) py_obj;
+    *is_new_object = 1;
+  }
+  return ary;
+}
+
+/* Given a PyArrayObject, check to see if it is contiguous.  If so,
+ * return the input pointer and flag it as not a new object.  If it is
+ * not contiguous, create a new PyArrayObject using the original data,
+ * flag it as a new object and return the pointer.
+ */
+PyArrayObject* make_contiguous(PyArrayObject* ary, int* is_new_object,
+                               int min_dims, int max_dims) {
+  PyArrayObject* result;
+  if (array_is_contiguous(ary)) {
+    result = ary;
+    *is_new_object = 0;
+  }
+  else {
+    result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary, 
+							   array_type(ary), 
+							   min_dims,
+							   max_dims);
+    *is_new_object = 1;
+  }
+  return result;
+}
+
+/* Convert a given PyObject to a contiguous PyArrayObject of the
+ * specified type.  If the input object is not a contiguous
+ * PyArrayObject, a new one will be created and the new object flag
+ * will be set.
+ */
+PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input,
+                                                        int typecode,
+                                                        int* is_new_object) {
+  int is_new1 = 0;
+  int is_new2 = 0;
+  PyArrayObject* ary2;
+  PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, 
+						      &is_new1);
+  if (ary1) {
+    ary2 = make_contiguous(ary1, &is_new2, 0, 0);
+    if ( is_new1 && is_new2) {
+      Py_DECREF(ary1);
+    }
+    ary1 = ary2;    
+  }
+  *is_new_object = is_new1 || is_new2;
+  return ary1;
+}
+
+/* Test whether a python object is contiguous.  If array is
+ * contiguous, return 1.  Otherwise, set the python error string and
+ * return 0.
+ */
+int require_contiguous(PyArrayObject* ary) {
+  int contiguous = 1;
+  if (!array_is_contiguous(ary)) {
+    PyErr_SetString(PyExc_TypeError,
+		    "Array must be contiguous.  A non-contiguous array was given");
+    contiguous = 0;
+  }
+  return contiguous;
+}
+
+/* Require that a numpy array is not byte-swapped.  If the array is
+ * not byte-swapped, return 1.  Otherwise, set the python error string
+ * and return 0.
+ */
+int require_native(PyArrayObject* ary) {
+  int native = 1;
+  if (!array_is_native(ary)) {
+    PyErr_SetString(PyExc_TypeError,
+		    "Array must have native byteorder.  A byte-swapped array was given");
+    native = 0;
+  }
+  return native;
+}
+
+/* Require the given PyArrayObject to have a specified number of
+ * dimensions.  If the array has the specified number of dimensions,
+ * return 1.  Otherwise, set the python error string and return 0.
+ */
+int require_dimensions(PyArrayObject* ary, int exact_dimensions) {
+  int success = 1;
+  if (array_numdims(ary) != exact_dimensions) {
+    PyErr_Format(PyExc_TypeError, 
+		 "Array must have %d dimensions.  Given array has %d dimensions", 
+		 exact_dimensions, array_numdims(ary));
+    success = 0;
+  }
+  return success;
+}
+
+/* Require the given PyArrayObject to have one of a list of specified
+ * number of dimensions.  If the array has one of the specified number
+ * of dimensions, return 1.  Otherwise, set the python error string
+ * and return 0.
+ */
+int require_dimensions_n(PyArrayObject* ary, int* exact_dimensions, int n) {
+  int success = 0;
+  int i;
+  char dims_str[255] = "";
+  char s[255];
+  for (i = 0; i < n && !success; i++) {
+    if (array_numdims(ary) == exact_dimensions[i]) {
+      success = 1;
+    }
+  }
+  if (!success) {
+    for (i = 0; i < n-1; i++) {
+      sprintf(s, "%d, ", exact_dimensions[i]);                
+      strcat(dims_str,s);
+    }
+    sprintf(s, " or %d", exact_dimensions[n-1]);            
+    strcat(dims_str,s);
+    PyErr_Format(PyExc_TypeError, 
+		 "Array must be have %s dimensions.  Given array has %d dimensions",
+		 dims_str, array_numdims(ary));
+  }
+  return success;
+}    
+
+/* Require the given PyArrayObject to have a specified shape.  If the
+ * array has the specified shape, return 1.  Otherwise, set the python
+ * error string and return 0.
+ */
+int require_size(PyArrayObject* ary, npy_intp* size, int n) {
+  int i;
+  int success = 1;
+  int len;
+  char desired_dims[255] = "[";
+  char s[255];
+  char actual_dims[255] = "[";
+  for(i=0; i < n;i++) {
+    if (size[i] != -1 &&  size[i] != array_size(ary,i)) {
+      success = 0;    
+    }
+  }
+  if (!success) {
+    for (i = 0; i < n; i++) {
+      if (size[i] == -1) {
+	sprintf(s, "*,");                
+      }
+      else
+      {
+	sprintf(s, "%ld,", (long int)size[i]);                
+      }    
+      strcat(desired_dims,s);
+    }
+    len = strlen(desired_dims);
+    desired_dims[len-1] = ']';
+    for (i = 0; i < n; i++) {
+      sprintf(s, "%ld,", (long int)array_size(ary,i));                            
+      strcat(actual_dims,s);
+    }
+    len = strlen(actual_dims);
+    actual_dims[len-1] = ']';
+    PyErr_Format(PyExc_TypeError, 
+		 "Array must be have shape of %s.  Given array has shape of %s",
+		 desired_dims, actual_dims);
+  }
+  return success;
+}
+
+/* End John Hunter translation (with modifications by Bill Spotz)
+ */
+
+%}
+
+/* %numpy_typemaps() macro
+ *
+ * This macro defines a family of typemaps that allow pure input C
+ * arguments of the form
+ *
+ *     (DATA_TYPE IN_ARRAY1[ANY])
+ *     (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+ *     (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+ *
+ *     (DATA_TYPE IN_ARRAY2[ANY][ANY])
+ *     (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ *     (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+ *
+ *     (DATA_TYPE INPLACE_ARRAY1[ANY])
+ *     (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
+ *     (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
+ *
+ *     (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
+ *     (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ *     (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
+ *
+ *     (DATA_TYPE ARGOUT_ARRAY1[ANY])
+ *     (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
+ *     (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
+ *
+ *     (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
+ *
+ * where "DATA_TYPE" is any type supported by the NumPy module, and
+ * "DIM_TYPE" is any int-like type suitable for specifying dimensions.
+ * In python, the dimensions will not need to be specified (except for
+ * the "DATA_TYPE* ARGOUT_ARRAY1" typemaps).  The IN_ARRAYs can be a
+ * numpy array or any sequence that can be converted to a numpy array
+ * of the specified type.  The INPLACE_ARRAYs must be numpy arrays of
+ * the appropriate type.  The ARGOUT_ARRAYs will be returned as numpy
+ * arrays of the appropriate type.
+ *
+ * These typemaps can be applied to existing functions using the
+ * %apply directive:
+ *
+ *     %apply (double IN_ARRAY1[ANY]) {(double vector[ANY])};
+ *     double length(double vector[3]);
+ *
+ *     %apply (double* IN_ARRAY1, int DIM1) {(double* series, int length)};
+ *     double prod(double* series, int length);
+ *
+ *     %apply (int DIM1, double* IN_ARRAY1) {(int length, double* series)}
+ *     double sum(int length, double* series)
+ *
+ *     %apply (double IN_ARRAY2[ANY][ANY]) {(double matrix[2][2])};
+ *     double det(double matrix[2][2]);
+ *
+ *     %apply (double* IN_ARRAY2, int DIM1, int DIM2) {(double* matrix, int rows, int cols)};
+ *     double max(double* matrix, int rows, int cols);
+ *
+ *     %apply (int DIM1, int DIM2, double* IN_ARRAY2) {(int rows, int cols, double* matrix)}
+ *     double min(int length, double* series)
+ *
+ *     %apply (double INPLACE_ARRAY1[ANY]) {(double vector[3])};
+ *     void reverse(double vector[3]);
+ *
+ *     %apply (double* INPLACE_ARRAY1, int DIM1) {(double* series, int length)};
+ *     void ones(double* series, int length);
+ *
+ *     %apply (int DIM1, double* INPLACE_ARRAY1) {(int length, double* series)}
+ *     double zeros(int length, double* series)
+ *
+ *     %apply (double INPLACE_ARRAY2[ANY][ANY]) {(double matrix[3][3])};
+ *     void scale(double matrix[3][3]);
+ *
+ *     %apply (double* INPLACE_ARRAY2, int DIM1, int DIM2) {(double* matrix, int rows, int cols)};
+ *     void floor(double* matrix, int rows, int cols);
+ *
+ *     %apply (int DIM1, int DIM2, double* INPLACE_ARRAY2) {(int rows, int cols, double* matrix)};
+ *     void ceil(int rows, int cols, double* matrix);
+ *
+ *     %apply (double IN_ARRAY1[ANY]    ) {(double vector[ANY])};
+ *     %apply (double ARGOUT_ARRAY1[ANY]) {(double even[    3])};
+ *     %apply (double ARGOUT_ARRAY1[ANY]) {(double odd[     3])};
+ *     void eoSplit(double vector[3], double even[3], double odd[3]);
+ *
+ *     %apply (double* ARGOUT_ARRAY1, int DIM1) {(double* twoVec, int size)};
+ *     void twos(double* twoVec, int size);
+ *
+ *     %apply (int DIM1, double* ARGOUT_ARRAY1) {(int size, double* threeVec)};
+ *     void threes(int size, double* threeVec);
+ *
+ *     %apply (double IN_ARRAY2[ANY][ANY])     {(double matrix[2][2])};
+ *     %apply (double ARGOUT_ARRAY2[ANY][ANY]) {(double upper[ 3][3])};
+ *     %apply (double ARGOUT_ARRAY2[ANY][ANY]) {(double lower[ 3][3])};
+ *     void luSplit(double matrix[3][3], double upper[3][3], double lower[3][3]);
+ *
+ * or directly with
+ *
+ *     double length(double IN_ARRAY1[ANY]);
+ *     double prod(double* IN_ARRAY1, int DIM1);
+ *     double sum( int DIM1, double* IN_ARRAY1)
+ *
+ *     double det(double IN_ARRAY2[ANY][ANY]);
+ *     double max(double* IN_ARRAY2, int DIM1, int DIM2);
+ *     double min(int DIM1, int DIM2, double* IN_ARRAY2)
+ *
+ *     void reverse(double INPLACE_ARRAY1[ANY]);
+ *     void ones( double* INPLACE_ARRAY1, int DIM1);
+ *     void zeros(int DIM1, double* INPLACE_ARRAY1)
+ *
+ *     void scale(double INPLACE_ARRAY2[ANY][ANY]);
+ *     void floor(double* INPLACE_ARRAY2, int DIM1, int DIM2, double floor);
+ *     void ceil( int DIM1, int DIM2, double* INPLACE_ARRAY2, double ceil );
+ *
+ *     void eoSplit(double IN_ARRAY1[ANY], double ARGOUT_ARRAY1[ANY],
+ *                  double ARGOUT_ARRAY1[ANY]);
+ *     void twos(double* ARGOUT_ARRAY1, int DIM1)
+ *     void threes(int DIM1, double* ARGOUT_ARRAY1)
+ *
+ *     void luSplit(double IN_ARRAY2[ANY][ANY], double ARGOUT_ARRAY2[ANY][ANY],
+ *                  double ARGOUT_ARRAY2[ANY][ANY]);
+ */
+
+%define %numpy_typemaps(DATA_TYPE, DATA_TYPECODE, DIM_TYPE)
+
+/************************/
+/* Input Array Typemaps */
+/************************/
+
+/* Typemap suite for (DATA_TYPE IN_ARRAY1[ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE IN_ARRAY1[ANY])
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DATA_TYPE IN_ARRAY1[ANY])
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[1] = { $1_dim0 };
+  if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(freearg)
+  (DATA_TYPE IN_ARRAY1[ANY])
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[1] = { -1 };
+  if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[1] = {-1};
+  if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE IN_ARRAY2[ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE IN_ARRAY2[ANY][ANY])
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DATA_TYPE IN_ARRAY2[ANY][ANY])
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[2] = { $1_dim0, $1_dim1 };
+  if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(freearg)
+  (DATA_TYPE IN_ARRAY2[ANY][ANY])
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[2] = { -1, -1 };
+  if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[2] = { -1, -1 };
+  if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
+  if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(freearg)
+  (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[3] = { -1, -1, -1 };
+  if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, 
+ *                    DATA_TYPE* IN_ARRAY3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object);
+  npy_intp size[3] = { -1, -1, -1 };
+  if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/***************************/
+/* In-Place Array Typemaps */
+/***************************/
+
+/* Typemap suite for (DATA_TYPE INPLACE_ARRAY1[ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE INPLACE_ARRAY1[ANY])
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DATA_TYPE INPLACE_ARRAY1[ANY])
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  npy_intp size[1] = { $1_dim0 };
+  if (!array || !require_dimensions(array,1) || !require_size(array, size, 1)
+      || !require_contiguous(array) || !require_native(array)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
+  (PyArrayObject* array=NULL, int i=1)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,1) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = 1;
+  for (i=0; i < array_numdims(array); ++i) $2 *= array_size(array,i);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
+  (PyArrayObject* array=NULL, int i=0)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,1) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = 1;
+  for (i=0; i < array_numdims(array); ++i) $1 *= array_size(array,i);
+  $2 = (DATA_TYPE*) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  npy_intp size[2] = { $1_dim0, $1_dim1 };
+  if (!array || !require_dimensions(array,2) || !require_size(array, size, 2)
+      || !require_contiguous(array) || !require_native(array)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,2) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,2) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DATA_TYPE*) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
+  if (!array || !require_dimensions(array,3) || !require_size(array, size, 3)
+      || !require_contiguous(array) || !require_native(array)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,3) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, 
+ *                    DATA_TYPE* INPLACE_ARRAY3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),DATA_TYPECODE);
+}
+%typemap(in)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,3) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DATA_TYPE*) array_data(array);
+}
+
+/*************************/
+/* Argout Array Typemaps */
+/*************************/
+
+/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY1[ANY])
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE ARGOUT_ARRAY1[ANY])
+  (PyObject * array = NULL)
+{
+  npy_intp dims[1] = { $1_dim0 };
+  array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE ARGOUT_ARRAY1[ANY])
+{
+  $result = SWIG_Python_AppendOutput($result,array$argnum);
+}
+
+/* Typemap suite for (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
+ */
+%typemap(in,numinputs=1)
+  (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
+  (PyObject * array = NULL)
+{
+  if (!PyInt_Check($input)) {
+    char* typestring = pytype_string($input);
+    PyErr_Format(PyExc_TypeError, 
+		 "Int dimension expected.  '%s' given.", 
+		 typestring);
+    SWIG_fail;
+  }
+  $2 = (DIM_TYPE) PyInt_AsLong($input);
+  npy_intp dims[1] = { (npy_intp) $2 };
+  array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
+  $1 = (DATA_TYPE*) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
+{
+  $result = SWIG_Python_AppendOutput($result,array$argnum);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
+ */
+%typemap(in,numinputs=1)
+  (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
+  (PyObject * array = NULL)
+{
+  if (!PyInt_Check($input)) {
+    char* typestring = pytype_string($input);
+    PyErr_Format(PyExc_TypeError, 
+		 "Int dimension expected.  '%s' given.", 
+		 typestring);
+    SWIG_fail;
+  }
+  $1 = (DIM_TYPE) PyInt_AsLong($input);
+  npy_intp dims[1] = { (npy_intp) $1 };
+  array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
+  $2 = (DATA_TYPE*) array_data(array);
+}
+%typemap(argout)
+  (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
+{
+  $result = SWIG_Python_AppendOutput($result,array$argnum);
+}
+
+/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
+  (PyObject * array = NULL)
+{
+  npy_intp dims[2] = { $1_dim0, $1_dim1 };
+  array = PyArray_SimpleNew(2, dims, DATA_TYPECODE);
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
+{
+  $result = SWIG_Python_AppendOutput($result,array$argnum);
+}
+
+/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
+  (PyObject * array = NULL)
+{
+  npy_intp dims[3] = { $1_dim0, $1_dim1, $1_dim2 };
+  array = PyArray_SimpleNew(3, dims, DATA_TYPECODE);
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
+{
+  $result = SWIG_Python_AppendOutput($result,array$argnum);
+}
+
+%enddef    /* %numpy_typemaps() macro */
+
+
+/* Concrete instances of the %numpy_typemaps() macro: Each invocation
+ * below applies all of the typemaps above to the specified data type.
+ */
+%numpy_typemaps(signed char       , NPY_BYTE     , int)
+%numpy_typemaps(unsigned char     , NPY_UBYTE    , int)
+%numpy_typemaps(short             , NPY_SHORT    , int)
+%numpy_typemaps(unsigned short    , NPY_USHORT   , int)
+%numpy_typemaps(int               , NPY_INT      , int)
+%numpy_typemaps(unsigned int      , NPY_UINT     , int)
+%numpy_typemaps(long              , NPY_LONG     , int)
+%numpy_typemaps(unsigned long     , NPY_ULONG    , int)
+%numpy_typemaps(long long         , NPY_LONGLONG , int)
+%numpy_typemaps(unsigned long long, NPY_ULONGLONG, int)
+%numpy_typemaps(float             , NPY_FLOAT    , int)
+%numpy_typemaps(double            , NPY_DOUBLE   , int)
+
+/* ***************************************************************
+ * The follow macro expansion does not work, because C++ bool is 4
+ * bytes and NPY_BOOL is 1 byte
+ */
+/*%numpy_typemaps(bool, NPY_BOOL)
+ */
+
+/* ***************************************************************
+ * On my Mac, I get the following warning for this macro expansion:
+ * 'swig/python detected a memory leak of type 'long double *', no destructor found.'
+ */
+/*%numpy_typemaps(long double, NPY_LONGDOUBLE)
+ */
+
+/* ***************************************************************
+ * Swig complains about a syntax error for the following macros
+ * expansions:
+ */
+/*%numpy_typemaps(complex float,  NPY_CFLOAT , int)
+ */
+/*%numpy_typemaps(complex double, NPY_CDOUBLE, int)
+ */
+/*%numpy_typemaps(complex long double, NPY_CLONGDOUBLE)
+ */
+
+#endif /* SWIGPYTHON */

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/CompositeDB.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/CompositeDB.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/CompositeDB.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,126 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/spatialdb/CompositeDB.i
+ *
+ * @brief SWIG interface to C++ CompositeDB object.
+ */
+
+namespace spatialdata {
+  namespace spatialdb {
+
+    class CompositeDB : public SpatialDB
+    { // class CompositeDB
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor.
+      CompositeDB(void);
+  
+      /** Constructor with label.
+       *
+       * @param label Label of database
+       */
+      CompositeDB(const char* label);
+      
+      /// Default destructor.
+      ~CompositeDB(void);
+  
+      /** Set database A.
+       *
+       * @param db Pointer to database.
+       * @param names Array of names of values to use with database.
+       * @param numNames Size of array of names.
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** names,
+	 const int numNames)
+	  };
+      void dbA(SpatialDB* db,
+	       const char** names,
+	       const int numNames);
+      %clear(const char** names, const int numNames);
+
+      /** Set database B.
+       *
+       * @param db Pointer to database.
+       * @param names Array of names of values to use with database.
+       * @param numNames Size of array of names.
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** names,
+	 const int numNames)
+	  };
+      void dbB(SpatialDB* db,
+	       const char** names,
+	       const int numNames);
+      %clear(const char** names, const int numNames);
+      
+      /// Open the database and prepare for querying.
+      void open(void);
+      
+      /// Close the database.
+      void close(void);
+      
+      /** Set values to be returned by queries.
+       *
+       * @pre Must call open() before queryVals()
+       *
+       * @param names Names of values to be returned in queries
+       * @param numVals Number of values to be returned in queries
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** names,
+	 const int numVals)
+	  };
+      void queryVals(const char** names,
+		     const int numVals);
+      %clear(const char** names, const int numVals);
+      
+      /** Query the database.
+       *
+       * @pre Must call open() before query()
+       *
+       * @param vals Array for computed values (output from query), vals
+       *   must be allocated BEFORE calling query().
+       * @param numVals Number of values expected (size of pVals array)
+       * @param coords Coordinates of point for query
+       * @param numDims Number of dimensions for coordinates
+       * @param pCSQuery Coordinate system of coordinates
+       *
+       * @returns 0 on success, 1 on failure (i.e., could not interpolate
+       *   so values set to 0)
+       */
+      %apply(double* INPLACE_ARRAY1, int DIM1) {
+	(double* vals,
+	 const int numVals)
+	  };
+      %apply(double* IN_ARRAY1, int DIM1) {
+	(const double* coords,
+	 const int numDims)
+	  };
+      int query(double* vals,
+		const int numVals,
+		const double* coords,
+		const int numDims,
+		const spatialdata::geocoords::CoordSys* pCSQuery);
+      %clear(double* vals, const int numVals);
+      %clear(const double* coords, const int numDims);
+      
+    }; // class CompositeDB
+    
+  } // spatialdb
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/GravityField.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/GravityField.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/GravityField.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/spatialdb/GravityField.i
+ *
+ * @brief SWIG interface to C++ GravityField object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+    class CSGeo; // USES CSGeo
+  } // geocoords
+
+  namespace spatialdb {
+
+    class GravityField : public SpatialDB
+    { // class GravityField
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor.
+      GravityField(void);
+  
+      /// Default destructor.
+      ~GravityField(void);
+      
+      /** Set direction of gravitational body force. Used only with
+       * Cartesian coordinate system.
+       *
+       * @param x X component of direction
+       * @param y Y component of direction
+       * @param z Z component of direction
+       */
+      void gravityDir(const double x,
+		      const double y,
+		      const double z);
+      
+      /** Set gravitational acceleration.
+       *
+       * @param acceleration Gravitational acceleration.
+       */
+      void gravAcceleration(const double acceleration);
+      
+      /// Open the database and prepare for querying.
+      void open(void);
+      
+      /// Close the database.
+      void close(void);
+      
+      /** Set values to be returned by queries.
+       *
+       * Valid values for use in names are {'x', 'y', 'z'}.
+       *
+       * @pre Must call open() before queryVals()
+       *
+       * @param names Names of values to be returned in queries
+       * @param numVals Number of values to be returned in queries
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** names,
+	 const int numVals)
+	  };
+      void queryVals(const char** names,
+		     const int numVals);
+      %clear(const char** names, const int numVals);
+      
+      /** Query the database.
+       *
+       * @pre Must call open() before query()
+       *
+       * @param vals Array for computed values (output from query), vals
+       *   must be allocated BEFORE calling query().
+       * @param numVals Number of values expected (size of pVals array)
+       * @param coords Coordinates of point for query
+       * @param numDims Number of dimensions for coordinates
+       * @param cs Coordinate system of coordinates
+       *
+       * @returns 0 on success, 1 on failure (i.e., could not interpolate
+       *   so values set to 0)
+       */
+      %apply(double* INPLACE_ARRAY1, int DIM1) {
+	(double* vals,
+	 const int numVals)
+	  };
+      %apply(double* IN_ARRAY1, int DIM1) {
+	(const double* coords,
+	 const int numDims)
+	  };
+      int query(double* vals,
+		const int numVals,
+		const double* coords,
+		const int numDims,
+		const spatialdata::geocoords::CoordSys* cs);
+      %clear(double* vals, const int numVals);
+      %clear(const double* coords, const int numDims);
+      
+    }; // class GravityField
+    
+  } // spatialdb
+} // spatialdata
+
+
+// End of file 

Modified: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -13,43 +13,45 @@
 subpackage = spatialdb
 include $(top_srcdir)/subpackage.am
 
-EXTRA_DIST = \
-	spatialdb.pxd.src
+subpkgpyexec_LTLIBRARIES = _spatialdbmodule.la
 
-subpkgpyexec_LTLIBRARIES = spatialdbmodule.la
+subpkgpyexec_PYTHON = spatialdb.py
 
-spatialdbmodule_la_LDFLAGS = -module -avoid-version \
+swig_sources = \
+	spatialdb.i \
+	SpatialDBObj.i \
+	SimpleDB.i \
+	SimpleDBData.i \
+	SimpleIO.i \
+	SimpleIOAscii.i \
+	UniformDB.i \
+	CompositeDB.i \
+	SCECCVMH.i \
+	GravityField.i
+
+swig_generated = \
+	spatialdb_wrap.cxx \
+	spatialdb.py
+
+_spatialdbmodule_la_LDFLAGS = -module -avoid-version \
 	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
 
-dist_spatialdbmodule_la_SOURCES = spatialdb.pyxe.src
-nodist_spatialdbmodule_la_SOURCES = \
-	spatialdata.spatialdb.spatialdb.pyxe \
-	spatialdata.spatialdb.spatialdb.c spatialdata.spatialdb.spatialdb_embed.cpp spatialdata.spatialdb.spatialdb_embed.h
+dist__spatialdbmodule_la_SOURCES = $(swig_sources) $(swig_generated)
 
-spatialdbmodule_la_LIBADD = \
+_spatialdbmodule_la_LIBADD = \
 	$(top_builddir)/libsrc/libspatialdata.la
 if NO_UNDEFINED
-spatialdbmodule_la_LIBADD += \
+_spatialdbmodule_la_LIBADD += \
 	$(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
 endif
 
-INCLUDES += -I$(PYTHON_INCDIR)
+INCLUDES += -I$(NUMPY_INCDIR) -I$(PYTHON_INCDIR)
 
-nodist_pyexec_HEADERS = \
-	spatialdata.spatialdb.spatialdb.pxd
+$(srcdir)/spatialdb_wrap.cxx $(srcdir)/spatialdb.py: $(swig_sources)
+	$(SWIG) -Wall -c++ -python $<
 
-spatialdata.spatialdb.spatialdb.pyx spatialdata.spatialdb.spatialdb_embed.cpp spatialdata.spatialdb.spatialdb_embed.h: spatialdata.spatialdb.spatialdb.pyxe spatialdata.spatialdb.spatialdb.pxd
-	pyrexembed spatialdata.spatialdb.spatialdb.pyxe
-spatialdata.spatialdb.spatialdb.pyxe: $(srcdir)/spatialdb.pyxe.src
-	cp $(srcdir)/spatialdb.pyxe.src $@
-spatialdata.spatialdb.spatialdb.pxd: $(srcdir)/spatialdb.pxd.src
-	cp $(srcdir)/spatialdb.pxd.src $@
-spatialdata.spatialdb.spatialdb_embed.cpp: spatialdata.spatialdb.spatialdb_embed.h
-spatialdata.spatialdb.spatialdb_embed.h: spatialdata.spatialdb.spatialdb.pyx
 
-.pyx.c:
-	pyrexc $<
+MAINTAINERCLEANFILES = $(swig_generated)
 
-CLEANFILES = spatialdata.spatialdb.spatialdb.pyx spatialdata.spatialdb.spatialdb.pyxe spatialdata.spatialdb.spatialdb.c *_embed.*
 
 # End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SCECCVMH.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SCECCVMH.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SCECCVMH.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/spatialdb/SCECCVMH.i
+ *
+ * @brief SWIG interface to C++ SCECCVMH object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+    class CSGeoProj; // HASA CSGeoProj
+  } // geocoords
+
+  namespace spatialdb {
+
+    class SCECCVMH : SpatialDB
+    { // SCECCVMH
+ 
+    public :
+      // PUBLIC MEMBERS /////////////////////////////////////////////////
+ 
+      /// Constructor
+      SCECCVMH(void);
+ 
+      /// Destructor
+      ~SCECCVMH(void);
+      
+      /** Set directory containing SCEC CVM-H data files.
+       *
+       * @param dir Directory containing data files.
+       */
+      void dataDir(const char* dir);
+      
+      /** Set minimum shear wave speed. Corresponding minima for Vp and
+       * density are enforced using nominal Vp->Vs relation and
+       * Vp->density relations.
+       *
+       * @param value Minimum shear wave speed.
+       */
+      void minVs(const double value);
+      
+      /** Set squashed topography/bathymetry flag and minimum
+       * elevation of squashing.
+       *
+       * @param flag True if squashing, false otherwise.
+       * @param limit Minimum elevation for squashing.
+       */
+      void squash(const bool flag,
+		  const double limit =-2000.0);
+      
+      /// Open the database and prepare for querying.
+      void open(void);
+      
+      /// Close the database.
+      void close(void);
+      
+      /** Set values to be returned by queries.
+       *
+       * @pre Must call open() before queryVals()
+       *
+       * @param names Names of values to be returned in queries
+       * @param numVals Number of values to be returned in queries
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** names,
+	 const int numVals)
+	  };
+      void queryVals(const char** names,
+		     const int numVals);
+      %clear(const char** names, const int numVals);
+      
+      /** Query the database.
+       *
+       * @note pVals should be preallocated to accommodate numVals values.
+       *
+       * @pre Must call open() before query()
+       *
+       * @param vals Array for computed values (output from query), must be
+       *   allocated BEFORE calling query().
+       * @param numVals Number of values expected (size of pVals array)
+       * @param coords Coordinates of point for query
+       * @param numDims Number of dimensions for coordinates
+       * @param pCSQuery Coordinate system of coordinates
+       *
+       * @returns 0 on success, 1 on failure (i.e., could not interpolate)
+       */
+      %apply(double* INPLACE_ARRAY1, int DIM1) {
+	(double* vals,
+	 const int numVals)
+	  };
+      %apply(double* IN_ARRAY1, int DIM1) {
+	(const double* coords,
+	 const int numDims)
+	  };
+      int query(double* vals,
+		const int numVals,
+		const double* coords,
+		const int numDims,
+		const spatialdata::geocoords::CoordSys* pCSQuery);
+      %clear(double* vals, const int numVals);
+      %clear(const double* coords, const int numDims); 
+      
+    }; // SCECCVMH
+    
+  } // spatialdb
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleDB.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleDB.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleDB.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,128 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/spatialdb/SimpleDB.i
+ *
+ * @brief SWIG interface to C++ SimpleDB object.
+ */
+
+namespace spatialdata {
+  namespace spatialdb {
+    class SimpleIO; // USES SimpleIO
+
+    class SimpleDB : public SpatialDB
+    { // class SimpleDB
+
+    public :
+      // PUBLIC ENUM ////////////////////////////////////////////////////
+
+      /** Topology of spatial data */
+      enum TopoEnum { 
+	POINT=0,
+	LINE=1,
+	AREA=2,
+	VOLUME=3
+      };
+      
+      /** Type of query */
+      enum QueryEnum {
+	NEAREST=0,
+	LINEAR=1
+      };
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor.
+      SimpleDB(void);
+  
+      /** Constructor with label.
+       *
+       * @param label Label of database
+       */
+      SimpleDB(const char* label);
+      
+      /// Default destructor.
+      ~SimpleDB(void);
+      
+      /// Open the database and prepare for querying.
+      void open(void);
+      
+      /// Close the database.
+      void close(void);
+      
+      /** Set query type.
+       *
+       * @pre Must call Open() before QueryType()
+       *
+       * @param queryType Set type of query
+       */
+      void queryType(const SimpleDB::QueryEnum queryType);
+      
+      /** Set values to be returned by queries.
+       *
+       * @pre Must call open() before queryVals()
+       *
+       * @param names Names of values to be returned in queries
+       * @param numVals Number of values to be returned in queries
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** names,
+	 const int numVals)
+	  };
+      void queryVals(const char** names,
+		     const int numVals);
+      %clear(const char** names, const int numVals);
+      
+      /** Set the I/O handler.
+       *
+       * @param iohandler
+       */
+      void ioHandler(const SimpleIO* iohandler);
+      
+      /** Query the database.
+       *
+       * @pre Must call open() before query()
+       *
+       * @param vals Array for computed values (output from query), vals
+       *   must be allocated BEFORE calling query().
+       * @param numVals Number of values expected (size of pVals array)
+       * @param coords Coordinates of point for query
+       * @param numDims Number of dimensions for coordinates
+       * @param pCSQuery Coordinate system of coordinates
+       *
+       * @returns 0 on success, 1 on failure (i.e., could not interpolate
+       *   so values set to 0)
+       */
+      %apply(double* INPLACE_ARRAY1, int DIM1) {
+	(double* vals,
+	 const int numVals)
+	  };
+      %apply(double* IN_ARRAY1, int DIM1) {
+	(const double* coords,
+	 const int numDims)
+	  };
+      int query(double* vals,
+		const int numVals,
+		const double* coords,
+		const int numDims,
+		const spatialdata::geocoords::CoordSys* pCSQuery);
+      %clear(double* vals, const int numVals);
+      %clear(const double* coords, const int numDims);
+      
+    }; // class SimpleDB
+    
+  } // spatialdb
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleDBData.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleDBData.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleDBData.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/spatialdb/SimpleDBData.i
+ *
+ * @brief SWIG interface to C++ SimpleDBData object.
+ */
+
+namespace spatialdata {
+  namespace spatialdb {
+
+    class SimpleDBData
+    { // SimpleDBData
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor
+      SimpleDBData(void);
+
+      /// Default destructor
+      ~SimpleDBData(void);
+      
+      /** Allocate data structues.
+       *
+       * @param numLocs Number of locations.
+       * @param numValues Number of values.
+       * @param spaceDim Spatial dimension of domain.
+       * @param dataDim Spatial dimension of data distribution.
+       */
+      void allocate(const int numLocs,
+		    const int numValues,
+		    const int spaceDim,
+		    const int dataDim);
+      
+      /** Set data values.
+       *
+       * @pre Must call allocate() before setData().
+       *
+       * @param values Array of data values [numLocs*numValues].
+       * @param numLocs Number of locations.
+       * @param numValues Number of values.
+       */
+      %apply(double* IN_ARRAY2, int DIM1, int DIM2) {
+	(const double* values,
+	 const int numLocs,
+	 const int numValues)
+	  };
+      void data(const double* values,
+		const int numLocs,
+		const int numValues);
+      %clear(const double* values, const int numLocs, const int numValues);
+      
+      /** Set coordinates of locations.
+       *
+       * @pre Must call allocate() before setLocations().
+       *
+       * @param values Array of coordinates of locations [numLocs*spaceDim].
+       * @param numLocs Number of locations.
+       * @param spaceDim Spatial dimension of coordinates.
+       */
+      %apply(double* IN_ARRAY2, int DIM1, int DIM2) {
+	(const double* values,
+	 const int numLocs,
+	 const int spaceDim)
+	  };
+      void coordinates(const double* values,
+		       const int numLocs,
+		       const int spaceDim);
+      %clear(const double* values, const int numLocs, const int numValues);
+      
+      /** Set names of values.
+       *
+       * @pre Must call allocate() before setNames().
+       *
+       * @param values Array of names of values [numValues].
+       * @param numValues Number of values.
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** const values,
+	 const int numValues)
+	  };
+      void names(const char** const values,
+		 const int numValues);
+      %clear(const char** const values, const int numValues);
+      
+      /** Set units of values.
+       *
+       * @pre Must call allocate() before setUnits().
+       *
+       * @param values Array of units of values [numValues].
+       * @param numValues Number of values.
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** const values,
+	 const int numValues)
+	  };
+      void units(const char** const values,
+		 const int numValues);
+      %clear(const char** const values, const int numValues);
+      
+      /** Get number of locations for data.
+       *
+       * @returns Number of locations.
+       */
+      int numLocs(void) const;
+      
+      /** Get number of values for data.
+       *
+       * @returns Number of values.
+       */
+      int numValues(void) const;
+      
+      /** Get spatial dimension of data distribution.
+       *
+       * @returns Spatial dimension.
+       */
+      int dataDim(void) const;
+      
+      /** Get spatial dimension of locations.
+       *
+       * @returns Spatial dimension.
+       */
+      int spaceDim(void) const;
+      
+    }; // class SpatialDBData
+
+  } // spatialdb
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleIO.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleIO.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleIO.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/spatialdb/SimpleIO.i
+ *
+ * @brief SWIG interface to C++ SimpleIO object.
+ */
+
+namespace spatialdata {
+  namespace spatialdb {
+    class SimpleDBData; // forward declaration
+
+    class SimpleIO
+    { // class SimpleIO
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor.
+      SimpleIO(void);
+  
+      /// Default destructor.
+      virtual
+      ~SimpleIO(void);
+
+      /** Set filename for database.
+       *
+       * @param filename Filename of database
+       */
+      void filename(const char* filename);
+
+      /** Get filename for database.
+       *
+       * @returns Filename of database
+       */
+      const char* filename(void) const;
+
+      /** Read the database.
+       *
+       * @param pData Database data
+       * @param ppCS Pointer to coordinate system
+       */
+      virtual
+      void read(SimpleDBData* pData,
+		spatialdata::geocoords::CoordSys** ppCS) = 0;
+
+      /** Write the database.
+       *
+       * @param data Database data
+       * @param pCS Pointer to coordinate system
+       */
+      virtual
+      void write(const SimpleDBData& data,
+		 const spatialdata::geocoords::CoordSys* pCS) = 0;
+
+    }; // class SimpleIO
+
+  } // namespace spatialdb
+} // namespace spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleIOAscii.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleIOAscii.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SimpleIOAscii.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/spatialdb/SimpleIOAscii.i
+ *
+ * @brief SWIG interface to C++ SimpleIOAscii object.
+ */
+
+namespace spatialdata {
+  namespace spatialdb {
+    class SimpleDBData; // forward declaration
+
+    class SimpleIOAscii : public SimpleIO
+    { // SimpleIOAscii
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor.
+      SimpleIOAscii(void);
+
+      /// Default destructor.
+      ~SimpleIOAscii(void);  
+      
+      /** Read the database.
+       *
+       * @param pData Database data
+       * @param ppCS Pointer to coordinate system
+       */
+      void read(SimpleDBData* pData,
+		spatialdata::geocoords::CoordSys** ppCS);
+
+      /** Write the database.
+       *
+       * @param data Database data
+       * @param pCS Pointer to coordinate system
+       */
+      void write(const SimpleDBData& data,
+		 const spatialdata::geocoords::CoordSys* pCS);
+
+    }; // class SimpleIOAscii
+
+  } // spatialdb
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SpatialDBObj.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SpatialDBObj.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/SpatialDBObj.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/spatialdb/SpatialDBObj.i
+ *
+ * @brief SWIG interface to C++ SpatialDB object.
+ */
+
+namespace spatialdata {
+  namespace geocoords {
+    class CoordSys; // forward declaration
+  } // geocoords
+
+  namespace spatialdb {
+
+    class SpatialDB
+    { // class SpatialDB
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+  
+      /// Default constructor.
+      SpatialDB(void);
+  
+      /** Constructor with label.
+       *
+       * @param label Label for database
+       */
+      SpatialDB(const char* label);
+  
+      /// Default destructor.
+      virtual
+      ~SpatialDB(void);
+      
+      /** Set label of spatial database.
+       *
+       * @param label Label for database
+       */
+      void label(const char* label);
+      
+      /** Get label of spatial database.
+       *
+       * @returns Label for database
+       */
+      const char* label(void) const;
+      
+      /// Open the database and prepare for querying.
+      virtual
+      void open(void) = 0;
+      
+      /// Close the database.
+      virtual
+      void close(void) = 0;
+      
+      /** Set values to be returned by queries.
+       *
+       * @pre Must call open() before queryVals()
+       *
+       * @param names Names of values to be returned in queries
+       * @param numVals Number of values to be returned in queries
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** names,
+	 const int numVals)
+	  };
+      virtual
+      void queryVals(const char** names,
+		     const int numVals) = 0;
+      %clear(const char** names, const int numVals);
+      
+      /** Query the database.
+       *
+       * @note pVals should be preallocated to accommodate numVals values.
+       *
+       * @pre Must call open() before query()
+       *
+       * @param vals Array for computed values (output from query), must be
+       *   allocated BEFORE calling query().
+       * @param numVals Number of values expected (size of pVals array)
+       * @param coords Coordinates of point for query
+       * @param numDims Number of dimensions for coordinates
+       * @param pCSQuery Coordinate system of coordinates
+       *
+       * @returns 0 on success, 1 on failure (i.e., could not interpolate)
+       */
+      %apply(double* INPLACE_ARRAY1, int DIM1) {
+	(double* vals,
+	 const int numVals)
+	  };
+      %apply(double* IN_ARRAY1, int DIM1) {
+	(const double* coords,
+	 const int numDims)
+	  };
+      virtual
+      int query(double* vals,
+		const int numVals,
+		const double* coords,
+		const int numDims,
+		const spatialdata::geocoords::CoordSys* pCSQuery) = 0;
+      %clear(double* vals, const int numVals);
+      %clear(const double* coords, const int numDims);
+      
+    }; // class SpatialDB
+    
+  } // spatialdb
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/UniformDB.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/UniformDB.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/UniformDB.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// <LicenseText>
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/spatialdb/UniformDB.i
+ *
+ * @brief SWIG interface to C++ UniformDB object.
+ */
+
+namespace spatialdata {
+  namespace spatialdb {
+
+    class UniformDB : public SpatialDB
+    { // class UniformDB
+
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor.
+      UniformDB(void);
+  
+      /** Constructor with label.
+       *
+       * @param label Label of database
+       */
+      UniformDB(const char* label);
+      
+      /// Default destructor.
+      ~UniformDB(void);
+      
+      /** Set values in database.
+       *
+       * @param names Array of names of values in database.
+       * @param values Array of values in database.
+       * @param numValues Number of values in database.
+       */
+      %apply(const char** string_list) {
+	(const char** names)
+	  };
+      %apply(double* IN_ARRAY1, int DIM1) {
+	(const double* values,
+	 const int numValues)
+	  };
+      void setData(const char** names,
+		   const double* values,
+		   const int numValues);
+      %clear(const double* values, const int numValues);
+      
+      /// Open the database and prepare for querying.
+      void open(void);
+      
+      /// Close the database.
+      void close(void);
+      
+      /** Set values to be returned by queries.
+       *
+       * @pre Must call open() before queryVals()
+       *
+       * @param names Names of values to be returned in queries
+       * @param numVals Number of values to be returned in queries
+       */
+      %apply(const char** string_list, const int list_len){
+	(const char** names,
+	 const int numVals)
+	  };
+      void queryVals(const char** names,
+		     const int numVals);
+      %clear(const char** names, const int numVals);
+      
+      /** Query the database.
+       *
+       * @pre Must call open() before query()
+       *
+       * @param vals Array for computed values (output from query), vals
+       *   must be allocated BEFORE calling query().
+       * @param numVals Number of values expected (size of pVals array)
+       * @param coords Coordinates of point for query
+       * @param numDims Number of dimensions for coordinates
+       * @param pCSQuery Coordinate system of coordinates
+       *
+       * @returns 0 on success, 1 on failure (i.e., could not interpolate
+       *   so values set to 0)
+       */
+      %apply(double* INPLACE_ARRAY1, int DIM1) {
+	(double* vals,
+	 const int numVals)
+	  };
+      %apply(double* IN_ARRAY1, int DIM1) {
+	(const double* coords,
+	 const int numDims)
+	  };
+      int query(double* vals,
+		const int numVals,
+		const double* coords,
+		const int numDims,
+		const spatialdata::geocoords::CoordSys* pCSQuery);
+      %clear(double* vals, const int numVals);
+      %clear(const double* coords, const int numDims);
+      
+    }; // class UniformDB
+    
+  } // spatialdb
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,69 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// SWIG interface
+%module spatialdb
+
+// Header files for module C++ code
+%{
+#include <iosfwd>
+#include <string> // USES std::string
+
+#include "spatialdata/geocoords/CoordSys.hh"
+
+#include "spatialdata/spatialdb/SpatialDB.hh"
+#include "spatialdata/spatialdb/SimpleDB.hh"
+#include "spatialdata/spatialdb/SimpleDBData.hh"
+#include "spatialdata/spatialdb/SimpleIO.hh"
+#include "spatialdata/spatialdb/SimpleIOAscii.hh"
+#include "spatialdata/spatialdb/UniformDB.hh"
+#include "spatialdata/spatialdb/CompositeDB.hh"
+#include "spatialdata/spatialdb/SCECCVMH.hh"
+#include "spatialdata/spatialdb/GravityField.hh"
+
+%}
+
+%include "exception.i"
+%exception {
+  try {
+    $action
+  } catch (const std::exception& err) {
+    SWIG_exception(SWIG_RuntimeError, err.what());
+  } // try/catch
+ } // exception
+
+%include "typemaps.i"
+%include "../include/chararray.i"
+
+// Numpy interface stuff
+%{
+#define SWIG_FILE_WITH_INIT
+%}
+%include "../include/numpy.i"
+%init %{
+import_array();
+%}
+
+// Interfaces
+
+%include "SpatialDBObj.i"
+%include "SimpleDB.i"
+%include "SimpleDBData.i"
+%include "SimpleIO.i"
+%include "SimpleIOAscii.i"
+%include "UniformDB.i"
+%include "CompositeDB.i"
+%include "SCECCVMH.i"
+%include "GravityField.i"
+
+
+// End of file

Deleted: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pxd.src
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pxd.src	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pxd.src	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,7 +0,0 @@
-
-cdef class SpatialDB:
-
-  cdef void* thisptr # Pointer to C++ object
-  cdef readonly object handle # PyCObject holding pointer to C++ object
-  cdef readonly object name # Identifier for type of object
-

Deleted: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe.src
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe.src	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe.src	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,777 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-#header{
-#include "spatialdata/spatialdb/SpatialDB.hh"
-#include "spatialdata/spatialdb/SimpleDB.hh"
-#include "spatialdata/spatialdb/SimpleIO.hh"
-#include "spatialdata/spatialdb/SimpleIOAscii.hh"
-#include "spatialdata/spatialdb/SimpleDBTypes.hh"
-#include "spatialdata/spatialdb/GravityField.hh"
-#include "spatialdata/spatialdb/UniformDB.hh"
-#include "spatialdata/spatialdb/CompositeDB.hh"
-#include "spatialdata/spatialdb/SCECCVMH.hh"
-
-#include "spatialdata/geocoords/CoordSys.hh"
-
-#include <stdexcept>
-#include <Python.h>
-#}header
-
-# ----------------------------------------------------------------------
-cdef extern from "Python.h":
-  object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
-  void* PyCObject_AsVoidPtr(object)
-
-
-cdef extern from "stdlib.h":
-  ctypedef unsigned long size_t
-  void* malloc(size_t size)
-  void free(void* mem)
-  void strcpy(char*, char*)
-
-
-cdef void* ptrFromHandle(obj):
-  """
-  Extract pointer from PyCObject.
-  """
-  return PyCObject_AsVoidPtr(obj.handle)
-
-cdef double* doubleArray(size):
-  """
-  Allocate C++ double array.
-  """
-  # create shim
-  #embed{ double* doubleArray_cpp(int size)
-  double* result = (size > 0) ? new double[size] : 0;
-  return result;
-  #}embed
-  return doubleArray_cpp(size)
-
-
-cdef float* floatArray(size):
-  """
-  Allocate C++ float array.
-  """
-  # create shim
-  #embed{ float* floatArray_cpp(int size)
-  float* result = (size > 0) ? new float[size] : 0;
-  return result;
-  #}embed
-  return floatArray_cpp(size)
-
-
-cdef int* intArray(size):
-  """
-  Allocate C++ int array.
-  """
-  # create shim
-  #embed{ int* intArray_cpp(int size)
-  int* result = (size > 0) ? new int[size] : 0;
-  return result;
-  #}embed
-  return intArray_cpp(size)
-
-
-# ----------------------------------------------------------------------
-cdef void SpatialDB_destructor(void* obj):
-  """
-  Destroy SpatialDB object.
-  """
-  # create shim for destructor
-  #embed{ void SpatialDB_destructor_cpp(void* pObj)
-  spatialdata::spatialdb::SpatialDB* pDB =
-    (spatialdata::spatialdb::SpatialDB*) pObj;
-  delete pDB;
-  #}embed
-  SpatialDB_destructor_cpp(obj)
-  return
-
-cdef class SpatialDB:
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    self.handle = None
-    self.thisptr = NULL
-    self.name = "spatialdata_spatialdb_SpatialDB"
-    return
-
-
-  property label:
-    def __set__(self, name):
-      """
-      Set label of spatial database.
-      """
-      # create shim for method 'label'
-      #embed{ void SpatialDB_label_set(void* pObj, char* name)
-      try {
-        ((spatialdata::spatialdb::SpatialDB*) pObj)->label(name);
-      } 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
-
-      SpatialDB_label_set(self.thisptr, name)
-
-    def __get__(self):
-      """
-      Get label of spatial database.
-      """
-      # create shim for method 'label'
-      #embed{ char* SpatialDB_label_get(void* pObj)
-      char* label = 0;
-      try {
-        label = (char*) ((spatialdata::spatialdb::SpatialDB*) pObj)->label();
-      } 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
-      return label;
-      #}embed
-
-      return SpatialDB_label_get(self.thisptr)
-
-      
-  def open(self):
-    """
-    Open database and prepare for querying.
-    """
-    # create shim for method 'open'
-    #embed{ void SpatialDB_open(void* pObj)
-    try {
-      ((spatialdata::spatialdb::SpatialDB*) pObj)->open();
-    } 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
-
-    SpatialDB_open(self.thisptr)
-    return
-
-
-  def close(self):
-    """
-    Close the database.
-    """
-    # create shim for method 'close'
-    #embed{ void SpatialDB_close(void* pObj)
-    try {
-      ((spatialdata::spatialdb::SpatialDB*) pObj)->close();
-    } 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
-
-    SpatialDB_close(self.thisptr)
-    return
-
-
-  def queryVals(self, names):
-    """
-    Set values to be returned by queries.
-    """
-    # create shim for method 'queryVals'
-    #embed{ void SpatialDB_queryVals(void* pObj, char** names, int numVals)
-    try {
-      ((spatialdata::spatialdb::SpatialDB*) pObj)->queryVals((const char**) names, numVals);
-    } 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
-
-    cdef char** pNames
-    pNames = NULL
-    numVals = len(names)
-    if numVals > 0:
-      pNames = <char**> malloc(numVals*sizeof(char*))
-    for i from 0 <= i < numVals:
-      strsize = len(names[i])
-      pNames[i] = <char*> malloc(1+strsize*sizeof(char))
-      tmp = names[i]
-      strcpy(pNames[i], tmp)
-
-    SpatialDB_queryVals(self.thisptr, pNames, numVals)
-
-    # memory cleanup
-    for i from 0 <= i < numVals:
-      free(<void*> pNames[i])
-    free(<void*> pNames)
-    
-    return
-
-
-  def query(self, locs, cs, nvals):
-    """
-    Query db to get values at locations.
-    """
-    # create shim for method 'query'
-    #embed{ int SpatialDB_query(void* pObj, double* vals, int nvals, double* coords, int spaceDim, void* csObj)
-    int err = 0;
-    try {
-      spatialdata::geocoords::CoordSys* pCS =
-        (spatialdata::geocoords::CoordSys*) csObj;
-        err = ((spatialdata::spatialdb::SpatialDB*) pObj)->query(vals, nvals,
-                                                            coords, spaceDim,
-                                                            pCS);
-    } 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
-    return err;
-    #}embed
-
-    import spatialdata.utils.simplearray
-    locs = spatialdata.utils.simplearray.objAsSimpleArray(locs)
-    if not locs.isCompatible(nd=2,
-                             simpletype="double",
-                             contiguous=True,
-                             notswapped=True):
-      raise TypeError, \
-            "Argument 'locs' must be a contiguous, 2-D array of type double."
-
-    if not cs.name == "spatialdata_geocoords_CoordSys":
-      raise TypeError, \
-            "Argument 'cs' must be extension module type 'CoordSys'."
-    if nvals < 1:
-      raise TypeError, \
-              "Argument 'nvals' must be a positive integer."
-
-    (nlocs, spaceDim) = locs.shape
-    
-    cdef double* pLocs
-    pLocs = <double*> PyCObject_AsVoidPtr(locs.data)
-
-    cdef double* pVals
-    pVals = doubleArray(nlocs*nvals)
-
-    cdef int* pErr
-    pErr = <int*> intArray(nlocs)
-
-    cdef double* valbuffer
-    valbuffer = <double*> malloc(nvals*sizeof(double))
-
-    for iloc from 0 <= iloc < nlocs:
-      pErr[iloc] = SpatialDB_query(self.thisptr, valbuffer, nvals,
-                                  &pLocs[spaceDim*iloc], spaceDim,
-                                  ptrFromHandle(cs))
-      for ival from 0 <= ival < nvals:
-        pVals[nvals*iloc+ival] = valbuffer[ival]
-    free(<void*> valbuffer)
-
-    dims = [nlocs, nvals]
-    import spatialdata.utils.simplearray
-    pValsObj = PyCObject_FromVoidPtr(pVals, NULL);
-    pErrObj = PyCObject_FromVoidPtr(pErr, NULL);
-    return (spatialdata.utils.simplearray.SimpleCppArray(pValsObj, dims, "double"),
-            spatialdata.utils.simplearray.SimpleCppArray(pErrObj, [nlocs], "int"))
-
-
-  def _createHandle(self):
-    """
-    Wrap pointer to C++ object in PyCObject.
-    """
-    return PyCObject_FromVoidPtr(self.thisptr, SpatialDB_destructor)
-
-
-# ----------------------------------------------------------------------
-cdef class SimpleDB(SpatialDB):
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    # create shim for constructor
-    #embed{ void* SimpleDB_constructor()
-      return (void*)(new spatialdata::spatialdb::SimpleDB);
-    #}embed
-
-    SpatialDB.__init__(self)
-    self.thisptr = SimpleDB_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  def queryType(self, name):
-    """
-    Set query type.
-    """
-    # create shim for method 'queryType'
-    #embed{ void SimpleDB_queryType(void* pObj, char* name)
-    spatialdata::spatialdb::SimpleDB::QueryEnum queryType =
-      spatialdata::spatialdb::SimpleDB::NEAREST;
-    if (0 == strcasecmp(name, "nearest"))
-      queryType = spatialdata::spatialdb::SimpleDB::NEAREST;
-    else if (0 == strcasecmp(name, "linear"))
-      queryType = spatialdata::spatialdb::SimpleDB::LINEAR;
-    ((spatialdata::spatialdb::SimpleDB*) pObj)->queryType(queryType);
-    #}embed
-
-    if not (name.lower() == "nearest" or name.lower() == "linear"):
-      raise ValueError, "Couldn't parse query type '%s' into a known type" \
-            "type of query. Accepted values are 'nearest' and 'linear'." \
-            % name
-
-    SimpleDB_queryType(self.thisptr, name)
-    return
-
-
-  def ioHandler(self, handle):
-    """
-    Set the I/O handler.
-    """
-    # create shim for method 'ioHandler'
-    #embed{ void SimpleDB_ioHandler(void* pObj, void* pHandlerObj)
-    spatialdata::spatialdb::SimpleIO* pHandler =
-      (spatialdata::spatialdb::SimpleIO*) pHandlerObj;
-    ((spatialdata::spatialdb::SimpleDB*) pObj)->ioHandler(pHandler);
-    #}embed
-
-    if not handle.name == "spatialdata_spatialdb_SimpleIO":
-      raise TypeError, \
-            "Argument 'handle' must be extension module type 'SimpleIO'."
-
-    SimpleDB_ioHandler(self.thisptr, ptrFromHandle(handle))
-    return
-
-
-# ----------------------------------------------------------------------
-cdef void SimpleIO_destructor(void* obj):
-  """
-  Destructor SimplIO object.
-  """
-  # create shim for destructor
-  #embed{ void SimpleIO_destructor_cpp(void* pObj)
-  spatialdata::spatialdb::SimpleIO* pIO =
-    (spatialdata::spatialdb::SimpleIO*) pObj;
-  delete pIO;
-  #}embed
-  SimpleIO_destructor_cpp(obj)
-  return
-
-
-cdef class SimpleIO:
-
-  cdef void* thisptr # Pointer to C++ object
-  cdef readonly object handle # PyCObject holding pointer to C++ object
-  cdef readonly object name # Identifier for type of object
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    self.handle = None
-    self.thisptr = NULL
-    self.name = "spatialdata_spatialdb_SimpleIO"
-    return
-
-
-  def filename(self, name):
-    """
-    Set filename for database.
-    """
-    # create shim for method 'filename'
-    #embed{ void SimpleIO_filename(void* pObj, char* name)
-    ((spatialdata::spatialdb::SimpleIO*) pObj)->filename(name);
-    #}embed
-
-    SimpleIO_filename(self.thisptr, name)
-    return
-
-
-  def _createHandle(self):
-    """
-    Wrap pointer to C++ object in PyCObject.
-    """
-    return PyCObject_FromVoidPtr(self.thisptr, SimpleIO_destructor)
-
-
-# ----------------------------------------------------------------------
-cdef class SimpleIOAscii(SimpleIO):
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    # create shim for constructor
-    #embed{ void* SimpleIOAscii_constructor()
-      return (void*)(new spatialdata::spatialdb::SimpleIOAscii);
-    #}embed
-
-    SimpleIO.__init__(self)
-    self.thisptr = SimpleIOAscii_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  def write(self, names, units, dataObj, spaceDim, dataDim, cs):
-    """
-    Write database to file.
-    """
-    # create shim for method 'write'
-    #embed{ void SimpleIOAscii_write(void* pObj, char** names, char** units, double* data, int numLocs, int spaceDim, int numValues, int dataDim, void* pCSObj)
-    spatialdata::spatialdb::SimpleDB::DataStruct* pData =
-      new spatialdata::spatialdb::SimpleDB::DataStruct;
-    pData->data = data;
-
-    pData->valNames = new std::string[numValues];
-    pData->valUnits = new std::string[numValues];
-    for (int iValue=0; iValue < numValues; ++iValue) {
-      pData->valNames[iValue] = names[iValue];
-      pData->valUnits[iValue] = units[iValue];
-    } // for
-    pData->numLocs = numLocs;
-    pData->numVals = numValues;
-    pData->dataDim = dataDim;
-    pData->spaceDim = spaceDim;
-
-    spatialdata::geocoords::CoordSys* pCS =
-      (spatialdata::geocoords::CoordSys*) pCSObj;  
-    ((spatialdata::spatialdb::SimpleIOAscii*) pObj)->write(*pData, pCS);
-    delete[] pData->valNames;
-    delete[] pData->valUnits;
-    delete pData; pData = 0;
-    #}embed
-
-    
-    import spatialdata.utils.simplearray
-    data = spatialdata.utils.simplearray.objAsSimpleArray(dataObj)
-    if not data.isCompatible(nd=2,
-                             simpletype="double",
-                             contiguous=True,
-                             notswapped=True):
-      raise TypeError, \
-            "Argument 'dataObj' must be a contiguous, 2-D array of type double."
-    numValues = len(names)
-    if not (numValues == len(units)):
-      raise ValueError, \
-            "Arguments 'names' and 'values' must have the same length."
-    (numLocs, totalDim) = data.shape
-    if totalDim != numValues + spaceDim:
-      raise ValueError, \
-            "'dataObj' not compatible with number of values and spaceDim."
-    if not cs.name == "spatialdata_geocoords_CoordSys":
-      raise TypeError, \
-            "Argument 'cs' must be extension module type 'CoordSys'."
-
-    cdef double* dataArray
-    dataArray = <double*> PyCObject_AsVoidPtr(data.data)
-
-    cdef char** namesArray
-    cdef char** unitsArray
-    namesArray = NULL
-    unitsArray = NULL
-    if numValues > 0:
-      namesArray = <char**> malloc(numValues*sizeof(char*))
-      unitsArray = <char**> malloc(numValues*sizeof(char*))
-    for i from 0 <= i < numValues:
-      strsize = len(names[i])
-      namesArray[i] = <char*> malloc(1+strsize*sizeof(char))
-      tmp = names[i] # KLUDGE??
-      strcpy(namesArray[i], tmp)
-
-      strsize = len(units[i])
-      unitsArray[i] = <char*> malloc(1+strsize*sizeof(char))
-      tmp = units[i] # KLUDGE??
-      strcpy(unitsArray[i], tmp)
-      
-    SimpleIOAscii_write(self.thisptr,
-                        namesArray, unitsArray, dataArray,
-                        numLocs, spaceDim, numValues, dataDim,
-                        ptrFromHandle(cs))
-    for i from 0 <= i < numValues:
-      free(<void*> namesArray[i])
-      free(<void*> unitsArray[i])
-    free(<void*> namesArray)
-    free(<void*> unitsArray)
-    return
-
-
-# ----------------------------------------------------------------------
-cdef class GravityField(SpatialDB):
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    # create shim for constructor
-    #embed{ void* GravityField_constructor()
-      return (void*)(new spatialdata::spatialdb::GravityField);
-    #}embed
-
-    SpatialDB.__init__(self)
-    self.thisptr = GravityField_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  def gravityDir(self, up):
-    """
-    Set direction of gravitational body force.
-    """
-    # create shim for method 'gravityDir'
-    #embed{ void GravityField_gravityDir(void* pObj, double x, double y, double z)
-    assert(0 != pObj);
-    ((spatialdata::spatialdb::GravityField*) pObj)->gravityDir(x, y, z);
-    #}embed
-    if len(up) != 3:
-      raise ValueError("Up direction must be a 3 component list or tuple.")
-    (x, y, z) = map(float, up)
-
-    GravityField_gravityDir(self.thisptr, x, y, z)
-    return
-
-
-  def gravAcceleration(self, value):
-    """
-    Set gravitational acceleration.
-    """
-    # create shim for method 'gravAcceleration'
-    #embed{ void GravityField_gravAcceleration(void* pObj, double value)
-    assert(0 != pObj);
-    ((spatialdata::spatialdb::GravityField*) pObj)->gravAcceleration(value);
-    #}embed
-
-    GravityField_gravAcceleration(self.thisptr, value)
-    return
-
-
-# ----------------------------------------------------------------------
-cdef class UniformDB(SpatialDB):
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    # create shim for constructor
-    #embed{ void* UniformDB_constructor()
-      return (void*)(new spatialdata::spatialdb::UniformDB);
-    #}embed
-
-    SpatialDB.__init__(self)
-    self.thisptr = UniformDB_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  def setData(self, names, values):
-    """
-    Set the data in the spatial database.
-    """
-    # create shim for method 'setData'
-    #embed{ void UniformDB_setData(void* pObj, char** names, double* values, int size)
-    assert(0 != pObj);
-    ((spatialdata::spatialdb::UniformDB*) pObj)->setData(
-      const_cast<const char**>(names), values, size);
-    #}embed
-
-    cdef char** namesArray
-    cdef double* valuesArray
-    namesArray = NULL
-    valuesArray = NULL
-    numValues = len(names)
-    assert(numValues == len(values))
-    if numValues > 0:
-      namesArray = <char**> malloc(numValues*sizeof(char*))
-      valuesArray = <double*> malloc(numValues*sizeof(double))
-    for i from 0 <= i < numValues:
-      strsize = len(names[i])
-      namesArray[i] = <char*> malloc(1+strsize*sizeof(char))
-      tmp = names[i] # KLUDGE??
-      strcpy(namesArray[i], tmp)
-
-      valuesArray[i] = values[i]
-      
-    UniformDB_setData(self.thisptr, namesArray, valuesArray, numValues)
-
-    for i from 0 <= i < numValues:
-      free(<void*> namesArray[i])
-    free(<void*> namesArray)
-    free(<void*> valuesArray)
-    return
-
-
-# ----------------------------------------------------------------------
-cdef class CompositeDB(SpatialDB):
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    # create shim for constructor
-    #embed{ void* CompositeDB_constructor()
-      return (void*)(new spatialdata::spatialdb::CompositeDB);
-    #}embed
-
-    SpatialDB.__init__(self)
-    self.thisptr = CompositeDB_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  def dbA(self, db, names):
-    """
-    Set database A information.
-    """
-    # create shim for method 'dbA'
-    #embed{ void CompositeDB_dbA(void* pObj, void* objDB, char** names, int size)
-    assert(0 != pObj);
-    assert(0 != objDB);
-    spatialdata::spatialdb::SpatialDB* db =
-      (spatialdata::spatialdb::SpatialDB*) objDB;
-    ((spatialdata::spatialdb::CompositeDB*) pObj)->dbA(db,
-      const_cast<const char**>(names), size);
-    #}embed
-
-    if db.name != "spatialdata_spatialdb_SpatialDB":
-      raise TypeError("Argument 'db' must be extension module type 'SpatialDB'")
-
-    cdef char** namesArray
-    namesArray = NULL
-    numValues = len(names)
-    if numValues > 0:
-      namesArray = <char**> malloc(numValues*sizeof(char*))
-    for i from 0 <= i < numValues:
-      strsize = len(names[i])
-      namesArray[i] = <char*> malloc(1+strsize*sizeof(char))
-      tmp = names[i] # KLUDGE??
-      strcpy(namesArray[i], tmp)
-      
-    CompositeDB_dbA(self.thisptr, ptrFromHandle(db), namesArray, numValues)
-
-    for i from 0 <= i < numValues:
-      free(<void*> namesArray[i])
-    free(<void*> namesArray)
-    return
-
-
-  def dbB(self, db, names):
-    """
-    Set database B information.
-    """
-    # create shim for method 'dbB'
-    #embed{ void CompositeDB_dbB(void* pObj, void* objDB, char** names, int size)
-    assert(0 != pObj);
-    assert(0 != objDB);
-    spatialdata::spatialdb::SpatialDB* db =
-      (spatialdata::spatialdb::SpatialDB*) objDB;
-    ((spatialdata::spatialdb::CompositeDB*) pObj)->dbB(db,
-      const_cast<const char**>(names), size);
-    #}embed
-
-    if db.name != "spatialdata_spatialdb_SpatialDB":
-      raise TypeError("Argument 'db' must be extension module type 'SpatialDB'")
-
-    cdef char** namesArray
-    namesArray = NULL
-    numValues = len(names)
-    if numValues > 0:
-      namesArray = <char**> malloc(numValues*sizeof(char*))
-    for i from 0 <= i < numValues:
-      strsize = len(names[i])
-      namesArray[i] = <char*> malloc(1+strsize*sizeof(char))
-      tmp = names[i] # KLUDGE??
-      strcpy(namesArray[i], tmp)
-      
-    CompositeDB_dbB(self.thisptr, ptrFromHandle(db), namesArray, numValues)
-
-    for i from 0 <= i < numValues:
-      free(<void*> namesArray[i])
-    free(<void*> namesArray)
-    return
-
-
-# ----------------------------------------------------------------------
-cdef class SCECCVMH(SpatialDB):
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    # create shim for constructor
-    #embed{ void* SCECCVMH_constructor()
-      return (void*)(new spatialdata::spatialdb::SCECCVMH);
-    #}embed
-
-    SpatialDB.__init__(self)
-    self.thisptr = SCECCVMH_constructor()
-    self.handle = self._createHandle()
-    return
-
-
-  def dataDir(self, dir):
-    """
-    Set the data directory for SCEC CVM-H data files..
-    """
-    # create shim for method 'dataDir'
-    #embed{ void SCECCVMH_dataDir(void* pObj, char* dir)
-    assert(0 != pObj);
-    ((spatialdata::spatialdb::SCECCVMH*) pObj)->dataDir(dir);
-    #}embed
-
-    SCECCVMH_dataDir(self.thisptr, dir)
-    return
-
-
-  def minVs(self, value):
-    """
-    Set minimum shear wave speed.
-    """
-    # create shim for method 'minVs'
-    #embed{ void SCECCVMH_minVs(void* pObj, double value)
-    assert(0 != pObj);
-    ((spatialdata::spatialdb::SCECCVMH*) pObj)->minVs(value);
-    #}embed
-
-    SCECCVMH_minVs(self.thisptr, value)
-    return
-
-
-  def squash(self, flag, limit):
-    """
-    Set squashed topography/bathymetry flag and minimum elevation of 
-    squashing.
-    """
-    # create shim for method 'squash'
-    #embed{ void SCECCVMH_squash(void* pObj, int flag, double limit)
-    assert(0 != pObj);
-    ((spatialdata::spatialdb::SCECCVMH*) pObj)->squash(flag, limit);
-    #}embed
-
-    SCECCVMH_squash(self.thisptr, flag, limit)
-    return
-
-
-# End of file 

Modified: cs/spatialdata-0.1/trunk/modulesrc/units/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/units/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/units/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -13,37 +13,38 @@
 subpackage = units
 include $(top_srcdir)/subpackage.am
 
+subpkgpyexec_LTLIBRARIES = _unitsmodule.la
+subpkgpyexec_PYTHON = units.py
 
-subpkgpyexec_LTLIBRARIES = unitsmodule.la
+swig_sources = \
+	units.i \
+	Nondimensional.i
 
-unitsmodule_la_LDFLAGS = -module -avoid-version \
+swig_generated = \
+	units_wrap.cxx \
+	units.py
+
+_unitsmodule_la_LDFLAGS = -module -avoid-version \
 	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
 
-dist_unitsmodule_la_SOURCES = units.pyxe.src
+dist__unitsmodule_la_SOURCES = $(swig_sources) $(swig_generated)
 
-nodist_unitsmodule_la_SOURCES = \
-	units.pyxe \
-	units.c units_embed.cpp units_embed.h
-
-unitsmodule_la_LIBADD = \
+_unitsmodule_la_LIBADD = \
 	$(top_builddir)/libsrc/libspatialdata.la
 if NO_UNDEFINED
-unitsmodule_la_LIBADD += \
+_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
+$(srcdir)/units_wrap.cxx $(srcdir)/units.py: $(swig_sources)
+	$(SWIG) -Wall -c++ -python $<
 
-.pyx.c:
-	pyrexc $<
 
-CLEANFILES = units.pyx units.pyxe units.c *_embed.*
+MAINTAINERCLEANFILES = \
+	$(srcdir)/units_wrap.cxx \
+	$(srcdir)/units.py
 
+
 # End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/units/Nondimensional.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/units/Nondimensional.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/units/Nondimensional.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,132 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/** @file modulesrc/units/Nondimensional.i
+ *
+ * @brief SWIG interface for C++ Nondimensional object.
+ */
+
+namespace spatialdata {
+  namespace units {
+
+    class Nondimensional
+    { // class Nondimensional
+    public :
+      // PUBLIC METHODS /////////////////////////////////////////////////
+
+      /// Default constructor
+      Nondimensional(void);
+
+      /// Default destructor
+      ~Nondimensional(void);
+
+      /** Set value to nondimensionalize length scale in meters (SI
+       * units).
+       *
+       * @param value Length scale in meters (SI units).
+       */
+      void lengthScale(const double value);
+      
+      /** Get value to nondimensionalize length scale in meters (SI
+       * units).
+       *
+       * @returns Length scale in meters (SI units).
+       */
+      double lengthScale(void) const;
+      
+      /** Set value to nondimensionalize pressure scale in Pascals (SI
+       * units).
+       *
+       * @param value Pressure scale in Pascals (SI units).
+       */
+      void pressureScale(const double value);
+      
+      /** Get value to nondimensionalize pressure scale in Pascals (SI
+       * units).
+       *
+       * @returns Pressure scale in Pascals (SI units).
+       */
+      double pressureScale(void) const;
+      
+      /** Set value to nondimensionalize time scale in seconds (SI
+       * units).
+       *
+       * @param value Time scale in seconds (SI units).
+       */
+      void timeScale(const double value);
+      
+      /** Get value to nondimensionalize time scale in seconds (SI
+       * units).
+       *
+       * @returns Time scale in seconds (SI units).
+       */
+      double timeScale(void) const;
+      
+      /** 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);
+      
+      /** Get value to nondimensionalize density scale in kg/m^3 (SI
+       * units).
+       *
+       * @returns Density scale in kg/m^3 (SI units).
+       */
+      double densityScale(void) const;
+      
+      /** Make value dimensionless.
+       *
+       * @param value Value with dimensions in SI units.
+       * @param scale Scale used to nondimensionalize value.
+       * @returns Dimensionless value.
+       */
+      double nondimensionalize(const double value,
+			       const double scale) const;
+      
+      /** Make value dimensionless.
+       *
+       * @param value Dimensionless value.
+       * @param value Value with dimensions in SI units.
+       * @returns Scale used to nondimensionalize value.
+       */
+      double dimensionalize(const double value,
+			    const double scale) const;
+      
+      /** Make values dimensionless.
+       *
+       * @param values Array of values with dimensions in SI units.
+       * @param nvalues Number of values.
+       * @param scale Scale used to nondimensionalize value.
+       */
+      void nondimensionalize(double* const values,
+			     const int nvalues,
+			     const double scale) const;
+      
+      /** Make value dimensionless.
+       *
+       * @param values Array of dimensionless values.
+       * @param nvalues Number of values.
+       * @param scale Scale used to nondimensionalize value.
+       */
+      void dimensionalize(double* const values,
+			  const int nvalues,
+			  const double scale) const;
+      
+    }; // class Nondimensional
+    
+  } // units
+} // spatialdata
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/modulesrc/units/units.i
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/units/units.i	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/modulesrc/units/units.i	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// SWIG interface
+%module units
+
+// Header files for module C++ code
+%{
+#include "spatialdata/units/Nondimensional.hh"
+%}
+
+%include "exception.i"
+%exception {
+  try {
+    $action
+  } catch (const std::exception& err) {
+    SWIG_exception(SWIG_RuntimeError, err.what());
+  } // try/catch
+} // exception
+
+%include "Nondimensional.i"
+
+
+// End of file

Deleted: cs/spatialdata-0.1/trunk/modulesrc/units/units.pyxe.src
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/units/units.pyxe.src	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/units/units.pyxe.src	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,145 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-#header{
-#include "spatialdata/units/Nondimensional.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 Nondimensional_destructor(void* obj):
-  """
-  Destroy Nondimensional object.
-  """
-  # create shim for destructor
-  #embed{ void Nondimensional_destructor_cpp(void* pObj)
-  spatialdata::units::Nondimensional* pDim =
-  (spatialdata::units::Nondimensional*) pObj;
-  delete pDim;
-  #}embed
-  Nondimensional_destructor_cpp(obj)
-  return
-
-  
-# ----------------------------------------------------------------------
-cdef class Nondimensional:
-
-  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* Nondimensional_constructor()
-      return (void*)(new spatialdata::units::Nondimensional);
-    #}embed
-
-    self.name = "spatialdata_units_Nondimensional"
-    self.thisptr = Nondimensional_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 Nondimensional_length_set(void* pObj, double value)
-      try {
-        ((spatialdata::units::Nondimensional*) 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
-      Nondimensional_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 Nondimensional_pressure_set(void* pObj, double value)
-      try {
-        ((spatialdata::units::Nondimensional*) 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
-      Nondimensional_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 Nondimensional_time_set(void* pObj, double value)
-      try {
-        ((spatialdata::units::Nondimensional*) 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
-      Nondimensional_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 Nondimensional_density_set(void* pObj, double value)
-      try {
-        ((spatialdata::units::Nondimensional*) 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
-      Nondimensional_density_set(self.thisptr, value)
-
-
-  def _createHandle(self):
-    """Wrap pointer to C++ object in PyCObject."""
-    return PyCObject_FromVoidPtr(self.thisptr, Nondimensional_destructor)
-
-
-# End of file 

Deleted: cs/spatialdata-0.1/trunk/modulesrc/utils/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/utils/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/modulesrc/utils/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,72 +0,0 @@
-# -*- Makefile -*-
-#
-# ----------------------------------------------------------------------
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-subpackage = utils
-include $(top_srcdir)/subpackage.am
-
-subpkgpyexec_LTLIBRARIES = \
-	simplearraymodule.la \
-	utilsmodule.la
-
-INCLUDES += -I$(PYTHON_INCDIR)
-
-# simple array
-simplearraymodule_la_LDFLAGS = -module -avoid-version \
-	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
-dist_simplearraymodule_la_SOURCES = simplearray.pyxe.src
-nodist_simplearraymodule_la_SOURCES = \
-	simplearray.pyxe \
-	simplearray.c simplearray_embed.cpp simplearray_embed.h
-simplearraymodule_la_LIBADD =
-if NO_UNDEFINED
-simplearraymodule_la_LIBADD += \
-	$(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
-endif
-
-# utils
-utilsmodule_la_LDFLAGS = -module -avoid-version \
-	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
-dist_utilsmodule_la_SOURCES = utils.pyxe.src
-nodist_utilsmodule_la_SOURCES = \
-	utils.pyxe \
-	utils.c utils_embed.cpp utils_embed.h
-utilsmodule_la_LIBADD = \
-	$(top_builddir)/libsrc/libspatialdata.la
-if NO_UNDEFINED
-utilsmodule_la_LIBADD += \
-	$(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
-endif
-
-# simple array targets
-simplearray.pyx simplearray_embed.cpp  simplearray_embed.h: simplearray.pyxe
-	pyrexembed simplearray.pyxe
-simplearray.pyxe: $(srcdir)/simplearray.pyxe.src
-	cp $(srcdir)/simplearray.pyxe.src $@
-simplearray_embed.cpp: simplearray_embed.h
-simplearray_embed.h: simplearray.pyx
-
-# utils targets
-utils.pyx utils_embed.cpp  utils_embed.h: utils.pyxe
-	pyrexembed utils.pyxe
-utils.pyxe: $(srcdir)/utils.pyxe.src
-	cp $(srcdir)/utils.pyxe.src $@
-utils_embed.cpp: utils_embed.h
-utils_embed.h: utils.pyx
-
-.pyx.c:
-	pyrexc $<
-
-CLEANFILES = utils.pyx utils.pyxe utils.c \
-	simplearray.pyx simplearray.pyxe simplearray.c \
-	*_embed.*
-
-# End of file 

Modified: cs/spatialdata-0.1/trunk/spatialdata/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -26,7 +26,7 @@
 	spatialdb/SimpleDB.py \
 	spatialdb/SimpleIOAscii.py \
 	spatialdb/SimpleIO.py \
-	spatialdb/SpatialDB.py \
+	spatialdb/SpatialDBObj.py \
 	spatialdb/UniformDB.py \
 	spatialdb/__init__.py \
 	spatialdb/generator/Shaper.py \

Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSCart.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSCart.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSCart.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,9 +17,10 @@
 ## Factory: coordsys.
 
 from CoordSys import CoordSys
+from geocoords import CSCart as ModuleCSCart
 
 # CSCart class
-class CSCart(CoordSys):
+class CSCart(CoordSys, ModuleCSCart):
   """
   Python manager for Cartesian coordinate systems.
 
@@ -51,43 +52,36 @@
     spaceDim = pyre.inventory.int("space_dim", default=3)
     spaceDim.meta['tip'] = "Number of dimensions for coordinate system."
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="cscart"):
     """Constructor."""
     CoordSys.__init__(self, name)
-
-    import spatialdata.geocoords.geocoords as bindings
-    self.cppHandle = bindings.CSCart()
-    self.units = "m"
-    self.spaceDim = 3
     return
 
 
-  def initialize(self):
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
     """
-    Initialize coordinate system.
+    Setup members using inventory.
     """
+    CoordSys._configure(self)
+
     import pyre.units
     uparser = pyre.units.parser()
-    coordUnits = uparser.parse(self.units)
-    self.cppHandle.toMeters = coordUnits.value
-
-    self.cppHandle.spaceDim = self.spaceDim
-
-    CoordSys.initialize(self)
+    coordUnits = uparser.parse(self.inventory.units)
+    self.toMeters(coordUnits.value)
+    self.setSpaceDim(self.inventory.spaceDim)
     return
 
 
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _configure(self):
+  def _createModuleObj(self):
     """
-    Setup members using inventory.
+    Create Python module object.
     """
-    CoordSys._configure(self)
-    self.units = self.inventory.units
-    self.spaceDim = self.inventory.spaceDim
+    ModuleCSCart.__init__(self)
     return
 
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeo.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeo.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeo.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,9 +17,10 @@
 ## Factory: coordsys.
 
 from CoordSys import CoordSys
+from geocoords import CSGeo as ModuleCSGeo
 
 # CSGeo class
-class CSGeo(CoordSys):
+class CSGeo(CoordSys, ModuleCSGeo):
   """
   Python manager for geographic coordinate systems.
 
@@ -75,51 +76,34 @@
     Constructor.
     """
     CoordSys.__init__(self, name)
-
-    import spatialdata.geocoords.geocoords as bindings
-    self.cppHandle = bindings.CSGeo()
-    self.ellipsoid = "WGS84"
-    self.datumHoriz = "WGS84"
-    self.datumVert = "ellipsoid"
-    self.isGeocentric = False
-    self.units = "m"
-    self.spaceDim = 3
     return
 
 
-  def initialize(self):
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
     """
-    Initialize coordinate system.
+    Setup members using inventory.
     """
-    self.cppHandle.ellipsoid = self.ellipsoid
-    self.cppHandle.datumHoriz = self.datumHoriz
-    self.cppHandle.datumVert = self.datumVert
-    self.cppHandle.isGeocentric = self.isGeocentric
+    CoordSys._configure(self)
+    self.ellipsoid(self.inventory.ellipsoid)
+    self.datumHoriz(self.inventory.datumHoriz)
+    self.datumVert(self.inventory.datumVert)
+    self.isGeocentric(self.inventory.isGeocentric)
+    self.setSpaceDim(self.inventory.spaceDim)
 
     import pyre.units
     uparser = pyre.units.parser()
-    coordUnits = uparser.parse(self.units)
-    self.cppHandle.toMeters = coordUnits.value
-
-    self.cppHandle.spaceDim = self.spaceDim
-
-    CoordSys.initialize(self)
+    coordUnits = uparser.parse(self.inventory.units)
+    self.toMeters(coordUnits.value)
     return
 
 
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _configure(self):
+  def _createModuleObj(self):
     """
-    Setup members using inventory.
+    Create Python module object.
     """
-    CoordSys._configure(self)
-    self.ellipsoid = self.inventory.ellipsoid
-    self.datumHoriz = self.inventory.datumHoriz
-    self.datumVert = self.inventory.datumVert
-    self.isGeocentric = self.inventory.isGeocentric
-    self.units = self.inventory.units
-    self.spaceDim = self.inventory.spaceDim
+    ModuleCSGeo.__init__(self)
     return
 
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoLocalCart.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoLocalCart.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoLocalCart.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,9 +17,10 @@
 ## Factory: coordsys
 
 from CSGeo import CSGeo
+from geocoords import CSGeoLocalCart as ModuleCSGeoLocalCart
 
 # CSGeoLocalCart class
-class CSGeoLocalCart(CSGeo):
+class CSGeoLocalCart(CSGeo, ModuleCSGeoLocalCart):
   """
   Python manager for local coordinate systems.
 
@@ -64,28 +65,9 @@
     Constructor.
     """
     CSGeo.__init__(self, name)
-
-    import spatialdata.geocoords.geocoords as bindings
-    self.cppHandle = bindings.CSGeoLocalCart()
-
-    self.originLon = 0.0
-    self.originLat = 0.0
-    self.originElev = 0.0
-    self.isGeocentric = True
     return
 
 
-  def initialize(self):
-    """
-    Initialize coordinate system.
-    """
-    self.cppHandle.origin(self.originLon, self.originLat,
-                          self.originElev.value)
-    CSGeo.initialize(self)
-
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -93,13 +75,20 @@
     Setup members using inventory.
     """
     CSGeo._configure(self)
-    self.originLon = self.inventory.originLon
-    self.originLat = self.inventory.originLat
-    self.originElev = self.inventory.originElev
-    self.isGeocentric = True
+    self.origin(self.inventory.originLon, self.inventory.originLat,
+                self.inventory.originElev.value)
+    self.isGeocentric(True)
     return
 
 
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    ModuleCSGeoLocalCart.__init__(self)
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def coordsys():

Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoProj.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoProj.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/CSGeoProj.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,9 +17,10 @@
 ## Factory: CSGeoProj
 
 from CSGeo import CSGeo
+from geocoords import CSGeoProj as ModuleCSGeoProj
 
 # CoordSysGeo class
-class CSGeoProj(CSGeo):
+class CSGeoProj(CSGeo, ModuleCSGeoProj):
   """
   Python manager for projected geographic coordinate systems.
 
@@ -57,24 +58,9 @@
     Constructor.
     """
     CSGeo.__init__(self, name)
-
-    import spatialdata.geocoords.geocoords as bindings
-    self.cppHandle = bindings.CSGeoProj()
-    self.projector = None
     return
 
 
-  def initialize(self):
-    """
-    Initialize coordinate system.
-    """
-    self.projector.initialize(self)
-    self.cppHandle.projector = self.projector.cppHandle
-
-    CSGeo.initialize(self)
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -82,10 +68,18 @@
     Setup members using inventory.
     """
     CSGeo._configure(self)
-    self.projector = self.inventory.projector
+    self.projector(self.inventory.projector)
     return
 
 
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    ModuleCSGeoProj.__init__(self)
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def coordsys():

Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/Converter.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/Converter.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/Converter.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -14,19 +14,19 @@
 ##
 ## @brief Python function to convert b/t coordinate systems.
 
-def convert(coordsSrc, csDest, csSrc):
+def convert(coords, csDest, csSrc):
   """
   Convert coordinates from source coordinate system to destination
   coordinate system. Transformation is done in place.
   """
 
-  if not csDest.spaceDim == csSrc.spaceDim:
+  if not csDest.spaceDim() == csSrc.spaceDim():
     msg = "Spatial dimensions of source (%d) and destination (%d) " \
-          "coordinate systems must match." % (csSrc.spaceDim, csDest.spaceDim)
+          "coordinate systems must match." % (csSrc.spaceDim(), csDest.spaceDim())
     raise ValueError(msg)
 
-  import spatialdata.geocoords.geocoords as bindings
-  bindings.Converter_convert(coordsSrc, csDest.cppHandle, csSrc.cppHandle)
+  import geocoords
+  geocoords.Converter.convert(coords, csDest, csSrc)
   return
 
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/CoordSys.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/CoordSys.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/CoordSys.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -47,19 +47,10 @@
     Constructor.
     """
     Component.__init__(self, name, facility="coordsys")
-
-    self.cppHandle = None
+    self._createModuleObj()
     return
 
 
-  def initialize(self):
-    """
-    Initialize coordinate system.
-    """
-    self.cppHandle.initialize()
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -70,6 +61,14 @@
     return
 
 
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    raise NotImplementedError("_createModuleObj() not implemented.")
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def coordsys():

Modified: cs/spatialdata-0.1/trunk/spatialdata/geocoords/Projector.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/geocoords/Projector.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/geocoords/Projector.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,9 +17,10 @@
 ## Factory: projector.
 
 from pyre.components.Component import Component
+from geocoords import Projector as ModuleProjector
 
 # Projector class
-class Projector(Component):
+class Projector(Component, ModuleProjector):
   """
   Python manager for projector.
 
@@ -60,38 +61,10 @@
     Constructor.
     """
     Component.__init__(self, name, facility="projector")
-
-    import spatialdata.geocoords.geocoords as bindings
-    self.cppHandle = bindings.Projector()
+    self._createModuleObj()
     return
 
 
-  def initialize(self, coordSys):
-    """
-    Initialize projector.
-    """
-
-    self.cppHandle.projection = self.projection
-    self.cppHandle.units = self.units
-    self.cppHandle.projOptions = self.projOptions
-    self.cppHandle.initialize(coordSys.cppHandle)
-    return
-
-
-  def project(self, lonlat):
-    """
-    Project geographic coordinates.
-    """
-    return self.cppHandle.project(lonlat)
-  
-
-  def invproject(self, xy):
-    """
-    Project geographic coordinates.
-    """
-    return self.cppHandle.invproject(xy)
-  
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -99,12 +72,20 @@
     Setup members using inventory.
     """
     Component._configure(self)
-    self.projection = self.inventory.projection
-    self.units = self.inventory.units
-    self.projOptions = self.inventory.projOptions
+    self.projection(self.inventory.projection)
+    self.units(self.inventory.units)
+    self.projOptions(self.inventory.projOptions)
     return
 
 
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    ModuleProjector.__init__(self)
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def coordsys():

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/CompositeDB.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/CompositeDB.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/CompositeDB.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,10 +16,11 @@
 ##
 ## Factory: spatial_database
 
-from SpatialDB import SpatialDB
+from SpatialDBObj import SpatialDBObj
+from spatialdb import CompositeDB as ModuleCompositeDB
 
 # CompositeDB class
-class CompositeDB(SpatialDB):
+class CompositeDB(SpatialDBObj, ModuleCompositeDB):
   """
   Python manager for spatial database with uniform values.
 
@@ -28,7 +29,7 @@
 
   # INVENTORY //////////////////////////////////////////////////////////
 
-  class Inventory(SpatialDB.Inventory):
+  class Inventory(SpatialDBObj.Inventory):
     """
     Python object for managing CompositeDB facilities and properties.
     """
@@ -52,12 +53,12 @@
     namesB = pyre.inventory.list("values_B", default=[])
     namesB.meta['tip'] = "Names of values to query with database B."
 
-    from SimpleDB import SimpleDB
-    dbA = pyre.inventory.facility("db_A", factory=SimpleDB,
+    from UniformDB import UniformDB
+    dbA = pyre.inventory.facility("db_A", factory=UniformDB,
                                   family="spatial_database")
     dbA.meta['tip'] = "Spatial database A."
 
-    dbB = pyre.inventory.facility("db_B", factory=SimpleDB,
+    dbB = pyre.inventory.facility("db_B", factory=UniformDB,
                                   family="spatial_database")
     dbB.meta['tip'] = "Spatial database B."
 
@@ -68,39 +69,31 @@
     """
     Constructor.
     """
-    SpatialDB.__init__(self, name)
-    import spatialdb as bindings
-    self.cppHandle = bindings.CompositeDB()
+    SpatialDBObj.__init__(self, name)
     return
 
 
-  def initialize(self):
-    """
-    Initialize database.
-    """
-    SpatialDB.initialize(self)
-    self.dbA.initialize()
-    self.dbB.initialize()
-    self.cppHandle.dbA(self.dbA.cppHandle, self.namesA)
-    self.cppHandle.dbB(self.dbB.cppHandle, self.namesB)
-    return
-  
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
     """
     Set members based on inventory.
     """
-    SpatialDB._configure(self)
+    SpatialDBObj._configure(self)
     self._validateParameters(self.inventory)
-    self.namesA = self.inventory.namesA
-    self.dbA = self.inventory.dbA
-    self.namesB = self.inventory.namesB
-    self.dbB = self.inventory.dbB
+    self.dbA(self.inventory.dbA, self.inventory.namesA)
+    self.dbB(self.inventory.dbB, self.inventory.namesB)
     return
 
 
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    ModuleCompositeDB.__init__(self)
+    return
+
+
   def _validateParameters(self, data):
     """
     Validate parameters.

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/GravityField.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/GravityField.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/GravityField.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,10 +16,11 @@
 ##
 ## Factory: spatial_database
 
-from SpatialDB import SpatialDB
+from SpatialDBObj import SpatialDBObj
+from spatialdb import GravityField as ModuleGravityField
 
 # GravityField class
-class GravityField(SpatialDB):
+class GravityField(SpatialDBObj, ModuleGravityField):
   """
   Python manager for spatial database with gravity field information.
 
@@ -28,7 +29,7 @@
 
   # INVENTORY //////////////////////////////////////////////////////////
 
-  class Inventory(SpatialDB.Inventory):
+  class Inventory(SpatialDBObj.Inventory):
     """
     Python object for managing GravityField facilities and properties.
     """
@@ -59,48 +60,45 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def __init__(self, name="uniformdb"):
+  def __init__(self, name="gravityfield"):
     """
     Constructor.
     """
-    SpatialDB.__init__(self, name)
-    import spatialdb as bindings
-    self.cppHandle = bindings.GravityField()
+    SpatialDBObj.__init__(self, name)
     return
 
 
-  def initialize(self):
-    """
-    Initialize database.
-    """
-    SpatialDB.initialize(self)
-    self.cppHandle.gravityDir(self.gravityDir)
-    self.cppHandle.gravAcceleration(self.acceleration.value)
-    return
-  
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
     """
     Set members based on inventory.
     """
-    SpatialDB._configure(self)
+    SpatialDBObj._configure(self)
     self._validateParameters(self.inventory)
-    self.gravityDir = self.inventory.gravityDir
-    self.acceleration = self.inventory.acceleration
+    dir = self.inventory.gravityDir
+    self.gravityDir(dir[0], dir[1], dir[2])
+    self.gravAcceleration(self.inventory.acceleration.value)
     return
 
 
-  def _validateParameters(self, data):
+  def _createModuleObj(self):
     """
+    Create Python module object.
+    """
+    ModuleGravityField.__init__(self)
+    return
+
+
+  def _validateParameters(self, params):
+    """
     Validate parameters.
     """
-    if (len(data.gravityDir) != 3):
+    if (len(params.gravityDir) != 3):
       raise ValueError, \
             "Gravity direction must be a 3 component list or tuple."
     try:
-      dataFloat = map(float, data.gravityDir)
+      dirFloat = map(float, params.gravityDir)
     except:
         raise ValueError, \
               "'gravityDir' must contain floating point values."

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SCECCVMH.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SCECCVMH.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SCECCVMH.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,10 +17,11 @@
 ##
 ## Factory: spatial_database
 
-from SpatialDB import SpatialDB
+from SpatialDBObj import SpatialDBObj
+from spatialdb import SCECCVMH as ModuleSCECCVMH
 
 # SCECCVMH class
-class SCECCVMH(SpatialDB):
+class SCECCVMH(SpatialDBObj, ModuleSCECCVMH):
   """
   Python manager for spatial database to the SCEC CVM-H.
 
@@ -29,7 +30,7 @@
 
   # INVENTORY //////////////////////////////////////////////////////////
 
-  class Inventory(SpatialDB.Inventory):
+  class Inventory(SpatialDBObj.Inventory):
     """
     Python object for managing SCECCVMH facilities and properties.
     """
@@ -71,35 +72,29 @@
     """
     Constructor.
     """
-    SpatialDB.__init__(self, name)
-    import spatialdb as bindings
-    self.cppHandle = bindings.SCECCVMH()
-    self.cppHandle.label = "SCEC CVM-H"
+    SpatialDBObj.__init__(self, name)
     return
 
 
-  def initialize(self):
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
     """
-    Initialize database.
+    Set members based on inventory.
     """
-    SpatialDB.initialize(self)
-    self.cppHandle.dataDir(self.dataDir)
-    self.cppHandle.minVs(self.minVs.value)
-    self.cppHandle.squash(self.squash, self.squashLimit.value)
+    SpatialDBObj._configure(self)
+    self.label("SCEC CVM-H")
+    self.dataDir(self.inventory.dataDir)
+    self.minVs(self.inventory.minVs.value)
+    self.squash(self.inventory.squash, self.inventory.squashLimit.value)
     return
-  
 
-  # PRIVATE METHODS ////////////////////////////////////////////////////
 
-  def _configure(self):
+  def _createModuleObj(self):
     """
-    Set members based on inventory.
+    Create Python module object.
     """
-    SpatialDB._configure(self)
-    self.dataDir = self.inventory.dataDir
-    self.minVs = self.inventory.minVs
-    self.squash = self.inventory.squash
-    self.squashLimit = self.inventory.squashLimit
+    ModuleSCECCVMH.__init__(self)
     return
 
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleDB.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleDB.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleDB.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,10 +16,11 @@
 ##
 ## Factory: spatial_database
 
-from SpatialDB import SpatialDB
+from SpatialDBObj import SpatialDBObj
+from spatialdb import SimpleDB as ModuleSimpleDB
 
 # SimpleDB class
-class SimpleDB(SpatialDB):
+class SimpleDB(SpatialDBObj, ModuleSimpleDB):
   """
   Python manager for simple spatial database.
 
@@ -28,7 +29,7 @@
 
   # INVENTORY //////////////////////////////////////////////////////////
 
-  class Inventory(SpatialDB.Inventory):
+  class Inventory(SpatialDBObj.Inventory):
     """
     Python object for managing SimpleDB facilities and properties.
     """
@@ -60,36 +61,40 @@
     """
     Constructor.
     """
-    SpatialDB.__init__(self, name)
-    import spatialdb as bindings
-    self.cppHandle = bindings.SimpleDB()
-    self.queryType = "nearest"
+    SpatialDBObj.__init__(self, name)
     return
 
 
-  def initialize(self):
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
     """
-    Initialize database.
+    Set members based on inventory.
     """
-    self.iohandler.initialize()
-    SpatialDB.initialize(self)
-    self.cppHandle.ioHandler(self.iohandler.cppHandle)
-    self.cppHandle.queryType(self.queryType)
+    SpatialDBObj._configure(self)
+    self.ioHandler(self.inventory.iohandler)
+    self.queryType(self._parseQueryString(self.inventory.queryType))
     return
-  
 
-  # PRIVATE METHODS ////////////////////////////////////////////////////
 
-  def _configure(self):
+  def _createModuleObj(self):
     """
-    Set members based on inventory.
+    Create Python module object.
     """
-    SpatialDB._configure(self)
-    self.iohandler = self.inventory.iohandler
-    self.queryType = self.inventory.queryType
+    ModuleSimpleDB.__init__(self)
     return
 
 
+  def _parseQueryString(self, label):
+    if label.lower() == "nearest":
+      value = ModuleSimpleDB.NEAREST
+    elif label.lower() == "linear":
+      value = ModuleSimpleDB.LINEAR
+    else:
+      raise ValueError("Unknown value for query type '%s'." % label)
+    return value
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def spatial_database():

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleIO.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleIO.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleIO.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -55,18 +55,10 @@
     Constructor.
     """
     Component.__init__(self, name, facility="simpledb_io")
-    self.cppHandle = None
+    self._createModuleObj()
     return
 
 
-  def initialize(self):
-    """
-    Initialize the database.
-    """
-    self.cppHandle.filename(self.filename)
-    return
-    
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -74,10 +66,32 @@
     Set members using inventory.
     """
     Component._configure(self)
-    self.filename = self.inventory.filename
+    self.filename(self.inventory.filename)
     return
 
 
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    raise NotImplementedError("_createModuleObj() not implemented.")
+    return
+
+
+  def _validateData(self, data):
+    """
+    Check consistency of database data.
+    """
+    (numLocs, spaceDim) = data['locs'].shape
+    cs = data['coordsys']
+    if spaceDim != cs.spaceDim():
+      raise ValueError, \
+          "Simple database space-dim (%d) does not agree with spatial "\
+          "dimension of coordinate system (%d)." % \
+          (spaceDim, cs.spaceDim())
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def simpledb_io():

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleIOAscii.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleIOAscii.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SimpleIOAscii.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,11 +17,10 @@
 ## Factory: simpledb_io
 
 from SimpleIO import SimpleIO
+from spatialdb import SimpleIOAscii as ModuleSimpleIOAscii
 
-import numpy
-
 # SimpleIOAscii class
-class SimpleIOAscii(SimpleIO):
+class SimpleIOAscii(SimpleIO, ModuleSimpleIOAscii):
   """
   Python ascii I/O manager for simple spatial database (SimpleDB).
 
@@ -35,8 +34,6 @@
     Constructor.
     """
     SimpleIO.__init__(self, name)
-    import spatialdb as bindings
-    self.cppHandle = bindings.SimpleIOAscii()
     return
 
 
@@ -52,24 +49,45 @@
                           'units': Units of value,
                           'data': Data for value (numLocs)}]}
     """
+    import numpy
+
+    self._validateData(data)
+
+    (numLocs, spaceDim) = data['locs'].shape
+    dataDim = data['data_dim']
+    numValues = len(data['values'])    
     names = []
     units = []
-    (numLocs, spaceDim) = data['locs'].shape
-    dataDim = data['data_dim']
-    numValues = len(data['values'])
-    dbData = numpy.zeros( (numLocs, spaceDim+numValues), dtype=numpy.float64)
-    dbData[:,0:spaceDim] = data['locs'][:]
-    i = spaceDim
+    values = numpy.zeros( (numLocs, numValues), dtype=numpy.float64)
+    i = 0
     for value in data['values']:
       names.append(value['name'])
       units.append(value['units'])
-      dbData[:,i] = value['data'][:]
+      values[:,i] = value['data'][:]
       i += 1
-    cs = data['coordsys']
-    self.cppHandle.write(names, units, dbData, spaceDim, dataDim, cs.cppHandle)
+
+    from spatialdb import SimpleDBData
+    dbData = SimpleDBData()
+    dbData.allocate(numLocs, numValues, spaceDim, dataDim)
+    dbData.coordinates(data['locs'])
+    dbData.data(values)
+    dbData.names(names)
+    dbData.units(units)
+
+    ModuleSimpleIOAscii.write(self, dbData, data['coordsys'])
     return
 
 
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    ModuleSimpleIOAscii.__init__(self)
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def simpledb_io():

Deleted: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDB.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDB.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDB.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,123 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file spatialdata/spatialdb/SpatialDB.py
-##
-## @brief Python abstract base class for spatial database.
-##
-## Factory: spatial_database
-
-from pyre.components.Component import Component
-
-import spatialdb as bindings
-
-# SpatialDB class
-class SpatialDB(Component):
-  """
-  Python abstract base class for spatial database.
-
-  Factory: spatial_database
-  """
-
-  # INVENTORY //////////////////////////////////////////////////////////
-
-  class Inventory(Component.Inventory):
-    """
-    Python object for managing SpatialDB facilities and properties.
-    """
-
-    ## @class Inventory
-    ## Python object for managing SpatialDB facilities and properties.
-    ##
-    ## \b Properties
-    ## @li \b label Label of database
-    ##
-    ## \b Facilities
-    ## @li None
-
-    import pyre.inventory
-
-    label = pyre.inventory.str("label", default="spatial database")
-    label.meta['tip'] = "Label of database."
-
-
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def __init__(self, name="spatialdb"):
-    """
-    Constructor.
-    """
-    Component.__init__(self, name, facility="spatial_database")
-    self.cppHandle = None
-    return
-
-
-  def initialize(self):
-    """
-    Initialize database.
-    """
-    self.cppHandle.label = self.label
-    return
-
-
-  def open(self):
-    """
-    Open database and prepare for querying.
-    """
-    self.cppHandle.open()
-    return
-
-
-  def close(self):
-    """
-    Close database.
-    """
-    self.cppHandle.close()
-    return
-
-
-  def queryVals(self, names):
-    """
-    Set values to return in queries.
-    """
-    self.cppHandle.queryVals(names)
-    return
-
-
-  def query(self, locs, cs, numvals):
-    """
-    Perform query of db to get values at locations.
-    """
-    return self.cppHandle.query(locs, cs.cppHandle, numvals)
-
-
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _configure(self):
-    """
-    Set attributes based on inventory.
-    """
-    Component._configure(self)
-    self.label = self.inventory.label
-    return
-  
-
-# FACTORIES ////////////////////////////////////////////////////////////
-
-def spatial_database():
-  """
-  Factory associated with SimpleDB.
-  """
-  return SpatialDB()
-
-
-# End of file 

Copied: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDBObj.py (from rev 13871, cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDB.py)
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDBObj.py	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/SpatialDBObj.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file spatialdata/spatialdb/SpatialDBObj.py
+##
+## @brief Python abstract base class for spatial database.
+##
+## Factory: spatial_database
+
+from pyre.components.Component import Component
+from spatialdb import SpatialDB as ModuleSpatialDB
+
+# SpatialDBObj class
+class SpatialDBObj(Component, ModuleSpatialDB):
+  """
+  Python abstract base class for spatial database.
+
+  Factory: spatial_database
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(Component.Inventory):
+    """
+    Python object for managing SpatialDBObj facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing SpatialDBObj facilities and properties.
+    ##
+    ## \b Properties
+    ## @li \b label Label of database
+    ##
+    ## \b Facilities
+    ## @li None
+
+    import pyre.inventory
+
+    label = pyre.inventory.str("label", default="spatial database")
+    label.meta['tip'] = "Label of database."
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="spatialdb"):
+    """
+    Constructor.
+    """
+    Component.__init__(self, name, facility="spatial_database")
+    self._createModuleObj()
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set attributes based on inventory.
+    """
+    Component._configure(self)
+    self.label(self.inventory.label)
+    return
+  
+
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    raise NotImplementedError("_createModuleObj() not implemented.")
+    return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def spatial_database():
+  """
+  Factory associated with SimpleDB.
+  """
+  return SpatialDBObj()
+
+
+# End of file 

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/UniformDB.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/UniformDB.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/UniformDB.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,10 +16,11 @@
 ##
 ## Factory: spatial_database
 
-from SpatialDB import SpatialDB
+from SpatialDBObj import SpatialDBObj
+from spatialdb import UniformDB as ModuleUniformDB
 
 # UniformDB class
-class UniformDB(SpatialDB):
+class UniformDB(SpatialDBObj, ModuleUniformDB):
   """
   Python manager for spatial database with uniform values.
 
@@ -28,7 +29,7 @@
 
   # INVENTORY //////////////////////////////////////////////////////////
 
-  class Inventory(SpatialDB.Inventory):
+  class Inventory(SpatialDBObj.Inventory):
     """
     Python object for managing UniformDB facilities and properties.
     """
@@ -58,46 +59,43 @@
     """
     Constructor.
     """
-    SpatialDB.__init__(self, name)
-    import spatialdb as bindings
-    self.cppHandle = bindings.UniformDB()
+    SpatialDBObj.__init__(self, name)
     return
 
 
-  def initialize(self):
-    """
-    Initialize database.
-    """
-    SpatialDB.initialize(self)
-    self.cppHandle.setData(self.values, self.data)
-    return
-  
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
     """
     Set members based on inventory.
     """
-    SpatialDB._configure(self)
+    SpatialDBObj._configure(self)
     self._validateParameters(self.inventory)
-    self.values = self.inventory.values
-    self.data = map(float, self.inventory.data)
+    data = map(float, self.inventory.data)
+    self.setData(self.inventory.values, data)
     return
 
+  
+  def _createModuleObj(self):
+    """
+    Create Python module object.
+    """
+    ModuleUniformDB.__init__(self)
+    return
 
-  def _validateParameters(self, data):
+
+  def _validateParameters(self, params):
     """
     Validate parameters.
     """
-    if (len(data.values) != len(data.data)):
+    if (len(params.values) != len(params.data)):
       raise ValueError, \
             "Incompatible settings for uniform spatial database '%s'.\n"\
             "'values' and 'data' must be lists of the same size.\n"\
             "'values' has size of %d but 'data' has size of %d." \
-            % (self.label, len(data.values), len(data.data))
+            % (self.label, len(params.values), len(params.data))
     try:
-      dataFloat = map(float, data.data)
+      dataFloat = map(float, params.data)
     except:
         raise ValueError, \
               "'data' list must contain floating point values."

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/__init__.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/__init__.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/__init__.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -18,7 +18,7 @@
            'SimpleDB',
            'SimpleIOAscii',
            'SimpleIO',
-           'SpatialDB',
+           'SpatialDBObj',
            'UniformDB',
            'generator']
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/GenSimpleDBApp.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/GenSimpleDBApp.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/GenSimpleDBApp.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -87,7 +87,6 @@
                              'units': value.units,
                              'data': value.calculate(locs, coordsys)})
     self._info.log("Writing database.")
-    self.iohandler.initialize()
     self.iohandler.write(data)
     return
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Shaper.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Shaper.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/spatialdb/generator/Shaper.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -84,7 +84,6 @@
       raise ValueError, \
             "Name of value in spatial database must be set for shaper '%s'." %\
             self.name
-    self.db.initialize()
     self.db.open()
     return
 
@@ -101,10 +100,17 @@
     """
     Shape value.
     """
+    nlocs = locs.shape[0]
+
     self.db.queryVals([self.dbValue])
-    (vals, err) = self.db.query(locs, cs, numvals=1)
+    v = numpy.zeros( (1,), dtype=numpy.float64)
+    vals = numpy.zeros( (nlocs,), dtype=numpy.float64)
+    err = numpy.ones( (nlocs,), dtype=numpy.int32)
+    for i in xrange(nlocs):
+      e = self.db.query(v, locs[i,:], cs)
+      vals[i] = v[0]
+      err[i] = e
     vals = numpy.reshape(numpy.array(vals), -1)
-    err = numpy.array(err)
     default = self.defaultValue*numpy.ones( vals.shape, dtype=numpy.float64)
     mask = numpy.zeros( vals.shape, dtype=numpy.float64)
     mask[err[:] != 0] = 1.0

Modified: cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticDynamic.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticDynamic.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticDynamic.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -88,11 +88,10 @@
     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
-
+    self.setLengthScale(vs * period)
+    self.setPressureScale(vs**2 * density)
+    self.setTimeScale(period)
+    self.setDensityScale(density)
     return
 
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticQuasistatic.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticQuasistatic.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/units/NondimElasticQuasistatic.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -85,9 +85,9 @@
     Setup members using inventory.
     """
     Nondimensional._configure(self)
-    self._length = self.inventory.lengthScale
-    self._pressure = self.inventory.shearModulus
-    self._time = self.inventory.relaxationTime
+    self.setLengthScale(self.inventory.lengthScale)
+    self.setPressureScale(self.inventory.shearModulus)
+    self.setTimeScale(self.inventory.relaxationTime)
 
     return
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/units/Nondimensional.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/units/Nondimensional.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/units/Nondimensional.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,9 +17,10 @@
 ## Factory: nondimensional
 
 from pyre.components.Component import Component
+from units import Nondimensional as ModuleNondimensional
 
 # Nondimensional class
-class Nondimensional(Component):
+class Nondimensional(Component, ModuleNondimensional):
   """
   Python manager for nondimensionalizing problems.
 
@@ -48,58 +49,69 @@
     Constructor.
     """
     Component.__init__(self, name, facility="nondimensional")
-
-    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
+    self._createModuleObj()
     return
 
 
-  def initialize(self):
+  def setLengthScale(self, value):
     """
-    Initialize coordinate system.
+    Get length scale.
     """
-    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
+    return ModuleNondimensional.lengthScale(self, value.value)
 
 
   def lengthScale(self):
     """
     Get length scale.
     """
-    return self._length
+    from pyre.units.length import meter
+    return ModuleNondimensional.lengthScale(self) * meter
 
 
+  def setPressureScale(self, value):
+    """
+    Get length scale.
+    """
+    return ModuleNondimensional.pressureScale(self, value.value)
+
+
   def pressureScale(self):
     """
     Get pressure scale.
     """
-    return self._pressure
+    from pyre.units.pressure import pascal
+    return ModuleNondimensional.pressureScale(self) * pascal
 
 
+  def setTimeScale(self, value):
+    """
+    Get time scale.
+    """
+    return ModuleNondimensional.timeScale(self, value.value)
+
+
   def timeScale(self):
     """
     Get time scale.
     """
-    return self._time
+    from pyre.units.time import second
+    return ModuleNondimensional.timeScale(self) * second
 
 
+  def setDensityScale(self, value):
+    """
+    Get density scale.
+    """
+    return ModuleNondimensional.densityScale(self, value.value)
+
+
   def densityScale(self):
     """
     Get density scale.
     """
-    return self._density
+    from pyre.units.length import meter
+    from pyre.units.mass import kilogram
+    return ModuleNondimensional.densityScale(self) * kilogram / meter**3
 
 
   def nondimensionalize(self, value, scale):
@@ -126,13 +138,11 @@
     return
 
 
-  def _createCppHandle(self):
+  def _createModuleObj(self):
     """
-    Create handle to C++ object.
+    Create Python module object.
     """
-    if None == self.cppHandle:
-      import spatialdata.units.units as bindings
-      self.cppHandle = bindings.Nondimensional()
+    ModuleNondimensional.__init__(self)
     return
 
 

Modified: cs/spatialdata-0.1/trunk/spatialdata/utils/PointsStream.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/utils/PointsStream.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/spatialdata/utils/PointsStream.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -18,6 +18,8 @@
 
 from pyre.components.Component import Component
 
+import numpy
+
 # PointsStream class
 class PointsStream(Component):
   """
@@ -40,8 +42,7 @@
     ## @li \b filename Name of file for input/output
     ##          (default is to use stdin/stdout).
     ## @li \b commentFlag String identifying comment (input).
-    ## @li \b field_width Width of field for coordinates (output).
-    ## @li \b precision Decimnal precision of coordinates (output).
+    ## @li \b numFormat C style string specifying number format.
     ##
     ## \b Facilities
     ## @li None
@@ -54,23 +55,18 @@
     commentFlag = pyre.inventory.str("comment_flag", default="#")
     commentFlag.meta['tip'] = "String identifying comment."
 
-    fieldWidth = pyre.inventory.int("field_width", default=14)
-    fieldWidth.meta['tip'] = "Width of field for coordinates."
-    fieldWidth.validator = pyre.inventory.greater(0)
+    numFormat = pyre.inventory.str("number_format", default="%14.5e")
+    numFormat.meta['tip'] = "C style string specifying number format."
 
-    precision = pyre.inventory.int("precision", default=5)
-    precision.meta['tip'] = "Decimal precision of coordinates."
-    precision.validator = pyre.inventory.greaterEqual(0)
 
-
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def read(self):
     """
     Read points from stdin.
     """
-    self._sync()
-    points = self.cppHandle.read()
+    points = numpy.loadtxt(self.filename,
+                           comments=self.commentFlag)
     return points
 
 
@@ -78,8 +74,9 @@
     """
     Write points to stdout.
     """
-    self._sync()
-    self.cppHandle.write(points)
+    numpy.savetxt(self.filename,
+                  points,
+                  fmt=self.numFormat)
     return
 
 
@@ -88,12 +85,6 @@
     Constructor.
     """
     Component.__init__(self, name, facility="pointsstream")
-    import spatialdata.utils.utils as bindings
-    self.cppHandle = bindings.PointsStream()
-    self.filename = ""
-    self.commentFlag = "#"
-    self.fieldWidth = 14
-    self.precision = 5
     return
 
 
@@ -105,22 +96,10 @@
     """
     self.filename = self.inventory.filename
     self.commentFlag = self.inventory.commentFlag
-    self.fieldWidth = self.inventory.fieldWidth
-    self.precision = self.inventory.precision
+    self.numFormat = self.inventory.numFormat
     return
 
 
-  def _sync(self):
-    """
-    Synchronize with C++ object.
-    """
-    self.cppHandle.filename = self.filename
-    self.cppHandle.commentFlag = self.commentFlag
-    self.cppHandle.fieldWidth = self.fieldWidth
-    self.cppHandle.precision = self.precision
-    return
-
-
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def writer():

Modified: cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestProjector.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestProjector.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/geocoords/TestProjector.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -19,6 +19,7 @@
 #include "spatialdata/geocoords/CoordSys.hh" // USES CSGeo
 #include "spatialdata/geocoords/CSGeo.hh" // USES CSGeo
 
+#include <valarray> // USES std::valarray
 #include <string.h> // USES strcmp()
 #include <strings.h> // USES strcasecmp()
 #include <sstream> // USES std::stringstream
@@ -112,16 +113,15 @@
   proj.initialize(cs);
 
   const int numLocs = _NUMLOCS;
-  for (int iLoc=0; iLoc < numLocs; ++iLoc) {
-    double x = 0;
-    double y = 0;
-    const double* pLonLat = &_LONLAT[2*iLoc];
-    proj.project(&x, &y, pLonLat[0], pLonLat[1]);
-    const double* pXY = &_XY[2*iLoc];
-    const double tolerance = 1.0e-6;
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(x/pXY[0], 1.0, tolerance);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(y/pXY[1], 1.0, tolerance);
-  } // for
+  const int numDims = 2;
+  const int size = numDims * numLocs;
+  std::valarray<double> coords(size);
+  memcpy(&coords[0], _LONLAT, size*sizeof(double));
+
+  proj.project(&coords[0], numLocs, numDims);
+  const double tolerance = 1.0e-6;
+  for (int i=0; i < size; ++i)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(coords[i]/_XY[i], 1.0, tolerance);
 } // testProject
 
 // ----------------------------------------------------------------------
@@ -141,16 +141,15 @@
   proj.initialize(cs);
 
   const int numLocs = _NUMLOCS;
-  for (int iLoc=0; iLoc < numLocs; ++iLoc) {
-    double lon = 0;
-    double lat = 0;
-    const double* pXY = &_XY[2*iLoc];
-    proj.invproject(&lon, &lat, pXY[0], pXY[1]);
-    const double* pLonLat = &_LONLAT[2*iLoc];
-    const double tolerance = 1.0e-6;
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, lon/pLonLat[0], tolerance);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, lat/pLonLat[1], tolerance);
-  } // for
+  const int numDims = 2;
+  const int size = numDims * numLocs;
+  std::valarray<double> coords(size);
+  memcpy(&coords[0], _XY, size*sizeof(double));
+
+  proj.invproject(&coords[0], numLocs, numDims);
+  const double tolerance = 1.0e-6;
+  for (int i=0; i < size; ++i)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(coords[i]/_LONLAT[i], 1.0, tolerance);
 } // testInvproject
 
 // ----------------------------------------------------------------------
@@ -173,7 +172,5 @@
   CPPUNIT_ASSERT(0 == strcasecmp(_PROJOPTIONS, projB.projOptions()));
 } // testPickle
 
-// version
-// $Id$
 
 // End of file 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -23,6 +23,7 @@
 	TestCompositeDB.cc \
 	TestGravityField.cc \
 	TestSCECCVMH.cc \
+	TestSimpleDBData.cc \
 	TestSimpleDBQuery.cc \
 	TestSimpleDBQuery3D.cc \
 	TestSimpleDB.cc \
@@ -40,6 +41,7 @@
 	TestCompositeDB.hh \
 	TestGravityField.hh \
 	TestSCECCVMH.hh \
+	TestSimpleDBData.hh \
 	TestSimpleDBQuery.hh \
 	TestSimpleDBQuery3D.hh \
 	TestSimpleDB.hh \
@@ -66,20 +68,20 @@
 testspatial_SOURCES += \
 	data/SimpleDBQueryData.cc \
 	data/SimpleDBQueryData3D.cc \
-	data/SimpleDBData.cc \
-	data/SimpleDBDataPoint3D.cc \
-	data/SimpleDBDataLine3D.cc \
-	data/SimpleDBDataArea3D.cc \
-	data/SimpleDBDataVolume3D.cc
+	data/SimpleDBTestData.cc \
+	data/SimpleDBTestDataPoint3D.cc \
+	data/SimpleDBTestDataLine3D.cc \
+	data/SimpleDBTestDataArea3D.cc \
+	data/SimpleDBTestDataVolume3D.cc
 
 noinst_HEADERS += \
 	data/SimpleDBQueryData.hh \
 	data/SimpleDBQueryData3D.hh \
-	data/SimpleDBData.hh \
-	data/SimpleDBDataPoint3D.hh \
-	data/SimpleDBDataLine3D.hh \
-	data/SimpleDBDataArea3D.hh \
-	data/SimpleDBDataVolume3D.hh
+	data/SimpleDBTestData.hh \
+	data/SimpleDBTestDataPoint3D.hh \
+	data/SimpleDBTestDataLine3D.hh \
+	data/SimpleDBTestDataArea3D.hh \
+	data/SimpleDBTestDataVolume3D.hh
 
 
 # End of file 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,9 +16,9 @@
 
 #include "TestSimpleDB.hh" // Implementation of class methods
 
-#include "data/SimpleDBData.hh" // USES SimpleDBData
+#include "data/SimpleDBTestData.hh" // USES SimpleDBTestData
 
-#include "spatialdata/spatialdb/SimpleDBTypes.hh" // USES SimpleDBTypes
+#include "spatialdata/spatialdb/SimpleDBData.hh" // USES SimpleDBData
 #include "spatialdata/spatialdb/SimpleDBQuery.hh" // USES SimpleDBQuery
 
 #include "spatialdata/geocoords/CSCart.hh" // USE CSCart
@@ -61,7 +61,7 @@
 // Test query() using nearest neighbor
 void
 spatialdata::spatialdb::TestSimpleDB::_testQueryNearest(
-						  const SimpleDBData& data)
+					  const SimpleDBTestData& data)
 { // _testQueryNearest
   SimpleDB db;
   _setupDB(&db, data);
@@ -74,7 +74,7 @@
 // Test query() using linear interpolation
 void
 spatialdata::spatialdb::TestSimpleDB::_testQueryLinear(
-						  const SimpleDBData& data)
+						  const SimpleDBTestData& data)
 { // _testQueryLinear
   SimpleDB db;
   _setupDB(&db, data);
@@ -87,33 +87,16 @@
 // Populate database with data.
 void
 spatialdata::spatialdb::TestSimpleDB::_setupDB(SimpleDB* const db,
-					       const SimpleDBData& data)
+					 const SimpleDBTestData& data)
 { // _setupDB
-  SimpleDB::DataStruct* dbData = new SimpleDB::DataStruct;
+  SimpleDBData* dbData = new SimpleDBData;
+  dbData->allocate(data.numLocs, data.numVals, data.spaceDim,
+		   data.dataDim);
+  dbData->data(data.dbData, data.numLocs, data.numVals);
+  dbData->coordinates(data.dbCoords, data.numLocs, data.spaceDim);
+  dbData->names(const_cast<const char**>(data.names), data.numVals);
+  dbData->units(const_cast<const char**>(data.units), data.numVals);
 
-  const int numLocs = data.numLocs;
-  const int spaceDim = data.spaceDim;
-  const int numVals = data.numVals;
-  const int dataDim = data.dataDim;
-
-  const int size = numLocs * (spaceDim + numVals);
-  CPPUNIT_ASSERT(0 < size);
-  dbData->data = new double[size];
-  memcpy(dbData->data, data.dbData, size*sizeof(double));
-
-  dbData->valNames = new std::string[numVals];
-  for (int i=0; i < numVals; ++i)
-    dbData->valNames[i] = data.names[i];
-
-  dbData->valUnits = new std::string[numVals];
-  for (int i=0; i < numVals; ++i)
-    dbData->valUnits[i] = data.units[i];
-
-  dbData->numLocs = numLocs;
-  dbData->spaceDim = spaceDim;
-  dbData->numVals = numVals;
-  dbData->dataDim = dataDim;
-
   db->_data = dbData;
   db->_query = new SimpleDBQuery(*db);
   db->_cs = new spatialdata::geocoords::CSCart();

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -28,7 +28,7 @@
   namespace spatialdb {
     class TestSimpleDB;
     class SimpleDB; // USES SimpleDB
-    class SimpleDBData; // USES SimpleDBData
+    class SimpleDBTestData; // USES SimpleDBTestData
   } // spatialdb
 } // spatialdata
 
@@ -62,13 +62,13 @@
    *
    * @param data Data for database
    */
-  void _testQueryNearest(const SimpleDBData& data);
+  void _testQueryNearest(const SimpleDBTestData& data);
 
   /** Test query() using linear interpolation
    *
    * @param data Data for database
    */
-  void _testQueryLinear(const SimpleDBData& data);
+  void _testQueryLinear(const SimpleDBTestData& data);
 
   // PRIVATE METHODS ////////////////////////////////////////////////////
 private :
@@ -79,7 +79,7 @@
    * @param data Data for database
    */
   void _setupDB(SimpleDB* const db,
-		const SimpleDBData& data);
+		const SimpleDBTestData& data);
 
   /** Test query method by doing query and checking values returned.
    * 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -14,7 +14,7 @@
 
 #include "TestSimpleDBArea3D.hh" // Implementation of class methods
 
-#include "data/SimpleDBDataArea3D.hh"
+#include "data/SimpleDBTestDataArea3D.hh"
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBArea3D );
@@ -24,7 +24,7 @@
 void
 spatialdata::spatialdb::TestSimpleDBArea3D::testQueryLinear(void)
 { // testQueryLinear
-  SimpleDBDataArea3D data;
+  SimpleDBTestDataArea3D data;
 
   _testQueryLinear(data);
 } // testQueryLinear
@@ -34,7 +34,7 @@
 void
 spatialdata::spatialdb::TestSimpleDBArea3D::testQueryNearest(void)
 { // testQueryNearest
-  SimpleDBDataArea3D data;
+  SimpleDBTestDataArea3D data;
 
   _testQueryNearest(data);
 } // testQueryNearest

Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBData.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBData.cc	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBData.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestSimpleDBData.hh" // Implementation of class methods
+
+#include "spatialdata/spatialdb/SimpleDBData.hh" // USES SimpleDBData
+
+#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
+
+#include <string.h> // USES strcmp()
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBData );
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+spatialdata::spatialdb::TestSimpleDBData::testConstructor(void)
+{ // testConstructor
+  SimpleDBData data;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test allocate(), numLocs(), numValues(), spaceDim().
+void
+spatialdata::spatialdb::TestSimpleDBData::testAllocate(void)
+{ // testAllocate
+  const int numLocs = 4;
+  const int numValues = 5;
+  const int spaceDim = 3;
+  const int dataDim = 1;
+
+  SimpleDBData data;
+  data.allocate(numLocs, numValues, spaceDim, dataDim);
+
+  CPPUNIT_ASSERT_EQUAL(numLocs, data.numLocs());
+  CPPUNIT_ASSERT_EQUAL(numValues, data.numValues());
+  CPPUNIT_ASSERT_EQUAL(spaceDim, data.spaceDim());
+  CPPUNIT_ASSERT_EQUAL(dataDim, data.dataDim());
+  CPPUNIT_ASSERT(0 != data._data);
+  CPPUNIT_ASSERT(0 != data._coordinates);
+  CPPUNIT_ASSERT(0 != data._names);
+  CPPUNIT_ASSERT(0 != data._units);
+} // testAllocate
+
+// ----------------------------------------------------------------------
+// Test data()
+void
+spatialdata::spatialdb::TestSimpleDBData::testData(void)
+{ // testData
+  const int numLocs = 4;
+  const int numValues = 2;
+  const int spaceDim = 3;
+  const int dataDim = 1;
+
+  const double valuesE[] = {
+    0.11, 0.21,
+    0.12, 0.22,
+    0.13, 0.23,
+    0.14, 0.24,
+  };
+
+  SimpleDBData data;
+  data.allocate(numLocs, numValues, spaceDim, dataDim);
+  data.data(valuesE, numLocs, numValues);
+
+  for (int iLoc=0, i=0; iLoc < numLocs; ++iLoc) {
+    const double* values = data.data(iLoc);
+    CPPUNIT_ASSERT(0 != values);
+    for (int iVal=0; iVal < numValues; ++iVal)
+      CPPUNIT_ASSERT_EQUAL(valuesE[i++], values[iVal]);
+  } // for
+} // testData
+
+// ----------------------------------------------------------------------
+// Test coordinates()
+void
+spatialdata::spatialdb::TestSimpleDBData::testCoordinates(void)
+{ // testCoordinates
+  const int numLocs = 4;
+  const int numValues = 2;
+  const int spaceDim = 3;
+  const int dataDim = 1;
+
+  const double coordsE[] = {
+    1.1, 2.1, 3.1,
+    1.2, 2.2, 3.2,
+    1.3, 2.3, 3.3,
+    1.4, 2.4, 3.4,
+  };
+
+  SimpleDBData data;
+  data.allocate(numLocs, numValues, spaceDim, dataDim);
+  data.coordinates(coordsE, numLocs, spaceDim);
+
+  for (int iLoc=0, i=0; iLoc < numLocs; ++iLoc) {
+    const double* coords = data.coordinates(iLoc);
+    CPPUNIT_ASSERT(0 != coords);
+    for (int iDim=0; iDim < spaceDim; ++iDim)
+      CPPUNIT_ASSERT_EQUAL(coordsE[i++], coords[iDim]);
+  } // for
+} // testCoordinates
+
+// ----------------------------------------------------------------------
+// Test names()
+void
+spatialdata::spatialdb::TestSimpleDBData::testNames(void)
+{ // testNames
+  const int numLocs = 4;
+  const int numValues = 2;
+  const int spaceDim = 3;
+  const int dataDim = 1;
+
+  const char* namesE[] = {
+    "one", "two",
+  };
+
+  SimpleDBData data;
+  data.allocate(numLocs, numValues, spaceDim, dataDim);
+  data.names(namesE, numValues);
+
+  for (int i=0; i < numValues; ++i)
+    CPPUNIT_ASSERT_EQUAL(std::string(namesE[i]),
+			 std::string(data.name(i)));
+} // testNames
+
+// ----------------------------------------------------------------------
+// Test units()
+void
+spatialdata::spatialdb::TestSimpleDBData::testUnits(void)
+{ // testUnits
+  const int numLocs = 4;
+  const int numValues = 2;
+  const int spaceDim = 3;
+  const int dataDim = 1;
+
+  const char* unitsE[] = {
+    "m", "m/s",
+  };
+
+  SimpleDBData data;
+  data.allocate(numLocs, numValues, spaceDim, dataDim);
+  data.units(unitsE, numValues);
+
+  for (int i=0; i < numValues; ++i)
+    CPPUNIT_ASSERT_EQUAL(std::string(unitsE[i]),
+			 std::string(data.units(i)));
+} // testUnits
+
+
+// End of file 

Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBData.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBData.hh	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBData.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file tests/libtests/spatialdb/TestSimpleDBData.hh
+ *
+ * @brief C++ TestSimpleDBData object
+ *
+ * C++ unit testing for SimpleDBData.
+ */
+
+#if !defined(spatialdata_spatialdb_testsimpledbdata_hh)
+#define spatialdata_spatialdb_testsimpledbdata_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for spatial package
+namespace spatialdata {
+  namespace spatialdb {
+    class TestSimpleDBData;
+  } // spatialdb
+} // spatialdata
+
+/// C++ unit testing for SimpleDBData
+class spatialdata::spatialdb::TestSimpleDBData : public CppUnit::TestFixture
+{ // class TestSimpleDBData
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestSimpleDBData );
+
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testAllocate );
+  CPPUNIT_TEST( testData );
+  CPPUNIT_TEST( testCoordinates );
+  CPPUNIT_TEST( testNames );
+  CPPUNIT_TEST( testUnits );
+
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test constructor.
+  void testConstructor(void);
+
+  /// Test allocate(), numLocs(), numValues(), spaceDim().
+  void testAllocate(void);
+
+  /// Test data() and dataDim().
+  void testData(void);
+
+  /// Test coordinates()
+  void testCoordinates(void);
+
+  /// Test names()
+  void testNames(void);
+
+  /// Test units()
+  void testUnits(void);
+
+}; // class TestSimpleDBData
+
+#endif // spatialdata_spatialdb_testsimpledbdata_hh
+
+
+// End of file 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -14,7 +14,7 @@
 
 #include "TestSimpleDBLine3D.hh" // Implementation of class methods
 
-#include "data/SimpleDBDataLine3D.hh"
+#include "data/SimpleDBTestDataLine3D.hh"
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBLine3D );
@@ -24,7 +24,7 @@
 void
 spatialdata::spatialdb::TestSimpleDBLine3D::testQueryLinear(void)
 { // testQueryLinear
-  SimpleDBDataLine3D data;
+  SimpleDBTestDataLine3D data;
 
   _testQueryLinear(data);
 } // testQueryLinear
@@ -34,7 +34,7 @@
 void
 spatialdata::spatialdb::TestSimpleDBLine3D::testQueryNearest(void)
 { // testQueryNearest
-  SimpleDBDataLine3D data;
+  SimpleDBTestDataLine3D data;
 
   _testQueryNearest(data);
 } // testQueryNearest

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -14,7 +14,7 @@
 
 #include "TestSimpleDBPoint3D.hh" // Implementation of class methods
 
-#include "data/SimpleDBDataPoint3D.hh"
+#include "data/SimpleDBTestDataPoint3D.hh"
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBPoint3D );
@@ -24,7 +24,7 @@
 void
 spatialdata::spatialdb::TestSimpleDBPoint3D::testQueryLinear(void)
 { // testQueryLinear
-  SimpleDBDataPoint3D data;
+  SimpleDBTestDataPoint3D data;
 
   _testQueryLinear(data);
 } // testQueryLinear
@@ -34,7 +34,7 @@
 void
 spatialdata::spatialdb::TestSimpleDBPoint3D::testQueryNearest(void)
 { // testQueryNearest
-  SimpleDBDataPoint3D data;
+  SimpleDBTestDataPoint3D data;
 
   _testQueryNearest(data);
 } // testQueryNearest

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -14,10 +14,9 @@
 
 #include "TestSimpleDBQuery.hh" // Implementation of class methods
 
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SimpleDB
 #include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
 #include "spatialdata/spatialdb/SimpleDBQuery.hh" // USES SimpleDBQuery
-#include "spatialdata/spatialdb/SimpleDBTypes.hh" // USES SimpleDBTypes
+#include "spatialdata/spatialdb/SimpleDBData.hh" // USES SimpleDBData
 
 #include "spatialdata/geocoords/CSCart.hh" // USE CSCart
 
@@ -64,29 +63,14 @@
 spatialdata::spatialdb::TestSimpleDBQuery::_setupDB(SimpleDB* const db,
 						    const SimpleDBQueryData& data)
 { // _setupDB
-  SimpleDB::DataStruct* pData = new SimpleDB::DataStruct;
+  SimpleDBData* pData = new SimpleDBData;
+  pData->allocate(data.numLocs, data.numVals, data.spaceDim,
+		  data.dataDim);
+  pData->data(data.dbData, data.numLocs, data.numVals);
+  pData->coordinates(data.dbCoords, data.numLocs, data.spaceDim);
+  pData->names(const_cast<const char**>(data.names), data.numVals);
+  pData->units(const_cast<const char**>(data.units), data.numVals);
 
-  const int numCoords = data.spaceDim;
-  const int numLocs = data.numLocs;
-  const int numVals = data.numVals;
-
-  const int dataSize = numLocs*(numCoords+numVals);
-  CPPUNIT_ASSERT(0 < dataSize);
-  pData->data = new double[dataSize];
-  memcpy(pData->data, data.dbData, dataSize*sizeof(double));
-
-  pData->valNames = new std::string[numVals];
-  for (int i=0; i < numVals; ++i)
-    pData->valNames[i] = data.names[i];
-
-  pData->valUnits = new std::string[numVals];
-  for (int i=0; i < numVals; ++i)
-    pData->valUnits[i] = data.units[i];
-
-  pData->numLocs = numLocs;
-  pData->numVals = numVals;
-  pData->dataDim = data.dataDim;
-
   db->_data = pData;
   db->_query = new SimpleDBQuery(*db);
   db->_cs = new spatialdata::geocoords::CSCart();
@@ -132,7 +116,6 @@
   } // test C
 } // _testQueryVals
 
-#include <iostream>
 // ----------------------------------------------------------------------
 // Test distSquared()
 void

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -14,7 +14,7 @@
 
 #include "TestSimpleDBVolume3D.hh" // Implementation of class methods
 
-#include "data/SimpleDBDataVolume3D.hh"
+#include "data/SimpleDBTestDataVolume3D.hh"
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBVolume3D );
@@ -24,7 +24,7 @@
 void
 spatialdata::spatialdb::TestSimpleDBVolume3D::testQueryLinear(void)
 { // testQueryLinear
-  SimpleDBDataVolume3D data;
+  SimpleDBTestDataVolume3D data;
 
   _testQueryLinear(data);
 } // testQueryLinear
@@ -34,7 +34,7 @@
 void
 spatialdata::spatialdb::TestSimpleDBVolume3D::testQueryNearest(void)
 { // testQueryNearest
-  SimpleDBDataVolume3D data;
+  SimpleDBTestDataVolume3D data;
 
   _testQueryNearest(data);
 } // testQueryNearest

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -14,7 +14,6 @@
 
 #include "TestSimpleIOAscii.hh" // Implementation of class methods
 
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SimpleDB
 #include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
 #include "spatialdata/spatialdb/SimpleIO.hh" // USES SimpleIOAscii
 #include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii
@@ -22,7 +21,7 @@
 #include "spatialdata/geocoords/CoordSys.hh" // USES CSCart
 #include "spatialdata/geocoords/CSCart.hh" // USES CSCart
 
-#include "spatialdata/spatialdb/SimpleDBTypes.hh" // USES SimpleDBTypes
+#include "spatialdata/spatialdb/SimpleDBData.hh" // USES SimpleDBData
 
 #include <string.h> // USES strcmp()
 #include <sstream> // USES std::ostringstream
@@ -35,11 +34,16 @@
 void
 spatialdata::spatialdb::TestSimpleIOAscii::testIO(void)
 { // testIO
-  const double data[] = { 0.6, 0.1, 0.2,  6.6, 3.4,
-			  1.0, 1.1, 1.2,  5.5, 6.7,
-			  4.7, 9.5, 8.7,  2.3, 4.1,
-			  3.4, 0.7, 9.8,  5.7, 2.0,
-			  3.4, 9.8, 5.7,  6.3, 6.7};
+  const double coords[] = { 0.6, 0.1, 0.2,
+			    1.0, 1.1, 1.2,
+			    4.7, 9.5, 8.7,
+			    3.4, 0.7, 9.8,
+			    3.4, 9.8, 5.7};
+  const double data[] = { 6.6, 3.4,
+			  5.5, 6.7,
+			  2.3, 4.1,
+			  5.7, 2.0,
+			  6.3, 6.7};
   const int spaceDim = 3;
   const int numLocs = 5;
   const int numVals = 2;
@@ -47,18 +51,12 @@
   const char* names[] = { "One", "Two" };
   const char* units[] = { "m", "m" };
 
-  SimpleDB::DataStruct dbOut;
-  dbOut.data = (double*) data;
-  dbOut.valNames = new std::string[numVals];
-  for (int iVal=0; iVal < numVals; ++iVal)
-    dbOut.valNames[iVal] = names[iVal];
-  dbOut.valUnits = new std::string[numVals];
-  for (int iVal=0; iVal < numVals; ++iVal)
-    dbOut.valUnits[iVal] = units[iVal];
-  dbOut.numLocs = numLocs;
-  dbOut.numVals = numVals;
-  dbOut.dataDim = dataDim;
-  dbOut.spaceDim = dataDim;
+  SimpleDBData dbOut;
+  dbOut.allocate(numLocs, numVals, spaceDim, dataDim);
+  dbOut.data(data, numLocs, numVals);
+  dbOut.coordinates(coords, numLocs, spaceDim);
+  dbOut.names(names, numVals);
+  dbOut.units(units, numVals);
 
   geocoords::CSCart csOut;
 
@@ -67,31 +65,36 @@
   dbIO.filename(filename);
   dbIO.write(dbOut, &csOut);
 
-  SimpleDB::DataStruct dbIn;
+  SimpleDBData dbIn;
   geocoords::CoordSys* pCSIn = 0;
-  dbIn.data = 0;
-  dbIn.valNames = 0;
-  dbIn.valUnits = 0;
   dbIO.read(&dbIn, &pCSIn);
 
-  CPPUNIT_ASSERT(numLocs == dbIn.numLocs);
-  CPPUNIT_ASSERT(numVals == dbIn.numVals);
-  CPPUNIT_ASSERT(dataDim == dbIn.dataDim);
-  CPPUNIT_ASSERT(spaceDim == dbIn.spaceDim);
+  CPPUNIT_ASSERT_EQUAL(numLocs, dbIn.numLocs());
+  CPPUNIT_ASSERT_EQUAL(numVals, dbIn.numValues());
+  CPPUNIT_ASSERT_EQUAL(dataDim, dbIn.dataDim());
+  CPPUNIT_ASSERT_EQUAL(spaceDim, dbIn.spaceDim());
   for (int iVal=0; iVal < numVals; ++iVal) {
-    CPPUNIT_ASSERT(0 == strcmp(names[iVal], dbIn.valNames[iVal].c_str()));
-    CPPUNIT_ASSERT(0 == strcmp(units[iVal], dbIn.valUnits[iVal].c_str()));
+    CPPUNIT_ASSERT_EQUAL(std::string(names[iVal]),
+			 std::string(dbIn.name(iVal)));
+    CPPUNIT_ASSERT_EQUAL(std::string(units[iVal]),
+			 std::string(dbIn.units(iVal)));
   } // for
-  const int dataSize = numLocs*(spaceDim+numVals);
+
   const double tolerance = 1.0e-06;
-  for (int i=0; i < dataSize; ++i)
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(dbIn.data[i]/data[i], 1.0, tolerance);
+  for (int iLoc=0, i=0; iLoc < numLocs; ++iLoc) {
+    const double* coordinates = dbIn.coordinates(iLoc);
+    for (int iDim=0; iDim < spaceDim; ++iDim, ++i)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(coordinates[iDim]/coords[i], 1.0,
+				 tolerance);
+  } // for
 
-  delete[] dbOut.valNames; dbOut.valNames = 0;
-  delete[] dbOut.valUnits; dbOut.valUnits = 0;
-  delete[] dbIn.data; dbIn.data = 0;
-  delete[] dbIn.valNames; dbIn.valNames = 0;
-  delete[] dbIn.valUnits; dbIn.valUnits = 0;
+  for (int iLoc=0, i=0; iLoc < numLocs; ++iLoc) {
+    const double* values = dbIn.data(iLoc);
+    for (int iVal=0; iVal < numVals; ++iVal, ++i)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(values[iVal]/data[i], 1.0,
+				 tolerance);
+  } // for
+
   delete pCSIn; pCSIn = 0;
 } // testIO
 
@@ -101,11 +104,16 @@
 void
 spatialdata::spatialdb::TestSimpleIOAscii::testReadComments(void)
 { // testReadComments
-  const double data[] = { 0.6, 0.1, 0.2,  6.6, 3.4,
-			  1.0, 1.1, 1.2,  5.5, 6.7,
-			  4.7, 9.5, 8.7,  2.3, 4.1,
-			  3.4, 0.7, 9.8,  5.7, 2.0,
-			  3.4, 9.8, 5.7,  6.3, 6.7};
+  const double coords[] = { 0.6, 0.1, 0.2,
+			    1.0, 1.1, 1.2,
+			    4.7, 9.5, 8.7,
+			    3.4, 0.7, 9.8,
+			    3.4, 9.8, 5.7};
+  const double data[] = { 6.6, 3.4,
+			  5.5, 6.7,
+			  2.3, 4.1,
+			  5.7, 2.0,
+			  6.3, 6.7};
   const int spaceDim = 3;
   const int numLocs = 5;
   const int numVals = 2;
@@ -117,31 +125,36 @@
   SimpleIOAscii dbIO;
   dbIO.filename(filename);
 
-  SimpleDB::DataStruct dbIn;
+  SimpleDBData dbIn;
   geocoords::CoordSys* pCSIn = 0;
-  dbIn.data = 0;
-  dbIn.valNames = 0;
-  dbIn.valUnits = 0;
   dbIO.read(&dbIn, &pCSIn);
 
-  CPPUNIT_ASSERT_EQUAL(numLocs, dbIn.numLocs);
-  CPPUNIT_ASSERT_EQUAL(numVals, dbIn.numVals);
-  CPPUNIT_ASSERT_EQUAL(dataDim, dbIn.dataDim);
-  CPPUNIT_ASSERT_EQUAL(spaceDim, dbIn.spaceDim);
+  CPPUNIT_ASSERT_EQUAL(numLocs, dbIn.numLocs());
+  CPPUNIT_ASSERT_EQUAL(numVals, dbIn.numValues());
+  CPPUNIT_ASSERT_EQUAL(dataDim, dbIn.dataDim());
+  CPPUNIT_ASSERT_EQUAL(spaceDim, dbIn.spaceDim());
   for (int iVal=0; iVal < numVals; ++iVal) {
     CPPUNIT_ASSERT_EQUAL(std::string(names[iVal]),
-			 std::string(dbIn.valNames[iVal].c_str()));
+			 std::string(dbIn.name(iVal)));
     CPPUNIT_ASSERT_EQUAL(std::string(units[iVal]),
-			 std::string(dbIn.valUnits[iVal].c_str()));
+			 std::string(dbIn.units(iVal)));
   } // for
-  const int dataSize = numLocs*(spaceDim+numVals);
+
   const double tolerance = 1.0e-06;
-  for (int i=0; i < dataSize; ++i)
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(dbIn.data[i]/data[i], 1.0, tolerance);
+  for (int iLoc=0, i=0; iLoc < numLocs; ++iLoc) {
+    const double* coordinates = dbIn.coordinates(iLoc);
+    for (int iDim=0; iDim < spaceDim; ++iDim, ++i)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(coordinates[iDim]/coords[i], 1.0,
+				 tolerance);
+  } // for
 
-  delete[] dbIn.data; dbIn.data = 0;
-  delete[] dbIn.valNames; dbIn.valNames = 0;
-  delete[] dbIn.valUnits; dbIn.valUnits = 0;
+  for (int iLoc=0, i=0; iLoc < numLocs; ++iLoc) {
+    const double* values = dbIn.data(iLoc);
+    for (int iVal=0; iVal < numVals; ++iVal, ++i)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(values[iVal]/data[i], 1.0,
+				 tolerance);
+  } // for
+
   delete pCSIn; pCSIn = 0;
 } // testReadComments
 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -54,7 +54,5 @@
 
 #endif // spatialdata_spatialdb_testsimpleioascii_hh
 
-// version
-// $Id$
 
 // End of file 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBApp.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBApp.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBApp.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -59,6 +59,7 @@
     self.numVals = None
     self.dataDim = None
     self.dbData = None
+    self.dbCords = None
     self.names = None
     self.units = None
 
@@ -109,8 +110,10 @@
                         format="%d")
     self.data.addScalar(vtype="int", name="_dataDim", value=self.dataDim,
                         format="%d")
+    self.data.addArray(vtype="double", name="_dbCoords", values=self.dbCoords,
+                       format="%16.8e", ncols=self.spaceDim)
     self.data.addArray(vtype="double", name="_dbData", values=self.dbData,
-                       format="%16.8e", ncols=self.spaceDim+self.numVals)
+                       format="%16.8e", ncols=self.numVals)
     self.data.addArray(vtype="char*", name="_names", values=self.names,
                        format="\"%s\"", ncols=1)
     self.data.addArray(vtype="char*", name="_units", values=self.units,

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,39 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#include "SimpleDBData.hh"
-
-// ----------------------------------------------------------------------
-// Constructor
-spatialdata::spatialdb::SimpleDBData::SimpleDBData(void) :
-  numLocs(0),
-  spaceDim(0),
-  numVals(0),
-  dataDim(0),
-  dbData(0),
-  errFlags(0),
-  names(0),
-  units(0),
-  numQueries(0),
-  queryNearest(0),
-  queryLinear(0)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor
-spatialdata::spatialdb::SimpleDBData::~SimpleDBData(void)
-{ // destructor
-} // destructor
-
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,61 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(spatialdata_spatialdb_simpledbdata_hh)
-#define spatialdata_spatialdb_simpledbdata_hh
-
-namespace spatialdata {
-  namespace spatialdb {
-     class SimpleDBData;
-  } // spatialdb
-} // spatialdata
-
-class spatialdata::spatialdb::SimpleDBData
-{
-
-// PUBLIC METHODS ///////////////////////////////////////////////////////
-public :
-  
-  /// Constructor
-  SimpleDBData(void);
-
-  /// Destructor
-  ~SimpleDBData(void);
-
-// PUBLIC MEMBERS ///////////////////////////////////////////////////////
-public:
-  
-  /// @name Database information
-  //@{
-  int numLocs; ///< Number of locations in database
-  int spaceDim; ///< Spatial dimension for coordinates of locations
-  int numVals; ///< Number of values per location in database
-  int dataDim; ///< Spatial dimension of data in database
-  double* dbData; ///< Database data
-  char** names; ///< Names of values in database
-  char** units; ///< Units of values in database
-  //@}
-
-  /// @name Query information
-  //@{
-  int numQueries; ///< Number of queries
-  double* queryNearest; ///< Data for nearest neighbor queries
-  double* queryLinear; ///< Data for linear interpolation queries
-  int* errFlags; ///< Expected return values for queries
-  //@}
-
-};
-
-#endif // spatialdata_spatialdb_simpledbdata_hh
-
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,83 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from python application simpledbdataarea3D.
-
-#include "SimpleDBDataArea3D.hh"
-
-const int spatialdata::spatialdb::SimpleDBDataArea3D::_numLocs = 6;
-
-const int spatialdata::spatialdb::SimpleDBDataArea3D::_spaceDim = 3;
-
-const int spatialdata::spatialdb::SimpleDBDataArea3D::_numVals = 2;
-
-const int spatialdata::spatialdb::SimpleDBDataArea3D::_dataDim = 2;
-
-const int spatialdata::spatialdb::SimpleDBDataArea3D::_numQueries = 4;
-
-const double spatialdata::spatialdb::SimpleDBDataArea3D::_dbData[] = {
-  3.40000000e+00,  9.50000000e+00,  8.70000000e+00,  1.00000000e-01,  1.10000000e+00,
-  4.29442719e+00,  9.50000000e+00,  9.14721360e+00,  3.00000000e-01,  3.30000000e+00,
-  6.97770876e+00,  9.50000000e+00,  1.04888544e+01,  2.00000000e-01,  2.20000000e+00,
-  7.63236243e+00,  1.21186147e+01,  9.17954704e+00,  1.00000000e-01,  1.10000000e+00,
-  3.83643578e+00,  1.12457431e+01,  7.82712844e+00, -4.00000000e-01, -4.40000000e+00,
-  4.05465367e+00,  1.21186147e+01,  7.39069266e+00, -3.00000000e-01, -3.20000000e+00,
-};
-
-const char* spatialdata::spatialdb::SimpleDBDataArea3D::_names[] = {
-"One",
-"Two",
-};
-
-const char* spatialdata::spatialdb::SimpleDBDataArea3D::_units[] = {
-"m",
-"m",
-};
-
-const double spatialdata::spatialdb::SimpleDBDataArea3D::_queryNearest[] = {
-  6.30149946e+00,  1.03728716e+01,  9.60520501e+00,  2.00000000e-01,  2.20000000e+00,
-  3.78727022e+00,  1.01546537e+01,  8.48447656e+00,  1.00000000e-01,  1.10000000e+00,
-  6.95615313e+00,  1.29914862e+01,  8.29589766e+00,  1.00000000e-01,  1.10000000e+00,
-  4.89452639e+00,  1.19003968e+01,  7.94701520e+00, -3.00000000e-01, -3.20000000e+00,
-};
-
-const double spatialdata::spatialdb::SimpleDBDataArea3D::_queryLinear[] = {
-  6.30149946e+00,  1.03728716e+01,  9.60520501e+00,  2.00000000e-01,  2.20000000e+00,
-  3.78727022e+00,  1.01546537e+01,  8.48447656e+00, -3.75000000e-02, -4.12500000e-01,
-  6.95615313e+00,  1.29914862e+01,  8.29589766e+00,  0.00000000e+00,  0.00000000e+00,
-  4.89452639e+00,  1.19003968e+01,  7.94701520e+00, -2.25000000e-01, -2.42500000e+00,
-};
-
-const int spatialdata::spatialdb::SimpleDBDataArea3D::_errFlags[] = {
- 0, 0, 1, 0,};
-
-spatialdata::spatialdb::SimpleDBDataArea3D::SimpleDBDataArea3D(void)
-{ // constructor
-  numLocs = _numLocs;
-  spaceDim = _spaceDim;
-  numVals = _numVals;
-  dataDim = _dataDim;
-  numQueries = _numQueries;
-  dbData = const_cast<double*>(_dbData);
-  names = const_cast<char**>(_names);
-  units = const_cast<char**>(_units);
-  queryNearest = const_cast<double*>(_queryNearest);
-  queryLinear = const_cast<double*>(_queryLinear);
-  errFlags = const_cast<int*>(_errFlags);
-} // constructor
-
-spatialdata::spatialdb::SimpleDBDataArea3D::~SimpleDBDataArea3D(void)
-{}
-
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,66 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from python application simpledbdataarea3D.
-
-#if !defined(spatialdata_spatialdb_simpledbdataarea3d_hh)
-#define spatialdata_spatialdb_simpledbdataarea3d_hh
-
-#include "SimpleDBData.hh"
-
-namespace spatialdata {
-  namespace spatialdb {
-     class SimpleDBDataArea3D;
-  } // spatialdata
-} // spatialdb
-
-class spatialdata::spatialdb::SimpleDBDataArea3D : public SimpleDBData
-{
-
-public: 
-
-  /// Constructor
-  SimpleDBDataArea3D(void);
-
-  /// Destructor
-  ~SimpleDBDataArea3D(void);
-
-private:
-
-  static const int _numLocs;
-
-  static const int _spaceDim;
-
-  static const int _numVals;
-
-  static const int _dataDim;
-
-  static const int _numQueries;
-
-  static const double _dbData[];
-
-  static const char* _names[];
-
-  static const char* _units[];
-
-  static const double _queryNearest[];
-
-  static const double _queryLinear[];
-
-  static const int _errFlags[];
-
-};
-
-#endif // spatialdata_spatialdb_simpledbdataarea3d_hh
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-## @file tests/libtests/data/SimpleDBDataArea3D.odb
-
-## @brief Python data generator for tests of C++ SimpleDB using
-## data with areal 3-D spatial distribution.
-
-import numpy
-
-from SimpleDBApp import SimpleDBApp
-
-# SimpleDBDataArea3D class
-class SimpleDBDataArea3D(SimpleDBApp):
-  """
-  Python data generator for tests of C++ SimpleDB using
-  data with areal 3-D spatial distribution.
-  """
-
-  def _compute(self):
-    """
-    Compute query data.
-    """
-    # Database information
-    self.numLocs = 6
-    self.numVals = 2
-    self.spaceDim = 3
-    self.names = [ "One", "Two" ]
-    self.units = [ "m", "m" ]
-    self.dataDim = 2
-    self.dbData = None
-
-    # Query information
-    self.numQueries = 4
-    self.queryNearest = None
-    self.queryLinear = None
-    self.errFlags = numpy.array( [ 0, 0, 1, 0  ], dtype=numpy.int32)
-
-    tdata = [ {'s': 0.0, 't': 0.0, 'one': 0.1, 'two': 1.1},
-              {'s': 1.0, 't': 0.0, 'one': 0.3, 'two': 3.3},
-              {'s': 4.0, 't': 0.0, 'one': 0.2, 'two': 2.2},
-              {'s': 4.0, 't': 3.0, 'one': 0.1, 'two': 1.1},
-              {'s': 0.0, 't': 2.0, 'one': -0.4, 'two': -4.4},
-              {'s': 0.0, 't': 3.0, 'one': -0.3, 'two': -3.2} ]
-    qtdata = [ {'s': 3.0, 't': 1.0, 'ni': 2,
-                'wts': [{'i': 1, 'w': 1.0/3.0},
-                        {'i': 2, 'w': 1.0/3.0},
-                        {'i': 3, 'w': 1.0/3.0}] },
-               {'s': 0.25, 't': 0.75, 'ni': 0,
-                'wts': [{'i': 0, 'w': 0.375},
-                        {'i': 1, 'w': 0.250},
-                        {'i': 4, 'w': 0.375}] },
-               {'s': 3.0, 't': 4.0, 'ni': 3,
-                'wts': [{'i': 3, 'w': 0.0},
-                        {'i': 5, 'w': 0.0},
-                        {'i': 4, 'w': 0.0}] },
-               {'s': 1.0, 't': 2.75, 'ni': 5,
-                'wts': [{'i': 5, 'w': 0.50},
-                        {'i': 4, 'w': 0.25},
-                        {'i': 3, 'w': 0.25}]} ]
-
-    o = numpy.array([3.4, 9.5, 8.7], dtype=numpy.float64)
-    sqrt5 = 5**0.5
-    sqrt21 = 21**0.5    
-    a = numpy.array([2.0/sqrt5, 0, 1.0/sqrt5], dtype=numpy.float64)
-    b = numpy.array([1.0/sqrt21, 4/sqrt21, -2/sqrt21], dtype=numpy.float64)
-    self.dbData = numpy.zeros( (self.numLocs, self.spaceDim+self.numVals),
-                               dtype=numpy.float64)
-    iLoc = 0
-    for loc in tdata:
-      xyz = o + a*loc['s'] + b*loc['t']
-      self.dbData[iLoc, :] = numpy.array([xyz[0], xyz[1], xyz[2],
-                                          loc['one'], loc['two']],
-                                         dtype=numpy.float64)
-      iLoc += 1
-    
-    self.queryNearest = numpy.zeros( (self.numQueries,
-                                      self.spaceDim+self.numVals),
-                                     dtype=numpy.float64)
-    self.queryLinear = numpy.zeros( (self.numQueries,
-                                     self.spaceDim+self.numVals),
-                                    dtype=numpy.float64)
-    iLoc = 0
-    for qloc in qtdata:
-      xyz = o + a*qloc['s'] + b*qloc['t']
-      v1 = 0
-      v2 = 0
-      for wt in qloc['wts']:
-        v1 += tdata[wt['i']]['one']*wt['w']
-        v2 += tdata[wt['i']]['two']*wt['w']
-      self.queryLinear[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
-                                             dtype=numpy.float64)
-      v1 = tdata[qloc['ni']]['one']
-      v2 = tdata[qloc['ni']]['two']
-      self.queryNearest[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
-                                              dtype=numpy.float64)
-      iLoc += 1
-    return
-
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    SimpleDBApp.__init__(self, name="simpledbdataarea3D")
-    return
-
-
-# MAIN /////////////////////////////////////////////////////////////////
-if __name__ == "__main__":
-
-  app = SimpleDBDataArea3D()
-  app.run()
-
-
-# End of file 

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,82 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from python application simpledbdataline3D.
-
-#include "SimpleDBDataLine3D.hh"
-
-const int spatialdata::spatialdb::SimpleDBDataLine3D::_numLocs = 5;
-
-const int spatialdata::spatialdb::SimpleDBDataLine3D::_spaceDim = 3;
-
-const int spatialdata::spatialdb::SimpleDBDataLine3D::_numVals = 2;
-
-const int spatialdata::spatialdb::SimpleDBDataLine3D::_dataDim = 1;
-
-const int spatialdata::spatialdb::SimpleDBDataLine3D::_numQueries = 4;
-
-const double spatialdata::spatialdb::SimpleDBDataLine3D::_dbData[] = {
-  3.40000000e+00,  9.50000000e+00,  8.70000000e+00,  1.00000000e-01,  1.10000000e+00,
-  5.70000000e+00,  9.90000000e+00,  1.85000000e+01,  3.00000000e-01,  3.30000000e+00,
-  6.85000000e+00,  1.01000000e+01,  2.34000000e+01,  2.00000000e-01,  2.20000000e+00,
-  8.00000000e+00,  1.03000000e+01,  2.83000000e+01,  1.00000000e-01,  1.10000000e+00,
-  1.49000000e+01,  1.15000000e+01,  5.77000000e+01, -4.00000000e-01, -4.40000000e+00,
-};
-
-const char* spatialdata::spatialdb::SimpleDBDataLine3D::_names[] = {
-"One",
-"Two",
-};
-
-const char* spatialdata::spatialdb::SimpleDBDataLine3D::_units[] = {
-"m",
-"m",
-};
-
-const double spatialdata::spatialdb::SimpleDBDataLine3D::_queryNearest[] = {
-  5.70000000e+00,  9.90000000e+00,  1.85000000e+01,  3.00000000e-01,  3.30000000e+00,
-  1.26000000e+01,  1.11000000e+01,  4.79000000e+01, -4.00000000e-01, -4.40000000e+00,
-  1.72000000e+01,  1.19000000e+01,  6.75000000e+01, -4.00000000e-01, -4.40000000e+00,
-  6.16000000e+00,  9.98000000e+00,  2.04600000e+01,  3.00000000e-01,  3.30000000e+00,
-};
-
-const double spatialdata::spatialdb::SimpleDBDataLine3D::_queryLinear[] = {
-  5.70000000e+00,  9.90000000e+00,  1.85000000e+01,  3.00000000e-01,  3.30000000e+00,
-  1.26000000e+01,  1.11000000e+01,  4.79000000e+01, -2.33333333e-01, -2.56666667e+00,
-  1.72000000e+01,  1.19000000e+01,  6.75000000e+01,  0.00000000e+00,  0.00000000e+00,
-  6.16000000e+00,  9.98000000e+00,  2.04600000e+01,  2.60000000e-01,  2.86000000e+00,
-};
-
-const int spatialdata::spatialdb::SimpleDBDataLine3D::_errFlags[] = {
- 0, 0, 1, 0,};
-
-spatialdata::spatialdb::SimpleDBDataLine3D::SimpleDBDataLine3D(void)
-{ // constructor
-  numLocs = _numLocs;
-  spaceDim = _spaceDim;
-  numVals = _numVals;
-  dataDim = _dataDim;
-  numQueries = _numQueries;
-  dbData = const_cast<double*>(_dbData);
-  names = const_cast<char**>(_names);
-  units = const_cast<char**>(_units);
-  queryNearest = const_cast<double*>(_queryNearest);
-  queryLinear = const_cast<double*>(_queryLinear);
-  errFlags = const_cast<int*>(_errFlags);
-} // constructor
-
-spatialdata::spatialdb::SimpleDBDataLine3D::~SimpleDBDataLine3D(void)
-{}
-
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,66 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from python application simpledbdataline3D.
-
-#if !defined(spatialdata_spatialdb_simpledbdataline3d_hh)
-#define spatialdata_spatialdb_simpledbdataline3d_hh
-
-#include "SimpleDBData.hh"
-
-namespace spatialdata {
-  namespace spatialdb {
-     class SimpleDBDataLine3D;
-  } // spatialdata
-} // spatialdb
-
-class spatialdata::spatialdb::SimpleDBDataLine3D : public SimpleDBData
-{
-
-public: 
-
-  /// Constructor
-  SimpleDBDataLine3D(void);
-
-  /// Destructor
-  ~SimpleDBDataLine3D(void);
-
-private:
-
-  static const int _numLocs;
-
-  static const int _spaceDim;
-
-  static const int _numVals;
-
-  static const int _dataDim;
-
-  static const int _numQueries;
-
-  static const double _dbData[];
-
-  static const char* _names[];
-
-  static const char* _units[];
-
-  static const double _queryNearest[];
-
-  static const double _queryLinear[];
-
-  static const int _errFlags[];
-
-};
-
-#endif // spatialdata_spatialdb_simpledbdataline3d_hh
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,119 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-## @file tests/libtests/data/SimpleDBDataLine3D.odb
-
-## @brief Python data generator for tests of C++ SimpleDB using
-## data with linear 3-D spatial distribution.
-
-import numpy
-
-from SimpleDBApp import SimpleDBApp
-
-# SimpleDBDataLine3D class
-class SimpleDBDataLine3D(SimpleDBApp):
-  """
-  Python data generator for tests of C++ SimpleDB using
-  data with linear 3-D spatial distribution.
-  """
-
-  def _compute(self):
-    """
-    Compute query data.
-    """
-    # Database information
-    self.numLocs = 5
-    self.numVals = 2
-    self.spaceDim = 3
-    self.names = [ "One", "Two" ]
-    self.units = [ "m", "m" ]
-    self.dataDim = 1
-    self.dbData = None
-
-    # Query information
-    self.numQueries = 4
-
-    self.queryNearest = numpy.array( [[4.5, 2.3, 4.0, 6.3, 7.4],
-                                      [3.2, 7.4, 5.8, 6.3, 7.4],
-                                      [4.0, 9.8, 5.7, 6.3, 7.4]],
-                                     dtype=numpy.float64)
-    self.queryLinear = numpy.array( [[2.9, 3.4, 8.7, 6.3, 7.4],
-                                     [2.2, 9.0, 8.5, 6.3, 7.4],
-                                     [0.2, 5.8, 6.6, 6.3, 7.4]],
-                                    dtype=numpy.float64)
-    self.errFlags = numpy.array( [ 0, 0, 1, 0  ], dtype=numpy.int32)
-
-    tdata = [ {'t': 0.0, 'one': 0.1, 'two': 1.1},
-                    {'t': 1.0, 'one': 0.3, 'two': 3.3},
-                    {'t': 1.5, 'one': 0.2, 'two': 2.2},
-                    {'t': 2.0, 'one': 0.1, 'two': 1.1},
-                    {'t': 5.0, 'one': -0.4, 'two': -4.4} ]
-    qtdata = [ {'t': 1.0, 'ni': 1, 'wts': [{'i': 1, 'w': 1.0}] },
-               {'t': 4.0, 'ni': 4, 'wts': [{'i': 3, 'w': 1.0/3.0},
-                                           {'i': 4, 'w': 2.0/3.0} ] },
-               {'t': 6.0, 'ni': 4, 'wts': [{'i': 3, 'w': 0.0},
-                                           {'i': 4, 'w': 0.0} ] },
-               {'t': 1.2, 'ni': 1, 'wts': [{'i': 1, 'w': 0.6},
-                                           {'i': 2, 'w': 0.4}]} ]
-
-    o = numpy.array([3.4, 9.5, 8.7], dtype=numpy.float64)
-    a = numpy.array([2.3, 0.4, 9.8], dtype=numpy.float64)
-    self.dbData = numpy.zeros( (self.numLocs, self.spaceDim+self.numVals),
-                               dtype=numpy.float64)
-    iLoc = 0
-    for loc in tdata:
-      xyz = o + a*loc['t']
-      self.dbData[iLoc, :] = numpy.array([xyz[0], xyz[1], xyz[2],
-                                          loc['one'], loc['two']],
-                                         dtype=numpy.float64)
-      iLoc += 1
-    
-    self.queryNearest = numpy.zeros( (self.numQueries,
-                                      self.spaceDim+self.numVals),
-                                     dtype=numpy.float64)
-    self.queryLinear = numpy.zeros( (self.numQueries,
-                                     self.spaceDim+self.numVals),
-                                    dtype=numpy.float64)
-    iLoc = 0
-    for qloc in qtdata:
-      xyz = o + a*qloc['t']
-      v1 = 0
-      v2 = 0
-      for wt in qloc['wts']:
-        v1 += tdata[wt['i']]['one']*wt['w']
-        v2 += tdata[wt['i']]['two']*wt['w']
-      self.queryLinear[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
-                                             dtype=numpy.float64)
-      v1 = tdata[qloc['ni']]['one']
-      v2 = tdata[qloc['ni']]['two']
-      self.queryNearest[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
-                                              dtype=numpy.float64)
-      iLoc += 1
-    return
-
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    SimpleDBApp.__init__(self, name="simpledbdataline3D")
-    return
-
-
-# MAIN /////////////////////////////////////////////////////////////////
-if __name__ == "__main__":
-
-  app = SimpleDBDataLine3D()
-  app.run()
-
-
-# End of file 

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,76 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from python application simpledbdatapoint.
-
-#include "SimpleDBDataPoint3D.hh"
-
-const int spatialdata::spatialdb::SimpleDBDataPoint3D::_numLocs = 1;
-
-const int spatialdata::spatialdb::SimpleDBDataPoint3D::_spaceDim = 3;
-
-const int spatialdata::spatialdb::SimpleDBDataPoint3D::_numVals = 2;
-
-const int spatialdata::spatialdb::SimpleDBDataPoint3D::_dataDim = 0;
-
-const int spatialdata::spatialdb::SimpleDBDataPoint3D::_numQueries = 3;
-
-const double spatialdata::spatialdb::SimpleDBDataPoint3D::_dbData[] = {
-  1.00000000e-01,  2.00000000e-01,  3.00000000e-01,  6.30000000e+00,  7.40000000e+00,
-};
-
-const char* spatialdata::spatialdb::SimpleDBDataPoint3D::_names[] = {
-"One",
-"Two",
-};
-
-const char* spatialdata::spatialdb::SimpleDBDataPoint3D::_units[] = {
-"m",
-"m",
-};
-
-const double spatialdata::spatialdb::SimpleDBDataPoint3D::_queryNearest[] = {
-  4.50000000e+00,  2.30000000e+00,  4.00000000e+00,  6.30000000e+00,  7.40000000e+00,
-  3.20000000e+00,  7.40000000e+00,  5.80000000e+00,  6.30000000e+00,  7.40000000e+00,
-  4.00000000e+00,  9.80000000e+00,  5.70000000e+00,  6.30000000e+00,  7.40000000e+00,
-};
-
-const double spatialdata::spatialdb::SimpleDBDataPoint3D::_queryLinear[] = {
-  2.90000000e+00,  3.40000000e+00,  8.70000000e+00,  6.30000000e+00,  7.40000000e+00,
-  2.20000000e+00,  9.00000000e+00,  8.50000000e+00,  6.30000000e+00,  7.40000000e+00,
-  2.00000000e-01,  5.80000000e+00,  6.60000000e+00,  6.30000000e+00,  7.40000000e+00,
-};
-
-const int spatialdata::spatialdb::SimpleDBDataPoint3D::_errFlags[] = {
- 0, 0, 0,};
-
-spatialdata::spatialdb::SimpleDBDataPoint3D::SimpleDBDataPoint3D(void)
-{ // constructor
-  numLocs = _numLocs;
-  spaceDim = _spaceDim;
-  numVals = _numVals;
-  dataDim = _dataDim;
-  numQueries = _numQueries;
-  dbData = const_cast<double*>(_dbData);
-  names = const_cast<char**>(_names);
-  units = const_cast<char**>(_units);
-  queryNearest = const_cast<double*>(_queryNearest);
-  queryLinear = const_cast<double*>(_queryLinear);
-  errFlags = const_cast<int*>(_errFlags);
-} // constructor
-
-spatialdata::spatialdb::SimpleDBDataPoint3D::~SimpleDBDataPoint3D(void)
-{}
-
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,66 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from python application simpledbdatapoint.
-
-#if !defined(spatialdata_spatialdb_simpledbdatapoint3d_hh)
-#define spatialdata_spatialdb_simpledbdatapoint3d_hh
-
-#include "SimpleDBData.hh"
-
-namespace spatialdata {
-  namespace spatialdb {
-     class SimpleDBDataPoint3D;
-  } // spatialdata
-} // spatialdb
-
-class spatialdata::spatialdb::SimpleDBDataPoint3D : public SimpleDBData
-{
-
-public: 
-
-  /// Constructor
-  SimpleDBDataPoint3D(void);
-
-  /// Destructor
-  ~SimpleDBDataPoint3D(void);
-
-private:
-
-  static const int _numLocs;
-
-  static const int _spaceDim;
-
-  static const int _numVals;
-
-  static const int _dataDim;
-
-  static const int _numQueries;
-
-  static const double _dbData[];
-
-  static const char* _names[];
-
-  static const char* _units[];
-
-  static const double _queryNearest[];
-
-  static const double _queryLinear[];
-
-  static const int _errFlags[];
-
-};
-
-#endif // spatialdata_spatialdb_simpledbdatapoint3d_hh
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-## @file tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py
-
-## @brief Python data generator for tests of C++ SimpleDB using
-## data with point 3-D spatial distribution.
-
-import numpy
-
-from SimpleDBApp import SimpleDBApp
-
-# SimpleDBDataPoint3D class
-class SimpleDBDataPoint3D(SimpleDBApp):
-  """
-  Python data generator for tests of C++ SimpleDB using
-  data with point 3-D spatial distribution.
-  """
-
-  def _compute(self):
-    """
-    Compute query data.
-    """
-    # Database information
-    self.numLocs = 1
-    self.numVals = 2
-    self.spaceDim = 3
-    self.names = [ "One", "Two" ]
-    self.units = [ "m", "m" ]
-    self.dataDim = 0
-    self.dbData = numpy.array( [0.1, 0.2, 0.3, 6.3, 7.4],
-                               dtype=numpy.float64)
-
-    # Query information
-    self.numQueries = 3
-    self.queryNearest = numpy.array( [[4.5, 2.3, 4.0, 6.3, 7.4],
-                                      [3.2, 7.4, 5.8, 6.3, 7.4],
-                                      [4.0, 9.8, 5.7, 6.3, 7.4]],
-                                     dtype=numpy.float64)
-    self.queryLinear = numpy.array( [[2.9, 3.4, 8.7, 6.3, 7.4],
-                                     [2.2, 9.0, 8.5, 6.3, 7.4],
-                                     [0.2, 5.8, 6.6, 6.3, 7.4]],
-                                    dtype=numpy.float64)
-    self.errFlags = numpy.array( [ 0, 0, 0 ], dtype=numpy.int32)
-    return
-
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    SimpleDBApp.__init__(self, name="simpledbdatapoint")
-    return
-
-
-# MAIN /////////////////////////////////////////////////////////////////
-if __name__ == "__main__":
-
-  app = SimpleDBDataPoint3D()
-  app.run()
-
-
-# End of file 

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,87 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from python application simpledbdatavolume3D.
-
-#include "SimpleDBDataVolume3D.hh"
-
-const int spatialdata::spatialdb::SimpleDBDataVolume3D::_numLocs = 8;
-
-const int spatialdata::spatialdb::SimpleDBDataVolume3D::_spaceDim = 3;
-
-const int spatialdata::spatialdb::SimpleDBDataVolume3D::_numVals = 2;
-
-const int spatialdata::spatialdb::SimpleDBDataVolume3D::_dataDim = 3;
-
-const int spatialdata::spatialdb::SimpleDBDataVolume3D::_numQueries = 5;
-
-const double spatialdata::spatialdb::SimpleDBDataVolume3D::_dbData[] = {
-  4.46656933e+00,  8.13917840e+00,  8.80292932e+00,  1.00000000e-01,  1.10000000e+00,
-  2.67771495e+00,  8.13917840e+00,  7.90850213e+00,  3.00000000e-01,  3.30000000e+00,
-  4.90300511e+00,  9.88492152e+00,  7.93005776e+00,  2.00000000e-01,  2.20000000e+00,
-  3.11415073e+00,  9.88492152e+00,  7.03563057e+00,  1.00000000e-01,  1.10000000e+00,
-  3.68584927e+00,  9.11507848e+00,  1.03643694e+01,  4.00000000e-01,  4.60000000e+00,
-  1.89699489e+00,  9.11507848e+00,  9.46994224e+00,  3.00000000e-01,  3.20000000e+00,
-  4.12228505e+00,  1.08608216e+01,  9.49149787e+00,  7.00000000e-01,  5.20000000e+00,
-  2.33343067e+00,  1.08608216e+01,  8.59707068e+00,  5.00000000e-01,  4.60000000e+00,
-};
-
-const char* spatialdata::spatialdb::SimpleDBDataVolume3D::_names[] = {
-"One",
-"Two",
-};
-
-const char* spatialdata::spatialdb::SimpleDBDataVolume3D::_units[] = {
-"m",
-"m",
-};
-
-const double spatialdata::spatialdb::SimpleDBDataVolume3D::_queryNearest[] = {
-  4.38173419e+00,  8.36254772e+00,  8.74899281e+00,  1.00000000e-01,  1.10000000e+00,
-  2.35495601e+00,  1.00264422e+01,  9.00123360e+00,  5.00000000e-01,  4.60000000e+00,
-  3.91112675e+00,  1.07838373e+01,  9.69020768e+00,  7.00000000e-01,  5.20000000e+00,
-  3.87701461e+00,  1.04910673e+01,  9.08761157e+00,  7.00000000e-01,  5.20000000e+00,
-  3.01795532e+00,  8.84019490e+00,  8.79326896e+00,  3.00000000e-01,  3.30000000e+00,
-};
-
-const double spatialdata::spatialdb::SimpleDBDataVolume3D::_queryLinear[] = {
-  4.38173419e+00,  8.36254772e+00,  8.74899281e+00,  1.35000000e-01,  1.49500000e+00,
-  2.35495601e+00,  1.00264422e+01,  9.00123360e+00,  4.10000000e-01,  3.85500000e+00,
-  3.91112675e+00,  1.07838373e+01,  9.69020768e+00,  0.00000000e+00,  0.00000000e+00,
-  3.87701461e+00,  1.04910673e+01,  9.08761157e+00,  5.30000000e-01,  4.42000000e+00,
-  3.01795532e+00,  8.84019490e+00,  8.79326896e+00,  2.00000000e-01,  2.15500000e+00,
-};
-
-const int spatialdata::spatialdb::SimpleDBDataVolume3D::_errFlags[] = {
- 0, 0, 1, 0, 0,};
-
-spatialdata::spatialdb::SimpleDBDataVolume3D::SimpleDBDataVolume3D(void)
-{ // constructor
-  numLocs = _numLocs;
-  spaceDim = _spaceDim;
-  numVals = _numVals;
-  dataDim = _dataDim;
-  numQueries = _numQueries;
-  dbData = const_cast<double*>(_dbData);
-  names = const_cast<char**>(_names);
-  units = const_cast<char**>(_units);
-  queryNearest = const_cast<double*>(_queryNearest);
-  queryLinear = const_cast<double*>(_queryLinear);
-  errFlags = const_cast<int*>(_errFlags);
-} // constructor
-
-spatialdata::spatialdb::SimpleDBDataVolume3D::~SimpleDBDataVolume3D(void)
-{}
-
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,66 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from python application simpledbdatavolume3D.
-
-#if !defined(spatialdata_spatialdb_simpledbdatavolume3d_hh)
-#define spatialdata_spatialdb_simpledbdatavolume3d_hh
-
-#include "SimpleDBData.hh"
-
-namespace spatialdata {
-  namespace spatialdb {
-     class SimpleDBDataVolume3D;
-  } // spatialdata
-} // spatialdb
-
-class spatialdata::spatialdb::SimpleDBDataVolume3D : public SimpleDBData
-{
-
-public: 
-
-  /// Constructor
-  SimpleDBDataVolume3D(void);
-
-  /// Destructor
-  ~SimpleDBDataVolume3D(void);
-
-private:
-
-  static const int _numLocs;
-
-  static const int _spaceDim;
-
-  static const int _numVals;
-
-  static const int _dataDim;
-
-  static const int _numQueries;
-
-  static const double _dbData[];
-
-  static const char* _names[];
-
-  static const char* _units[];
-
-  static const double _queryNearest[];
-
-  static const double _queryLinear[];
-
-  static const int _errFlags[];
-
-};
-
-#endif // spatialdata_spatialdb_simpledbdatavolume3d_hh
-
-// End of file

Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,139 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-## @file tests/libtests/data/SimpleDBDataVolume3D.odb
-
-## @brief Python data generator for tests of C++ SimpleDB using
-## data with volumetric 3-D spatial distribution.
-
-import numpy
-
-from SimpleDBApp import SimpleDBApp
-
-# SimpleDBDataVolume3D class
-class SimpleDBDataVolume3D(SimpleDBApp):
-  """
-  Python data generator for tests of C++ SimpleDB using
-  data with volumetric 3-D spatial distribution.
-  """
-
-  def _compute(self):
-    """
-    Compute query data.
-    """
-    # Database information
-    self.numLocs = 8
-    self.numVals = 2
-    self.spaceDim = 3
-    self.names = [ "One", "Two" ]
-    self.units = [ "m", "m" ]
-    self.dataDim = 3
-    self.dbData = None
-
-    # Query information
-    self.numQueries = 5
-    self.queryNearest = None
-    self.queryLinear = None
-    self.errFlags = numpy.array( [ 0, 0, 1, 0, 0  ], dtype=numpy.int32)
-
-    tdata = [ {'r': 1.0, 's':-1.0, 't':-1.0, 'one': 0.1, 'two': 1.1},
-              {'r':-1.0, 's':-1.0, 't':-1.0, 'one': 0.3, 'two': 3.3},
-              {'r': 1.0, 's': 1.0, 't':-1.0, 'one': 0.2, 'two': 2.2},
-              {'r':-1.0, 's': 1.0, 't':-1.0, 'one': 0.1, 'two': 1.1},
-              {'r': 1.0, 's':-1.0, 't': 1.0, 'one': 0.4, 'two': 4.6},
-              {'r':-1.0, 's':-1.0, 't': 1.0, 'one': 0.3, 'two': 3.2},
-              {'r': 1.0, 's': 1.0, 't': 1.0, 'one': 0.7, 'two': 5.2},
-              {'r':-1.0, 's': 1.0, 't': 1.0, 'one': 0.5, 'two': 4.6}]
-    qtdata = [ {'r': 0.9, 's':-0.8, 't':-0.9, 'ni': 0,
-                'wts': [{'i': 0, 'w': 0.80},
-                        {'i': 2, 'w': 0.10},
-                        {'i': 4, 'w': 0.05},
-                        {'i': 1, 'w': 0.05}] },
-               {'r': -0.8, 's': 0.1, 't': 0.9, 'ni': 7,
-                'wts': [{'i': 7, 'w': 0.40},
-                        {'i': 5, 'w': 0.45},
-                        {'i': 6, 'w': 0.10},
-                        {'i': 3, 'w': 0.05}] },
-               {'r': 0.9, 's': 0.8, 't': 1.2, 'ni': 6,
-                'wts': [{'i': 6, 'w': 0.0},
-                        {'i': 4, 'w': 0.0},
-                        {'i': 7, 'w': 0.0},
-                        {'i': 2, 'w': 0.0}] },
-               {'r': 0.6, 's': 0.8, 't': 0.6, 'ni': 6,
-                'wts': [{'i': 6, 'w': 0.50},
-                        {'i': 2, 'w': 0.20},
-                        {'i': 7, 'w': 0.20},
-                        {'i': 4, 'w': 0.10}] },
-               {'r':-0.3, 's':-0.7, 't':-0.1, 'ni': 1,
-                'wts': [{'i': 1, 'w': 0.05},
-                        {'i': 5, 'w': 0.45},
-                        {'i': 0, 'w': 0.35},
-                        {'i': 3, 'w': 0.15}]} ]
-
-    o = numpy.array([3.4, 9.5, 8.7], dtype=numpy.float64)
-    sqrt5 = 5**0.5
-    sqrt21 = 21**0.5    
-    sqrt105 = 105**0.5
-    a = numpy.array([2.0/sqrt5, 0, 1.0/sqrt5], dtype=numpy.float64)
-    b = numpy.array([1.0/sqrt21, 4.0/sqrt21, -2.0/sqrt21], dtype=numpy.float64)
-    c = numpy.array([-4.0/sqrt105, 5.0/sqrt105, 8.0/sqrt105],
-                    dtype=numpy.float64)
-    self.dbData = numpy.zeros( (self.numLocs, self.spaceDim+self.numVals),
-                               dtype=numpy.float64)
-    iLoc = 0
-    for loc in tdata:
-      xyz = o + a*loc['r'] + b*loc['s'] + c*loc['t']
-      self.dbData[iLoc, :] = numpy.array([xyz[0], xyz[1], xyz[2],
-                                          loc['one'], loc['two']],
-                                         dtype=numpy.float64)
-      iLoc += 1
-    
-    self.queryNearest = numpy.zeros( (self.numQueries,
-                                      self.spaceDim+self.numVals),
-                                     dtype=numpy.float64)
-    self.queryLinear = numpy.zeros( (self.numQueries,
-                                     self.spaceDim+self.numVals),
-                                    dtype=numpy.float64)
-    iLoc = 0
-    for qloc in qtdata:
-      xyz = o + a*qloc['r'] + b*qloc['s'] + c*qloc['t']
-      v1 = 0
-      v2 = 0
-      for wt in qloc['wts']:
-        v1 += tdata[wt['i']]['one']*wt['w']
-        v2 += tdata[wt['i']]['two']*wt['w']
-      self.queryLinear[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
-                                             dtype=numpy.float64)
-      v1 = tdata[qloc['ni']]['one']
-      v2 = tdata[qloc['ni']]['two']
-      self.queryNearest[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
-                                              dtype=numpy.float64)
-      iLoc += 1
-    return
-
-
-  def __init__(self):
-    """
-    Constructor.
-    """
-    SimpleDBApp.__init__(self, name="simpledbdatavolume3D")
-    return
-
-
-# MAIN /////////////////////////////////////////////////////////////////
-if __name__ == "__main__":
-
-  app = SimpleDBDataVolume3D()
-  app.run()
-
-
-# End of file 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryApp.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryApp.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryApp.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -60,6 +60,7 @@
     self.spaceDim = None
     self.numVals = None
     self.dataDim = None
+    self.dbCoords = None
     self.dbData = None
     self.names = None
     self.units = None
@@ -113,8 +114,10 @@
                         format="%d")
     self.data.addScalar(vtype="int", name="_dataDim", value=self.dataDim,
                         format="%d")
+    self.data.addArray(vtype="double", name="_dbCoords", values=self.dbCoords,
+                       format="%16.8e", ncols=self.spaceDim)
     self.data.addArray(vtype="double", name="_dbData", values=self.dbData,
-                       format="%16.8e", ncols=self.spaceDim+self.numVals)
+                       format="%16.8e", ncols=self.numVals)
     self.data.addArray(vtype="char*", name="_names", values=self.names,
                        format="\"%s\"", ncols=1)
     self.data.addArray(vtype="char*", name="_units", values=self.units,

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -19,6 +19,7 @@
   spaceDim(0),
   numVals(0),
   dataDim(0),
+  dbCoords(0),
   dbData(0),
   names(0),
   units(0),

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -40,6 +40,7 @@
   int spaceDim; ///< Spatial dimension for coordinates of locations
   int numVals; ///< Number of values per location in database
   int dataDim; ///< Spatial dimension of data in database
+  double* dbCoords; ///< Database locations
   double* dbData; ///< Database data
   char** names; ///< Names of values in database
   char** units; ///< Units of values in database

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -40,7 +40,8 @@
 
     dumper.writeVal("int", "NUMLOCS", numLocs, "%d")
     dumper.writeVal("int", "NUMVALS", numVals, "%d")
-    dumper.writeArray("double", "DATA", self._data, "%18.10e,", 3+numVals)
+    dumper.writeArray("double", "COORDS", self._data, "%18.10e,", 3)
+    dumper.writeArray("double", "DATA", self._data, "%18.10e,", numVals)
     dumper.writeArray("int", "ERRFLAGS", self._errFlags, "%2d,", 1)
     dumper.writeArray("char*", "NAMES", self._names, "  \"%s\",", 1)
     dumper.writeArray("char*", "UNITS", self._units, "  \"%s\",", 1)
@@ -62,7 +63,5 @@
     dumper.close()
     return
 
-# version
-__id__ = "$Id: SimpleDBQueryData.py,v 1.1 2005/05/25 18:43:07 baagaard Exp $"
 
 # End of file 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.cc	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -21,7 +21,7 @@
 
 const int spatialdata::spatialdb::SimpleDBQueryData3D::_numVals = 2;
 
-const int spatialdata::spatialdb::SimpleDBQueryData3D::_dataDim = 4;
+const int spatialdata::spatialdb::SimpleDBQueryData3D::_dataDim = 3;
 
 const int spatialdata::spatialdb::SimpleDBQueryData3D::_numPts = 4;
 
@@ -31,12 +31,20 @@
 
 const double spatialdata::spatialdb::SimpleDBQueryData3D::_volume =   2.95458000e+00;
 
+const double spatialdata::spatialdb::SimpleDBQueryData3D::_dbCoords[] = {
+  0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
+  1.00000000e+00,  1.00000000e-01,  3.00000000e-01,
+  2.00000000e+00,  2.00000000e-01,  2.00000000e-01,
+  3.00000000e+00,  3.00000000e-01,  1.00000000e-01,
+  4.00000000e+00,  4.00000000e-01,  9.00000000e-01,
+};
+
 const double spatialdata::spatialdb::SimpleDBQueryData3D::_dbData[] = {
-  0.00000000e+00,  0.00000000e+00,  0.00000000e+00,  1.10000000e+00,  5.50000000e+00,
-  1.00000000e+00,  1.00000000e-01,  3.00000000e-01,  2.20000000e+00,  6.60000000e+00,
-  2.00000000e+00,  2.00000000e-01,  2.00000000e-01,  3.30000000e+00,  7.70000000e+00,
-  3.00000000e+00,  3.00000000e-01,  1.00000000e-01,  4.40000000e+00,  8.80000000e+00,
-  4.00000000e+00,  4.00000000e-01,  9.00000000e-01,  4.50000000e+00,  9.90000000e+00,
+  1.10000000e+00,  5.50000000e+00,
+  2.20000000e+00,  6.60000000e+00,
+  3.30000000e+00,  7.70000000e+00,
+  4.40000000e+00,  8.80000000e+00,
+  4.50000000e+00,  9.90000000e+00,
 };
 
 const char* spatialdata::spatialdb::SimpleDBQueryData3D::_names[] = {
@@ -69,6 +77,7 @@
   dist2 = _dist2;
   area = _area;
   volume = _volume;
+  dbCoords = const_cast<double*>(_dbCoords);
   dbData = const_cast<double*>(_dbData);
   names = const_cast<char**>(_names);
   units = const_cast<char**>(_units);

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.hh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -53,6 +53,8 @@
 
   static const double _volume;
 
+  static const double _dbCoords[];
+
   static const double _dbData[];
 
   static const char* _names[];

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -39,13 +39,19 @@
     self.numLocs = 5
     self.spaceDim = 3
     self.numVals = 2
-    self.dataDim = 4
-    self.dbData = numpy.array([ [0.0, 0.0, 0.0, 1.1, 5.5],
-                               [1.0, 0.1, 0.3, 2.2, 6.6],
-                               [2.0, 0.2, 0.2, 3.3, 7.7],
-                               [3.0, 0.3, 0.1, 4.4, 8.8],
-                               [4.0, 0.4, 0.9, 4.5, 9.9] ],
+    self.dataDim = 3
+    self.dbCoords = numpy.array([ [0.0, 0.0, 0.0],
+                                  [1.0, 0.1, 0.3],
+                                  [2.0, 0.2, 0.2],
+                                  [3.0, 0.3, 0.1],
+                                  [4.0, 0.4, 0.9] ],
                              dtype=numpy.float64)
+    self.dbData = numpy.array([ [1.1, 5.5],
+                                [2.2, 6.6],
+                                [3.3, 7.7],
+                                [4.4, 8.8],
+                                [4.5, 9.9] ],
+                             dtype=numpy.float64)
     self.names = [ "One", "Two" ]
     self.units = [ "m", "m" ]
 

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestData.cc (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.cc)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestData.cc	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestData.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "SimpleDBTestData.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+spatialdata::spatialdb::SimpleDBTestData::SimpleDBTestData(void) :
+  numLocs(0),
+  spaceDim(0),
+  numVals(0),
+  dataDim(0),
+  dbCoords(0),
+  dbData(0),
+  errFlags(0),
+  names(0),
+  units(0),
+  numQueries(0),
+  queryNearest(0),
+  queryLinear(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+spatialdata::spatialdb::SimpleDBTestData::~SimpleDBTestData(void)
+{ // destructor
+} // destructor
+
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestData.hh (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.hh)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestData.hh	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestData.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(spatialdata_spatialdb_simpledbtestdata_hh)
+#define spatialdata_spatialdb_simpledbtestdata_hh
+
+namespace spatialdata {
+  namespace spatialdb {
+     class SimpleDBTestData;
+  } // spatialdb
+} // spatialdata
+
+class spatialdata::spatialdb::SimpleDBTestData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+  
+  /// Constructor
+  SimpleDBTestData(void);
+
+  /// Destructor
+  ~SimpleDBTestData(void);
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+  
+  /// @name Database information
+  //@{
+  int numLocs; ///< Number of locations in database
+  int spaceDim; ///< Spatial dimension for coordinates of locations
+  int numVals; ///< Number of values per location in database
+  int dataDim; ///< Spatial dimension of data in database
+  double* dbCoords; ///< Database locations
+  double* dbData; ///< Database data
+  char** names; ///< Names of values in database
+  char** units; ///< Units of values in database
+  //@}
+
+  /// @name Query information
+  //@{
+  int numQueries; ///< Number of queries
+  double* queryNearest; ///< Data for nearest neighbor queries
+  double* queryLinear; ///< Data for linear interpolation queries
+  int* errFlags; ///< Expected return values for queries
+  //@}
+
+};
+
+#endif // spatialdata_spatialdb_simpledbtestdata_hh
+
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.cc (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.cc)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.cc	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbdataarea3D.
+
+#include "SimpleDBTestDataArea3D.hh"
+
+const int spatialdata::spatialdb::SimpleDBTestDataArea3D::_numLocs = 6;
+
+const int spatialdata::spatialdb::SimpleDBTestDataArea3D::_spaceDim = 3;
+
+const int spatialdata::spatialdb::SimpleDBTestDataArea3D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleDBTestDataArea3D::_dataDim = 2;
+
+const int spatialdata::spatialdb::SimpleDBTestDataArea3D::_numQueries = 4;
+
+const double spatialdata::spatialdb::SimpleDBTestDataArea3D::_dbCoords[] = {
+  3.40000000e+00,  9.50000000e+00,  8.70000000e+00,
+  4.29442719e+00,  9.50000000e+00,  9.14721360e+00,
+  6.97770876e+00,  9.50000000e+00,  1.04888544e+01,
+  7.63236243e+00,  1.21186147e+01,  9.17954704e+00,
+  3.83643578e+00,  1.12457431e+01,  7.82712844e+00,
+  4.05465367e+00,  1.21186147e+01,  7.39069266e+00,
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataArea3D::_dbData[] = {
+  1.00000000e-01,  1.10000000e+00,
+  3.00000000e-01,  3.30000000e+00,
+  2.00000000e-01,  2.20000000e+00,
+  1.00000000e-01,  1.10000000e+00,
+ -4.00000000e-01, -4.40000000e+00,
+ -3.00000000e-01, -3.20000000e+00,
+};
+
+const char* spatialdata::spatialdb::SimpleDBTestDataArea3D::_names[] = {
+"One",
+"Two",
+};
+
+const char* spatialdata::spatialdb::SimpleDBTestDataArea3D::_units[] = {
+"m",
+"m",
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataArea3D::_queryNearest[] = {
+  6.30149946e+00,  1.03728716e+01,  9.60520501e+00,  2.00000000e-01,  2.20000000e+00,
+  3.78727022e+00,  1.01546537e+01,  8.48447656e+00,  1.00000000e-01,  1.10000000e+00,
+  6.95615313e+00,  1.29914862e+01,  8.29589766e+00,  1.00000000e-01,  1.10000000e+00,
+  4.89452639e+00,  1.19003968e+01,  7.94701520e+00, -3.00000000e-01, -3.20000000e+00,
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataArea3D::_queryLinear[] = {
+  6.30149946e+00,  1.03728716e+01,  9.60520501e+00,  2.00000000e-01,  2.20000000e+00,
+  3.78727022e+00,  1.01546537e+01,  8.48447656e+00, -3.75000000e-02, -4.12500000e-01,
+  6.95615313e+00,  1.29914862e+01,  8.29589766e+00,  0.00000000e+00,  0.00000000e+00,
+  4.89452639e+00,  1.19003968e+01,  7.94701520e+00, -2.25000000e-01, -2.42500000e+00,
+};
+
+const int spatialdata::spatialdb::SimpleDBTestDataArea3D::_errFlags[] = {
+ 0, 0, 1, 0,};
+
+spatialdata::spatialdb::SimpleDBTestDataArea3D::SimpleDBTestDataArea3D(void)
+{ // constructor
+  numLocs = _numLocs;
+  spaceDim = _spaceDim;
+  numVals = _numVals;
+  dataDim = _dataDim;
+  numQueries = _numQueries;
+  dbCoords = const_cast<double*>(_dbCoords);
+  dbData = const_cast<double*>(_dbData);
+  names = const_cast<char**>(_names);
+  units = const_cast<char**>(_units);
+  queryNearest = const_cast<double*>(_queryNearest);
+  queryLinear = const_cast<double*>(_queryLinear);
+  errFlags = const_cast<int*>(_errFlags);
+} // constructor
+
+spatialdata::spatialdb::SimpleDBTestDataArea3D::~SimpleDBTestDataArea3D(void)
+{}
+
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.hh (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.hh)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.hh	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbdataarea3D.
+
+#if !defined(spatialdata_spatialdb_simpledbtestdataarea3d_hh)
+#define spatialdata_spatialdb_simpledbtestdataarea3d_hh
+
+#include "SimpleDBTestData.hh"
+
+namespace spatialdata {
+  namespace spatialdb {
+     class SimpleDBTestDataArea3D;
+  } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleDBTestDataArea3D : public SimpleDBTestData
+{
+
+public: 
+
+  /// Constructor
+  SimpleDBTestDataArea3D(void);
+
+  /// Destructor
+  ~SimpleDBTestDataArea3D(void);
+
+private:
+
+  static const int _numLocs;
+
+  static const int _spaceDim;
+
+  static const int _numVals;
+
+  static const int _dataDim;
+
+  static const int _numQueries;
+
+  static const double _dbCoords[];
+
+  static const double _dbData[];
+
+  static const char* _names[];
+
+  static const char* _units[];
+
+  static const double _queryNearest[];
+
+  static const double _queryLinear[];
+
+  static const int _errFlags[];
+
+};
+
+#endif // spatialdata_spatialdb_simpledbtestdataarea3d_hh
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.py (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.py)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.py	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataArea3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file tests/libtests/data/SimpleDBDataArea3D.odb
+
+## @brief Python data generator for tests of C++ SimpleDB using
+## data with areal 3-D spatial distribution.
+
+import numpy
+
+from SimpleDBApp import SimpleDBApp
+
+# SimpleDBDataArea3D class
+class SimpleDBDataArea3D(SimpleDBApp):
+  """
+  Python data generator for tests of C++ SimpleDB using
+  data with areal 3-D spatial distribution.
+  """
+
+  def _compute(self):
+    """
+    Compute query data.
+    """
+    # Database information
+    self.numLocs = 6
+    self.numVals = 2
+    self.spaceDim = 3
+    self.names = [ "One", "Two" ]
+    self.units = [ "m", "m" ]
+    self.dataDim = 2
+    self.dbData = None
+
+    # Query information
+    self.numQueries = 4
+    self.queryNearest = None
+    self.queryLinear = None
+    self.errFlags = numpy.array( [ 0, 0, 1, 0  ], dtype=numpy.int32)
+
+    tdata = [ {'s': 0.0, 't': 0.0, 'one': 0.1, 'two': 1.1},
+              {'s': 1.0, 't': 0.0, 'one': 0.3, 'two': 3.3},
+              {'s': 4.0, 't': 0.0, 'one': 0.2, 'two': 2.2},
+              {'s': 4.0, 't': 3.0, 'one': 0.1, 'two': 1.1},
+              {'s': 0.0, 't': 2.0, 'one': -0.4, 'two': -4.4},
+              {'s': 0.0, 't': 3.0, 'one': -0.3, 'two': -3.2} ]
+    qtdata = [ {'s': 3.0, 't': 1.0, 'ni': 2,
+                'wts': [{'i': 1, 'w': 1.0/3.0},
+                        {'i': 2, 'w': 1.0/3.0},
+                        {'i': 3, 'w': 1.0/3.0}] },
+               {'s': 0.25, 't': 0.75, 'ni': 0,
+                'wts': [{'i': 0, 'w': 0.375},
+                        {'i': 1, 'w': 0.250},
+                        {'i': 4, 'w': 0.375}] },
+               {'s': 3.0, 't': 4.0, 'ni': 3,
+                'wts': [{'i': 3, 'w': 0.0},
+                        {'i': 5, 'w': 0.0},
+                        {'i': 4, 'w': 0.0}] },
+               {'s': 1.0, 't': 2.75, 'ni': 5,
+                'wts': [{'i': 5, 'w': 0.50},
+                        {'i': 4, 'w': 0.25},
+                        {'i': 3, 'w': 0.25}]} ]
+
+    o = numpy.array([3.4, 9.5, 8.7], dtype=numpy.float64)
+    sqrt5 = 5**0.5
+    sqrt21 = 21**0.5    
+    a = numpy.array([2.0/sqrt5, 0, 1.0/sqrt5], dtype=numpy.float64)
+    b = numpy.array([1.0/sqrt21, 4/sqrt21, -2/sqrt21], dtype=numpy.float64)
+    self.dbCoords = numpy.zeros( (self.numLocs, self.spaceDim),
+                               dtype=numpy.float64)
+    self.dbData = numpy.zeros( (self.numLocs, self.numVals),
+                               dtype=numpy.float64)
+    iLoc = 0
+    for loc in tdata:
+      xyz = o + a*loc['s'] + b*loc['t']
+      self.dbCoords[iLoc, :] = numpy.array([xyz[0], xyz[1], xyz[2]],
+                                         dtype=numpy.float64)
+      self.dbData[iLoc, :] = numpy.array([loc['one'], loc['two']],
+                                         dtype=numpy.float64)
+      iLoc += 1
+    
+    self.queryNearest = numpy.zeros( (self.numQueries,
+                                      self.spaceDim+self.numVals),
+                                     dtype=numpy.float64)
+    self.queryLinear = numpy.zeros( (self.numQueries,
+                                     self.spaceDim+self.numVals),
+                                    dtype=numpy.float64)
+    iLoc = 0
+    for qloc in qtdata:
+      xyz = o + a*qloc['s'] + b*qloc['t']
+      v1 = 0
+      v2 = 0
+      for wt in qloc['wts']:
+        v1 += tdata[wt['i']]['one']*wt['w']
+        v2 += tdata[wt['i']]['two']*wt['w']
+      self.queryLinear[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
+                                             dtype=numpy.float64)
+      v1 = tdata[qloc['ni']]['one']
+      v2 = tdata[qloc['ni']]['two']
+      self.queryNearest[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
+                                              dtype=numpy.float64)
+      iLoc += 1
+    return
+
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    SimpleDBApp.__init__(self, name="simpledbdataarea3D")
+    return
+
+
+# MAIN /////////////////////////////////////////////////////////////////
+if __name__ == "__main__":
+
+  app = SimpleDBDataArea3D()
+  app.run()
+
+
+# End of file 

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.cc (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.cc)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.cc	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbdataline3D.
+
+#include "SimpleDBTestDataLine3D.hh"
+
+const int spatialdata::spatialdb::SimpleDBTestDataLine3D::_numLocs = 5;
+
+const int spatialdata::spatialdb::SimpleDBTestDataLine3D::_spaceDim = 3;
+
+const int spatialdata::spatialdb::SimpleDBTestDataLine3D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleDBTestDataLine3D::_dataDim = 1;
+
+const int spatialdata::spatialdb::SimpleDBTestDataLine3D::_numQueries = 4;
+
+const double spatialdata::spatialdb::SimpleDBTestDataLine3D::_dbCoords[] = {
+  3.40000000e+00,  9.50000000e+00,  8.70000000e+00,
+  5.70000000e+00,  9.90000000e+00,  1.85000000e+01,
+  6.85000000e+00,  1.01000000e+01,  2.34000000e+01,
+  8.00000000e+00,  1.03000000e+01,  2.83000000e+01,
+  1.49000000e+01,  1.15000000e+01,  5.77000000e+01,
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataLine3D::_dbData[] = {
+  1.00000000e-01,  1.10000000e+00,
+  3.00000000e-01,  3.30000000e+00,
+  2.00000000e-01,  2.20000000e+00,
+  1.00000000e-01,  1.10000000e+00,
+ -4.00000000e-01, -4.40000000e+00,
+};
+
+const char* spatialdata::spatialdb::SimpleDBTestDataLine3D::_names[] = {
+"One",
+"Two",
+};
+
+const char* spatialdata::spatialdb::SimpleDBTestDataLine3D::_units[] = {
+"m",
+"m",
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataLine3D::_queryNearest[] = {
+  5.70000000e+00,  9.90000000e+00,  1.85000000e+01,  3.00000000e-01,  3.30000000e+00,
+  1.26000000e+01,  1.11000000e+01,  4.79000000e+01, -4.00000000e-01, -4.40000000e+00,
+  1.72000000e+01,  1.19000000e+01,  6.75000000e+01, -4.00000000e-01, -4.40000000e+00,
+  6.16000000e+00,  9.98000000e+00,  2.04600000e+01,  3.00000000e-01,  3.30000000e+00,
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataLine3D::_queryLinear[] = {
+  5.70000000e+00,  9.90000000e+00,  1.85000000e+01,  3.00000000e-01,  3.30000000e+00,
+  1.26000000e+01,  1.11000000e+01,  4.79000000e+01, -2.33333333e-01, -2.56666667e+00,
+  1.72000000e+01,  1.19000000e+01,  6.75000000e+01,  0.00000000e+00,  0.00000000e+00,
+  6.16000000e+00,  9.98000000e+00,  2.04600000e+01,  2.60000000e-01,  2.86000000e+00,
+};
+
+const int spatialdata::spatialdb::SimpleDBTestDataLine3D::_errFlags[] = {
+ 0, 0, 1, 0,};
+
+spatialdata::spatialdb::SimpleDBTestDataLine3D::SimpleDBTestDataLine3D(void)
+{ // constructor
+  numLocs = _numLocs;
+  spaceDim = _spaceDim;
+  numVals = _numVals;
+  dataDim = _dataDim;
+  numQueries = _numQueries;
+  dbCoords = const_cast<double*>(_dbCoords);
+  dbData = const_cast<double*>(_dbData);
+  names = const_cast<char**>(_names);
+  units = const_cast<char**>(_units);
+  queryNearest = const_cast<double*>(_queryNearest);
+  queryLinear = const_cast<double*>(_queryLinear);
+  errFlags = const_cast<int*>(_errFlags);
+} // constructor
+
+spatialdata::spatialdb::SimpleDBTestDataLine3D::~SimpleDBTestDataLine3D(void)
+{}
+
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.hh (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.hh)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.hh	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbdataline3D.
+
+#if !defined(spatialdata_spatialdb_simpledbtestdataline3d_hh)
+#define spatialdata_spatialdb_simpledbtestdataline3d_hh
+
+#include "SimpleDBTestData.hh"
+
+namespace spatialdata {
+  namespace spatialdb {
+     class SimpleDBTestDataLine3D;
+  } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleDBTestDataLine3D : public SimpleDBTestData
+{
+
+public: 
+
+  /// Constructor
+  SimpleDBTestDataLine3D(void);
+
+  /// Destructor
+  ~SimpleDBTestDataLine3D(void);
+
+private:
+
+  static const int _numLocs;
+
+  static const int _spaceDim;
+
+  static const int _numVals;
+
+  static const int _dataDim;
+
+  static const int _numQueries;
+
+  static const double _dbCoords[];
+
+  static const double _dbData[];
+
+  static const char* _names[];
+
+  static const char* _units[];
+
+  static const double _queryNearest[];
+
+  static const double _queryLinear[];
+
+  static const int _errFlags[];
+
+};
+
+#endif // spatialdata_spatialdb_simpledbtestdataline3d_hh
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.py (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.py)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.py	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataLine3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file tests/libtests/data/SimpleDBDataLine3D.odb
+
+## @brief Python data generator for tests of C++ SimpleDB using
+## data with linear 3-D spatial distribution.
+
+import numpy
+
+from SimpleDBApp import SimpleDBApp
+
+# SimpleDBDataLine3D class
+class SimpleDBDataLine3D(SimpleDBApp):
+  """
+  Python data generator for tests of C++ SimpleDB using
+  data with linear 3-D spatial distribution.
+  """
+
+  def _compute(self):
+    """
+    Compute query data.
+    """
+    # Database information
+    self.numLocs = 5
+    self.numVals = 2
+    self.spaceDim = 3
+    self.names = [ "One", "Two" ]
+    self.units = [ "m", "m" ]
+    self.dataDim = 1
+    self.dbCoords = None
+    self.dbData = None
+
+    # Query information
+    self.numQueries = 4
+
+    self.queryNearest = numpy.array( [[4.5, 2.3, 4.0, 6.3, 7.4],
+                                      [3.2, 7.4, 5.8, 6.3, 7.4],
+                                      [4.0, 9.8, 5.7, 6.3, 7.4]],
+                                     dtype=numpy.float64)
+    self.queryLinear = numpy.array( [[2.9, 3.4, 8.7, 6.3, 7.4],
+                                     [2.2, 9.0, 8.5, 6.3, 7.4],
+                                     [0.2, 5.8, 6.6, 6.3, 7.4]],
+                                    dtype=numpy.float64)
+    self.errFlags = numpy.array( [ 0, 0, 1, 0  ], dtype=numpy.int32)
+
+    tdata = [ {'t': 0.0, 'one': 0.1, 'two': 1.1},
+                    {'t': 1.0, 'one': 0.3, 'two': 3.3},
+                    {'t': 1.5, 'one': 0.2, 'two': 2.2},
+                    {'t': 2.0, 'one': 0.1, 'two': 1.1},
+                    {'t': 5.0, 'one': -0.4, 'two': -4.4} ]
+    qtdata = [ {'t': 1.0, 'ni': 1, 'wts': [{'i': 1, 'w': 1.0}] },
+               {'t': 4.0, 'ni': 4, 'wts': [{'i': 3, 'w': 1.0/3.0},
+                                           {'i': 4, 'w': 2.0/3.0} ] },
+               {'t': 6.0, 'ni': 4, 'wts': [{'i': 3, 'w': 0.0},
+                                           {'i': 4, 'w': 0.0} ] },
+               {'t': 1.2, 'ni': 1, 'wts': [{'i': 1, 'w': 0.6},
+                                           {'i': 2, 'w': 0.4}]} ]
+
+    o = numpy.array([3.4, 9.5, 8.7], dtype=numpy.float64)
+    a = numpy.array([2.3, 0.4, 9.8], dtype=numpy.float64)
+    self.dbCoords = numpy.zeros( (self.numLocs, self.spaceDim),
+                               dtype=numpy.float64)
+    self.dbData = numpy.zeros( (self.numLocs, self.numVals),
+                               dtype=numpy.float64)
+    iLoc = 0
+    for loc in tdata:
+      xyz = o + a*loc['t']
+      self.dbCoords[iLoc, :] = numpy.array([xyz[0], xyz[1], xyz[2]],
+                                         dtype=numpy.float64)
+      self.dbData[iLoc, :] = numpy.array([loc['one'], loc['two']],
+                                         dtype=numpy.float64)
+      iLoc += 1
+    
+    self.queryNearest = numpy.zeros( (self.numQueries,
+                                      self.spaceDim+self.numVals),
+                                     dtype=numpy.float64)
+    self.queryLinear = numpy.zeros( (self.numQueries,
+                                     self.spaceDim+self.numVals),
+                                    dtype=numpy.float64)
+    iLoc = 0
+    for qloc in qtdata:
+      xyz = o + a*qloc['t']
+      v1 = 0
+      v2 = 0
+      for wt in qloc['wts']:
+        v1 += tdata[wt['i']]['one']*wt['w']
+        v2 += tdata[wt['i']]['two']*wt['w']
+      self.queryLinear[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
+                                             dtype=numpy.float64)
+      v1 = tdata[qloc['ni']]['one']
+      v2 = tdata[qloc['ni']]['two']
+      self.queryNearest[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
+                                              dtype=numpy.float64)
+      iLoc += 1
+    return
+
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    SimpleDBApp.__init__(self, name="simpledbdataline3D")
+    return
+
+
+# MAIN /////////////////////////////////////////////////////////////////
+if __name__ == "__main__":
+
+  app = SimpleDBDataLine3D()
+  app.run()
+
+
+# End of file 

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.cc (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.cc)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.cc	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbdatapoint.
+
+#include "SimpleDBTestDataPoint3D.hh"
+
+const int spatialdata::spatialdb::SimpleDBTestDataPoint3D::_numLocs = 1;
+
+const int spatialdata::spatialdb::SimpleDBTestDataPoint3D::_spaceDim = 3;
+
+const int spatialdata::spatialdb::SimpleDBTestDataPoint3D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleDBTestDataPoint3D::_dataDim = 0;
+
+const int spatialdata::spatialdb::SimpleDBTestDataPoint3D::_numQueries = 3;
+
+const double spatialdata::spatialdb::SimpleDBTestDataPoint3D::_dbCoords[] = {
+  1.00000000e-01,  2.00000000e-01,  3.00000000e-01,
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataPoint3D::_dbData[] = {
+  6.30000000e+00,  7.40000000e+00,
+};
+
+const char* spatialdata::spatialdb::SimpleDBTestDataPoint3D::_names[] = {
+"One",
+"Two",
+};
+
+const char* spatialdata::spatialdb::SimpleDBTestDataPoint3D::_units[] = {
+"m",
+"m",
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataPoint3D::_queryNearest[] = {
+  4.50000000e+00,  2.30000000e+00,  4.00000000e+00,  6.30000000e+00,  7.40000000e+00,
+  3.20000000e+00,  7.40000000e+00,  5.80000000e+00,  6.30000000e+00,  7.40000000e+00,
+  4.00000000e+00,  9.80000000e+00,  5.70000000e+00,  6.30000000e+00,  7.40000000e+00,
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataPoint3D::_queryLinear[] = {
+  2.90000000e+00,  3.40000000e+00,  8.70000000e+00,  6.30000000e+00,  7.40000000e+00,
+  2.20000000e+00,  9.00000000e+00,  8.50000000e+00,  6.30000000e+00,  7.40000000e+00,
+  2.00000000e-01,  5.80000000e+00,  6.60000000e+00,  6.30000000e+00,  7.40000000e+00,
+};
+
+const int spatialdata::spatialdb::SimpleDBTestDataPoint3D::_errFlags[] = {
+ 0, 0, 0,};
+
+spatialdata::spatialdb::SimpleDBTestDataPoint3D::SimpleDBTestDataPoint3D(void)
+{ // constructor
+  numLocs = _numLocs;
+  spaceDim = _spaceDim;
+  numVals = _numVals;
+  dataDim = _dataDim;
+  numQueries = _numQueries;
+  dbCoords = const_cast<double*>(_dbCoords);
+  dbData = const_cast<double*>(_dbData);
+  names = const_cast<char**>(_names);
+  units = const_cast<char**>(_units);
+  queryNearest = const_cast<double*>(_queryNearest);
+  queryLinear = const_cast<double*>(_queryLinear);
+  errFlags = const_cast<int*>(_errFlags);
+} // constructor
+
+spatialdata::spatialdb::SimpleDBTestDataPoint3D::~SimpleDBTestDataPoint3D(void)
+{}
+
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.hh (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.hh)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.hh	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbdatapoint.
+
+#if !defined(spatialdata_spatialdb_simpledbtestdatapoint3d_hh)
+#define spatialdata_spatialdb_simpledbtestdatapoint3d_hh
+
+#include "SimpleDBTestData.hh"
+
+namespace spatialdata {
+  namespace spatialdb {
+     class SimpleDBTestDataPoint3D;
+  } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleDBTestDataPoint3D : public SimpleDBTestData
+{
+
+public: 
+
+  /// Constructor
+  SimpleDBTestDataPoint3D(void);
+
+  /// Destructor
+  ~SimpleDBTestDataPoint3D(void);
+
+private:
+
+  static const int _numLocs;
+
+  static const int _spaceDim;
+
+  static const int _numVals;
+
+  static const int _dataDim;
+
+  static const int _numQueries;
+
+  static const double _dbCoords[];
+
+  static const double _dbData[];
+
+  static const char* _names[];
+
+  static const char* _units[];
+
+  static const double _queryNearest[];
+
+  static const double _queryLinear[];
+
+  static const int _errFlags[];
+
+};
+
+#endif // spatialdata_spatialdb_simpledbtestdatapoint3d_hh
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.py (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.py	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataPoint3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py
+
+## @brief Python data generator for tests of C++ SimpleDB using
+## data with point 3-D spatial distribution.
+
+import numpy
+
+from SimpleDBApp import SimpleDBApp
+
+# SimpleDBDataPoint3D class
+class SimpleDBDataPoint3D(SimpleDBApp):
+  """
+  Python data generator for tests of C++ SimpleDB using
+  data with point 3-D spatial distribution.
+  """
+
+  def _compute(self):
+    """
+    Compute query data.
+    """
+    # Database information
+    self.numLocs = 1
+    self.numVals = 2
+    self.spaceDim = 3
+    self.names = [ "One", "Two" ]
+    self.units = [ "m", "m" ]
+    self.dataDim = 0
+    self.dbCoords = numpy.array( [0.1, 0.2, 0.3],
+                               dtype=numpy.float64)
+    self.dbData = numpy.array( [6.3, 7.4],
+                               dtype=numpy.float64)
+
+    # Query information
+    self.numQueries = 3
+    self.queryNearest = numpy.array( [[4.5, 2.3, 4.0, 6.3, 7.4],
+                                      [3.2, 7.4, 5.8, 6.3, 7.4],
+                                      [4.0, 9.8, 5.7, 6.3, 7.4]],
+                                     dtype=numpy.float64)
+    self.queryLinear = numpy.array( [[2.9, 3.4, 8.7, 6.3, 7.4],
+                                     [2.2, 9.0, 8.5, 6.3, 7.4],
+                                     [0.2, 5.8, 6.6, 6.3, 7.4]],
+                                    dtype=numpy.float64)
+    self.errFlags = numpy.array( [ 0, 0, 0 ], dtype=numpy.int32)
+    return
+
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    SimpleDBApp.__init__(self, name="simpledbdatapoint")
+    return
+
+
+# MAIN /////////////////////////////////////////////////////////////////
+if __name__ == "__main__":
+
+  app = SimpleDBDataPoint3D()
+  app.run()
+
+
+# End of file 

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.cc (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.cc)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.cc	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.cc	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbdatavolume3D.
+
+#include "SimpleDBTestDataVolume3D.hh"
+
+const int spatialdata::spatialdb::SimpleDBTestDataVolume3D::_numLocs = 8;
+
+const int spatialdata::spatialdb::SimpleDBTestDataVolume3D::_spaceDim = 3;
+
+const int spatialdata::spatialdb::SimpleDBTestDataVolume3D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleDBTestDataVolume3D::_dataDim = 3;
+
+const int spatialdata::spatialdb::SimpleDBTestDataVolume3D::_numQueries = 5;
+
+const double spatialdata::spatialdb::SimpleDBTestDataVolume3D::_dbCoords[] = {
+  4.46656933e+00,  8.13917840e+00,  8.80292932e+00,
+  2.67771495e+00,  8.13917840e+00,  7.90850213e+00,
+  4.90300511e+00,  9.88492152e+00,  7.93005776e+00,
+  3.11415073e+00,  9.88492152e+00,  7.03563057e+00,
+  3.68584927e+00,  9.11507848e+00,  1.03643694e+01,
+  1.89699489e+00,  9.11507848e+00,  9.46994224e+00,
+  4.12228505e+00,  1.08608216e+01,  9.49149787e+00,
+  2.33343067e+00,  1.08608216e+01,  8.59707068e+00,
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataVolume3D::_dbData[] = {
+  1.00000000e-01,  1.10000000e+00,
+  3.00000000e-01,  3.30000000e+00,
+  2.00000000e-01,  2.20000000e+00,
+  1.00000000e-01,  1.10000000e+00,
+  4.00000000e-01,  4.60000000e+00,
+  3.00000000e-01,  3.20000000e+00,
+  7.00000000e-01,  5.20000000e+00,
+  5.00000000e-01,  4.60000000e+00,
+};
+
+const char* spatialdata::spatialdb::SimpleDBTestDataVolume3D::_names[] = {
+"One",
+"Two",
+};
+
+const char* spatialdata::spatialdb::SimpleDBTestDataVolume3D::_units[] = {
+"m",
+"m",
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataVolume3D::_queryNearest[] = {
+  4.38173419e+00,  8.36254772e+00,  8.74899281e+00,  1.00000000e-01,  1.10000000e+00,
+  2.35495601e+00,  1.00264422e+01,  9.00123360e+00,  5.00000000e-01,  4.60000000e+00,
+  3.91112675e+00,  1.07838373e+01,  9.69020768e+00,  7.00000000e-01,  5.20000000e+00,
+  3.87701461e+00,  1.04910673e+01,  9.08761157e+00,  7.00000000e-01,  5.20000000e+00,
+  3.01795532e+00,  8.84019490e+00,  8.79326896e+00,  3.00000000e-01,  3.30000000e+00,
+};
+
+const double spatialdata::spatialdb::SimpleDBTestDataVolume3D::_queryLinear[] = {
+  4.38173419e+00,  8.36254772e+00,  8.74899281e+00,  1.35000000e-01,  1.49500000e+00,
+  2.35495601e+00,  1.00264422e+01,  9.00123360e+00,  4.10000000e-01,  3.85500000e+00,
+  3.91112675e+00,  1.07838373e+01,  9.69020768e+00,  0.00000000e+00,  0.00000000e+00,
+  3.87701461e+00,  1.04910673e+01,  9.08761157e+00,  5.30000000e-01,  4.42000000e+00,
+  3.01795532e+00,  8.84019490e+00,  8.79326896e+00,  2.00000000e-01,  2.15500000e+00,
+};
+
+const int spatialdata::spatialdb::SimpleDBTestDataVolume3D::_errFlags[] = {
+ 0, 0, 1, 0, 0,};
+
+spatialdata::spatialdb::SimpleDBTestDataVolume3D::SimpleDBTestDataVolume3D(void)
+{ // constructor
+  numLocs = _numLocs;
+  spaceDim = _spaceDim;
+  numVals = _numVals;
+  dataDim = _dataDim;
+  numQueries = _numQueries;
+  dbCoords = const_cast<double*>(_dbCoords);
+  dbData = const_cast<double*>(_dbData);
+  names = const_cast<char**>(_names);
+  units = const_cast<char**>(_units);
+  queryNearest = const_cast<double*>(_queryNearest);
+  queryLinear = const_cast<double*>(_queryLinear);
+  errFlags = const_cast<int*>(_errFlags);
+} // constructor
+
+spatialdata::spatialdb::SimpleDBTestDataVolume3D::~SimpleDBTestDataVolume3D(void)
+{}
+
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.hh (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.hh)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.hh	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.hh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbdatavolume3D.
+
+#if !defined(spatialdata_spatialdb_simpledbtestdatavolume3d_hh)
+#define spatialdata_spatialdb_simpledbtestdatavolume3d_hh
+
+#include "SimpleDBTestData.hh"
+
+namespace spatialdata {
+  namespace spatialdb {
+     class SimpleDBTestDataVolume3D;
+  } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleDBTestDataVolume3D : public SimpleDBTestData
+{
+
+public: 
+
+  /// Constructor
+  SimpleDBTestDataVolume3D(void);
+
+  /// Destructor
+  ~SimpleDBTestDataVolume3D(void);
+
+private:
+
+  static const int _numLocs;
+
+  static const int _spaceDim;
+
+  static const int _numVals;
+
+  static const int _dataDim;
+
+  static const int _numQueries;
+
+  static const double _dbCoords[];
+
+  static const double _dbData[];
+
+  static const char* _names[];
+
+  static const char* _units[];
+
+  static const double _queryNearest[];
+
+  static const double _queryLinear[];
+
+  static const int _errFlags[];
+
+};
+
+#endif // spatialdata_spatialdb_simpledbtestdatavolume3d_hh
+
+// End of file

Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.py (from rev 13871, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.py)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.py	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBTestDataVolume3D.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file tests/libtests/data/SimpleDBDataVolume3D.odb
+
+## @brief Python data generator for tests of C++ SimpleDB using
+## data with volumetric 3-D spatial distribution.
+
+import numpy
+
+from SimpleDBApp import SimpleDBApp
+
+# SimpleDBDataVolume3D class
+class SimpleDBDataVolume3D(SimpleDBApp):
+  """
+  Python data generator for tests of C++ SimpleDB using
+  data with volumetric 3-D spatial distribution.
+  """
+
+  def _compute(self):
+    """
+    Compute query data.
+    """
+    # Database information
+    self.numLocs = 8
+    self.numVals = 2
+    self.spaceDim = 3
+    self.names = [ "One", "Two" ]
+    self.units = [ "m", "m" ]
+    self.dataDim = 3
+    self.dbCoords = None
+    self.dbData = None
+
+    # Query information
+    self.numQueries = 5
+    self.queryNearest = None
+    self.queryLinear = None
+    self.errFlags = numpy.array( [ 0, 0, 1, 0, 0  ], dtype=numpy.int32)
+
+    tdata = [ {'r': 1.0, 's':-1.0, 't':-1.0, 'one': 0.1, 'two': 1.1},
+              {'r':-1.0, 's':-1.0, 't':-1.0, 'one': 0.3, 'two': 3.3},
+              {'r': 1.0, 's': 1.0, 't':-1.0, 'one': 0.2, 'two': 2.2},
+              {'r':-1.0, 's': 1.0, 't':-1.0, 'one': 0.1, 'two': 1.1},
+              {'r': 1.0, 's':-1.0, 't': 1.0, 'one': 0.4, 'two': 4.6},
+              {'r':-1.0, 's':-1.0, 't': 1.0, 'one': 0.3, 'two': 3.2},
+              {'r': 1.0, 's': 1.0, 't': 1.0, 'one': 0.7, 'two': 5.2},
+              {'r':-1.0, 's': 1.0, 't': 1.0, 'one': 0.5, 'two': 4.6}]
+    qtdata = [ {'r': 0.9, 's':-0.8, 't':-0.9, 'ni': 0,
+                'wts': [{'i': 0, 'w': 0.80},
+                        {'i': 2, 'w': 0.10},
+                        {'i': 4, 'w': 0.05},
+                        {'i': 1, 'w': 0.05}] },
+               {'r': -0.8, 's': 0.1, 't': 0.9, 'ni': 7,
+                'wts': [{'i': 7, 'w': 0.40},
+                        {'i': 5, 'w': 0.45},
+                        {'i': 6, 'w': 0.10},
+                        {'i': 3, 'w': 0.05}] },
+               {'r': 0.9, 's': 0.8, 't': 1.2, 'ni': 6,
+                'wts': [{'i': 6, 'w': 0.0},
+                        {'i': 4, 'w': 0.0},
+                        {'i': 7, 'w': 0.0},
+                        {'i': 2, 'w': 0.0}] },
+               {'r': 0.6, 's': 0.8, 't': 0.6, 'ni': 6,
+                'wts': [{'i': 6, 'w': 0.50},
+                        {'i': 2, 'w': 0.20},
+                        {'i': 7, 'w': 0.20},
+                        {'i': 4, 'w': 0.10}] },
+               {'r':-0.3, 's':-0.7, 't':-0.1, 'ni': 1,
+                'wts': [{'i': 1, 'w': 0.05},
+                        {'i': 5, 'w': 0.45},
+                        {'i': 0, 'w': 0.35},
+                        {'i': 3, 'w': 0.15}]} ]
+
+    o = numpy.array([3.4, 9.5, 8.7], dtype=numpy.float64)
+    sqrt5 = 5**0.5
+    sqrt21 = 21**0.5    
+    sqrt105 = 105**0.5
+    a = numpy.array([2.0/sqrt5, 0, 1.0/sqrt5], dtype=numpy.float64)
+    b = numpy.array([1.0/sqrt21, 4.0/sqrt21, -2.0/sqrt21], dtype=numpy.float64)
+    c = numpy.array([-4.0/sqrt105, 5.0/sqrt105, 8.0/sqrt105],
+                    dtype=numpy.float64)
+    self.dbCoords = numpy.zeros( (self.numLocs, self.spaceDim),
+                               dtype=numpy.float64)
+    self.dbData = numpy.zeros( (self.numLocs, self.numVals),
+                               dtype=numpy.float64)
+    iLoc = 0
+    for loc in tdata:
+      xyz = o + a*loc['r'] + b*loc['s'] + c*loc['t']
+      self.dbCoords[iLoc, :] = numpy.array([xyz[0], xyz[1], xyz[2]],
+                                         dtype=numpy.float64)
+      self.dbData[iLoc, :] = numpy.array([loc['one'], loc['two']],
+                                         dtype=numpy.float64)
+      iLoc += 1
+    
+    self.queryNearest = numpy.zeros( (self.numQueries,
+                                      self.spaceDim+self.numVals),
+                                     dtype=numpy.float64)
+    self.queryLinear = numpy.zeros( (self.numQueries,
+                                     self.spaceDim+self.numVals),
+                                    dtype=numpy.float64)
+    iLoc = 0
+    for qloc in qtdata:
+      xyz = o + a*qloc['r'] + b*qloc['s'] + c*qloc['t']
+      v1 = 0
+      v2 = 0
+      for wt in qloc['wts']:
+        v1 += tdata[wt['i']]['one']*wt['w']
+        v2 += tdata[wt['i']]['two']*wt['w']
+      self.queryLinear[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
+                                             dtype=numpy.float64)
+      v1 = tdata[qloc['ni']]['one']
+      v2 = tdata[qloc['ni']]['two']
+      self.queryNearest[iLoc,:] = numpy.array([xyz[0], xyz[1], xyz[2], v1, v2],
+                                              dtype=numpy.float64)
+      iLoc += 1
+    return
+
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    SimpleDBApp.__init__(self, name="simpledbdatavolume3D")
+    return
+
+
+# MAIN /////////////////////////////////////////////////////////////////
+if __name__ == "__main__":
+
+  app = SimpleDBDataVolume3D()
+  app.run()
+
+
+# End of file 

Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/generate.sh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/generate.sh	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/generate.sh	2009-01-19 00:08:26 UTC (rev 13878)
@@ -30,25 +30,25 @@
 
   # Point --------------------------------------------------------------
 
-  python SimpleDBDataPoint3D.py \
+  python SimpleDBTestDataPoint3D.py \
     --data.namespace=spatialdata,spatialdb \
-    --data.object=SimpleDBDataPoint3D \
-    --data.parent=SimpleDBData
+    --data.object=SimpleDBTestDataPoint3D \
+    --data.parent=SimpleDBTestData
 
-  python SimpleDBDataLine3D.py \
+  python SimpleDBTestDataLine3D.py \
     --data.namespace=spatialdata,spatialdb \
-    --data.object=SimpleDBDataLine3D \
-    --data.parent=SimpleDBData
+    --data.object=SimpleDBTestDataLine3D \
+    --data.parent=SimpleDBTestData
 
-  python SimpleDBDataArea3D.py \
+  python SimpleDBTestDataArea3D.py \
     --data.namespace=spatialdata,spatialdb \
-    --data.object=SimpleDBDataArea3D \
-    --data.parent=SimpleDBData
+    --data.object=SimpleDBTestDataArea3D \
+    --data.parent=SimpleDBTestData
 
-  python SimpleDBDataVolume3D.py \
+  python SimpleDBTestDataVolume3D.py \
     --data.namespace=spatialdata,spatialdb \
-    --data.object=SimpleDBDataVolume3D \
-    --data.parent=SimpleDBData
+    --data.object=SimpleDBTestDataVolume3D \
+    --data.parent=SimpleDBTestData
 
 fi
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSCart.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSCart.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSCart.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,12 +17,13 @@
   def test_initialize(self):
     from spatialdata.geocoords.CSCart import CSCart
     cs = CSCart()
-    cs.units = "km"
-    cs.spaceDim = 2
+    cs.inventory.units = "km"
+    cs.inventory.spaceDim = 2
+    cs._configure()
     cs.initialize()
 
-    self.assertEqual(1.0e+3, cs.cppHandle.toMeters)
-    self.assertEqual(2, cs.cppHandle.spaceDim)
+    self.assertEqual(1.0e+3, cs.toMeters())
+    self.assertEqual(2, cs.spaceDim())
 
     return
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeo.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeo.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeo.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,19 +17,20 @@
   def test_initialize(self):
     from spatialdata.geocoords.CSGeo import CSGeo
     cs = CSGeo()
-    cs.ellipsoid = "clrk66"
-    cs.datumHoriz = "NAD27"
-    cs.datumVert = "mean sea level"
-    cs.units = "km"
-    cs.spaceDim = 2
+    cs.inventory.ellipsoid = "clrk66"
+    cs.inventory.datumHoriz = "NAD27"
+    cs.inventory.datumVert = "mean sea level"
+    cs.inventory.units = "km"
+    cs.inventory.spaceDim = 2
+    cs._configure()
     cs.initialize()
 
-    self.assertEqual(cs.ellipsoid, cs.cppHandle.ellipsoid)
-    self.assertEqual(cs.datumHoriz, cs.cppHandle.datumHoriz)
-    self.assertEqual(cs.datumVert, cs.cppHandle.datumVert)
-    self.assertEqual(cs.isGeocentric, cs.isGeocentric)
-    self.assertEqual(1.0e+3, cs.cppHandle.toMeters)
-    self.assertEqual(2, cs.cppHandle.spaceDim)
+    self.assertEqual("clrk66", cs.ellipsoid())
+    self.assertEqual("NAD27", cs.datumHoriz())
+    self.assertEqual("mean sea level", cs.datumVert())
+    self.assertEqual(False, cs.isGeocentric())
+    self.assertEqual(1.0e+3, cs.toMeters())
+    self.assertEqual(2, cs.spaceDim())
 
     return
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoLocalCart.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoLocalCart.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoLocalCart.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,27 +17,28 @@
   def test_initialize(self):
     from spatialdata.geocoords.CSGeoLocalCart import CSGeoLocalCart
     cs = CSGeoLocalCart()
-    cs.originLon = -120.0
-    cs.originLat = 38.0
+    cs.inventory.originLon = -120.0
+    cs.inventory.originLat = 38.4
     from pyre.units.length import m
-    cs.originElev = 12.0*m
-    cs.ellipsoid = "clrk66"
-    cs.datumHoriz = "NAD27"
-    cs.datumVert = "mean sea level"
-    cs.units = "km"
+    cs.inventory.originElev = 12.0*m
+    cs.inventory.ellipsoid = "clrk66"
+    cs.inventory.datumHoriz = "NAD27"
+    cs.inventory.datumVert = "mean sea level"
+    cs.inventory.units = "km"
+    cs._configure()
     cs.initialize()
 
-    self.assertEqual(cs.ellipsoid, cs.cppHandle.ellipsoid)
-    self.assertEqual(cs.datumHoriz, cs.cppHandle.datumHoriz)
-    self.assertEqual(cs.datumVert, cs.cppHandle.datumVert)
-    self.assertEqual(True, cs.isGeocentric)
-    self.assertEqual(1.0e+3, cs.cppHandle.toMeters)
-    self.assertEqual(3, cs.cppHandle.spaceDim)
+    self.assertEqual("clrk66", cs.ellipsoid())
+    self.assertEqual("NAD27", cs.datumHoriz())
+    self.assertEqual("mean sea level", cs.datumVert())
+    self.assertEqual(True, cs.isGeocentric())
+    self.assertEqual(1.0e+3, cs.toMeters())
+    self.assertEqual(3, cs.spaceDim())
 
-    (lon, lat, elev) = cs.cppHandle.getOrigin()
-    self.assertAlmostEqual(cs.originLon, lon, 6)
-    self.assertAlmostEqual(cs.originLat, lat, 6)
-    self.assertAlmostEqual(cs.originElev.value, elev, 6)
+    (lon, lat, elev) = cs.origin()
+    self.assertAlmostEqual(-120.0, lon, 6)
+    self.assertAlmostEqual(38.4, lat, 6)
+    self.assertAlmostEqual(12.0, elev, 6)
 
     return
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoProj.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoProj.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestCSGeoProj.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -17,29 +17,28 @@
   def test_initialize(self):
     from spatialdata.geocoords.Projector import Projector
     proj = Projector()
-    proj.projection = "aea"
-    proj.units = "m"
-    proj.projOptions = ""
-    proj.falseEasting = -100.0
-    proj.falseNorthing = 30.0
-    proj.scaleFactor = 0.9995
+    proj.inventory.projection = "aea"
+    proj.inventory.units = "m"
+    proj.inventory.projOptions = "+lon_0=-100.0 +lat_30.0 +k=0.9995"
+    proj._configure()
 
     from spatialdata.geocoords.CSGeoProj import CSGeoProj
     cs = CSGeoProj()
-    cs.ellipsoid = "clrk66"
-    cs.datumHoriz = "NAD27"
-    cs.datumVert = "mean sea level"
-    cs.units = "km"
-    cs.spaceDim = 2
-    cs.projector = proj
+    cs.inventory.ellipsoid = "clrk66"
+    cs.inventory.datumHoriz = "NAD27"
+    cs.inventory.datumVert = "mean sea level"
+    cs.inventory.units = "km"
+    cs.inventory.spaceDim = 2
+    cs.inventory.projector = proj
+    cs._configure()
     cs.initialize()
     
-    self.assertEqual(cs.ellipsoid, cs.cppHandle.ellipsoid)
-    self.assertEqual(cs.datumHoriz, cs.cppHandle.datumHoriz)
-    self.assertEqual(cs.datumVert, cs.cppHandle.datumVert)
-    self.assertEqual(cs.isGeocentric, cs.isGeocentric)
-    self.assertEqual(1.0e+3, cs.cppHandle.toMeters)
-    self.assertEqual(2, cs.cppHandle.spaceDim)
+    self.assertEqual("clrk66", cs.ellipsoid())
+    self.assertEqual("NAD27", cs.datumHoriz())
+    self.assertEqual("mean sea level", cs.datumVert())
+    self.assertEqual(False, cs.isGeocentric())
+    self.assertEqual(1.0e+3, cs.toMeters())
+    self.assertEqual(2, cs.spaceDim())
 
     return
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestConverter.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestConverter.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestConverter.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -37,24 +37,26 @@
   def test_convert(self):
     from spatialdata.geocoords.CSGeo import CSGeo
     csNAD27 = CSGeo()
-    csNAD27.ellipsoid = "clrk66"
-    csNAD27.datumHoriz = "NAD27"
-    csNAD27.datumVert = "mean sea level"
+    csNAD27.inventory.ellipsoid = "clrk66"
+    csNAD27.inventory.datumHoriz = "NAD27"
+    csNAD27.inventory.datumVert = "mean sea level"
+    csNAD27._configure()
     csNAD27.initialize()
 
     from spatialdata.geocoords.CSGeoLocalCart import CSGeoLocalCart
     csLocal = CSGeoLocalCart()
-    csLocal.originLon = -100.0
-    csLocal.originLat = 39.0
+    csLocal.inventory.originLon = -100.0
+    csLocal.inventory.originLat = 39.0
     from pyre.units.length import m
-    csLocal.originElev = 0.01*m
-    csLocal.ellipsoid = "clrk66"
-    csLocal.datumHoriz = "NAD27"
-    csLocal.datumVert = "mean sea level"
+    csLocal.inventory.originElev = 0.01*m
+    csLocal.inventory.ellipsoid = "clrk66"
+    csLocal.inventory.datumHoriz = "NAD27"
+    csLocal.inventory.datumVert = "mean sea level"
+    csLocal._configure()
     csLocal.initialize()
 
     from spatialdata.geocoords.Converter import convert
-    coordsXYZ = lonlatNAD27ElevVals
+    coordsXYZ = numpy.array(lonlatNAD27ElevVals)
     convert(coordsXYZ, csLocal, csNAD27)
     xyzLocalValsT = numpy.array(coordsXYZ)
 
@@ -66,7 +68,4 @@
     return
 
 
-# version
-__id__ = "$Id$"
-
 # End of file 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestProjector.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestProjector.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/TestProjector.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -11,20 +11,23 @@
 #
 
 import unittest
+import numpy
 
 projection = "aea"
 units = "km"
 projOptions = "+lon_0=-100.0 +lat_0=30.0 +k=0.9996"
-lonlatVals = [ [-1.203425320000e+02,  5.323423000000e+01],
-               [-5.330394500000e+01,  3.334902000000e+01],
-               [ 3.422908500000e+01, -2.523422000000e+01],
-               [ 1.420845230000e+02, -3.439085000000e+01],
-               [ 4.990854300000e+01,  2.409830000000e+00] ]
-xyVals = [ [ -1.397886620000e+03,  2.729173050000e+03],
-           [  4.145823900000e+03,  1.412439200000e+03],
-           [  1.424820130000e+04,  6.884278430000e+03],
-           [ -1.424775469000e+04,  4.279122720000e+03],
-           [  1.205623096000e+04,  9.239581410000e+03] ]
+lonlatVals = numpy.array([ [-1.203425320000e+02,  5.323423000000e+01],
+                           [-5.330394500000e+01,  3.334902000000e+01],
+                           [ 3.422908500000e+01, -2.523422000000e+01],
+                           [ 1.420845230000e+02, -3.439085000000e+01],
+                           [ 4.990854300000e+01,  2.409830000000e+00] ],
+                         dtype=numpy.float64)
+xyVals = numpy.array([ [ -1.397886620000e+03,  2.729173050000e+03],
+                       [  4.145823900000e+03,  1.412439200000e+03],
+                       [  1.424820130000e+04,  6.884278430000e+03],
+                       [ -1.424775469000e+04,  4.279122720000e+03],
+                       [  1.205623096000e+04,  9.239581410000e+03] ],
+                     dtype=numpy.float64)
 
 class TestProjector(unittest.TestCase):
 
@@ -32,15 +35,17 @@
   def setUp(self):
     from spatialdata.geocoords.CSGeo import CSGeo
     cs = CSGeo()
+    cs._configure()
     cs.initialize()
     self.cs = cs
     
     from spatialdata.geocoords.Projector import Projector
-    self.projector = Projector()
-    
-    self.projector.projection = projection
-    self.projector.units = units
-    self.projector.projOptions = projOptions
+    projector = Projector()
+    projector.inventory.projection = projection
+    projector.inventory.units = units
+    projector.inventory.projOptions = projOptions
+    projector._configure()
+    self.projector = projector
     return
   
 
@@ -48,32 +53,11 @@
     self.projector.initialize(self.cs)
 
     proj = self.projector
-    self.assertEqual(proj.projection, proj.cppHandle.projection)
-    self.assertEqual(proj.units, proj.cppHandle.units)
-    self.assertEqual(proj.projOptions, proj.cppHandle.projOptions)
+    self.assertEqual(projection, proj.projection())
+    self.assertEqual(units, proj.units())
+    self.assertEqual(projOptions, proj.projOptions())
 
     return
 
 
-  def test_project(self):
-    self.projector.initialize(self.cs)
-    xyValsT = self.projector.project(lonlatVals)
-    self.assertEqual(len(xyVals), len(xyValsT))
-    for (xy, xyT) in zip(xyVals, xyValsT):
-      self.assertAlmostEqual(xy[0], xyT[0], 4)
-      self.assertAlmostEqual(xy[1], xyT[1], 4)
-    return
-
-  def test_invproject(self):
-    self.projector.initialize(self.cs)
-    lonlatValsT = self.projector.invproject(xyVals)
-    self.assertEqual(len(lonlatVals), len(lonlatValsT))
-    for (lonlat, lonlatT) in zip(lonlatVals, lonlatValsT):
-      self.assertAlmostEqual(lonlat[0], lonlatT[0], 4)
-      self.assertAlmostEqual(lonlat[1], lonlatT[1], 4)
-    return
-
-# version
-__id__ = "$Id$"
-
 # End of file 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/geocoords/testgeocoords.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/geocoords/testgeocoords.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/geocoords/testgeocoords.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -36,14 +36,14 @@
 
   return suite
 
+
 def main():
   unittest.TextTestRunner(verbosity=2).run(suite())
   return
 
+
 if __name__ == '__main__':
   main()
   
-# version
-__id__ = "$Id$"
 
 # End of file 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestCompositeDB.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestCompositeDB.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestCompositeDB.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -20,16 +20,16 @@
   def setUp(self):
     from spatialdata.spatialdb.UniformDB import UniformDB
     dbA = UniformDB()
-    dbA.label = "db A"
-    dbA.values = ["one", "two", "three"]
-    dbA.data = [1.1, 2.2, 3.3]
-    dbA.initialize()
+    dbA.inventory.label = "db A"
+    dbA.inventory.values = ["one", "two", "three"]
+    dbA.inventory.data = [1.1, 2.2, 3.3]
+    dbA._configure()
     
     dbB = UniformDB()
-    dbB.label = "db B"
-    dbB.values = ["two", "three", "four", "five" ]
-    dbB.data = [2.1, 3.1, 4.1, 5.1]
-    dbB.initialize()
+    dbB.inventory.label = "db B"
+    dbB.inventory.values = ["two", "three", "four", "five" ]
+    dbB.inventory.data = [2.1, 3.1, 4.1, 5.1]
+    dbB._configure()
 
     from spatialdata.spatialdb.CompositeDB import CompositeDB
     db = CompositeDB()
@@ -38,11 +38,11 @@
     db.inventory.dbB = dbB
     db.inventory.namesB = ["three", "five"]
     db._configure()
-    db.initialize()
 
     self._db = db
     return
 
+
   def test_database(self):
     locs = numpy.array( [[1.0, 2.0, 3.0],
                          [5.6, 4.2, 8.6]],
@@ -52,18 +52,21 @@
     queryVals = ["three", "one", "five"]
     dataE = numpy.array([[3.1, 1.1, 5.1],
                          [3.1, 1.1, 5.1]], numpy.float64)
-    errE = numpy.array( [0]*2, numpy.int32)
+    errE = [0, 0]
     
-    self._db.open()
-    self._db.queryVals(queryVals)
-    (data, err) = self._db.query(locs, cs, 3)
-    data = numpy.array(data)
-    err = numpy.array(err)
+    db = self._db
+    db.open()
+    db.queryVals(queryVals)
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = locs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], locs[i,:], cs)
+      err.append(e)
+    db.close()    
 
-    self.assertEqual(len(errE.shape), len(err.shape))
-    for dE, d in zip(errE.shape, err.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(errE, -1), numpy.reshape(err, -1)):
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
       self.assertEqual(vE, v)
 
     self.assertEqual(len(dataE.shape), len(data.shape))
@@ -72,7 +75,6 @@
     for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
       self.assertAlmostEqual(vE, v, 6)
 
-    self._db.close()    
     return
 
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestGenSimpleDBApp.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestGenSimpleDBApp.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestGenSimpleDBApp.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -30,39 +30,48 @@
 
     # Test write using query
     db = SimpleDB()
+    db.inventory.iohandler.inventory.filename = \
+        "data/gen1Din2D.spatialdb"
+    db.inventory.iohandler._configure()
+    db.inventory.label = "test"
+    db.inventory.queryType = "nearest"
     db._configure()
-    db.iohandler.filename = "data/gen1Din2D.spatialdb"
-    db.label = "test"
-    db.queryType = "nearest"
-    db.initialize()
 
-    db.open()
-    db.queryVals(["two", "one"])
-
     qlocs = numpy.array( [[-2.0,  2.0],
                           [ 3.0, -4.0],
                           [ 0.0,  0.7]],
                          numpy.float64)
     
-    valsE = numpy.array( [[-0.15, 3.45],
+    dataE = numpy.array( [[-0.15, 3.45],
                           [2.4, 6.4],
                           [-0.6, 3.45]], numpy.float64)
-    
+    errE = [0, 0, 0]
+
     from spatialdata.geocoords.CSCart import CSCart
     cs = CSCart()
-    cs.spaceDim = 2
-    cs.initialize()
+    cs.inventory.spaceDim = 2
+    cs._configure()
 
-    (vals, err) = db.query(qlocs, cs, 2)
-    vals = numpy.array(vals)
+    db.open()
+    db.queryVals(["two", "one"])
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = qlocs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], qlocs[i,:], cs)
+      err.append(e)
+    db.close()    
 
-    self.assertEqual(len(valsE.shape), len(vals.shape))
-    for dE, d in zip(valsE.shape, vals.shape):
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
+      self.assertEqual(vE, v)
+
+    self.assertEqual(len(dataE.shape), len(data.shape))
+    for dE, d in zip(dataE.shape, data.shape):
       self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(valsE, -1), numpy.reshape(vals, -1)):
+    for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
       self.assertAlmostEqual(vE, v, 6)
 
-    db.close()
     return
 
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestGravityField.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestGravityField.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestGravityField.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -21,7 +21,6 @@
     from spatialdata.spatialdb.GravityField import GravityField
     db = GravityField()
     db._configure()
-    db.initialize()
     self._db = db
     return
 
@@ -34,17 +33,20 @@
     gacc = 9.80665
     dataE = numpy.array([[0.0, 0.0, -gacc],
                          [0.0, 0.0, -gacc]], numpy.float64)
-    errE = numpy.array( [0]*2, numpy.int32)
+    errE = [0, 0]
     
-    self._db.open()
-    (data, err) = self._db.query(locs, cs, numvals=3)
-    data = numpy.array(data)
-    err = numpy.array(err)
+    db = self._db
+    db.open()
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = locs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], locs[i,:], cs)
+      err.append(e)
+    db.close()    
 
-    self.assertEqual(len(errE.shape), len(err.shape))
-    for dE, d in zip(errE.shape, err.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(errE, -1), numpy.reshape(err, -1)):
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
       self.assertEqual(vE, v)
 
     self.assertEqual(len(dataE.shape), len(data.shape))
@@ -53,7 +55,6 @@
     for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
       self.assertAlmostEqual(vE, v, 6)
 
-    self._db.close()    
     return
 
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -19,9 +19,8 @@
   def setUp(self):
     from spatialdata.spatialdb.SCECCVMH import SCECCVMH
     db = SCECCVMH()
+    db.inventory.dataDir = "/Users/brad/data/sceccvm-h/vx52/bin"
     db._configure()
-    db.dataDir = "/Users/brad/data/sceccvm-h/vx52/bin"
-    db.initialize()
     self._db = db
     return
 
@@ -32,27 +31,30 @@
                         numpy.float64)
     from spatialdata.geocoords.CSGeo import CSGeo
     cs = CSGeo()
+    cs.inventory.datumHoriz = "NAD27"
+    cs.inventory.datumVert = "mean sea level"
+    cs.inventory.ellipsoid = "clrk66"
     cs._configure()
-    cs.datumHoriz = "NAD27"
-    cs.datumVert = "mean sea level"
-    cs.ellipsoid = "clrk66"
     cs.initialize()
     queryVals = ["topo-elev", "moho-depth", "density"]
     dataE = numpy.array([[489.975189, -31178.105469,   2660.851074],
                          [801.209961, -34526.414062,   3022.192708]],
                         numpy.float64)
-    errE = numpy.array( [0]*2, numpy.int32)
+    errE = [0, 0]
     
-    self._db.open()
-    self._db.queryVals(queryVals)
-    (data, err) = self._db.query(locs, cs, 3)
-    data = numpy.array(data)
-    err = numpy.array(err)
+    db = self._db
+    db.open()
+    db.queryVals(queryVals)
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = locs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], locs[i,:], cs)
+      err.append(e)
+    db.close()    
 
-    self.assertEqual(len(errE.shape), len(err.shape))
-    for dE, d in zip(errE.shape, err.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(errE, -1), numpy.reshape(err, -1)):
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
       self.assertEqual(vE, v)
 
     self.assertEqual(len(dataE.shape), len(data.shape))
@@ -60,41 +62,42 @@
       self.assertEqual(dE, d)
     for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
       self.assertAlmostEqual(vE, v, 6)
-
-    self._db.close()    
     return
 
 
   def test_querySquash(self):
-    locs = numpy.array( [[-118.520000,  34.120000,  -1400.00],
-                         [-116.400000,  32.340000,  -1000.00]],
+    locs = numpy.array( [[-118.520000,  34.120000,  -1400.00-489.975189],
+                         [-116.400000,  32.340000,  -1000.00-801.209961]],
                         numpy.float64)
     from spatialdata.geocoords.CSGeo import CSGeo
     cs = CSGeo()
+    cs.inventory.datumHoriz = "NAD27"
+    cs.inventory.datumVert = "mean sea level"
+    cs.inventory.ellipsoid = "clrk66"
     cs._configure()
-    cs.datumHoriz = "NAD27"
-    cs.datumVert = "mean sea level"
-    cs.ellipsoid = "clrk66"
     cs.initialize()
     queryVals = ["topo-elev", "moho-depth", "density"]
     dataE = numpy.array([[489.975189, -31178.105469,   2660.851074],
                          [801.209961, -34526.414062,   3022.192708]],
                         numpy.float64)
-    errE = numpy.array( [0]*2, numpy.int32)
+    errE = [0, 0]
     
-    self._db.open()
-    self._db.queryVals(queryVals)
-    self._db.squash = True
+    db = self._db
+    db.open()
+    db.queryVals(queryVals)
     from pyre.units.length import km
-    self._db.squashLimit = -2.5*km
-    (data, err) = self._db.query(locs, cs, 3)
-    data = numpy.array(data)
-    err = numpy.array(err)
+    squashLimit = -2.5*km
+    db.squash(True, squashLimit.value)
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = locs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], locs[i,:], cs)
+      err.append(e)
+    db.close()    
 
-    self.assertEqual(len(errE.shape), len(err.shape))
-    for dE, d in zip(errE.shape, err.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(errE, -1), numpy.reshape(err, -1)):
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
       self.assertEqual(vE, v)
 
     self.assertEqual(len(dataE.shape), len(data.shape))
@@ -103,7 +106,6 @@
     for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
       self.assertAlmostEqual(vE, v, 6)
 
-    self._db.close()    
     return
 
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py.in
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py.in	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSCECCVMH.py.in	2009-01-19 00:08:26 UTC (rev 13878)
@@ -19,9 +19,8 @@
   def setUp(self):
     from spatialdata.spatialdb.SCECCVMH import SCECCVMH
     db = SCECCVMH()
+    db.inventory.dataDir = "@SCECCVMH_DATADIR@"
     db._configure()
-    db.dataDir = "@SCECCVMH_DATADIR@"
-    db.initialize()
     self._db = db
     return
 
@@ -32,27 +31,30 @@
                         numpy.float64)
     from spatialdata.geocoords.CSGeo import CSGeo
     cs = CSGeo()
+    cs.inventory.datumHoriz = "NAD27"
+    cs.inventory.datumVert = "mean sea level"
+    cs.inventory.ellipsoid = "clrk66"
     cs._configure()
-    cs.datumHoriz = "NAD27"
-    cs.datumVert = "mean sea level"
-    cs.ellipsoid = "clrk66"
     cs.initialize()
     queryVals = ["topo-elev", "moho-depth", "density"]
     dataE = numpy.array([[489.975189, -31178.105469,   2660.851074],
                          [801.209961, -34526.414062,   3022.192708]],
                         numpy.float64)
-    errE = numpy.array( [0]*2, numpy.int32)
+    errE = [0, 0]
     
-    self._db.open()
-    self._db.queryVals(queryVals)
-    (data, err) = self._db.query(locs, cs, 3)
-    data = numpy.array(data)
-    err = numpy.array(err)
+    db = self._db
+    db.open()
+    db.queryVals(queryVals)
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = locs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], locs[i,:], cs)
+      err.append(e)
+    db.close()    
 
-    self.assertEqual(len(errE.shape), len(err.shape))
-    for dE, d in zip(errE.shape, err.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(errE, -1), numpy.reshape(err, -1)):
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
       self.assertEqual(vE, v)
 
     self.assertEqual(len(dataE.shape), len(data.shape))
@@ -60,41 +62,42 @@
       self.assertEqual(dE, d)
     for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
       self.assertAlmostEqual(vE, v, 6)
-
-    self._db.close()    
     return
 
 
   def test_querySquash(self):
-    locs = numpy.array( [[-118.520000,  34.120000,  -1400.00],
-                         [-116.400000,  32.340000,  -1000.00]],
+    locs = numpy.array( [[-118.520000,  34.120000,  -1400.00-489.975189],
+                         [-116.400000,  32.340000,  -1000.00-801.209961]],
                         numpy.float64)
     from spatialdata.geocoords.CSGeo import CSGeo
     cs = CSGeo()
+    cs.inventory.datumHoriz = "NAD27"
+    cs.inventory.datumVert = "mean sea level"
+    cs.inventory.ellipsoid = "clrk66"
     cs._configure()
-    cs.datumHoriz = "NAD27"
-    cs.datumVert = "mean sea level"
-    cs.ellipsoid = "clrk66"
     cs.initialize()
     queryVals = ["topo-elev", "moho-depth", "density"]
     dataE = numpy.array([[489.975189, -31178.105469,   2660.851074],
                          [801.209961, -34526.414062,   3022.192708]],
                         numpy.float64)
-    errE = numpy.array( [0]*2, numpy.int32)
+    errE = [0, 0]
     
-    self._db.open()
-    self._db.queryVals(queryVals)
-    self._db.squash = True
+    db = self._db
+    db.open()
+    db.queryVals(queryVals)
     from pyre.units.length import km
-    self._db.squashLimit = -2.5*km
-    (data, err) = self._db.query(locs, cs, 3)
-    data = numpy.array(data)
-    err = numpy.array(err)
+    squashLimit = -2.5*km
+    db.squash(True, squashLimit.value)
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = locs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], locs[i,:], cs)
+      err.append(e)
+    db.close()    
 
-    self.assertEqual(len(errE.shape), len(err.shape))
-    for dE, d in zip(errE.shape, err.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(errE, -1), numpy.reshape(err, -1)):
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
       self.assertEqual(vE, v)
 
     self.assertEqual(len(dataE.shape), len(data.shape))
@@ -103,7 +106,6 @@
     for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
       self.assertAlmostEqual(vE, v, 6)
 
-    self._db.close()    
     return
 
 

Copied: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSimpleDB.py (from rev 13871, cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSimpleDB.py	                        (rev 0)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSimpleDB.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+import unittest
+
+import numpy
+from spatialdata.geocoords.CSCart import CSCart
+
+class TestSimpleDB(unittest.TestCase):
+
+  def setUp(self):
+    from spatialdata.spatialdb.SimpleDB import SimpleDB
+    db = SimpleDB()
+    db.inventory.label = "test"
+    db.inventory.queryType = "nearest"
+    db.inventory.iohandler.inventory.filename = "data/spatialdb.dat"
+    db.inventory.iohandler._configure()
+    db._configure()
+    self._db = db
+    return
+
+
+  def test_database(self):
+    locs = numpy.array( [[1.0, 2.0, 3.0],
+                         [5.6, 4.2, 8.6]],
+                        numpy.float64)
+    cs = CSCart()
+    cs._configure()
+    queryVals = ["two", "one"]
+    dataE = numpy.array( [[4.7, 6.3]]*2, numpy.float64)
+    errE = [0, 0]
+
+    db = self._db
+    db.open()
+    db.queryVals(queryVals)
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = locs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], locs[i,:], cs)
+      err.append(e)
+    db.close()    
+
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
+      self.assertEqual(vE, v)
+
+    self.assertEqual(len(dataE.shape), len(data.shape))
+    for dE, d in zip(dataE.shape, data.shape):
+      self.assertEqual(dE, d)
+    for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
+      self.assertAlmostEqual(vE, v, 6)
+
+    return
+
+
+# End of file 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSimpleIOAscii.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSimpleIOAscii.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSimpleIOAscii.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -13,7 +13,6 @@
 import unittest
 
 import numpy
-import spatialdata.utils.simplearray as simplearray
 from spatialdata.geocoords.CSCart import CSCart
 
 class TestSimpleIOAscii(unittest.TestCase):
@@ -23,8 +22,10 @@
     Test write().
     """
     # Database info
+    cs = CSCart()
+    cs.initialize()
+
     filename = "data/test.spatialdb"
-    cs = CSCart()
     data = {'locs': numpy.array( [ [1.0, 2.0, 3.0],
                                    [0.5, 3.0, -3.0]], numpy.float64),
             'coordsys': cs,
@@ -34,49 +35,51 @@
                         'data': numpy.array( [2.0, 8.0], numpy.float64)},
                        {'name': "Two",
                         'units': "m",
-                        'data': numpy.array( [-2.0, 3.0], numpy.float64)}]}
-            
+                        'data': numpy.array( [-2.0, 3.0], numpy.float64)}]}            
     dataDim = 1
             
-    
+    qlocs = numpy.array( [[0.875, 2.25, 1.5],
+                          [0.6, 2.8, -1.8],
+                          [1.0, 2.0, 3.0]],
+                         numpy.float64)    
+    valsE = numpy.array( [[-0.75, 3.5],
+                          [2.0, 6.8],
+                          [-2.0, 2.0]], numpy.float64)
+    errE = [0, 0, 0]
+  
+  
     # Write database
     from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
     writer = SimpleIOAscii()
-    writer.filename = filename
-    writer.initialize()
+    writer.inventory.filename = filename
+    writer._configure()
     writer.write(data)
 
     # Test write using query
     from spatialdata.spatialdb.SimpleDB import SimpleDB
     db = SimpleDB()
+    db.inventory.label = "test"
+    db.inventory.queryType = "linear"
+    db.inventory.iohandler.inventory.filename = filename
+    db.inventory.iohandler._configure()
     db._configure()
-    db.label = "test"
-    db.queryType = "Linear"
-    db.iohandler.filename = filename
-    db.initialize()
 
     db.open()
     db.queryVals(["two", "one"])
-
-    qlocs = numpy.array( [[0.875, 2.25, 1.5],
-                          [0.6, 2.8, -1.8],
-                          [1.0, 2.0, 3.0]],
-                         numpy.float64)
+    vals = numpy.zeros(valsE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = qlocs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(vals[i,:], qlocs[i,:], cs)
+      err.append(e)
+    db.close()    
     
-    valsE = numpy.array( [[-0.75, 3.5],
-                          [2.0, 6.8],
-                          [-2.0, 2.0]], numpy.float64)
-    
-    (vals, err) = db.query(qlocs, cs, 2)
-    vals = numpy.array(vals)
-
     self.assertEqual(len(valsE.shape), len(vals.shape))
     for dE, d in zip(valsE.shape, vals.shape):
       self.assertEqual(dE, d)
     for vE, v in zip(numpy.reshape(valsE, -1), numpy.reshape(vals, -1)):
       self.assertAlmostEqual(vE, v, 6)
 
-    db.close()    
     return
 
 

Deleted: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestSpatialDB.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-import unittest
-
-import numpy
-import spatialdata.utils.simplearray as simplearray
-from spatialdata.geocoords.CSCart import CSCart
-
-class TestSpatialDB(unittest.TestCase):
-
-  def setUp(self):
-    from spatialdata.spatialdb.SimpleDB import SimpleDB
-    db = SimpleDB()
-    db._configure()
-    db.label = "test"
-    db.queryType = "Nearest"
-    db.iohandler.filename = "data/spatialdb.dat"
-    db.initialize()
-    self._db = db
-    return
-
-  def test_database(self):
-    self._db.open()
-    self._db.queryVals(["two", "one"])
-
-    locs = numpy.array( [[1.0, 2.0, 3.0],
-                         [5.6, 4.2, 8.6]],
-                        numpy.float64)
-    cs = CSCart()
-    cs.toMeters = 1.0
-    
-    valsE = numpy.array( [[4.7, 6.3]]*2, numpy.float64)
-    errE = numpy.array( [0]*2, numpy.int32)
-
-    (vals, err) = self._db.query(locs, cs, 2)
-    vals = numpy.array(vals)
-    err = numpy.array(err)
-
-    self.assertEqual(len(errE.shape), len(err.shape))
-    for dE, d in zip(errE.shape, err.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(errE, -1), numpy.reshape(err, -1)):
-      self.assertEqual(vE, v)
-
-    self.assertEqual(len(valsE.shape), len(vals.shape))
-    for dE, d in zip(valsE.shape, vals.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(valsE, -1), numpy.reshape(vals, -1)):
-      self.assertAlmostEqual(vE, v, 6)
-
-    self._db.close()    
-    return
-
-
-# End of file 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestUniformDB.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestUniformDB.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/TestUniformDB.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -20,11 +20,10 @@
   def setUp(self):
     from spatialdata.spatialdb.UniformDB import UniformDB
     db = UniformDB()
+    db.inventory.label = "test"
+    db.inventory.values = ["one", "two", "three"]
+    db.inventory.data = [1.1, 2.2, 3.3]
     db._configure()
-    db.label = "test"
-    db.values = ["one", "two", "three"]
-    db.data = [1.1, 2.2, 3.3]
-    db.initialize()
     self._db = db
     return
 
@@ -37,18 +36,21 @@
     queryVals = ["three", "one"]
     dataE = numpy.array([[3.3, 1.1],
                          [3.3, 1.1]], numpy.float64)
-    errE = numpy.array( [0]*2, numpy.int32)
+    errE = [0, 0]
     
-    self._db.open()
-    self._db.queryVals(queryVals)
-    (data, err) = self._db.query(locs, cs, 2)
-    data = numpy.array(data)
-    err = numpy.array(err)
+    db = self._db
+    db.open()
+    db.queryVals(queryVals)
+    data = numpy.zeros(dataE.shape, dtype=numpy.float64)
+    err = []
+    nlocs = locs.shape[0]
+    for i in xrange(nlocs):
+      e = db.query(data[i,:], locs[i,:], cs)
+      err.append(e)
+    db.close()    
 
-    self.assertEqual(len(errE.shape), len(err.shape))
-    for dE, d in zip(errE.shape, err.shape):
-      self.assertEqual(dE, d)
-    for vE, v in zip(numpy.reshape(errE, -1), numpy.reshape(err, -1)):
+    self.assertEqual(len(errE), len(err))
+    for vE, v in zip(errE, err):
       self.assertEqual(vE, v)
 
     self.assertEqual(len(dataE.shape), len(data.shape))
@@ -57,7 +59,6 @@
     for vE, v in zip(numpy.reshape(dataE, -1), numpy.reshape(data, -1)):
       self.assertAlmostEqual(vE, v, 6)
 
-    self._db.close()    
     return
 
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/test_sceccvmh.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/test_sceccvmh.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/test_sceccvmh.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -21,10 +21,12 @@
 
   return suite
 
+
 def main():
   unittest.TextTestRunner(verbosity=2).run(suite())
   return
 
+
 if __name__ == '__main__':
   main()
   

Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/testspatial.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/testspatial.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/testspatial.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,12 +16,12 @@
 
   suite = unittest.TestSuite()
 
-  from TestSpatialDB import TestSpatialDB
-  suite.addTest(unittest.makeSuite(TestSpatialDB))
-
   from TestSimpleIOAscii import TestSimpleIOAscii
   suite.addTest(unittest.makeSuite(TestSimpleIOAscii))
 
+  from TestSimpleDB import TestSimpleDB
+  suite.addTest(unittest.makeSuite(TestSimpleDB))
+
   from TestUniformDB import TestUniformDB
   suite.addTest(unittest.makeSuite(TestUniformDB))
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticDynamic.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticDynamic.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticDynamic.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -32,10 +32,10 @@
     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)
+    self.assertEqual(wavelength, dim.lengthScale())
+    self.assertEqual(shearModulus, dim.pressureScale())
+    self.assertEqual(period, dim.timeScale())
+    self.assertEqual(density, dim.densityScale())
 
     return
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticQuasistatic.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticQuasistatic.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimElasticQuasistatic.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -25,10 +25,10 @@
     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)
+    self.assertEqual(1.0e+3*meter, dim.lengthScale())
+    self.assertEqual(3.0e+10*pascal, dim.pressureScale())
+    self.assertEqual(1.0*year, dim.timeScale())
+    self.assertEqual(1.0*kilogram/meter**3, dim.densityScale())
 
     return
 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimensional.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimensional.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/units/TestNondimensional.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -25,27 +25,18 @@
     dim = Nondimensional()
     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)
+    self.assertEqual(1.0*meter, dim.lengthScale())
+    self.assertEqual(1.0*pascal, dim.pressureScale())
+    self.assertEqual(1.0*second, dim.timeScale())
+    self.assertEqual(1.0*kilogram/meter**3, dim.densityScale())
 
     return
 
 
-  def test_initialize(self):
-    dim = Nondimensional()
-    dim._configure()
-    dim.initialize()
-
-    self.failIf(dim.cppHandle is None)
-    return
-
-
   def test_lengthScale(self):
     dim = Nondimensional()
     dim._configure()
-    dim._length = 2.0*meter
+    dim.setLengthScale(2.0*meter)
 
     self.assertEqual(2.0*meter, dim.lengthScale())
     self.assertEqual(1.0*pascal, dim.pressureScale())
@@ -57,7 +48,7 @@
   def test_pressureScale(self):
     dim = Nondimensional()
     dim._configure()
-    dim._pressure = 2.0*pascal
+    dim.setPressureScale(2.0*pascal)
 
     self.assertEqual(1.0*meter, dim.lengthScale())
     self.assertEqual(2.0*pascal, dim.pressureScale())
@@ -69,7 +60,7 @@
   def test_timeScale(self):
     dim = Nondimensional()
     dim._configure()
-    dim._time = 2.0*second
+    dim.setTimeScale(2.0*second)
 
     self.assertEqual(1.0*meter, dim.lengthScale())
     self.assertEqual(1.0*pascal, dim.pressureScale())
@@ -81,7 +72,7 @@
   def test_densityScale(self):
     dim = Nondimensional()
     dim._configure()
-    dim._density = 2.0*kilogram/meter**3
+    dim.setDensityScale(2.0*kilogram/meter**3)
 
     self.assertEqual(1.0*meter, dim.lengthScale())
     self.assertEqual(1.0*pascal, dim.pressureScale())
@@ -93,7 +84,6 @@
   def test_nondimensionalize(self):
     dim = Nondimensional()
     dim._configure()
-    dim.initialize()
 
     scale = 8.0*meter
     value = 2.0*meter
@@ -106,7 +96,6 @@
   def test_dimensionalize(self):
     dim = Nondimensional()
     dim._configure()
-    dim.initialize()
 
     scale = 8.0*meter
     value = 0.25

Modified: cs/spatialdata-0.1/trunk/tests/pytests/utils/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/utils/Makefile.am	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/utils/Makefile.am	2009-01-19 00:08:26 UTC (rev 13878)
@@ -24,7 +24,7 @@
 	TestPointsStream.py \
 	TestSimpleArray.py
 
-data_TMP = tmp.txt
+data_TMP = in.txt out.txt
 
 # module
 subpkgpyexec_LTLIBRARIES = testcppmodule.la

Modified: cs/spatialdata-0.1/trunk/tests/pytests/utils/TestChangeCoordSys.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/utils/TestChangeCoordSys.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/utils/TestChangeCoordSys.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -41,24 +41,28 @@
     """
     from spatialdata.geocoords.CSGeo import CSGeo
     csNAD27 = CSGeo()
-    csNAD27.ellipsoid = "clrk66"
-    csNAD27.datumHoriz = "NAD27"
-    csNAD27.datumVert = "mean sea level"
+    csNAD27.inventory.ellipsoid = "clrk66"
+    csNAD27.inventory.datumHoriz = "NAD27"
+    csNAD27.inventory.datumVert = "mean sea level"
+    csNAD27._configure()
 
     from spatialdata.geocoords.CSGeoLocalCart import CSGeoLocalCart
     csLocal = CSGeoLocalCart()
-    csLocal.originLon = -100.0
-    csLocal.originLat = 39.0
+    csLocal.inventory.originLon = -100.0
+    csLocal.inventory.originLat = 39.0
     from pyre.units.length import m
-    csLocal.originElev = 0.01*m
-    csLocal.ellipsoid = "clrk66"
-    csLocal.datumHoriz = "NAD27"
-    csLocal.datumVert = "mean sea level"
+    csLocal.inventory.originElev = 0.01*m
+    csLocal.inventory.ellipsoid = "clrk66"
+    csLocal.inventory.datumHoriz = "NAD27"
+    csLocal.inventory.datumVert = "mean sea level"
+    csLocal._configure()
 
     from spatialdata.utils.ChangeCoordSys import ChangeCoordSys
     converter = ChangeCoordSys()
-    converter.csDest = csLocal
-    converter.csSrc = csNAD27
+    converter.inventory.csDest = csLocal
+    converter.inventory.csSrc = csNAD27
+    converter._configure()
+
     coordsXYZ = lonlatNAD27ElevVals
     converter.convert(coordsXYZ)
     xyzLocalValsT = numpy.array(coordsXYZ)

Modified: cs/spatialdata-0.1/trunk/tests/pytests/utils/TestConvertApp.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/utils/TestConvertApp.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/utils/TestConvertApp.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -37,48 +37,60 @@
     """
     Test main().
     """
-    filename = "tmp.txt"
+    filename = "in.txt"
 
     from spatialdata.utils.PointsStream import PointsStream
     s = PointsStream()
-    s.filename = filename
-    s.fieldWidth = 20
-    s.precision = 8
+    s.inventory.filename = filename
+    s.inventory.numFormat = "%20.8e"
+    s._configure()
     
     s.write(lonlatNAD27ElevVals)
 
     from spatialdata.geocoords.CSGeo import CSGeo
     csNAD27 = CSGeo()
-    csNAD27.ellipsoid = "clrk66"
-    csNAD27.datumHoriz = "NAD27"
-    csNAD27.datumVert = "mean sea level"
+    csNAD27.inventory.ellipsoid = "clrk66"
+    csNAD27.inventory.datumHoriz = "NAD27"
+    csNAD27.inventory.datumVert = "mean sea level"
+    csNAD27._configure()
 
     from spatialdata.geocoords.CSGeoLocalCart import CSGeoLocalCart
     csLocal = CSGeoLocalCart()
-    csLocal.originLon = -100.0
-    csLocal.originLat = 39.0
+    csLocal.inventory.originLon = -100.0
+    csLocal.inventory.originLat = 39.0
     from pyre.units.length import m
-    csLocal.originElev = 0.01*m
-    csLocal.ellipsoid = "clrk66"
-    csLocal.datumHoriz = "NAD27"
-    csLocal.datumVert = "mean sea level"
+    csLocal.inventory.originElev = 0.01*m
+    csLocal.inventory.ellipsoid = "clrk66"
+    csLocal.inventory.datumHoriz = "NAD27"
+    csLocal.inventory.datumVert = "mean sea level"
+    csLocal._configure()
 
     from spatialdata.utils.ChangeCoordSys import ChangeCoordSys
     converter = ChangeCoordSys()
-    converter.csDest = csLocal
-    converter.csSrc = csNAD27
+    converter.inventory.csDest = csLocal
+    converter.inventory.csSrc = csNAD27
+    converter._configure()
 
     from spatialdata.utils.ConvertApp import ConvertApp
+    reader = PointsStream()
+    reader.inventory.filename = filename
+    reader.inventory.numFormat = "%20.8e"
+    reader._configure()
+
+    writer = PointsStream()
+    writer.inventory.filename = "out.txt"
+    writer.inventory.numFormat = "%20.8e"
+    writer._configure()
+
     app = ConvertApp()
-    app.reader = PointsStream()
-    app.reader.filename = filename
-    app.writer = app.reader
-    app.writer.fieldWidth = 20
-    app.writer.precision = 8
-    app.converter = converter
+    app.inventory.reader = reader
+    app.inventory.writer = writer
+    app.inventory.converter = converter
+    app._configure()
+
     app.main()
 
-    points = s.read()
+    points = writer.read()
     self.assertEqual(len(xyzLocalVals.shape), len(points.shape))
     for dE,d in zip(xyzLocalVals.shape, points.shape):
       self.assertEqual(dE, d)

Deleted: cs/spatialdata-0.1/trunk/tests/pytests/utils/TestPointsStream.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/utils/TestPointsStream.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/utils/TestPointsStream.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-import unittest
-
-import numpy
-from spatialdata.utils.PointsStream import PointsStream
-
-class TestPointsStream(unittest.TestCase):
-
-
-  def test_filename(self):
-    filename = "one"
-    s = PointsStream()
-    s.filename = filename
-    self.assertEqual(filename, s.filename)
-    return
-
-
-  def test_commentFlag(self):
-    flag = "%"
-    s = PointsStream()
-    s.commentFlag = flag
-    self.assertEqual(flag, s.commentFlag)
-    return
-
-
-  def test_fieldWidth(self):
-    fieldWidth = 6
-    s = PointsStream()
-    s.fieldWidth = fieldWidth
-    self.assertEqual(fieldWidth, s.fieldWidth)
-    return
-
-
-  def test_precision(self):
-    precision = 3
-    s = PointsStream()
-    s.precision = precision
-    self.assertEqual(precision, s.precision)
-    return
-
-  
-  def test_writeread(self):
-    pointsE = numpy.array([ [1.0, 2.0, 3.0],
-                            [1.1, 2.1, 3.1],
-                            [1.2, 2.2, 3.2] ],
-                          numpy.float64)
-    filename = "tmp.txt"
-    s = PointsStream()
-    s.filename = filename
-    s.write(pointsE)
-    
-    points = s.read()
-    self.assertEqual(len(pointsE.shape), len(points.shape))
-    for dE,d in zip(pointsE.shape, points.shape):
-      self.assertEqual(dE, d)
-    for vE,v in zip(numpy.reshape(pointsE, -1), numpy.reshape(points, -1)):
-      self.assertAlmostEqual(vE, v, 6)
-    return
-
-
-# End of file 

Deleted: cs/spatialdata-0.1/trunk/tests/pytests/utils/TestSimpleArray.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/utils/TestSimpleArray.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/utils/TestSimpleArray.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-import unittest
-
-import numpy
-import spatialdata.utils.simplearray as simplearray
-
-class TestSimpleArray(unittest.TestCase):
-
-
-  def test_frompy(self):
-    vals = [1.1, 2.1, 3.1, 1.2, 2.2, 3.2]
-    x = numpy.array(vals, numpy.float64)
-    y = simplearray.SimplePyArray(x)
-    self.assertEqual(len(x.shape), y.nd)
-    self.assertEqual(len(x.shape), len(y.shape))
-    for dE,d in zip(x.shape, y.shape):
-      self.assertEqual(dE, d)
-    z = numpy.array(y)
-    for vE, v in zip(vals, z):
-      self.assertAlmostEqual(vE, v, 6)
-
-    vals = [ [1, 2, 3],
-             [4, 5, 6] ]
-    x = numpy.array(vals, numpy.int32)
-    y = simplearray.SimplePyArray(x)
-    self.assertEqual(len(x.shape), y.nd)
-    self.assertEqual(len(x.shape), len(y.shape))
-    for dE,d in zip(x.shape, y.shape):
-      self.assertEqual(dE, d)
-    z = numpy.array(y)
-    for vE,v in zip(numpy.reshape(vals, -1), numpy.reshape(z, -1)):
-      self.assertEqual(vE, v)
-
-    vals = [ [ [1.1, 2.1, 3.1] ],
-             [ [2.1, 2.2, 3.2] ] ]
-    x = numpy.array(vals, numpy.float32)
-    y = simplearray.SimplePyArray(x)
-    self.assertEqual(len(x.shape), y.nd)
-    self.assertEqual(len(x.shape), len(y.shape))
-    for dE,d in zip(x.shape, y.shape):
-      self.assertEqual(dE, d)
-    z = numpy.array(y)
-    for vE,v in zip(numpy.reshape(vals, -1), numpy.reshape(z, -1)):
-      self.assertAlmostEqual(vE, v, 4)
-    return
-
-
-  def test_fromcpp(self):
-    vals = [ [1.1, 2.1, 3.1],
-             [1.2, 2.2, 3.2] ]
-    x = numpy.array(vals, numpy.float64)
-    import spatialdata.utils.testcpp as testcpp
-    y = testcpp.cpparray()
-    self.assertEqual(len(x.shape), y.nd)
-    self.assertEqual(len(x.shape), len(y.shape))
-    for dE,d in zip(x.shape, y.shape):
-      self.assertEqual(dE, d)
-    z = numpy.array(y)
-    for vE,v in zip(numpy.reshape(vals, -1), numpy.reshape(z, -1)):
-      self.assertAlmostEqual(vE, v, 4)
-    return
-
-
-  def test_tocpp(self):
-    vals = [ [1.1, 2.1],
-             [1.2, 2.2],
-             [1.3, 2.3] ]
-    x = numpy.array(vals, numpy.float64)
-    import spatialdata.utils.testcpp as testcpp
-    try:
-      testcpp.test(simplearray.SimplePyArray(x))
-    except ValueError, er:
-      print er
-      self.assertEqual(1, 0)
-    return
-
-
-# version
-__id__ = "$Id$"
-
-# End of file 

Modified: cs/spatialdata-0.1/trunk/tests/pytests/utils/testutils.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/utils/testutils.py	2009-01-17 01:34:26 UTC (rev 13877)
+++ cs/spatialdata-0.1/trunk/tests/pytests/utils/testutils.py	2009-01-19 00:08:26 UTC (rev 13878)
@@ -16,28 +16,22 @@
 
   suite = unittest.TestSuite()
 
-  from TestSimpleArray import TestSimpleArray
-  suite.addTest(unittest.makeSuite(TestSimpleArray))
-
   from TestChangeCoordSys import TestChangeCoordSys
   suite.addTest(unittest.makeSuite(TestChangeCoordSys))
 
-  from TestPointsStream import TestPointsStream
-  suite.addTest(unittest.makeSuite(TestPointsStream))
-
   from TestConvertApp import TestConvertApp
   suite.addTest(unittest.makeSuite(TestConvertApp))
 
   return suite
 
+
 def main():
   unittest.TextTestRunner(verbosity=2).run(suite())
   return
 
+
 if __name__ == '__main__':
   main()
   
-# version
-__id__ = "$Id$"
 
 # End of file 



More information about the CIG-COMMITS mailing list