[cig-commits] r5689 - in cs/spatialdata-0.1/trunk: .
libsrc/spatialdb modulesrc/geocoords modulesrc/spatialdb
modulesrc/spatialdb/generator spatialdata/utils
tests/libtests/spatialdb tests/libtests/spatialdb/data
tests/pytests/spatialdb/data
brad at geodynamics.org
brad at geodynamics.org
Sun Jan 7 12:24:38 PST 2007
Author: brad
Date: 2007-01-07 12:24:35 -0800 (Sun, 07 Jan 2007)
New Revision: 5689
Added:
cs/spatialdata-0.1/trunk/spatialdata/utils/CppData.py
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery3D.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery3D.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBApp.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/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/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/libtests/spatialdb/data/header.hh
Removed:
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.icc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.icc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.icc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.icc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBArea.dat
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBDataApp.py
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBLine.dat
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBPoint.dat
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBQuery.dat
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBQuery.py
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBVolume.dat
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/footer.dat
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/header.dat
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbarea.odb
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbline.odb
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbpoint.odb
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbvolume.odb
Modified:
cs/spatialdata-0.1/trunk/TODO
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/SimpleDBTypes.hh
cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.icc
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/spatialdb/SpatialDB.hh
cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.cc
cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.h
cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.cc
cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.h
cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe
cs/spatialdata-0.1/trunk/modulesrc/spatialdb/generator/generator.pyxe
cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe
cs/spatialdata-0.1/trunk/spatialdata/utils/Makefile.am
cs/spatialdata-0.1/trunk/spatialdata/utils/__init__.py
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/TestSimpleDBQuery.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.hh
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/Makefile.am
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/spatialdb.dat
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.c
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.h
cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testf77query.h
cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/data/spatialdb.dat
Log:
Updated spatialdb so that spatial database is not constrained to be in 3-D (coordinates can be 1-D, 2-D, or 3-D).
Modified: cs/spatialdata-0.1/trunk/TODO
===================================================================
--- cs/spatialdata-0.1/trunk/TODO 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/TODO 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,8 +1,6 @@
-pytests are failing on Brad's Mac with numpy-0.9.8. Try updating to
-numpy-1.0 (simplearray was made compatible? with 1.0 on Brad's linux
-machine).
+Update generator code to allow generating 0-D, 1-D, and 2-D spatial
+distributions in addition to 3-D.
-
UTILS
Ignore comment lines in PointsStream.
@@ -11,8 +9,6 @@
Make it possible to pickle/unpickle to/from file like in C++?
- Clean up number of coordinates issues. Use numbers instead of is2D flag?
-
SPATIALDB
Testing
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -30,10 +30,10 @@
// ----------------------------------------------------------------------
/// Default constructor
spatialdata::spatialdb::SimpleDB::SimpleDB(void) :
- _pIOHandler(0),
- _pQuery(0),
- _pData(0),
- _pCS(0)
+ _iohandler(0),
+ _query(0),
+ _data(0),
+ _cs(0)
{ // constructor
} // constructor
@@ -41,10 +41,10 @@
/// Constructor with label
spatialdata::spatialdb::SimpleDB::SimpleDB(const char* label) :
SpatialDB(label),
- _pIOHandler(0),
- _pQuery(0),
- _pData(0),
- _pCS(0)
+ _iohandler(0),
+ _query(0),
+ _data(0),
+ _cs(0)
{ // constructor
} // constructor
@@ -52,16 +52,16 @@
/// Default destructor
spatialdata::spatialdb::SimpleDB::~SimpleDB(void)
{ // destructor
- delete _pQuery; _pQuery = 0;
- if (0 != _pData) {
- delete[] _pData->data; _pData->data = 0;
- delete[] _pData->valNames; _pData->valNames = 0;
- delete[] _pData->valUnits; _pData->valUnits = 0;
+ 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 _pData; _pData = 0;
- delete _pIOHandler; _pIOHandler = 0;
+ delete _data; _data = 0;
+ delete _iohandler; _iohandler = 0;
- delete _pCS; _pCS = 0;
+ delete _cs; _cs = 0;
} // destructor
// ----------------------------------------------------------------------
@@ -69,20 +69,20 @@
void
spatialdata::spatialdb::SimpleDB::open(void)
{ // open
- assert(0 != _pIOHandler);
+ assert(0 != _iohandler);
// Read data
- if (0 == _pData) {
- _pData = new DataStruct;
- _pData->data = 0;
- _pData->valNames = 0;
- _pData->valUnits = 0;
- _pIOHandler->read(_pData, &_pCS);
+ if (0 == _data) {
+ _data = new DataStruct;
+ _data->data = 0;
+ _data->valNames = 0;
+ _data->valUnits = 0;
+ _iohandler->read(_data, &_cs);
} // if
// Create query object
- if (0 == _pQuery)
- _pQuery = new SimpleDBQuery(*this);
+ if (0 == _query)
+ _query = new SimpleDBQuery(*this);
} // open
// ----------------------------------------------------------------------
@@ -90,8 +90,8 @@
void
spatialdata::spatialdb::SimpleDB::close(void)
{ // close
- delete _pQuery; _pQuery = 0;
- delete[] _pData; _pData = 0;
+ delete _query; _query = 0;
+ delete[] _data; _data = 0;
} // close
// ----------------------------------------------------------------------
@@ -99,9 +99,9 @@
void
spatialdata::spatialdb::SimpleDB::queryType(const SimpleDB::QueryEnum queryType)
{ // queryType
- if (0 == _pQuery)
- _pQuery = new SimpleDBQuery(*this);
- _pQuery->queryType(queryType);
+ if (0 == _query)
+ _query = new SimpleDBQuery(*this);
+ _query->queryType(queryType);
} // QueryType
// ----------------------------------------------------------------------
@@ -110,14 +110,14 @@
spatialdata::spatialdb::SimpleDB::queryVals(const char** names,
const int numVals)
{ // queryVals
- if (0 == _pQuery) {
+ if (0 == _query) {
std::ostringstream msg;
msg
<< "Spatial database " << label() << " has not been opened.\n"
<< "Please call Open() before calling QueryVals().";
throw std::runtime_error(msg.str());
} // if
- _pQuery->queryVals(names, numVals);
+ _query->queryVals(names, numVals);
} // queryVals
// ----------------------------------------------------------------------
@@ -125,7 +125,7 @@
void
spatialdata::spatialdb::SimpleDB::ioHandler(const SimpleIO* iohandler)
{ // ioHandler
- _pIOHandler = iohandler->clone();
+ _iohandler = iohandler->clone();
} // ioHandler
// ----------------------------------------------------------------------
@@ -133,27 +133,26 @@
int
spatialdata::spatialdb::SimpleDB::query(double* vals,
const int numVals,
- const double x,
- const double y,
- const double z,
+ const double* coords,
+ const int numDims,
const spatialdata::geocoords::CoordSys* pCSQuery)
{ // query
try {
- if (0 == _pQuery) {
+ if (0 == _query) {
std::ostringstream msg;
msg
<< "Spatial database " << label() << " has not been opened.\n"
<< "Please call open() before calling query().";
throw std::runtime_error(msg.str());
} // if
- else if (0 == _pData) {
+ else if (0 == _data) {
std::ostringstream msg;
msg
<< "Spatial database " << label() << " does not contain any data.\n"
<< "Database query aborted.";
throw std::runtime_error(msg.str());
} // if
- _pQuery->query(vals, numVals, x, y, z, pCSQuery);
+ _query->query(vals, numVals, coords, numDims, pCSQuery);
} catch(const OutOfBounds& err) {
std::fill(vals, vals+numVals, 0);
return 1;
@@ -165,7 +164,5 @@
return 0;
} // query
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDB.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -18,6 +18,8 @@
#if !defined(spatialdata_spatialdb_simpledb_hh)
#define spatialdata_spatialdb_simpledb_hh
+#include "SpatialDB.hh"
+
namespace spatialdata {
namespace spatialdb {
class SpatialDB; // ISA SpatialDB
@@ -25,8 +27,8 @@
class SimpleIO; // USES SimpleIO
class SimpleDBTypes; // helper
class SimpleDBQuery; // helper
- class TestSimpleDB; // regression testing
- class TestSimpleDBQuery; // regression testing
+ class TestSimpleDB; // unit testing
+ class TestSimpleDBQuery; // unit testing
} // spatialdb
} // spatialdata
@@ -35,8 +37,8 @@
{ // class SimpleDB
friend class SimpleDBQuery; // helper
friend class SimpleDBTypes; // helper
- friend class TestSimpleDB; // regression testing
- friend class TestSimpleDBQuery; // regression testing
+ friend class TestSimpleDB; // unit testing
+ friend class TestSimpleDBQuery; // unit testing
public :
// PUBLIC ENUM ////////////////////////////////////////////////////////
@@ -104,20 +106,18 @@
* @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 x X coordinate of location for query
- * @param y Y coordinate of location for query
- * @param z Z coordinate of location for query
+ * @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)
*/
int query(double* vals,
- const int numVals,
- const double x,
- const double y,
- const double z,
- const spatialdata::geocoords::CoordSys* pCSQuery);
+ const int numVals,
+ const double* coords,
+ const int numDims,
+ const spatialdata::geocoords::CoordSys* pCSQuery);
private :
// PRIVATE METHODS ////////////////////////////////////////////////////
@@ -128,14 +128,14 @@
protected :
// PROTECTED MEMBERS ////////////////////////////////////////////////////
- DataStruct* _pData; ///< Pointer to data
+ DataStruct* _data; ///< Pointer to data
private :
// PRIVATE MEMBERS /////////////////////////////////////////////////////
- SimpleIO* _pIOHandler; ///< I/O handler
- SimpleDBQuery* _pQuery; ///< Query handler
- spatialdata::geocoords::CoordSys* _pCS; ///< Coordinate system
+ SimpleIO* _iohandler; ///< I/O handler
+ SimpleDBQuery* _query; ///< Query handler
+ spatialdata::geocoords::CoordSys* _cs; ///< Coordinate system
}; // class SimpleDB
@@ -143,7 +143,5 @@
#endif // spatialdata_spatialdb_simpledb_hh
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -63,7 +63,7 @@
spatialdata::spatialdb::SimpleDBQuery::queryVals(const char** names,
const int numVals)
{ // queryVals
- assert(0 != _db._pData);
+ assert(0 != _db._data);
if (0 == numVals) {
std::ostringstream msg;
msg
@@ -77,9 +77,9 @@
delete[] _queryVals; _queryVals = new int[numVals];
for (int iVal=0; iVal < numVals; ++iVal) {
int iName = 0;
- const int numNames = _db._pData->numVals;
+ const int numNames = _db._data->numVals;
while (iName < numNames) {
- if (0 == strcasecmp(names[iVal], _db._pData->valNames[iName].c_str()))
+ if (0 == strcasecmp(names[iVal], _db._data->valNames[iName].c_str()))
break;
++iName;
} // while
@@ -89,7 +89,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._pData->valNames[iName];
+ msg << "\n " << _db._data->valNames[iName];
msg << "\n";
throw std::runtime_error(msg.str());
} // if
@@ -102,16 +102,17 @@
void
spatialdata::spatialdb::SimpleDBQuery::query(double* vals,
const int numVals,
- const double x,
- const double y,
- const double z,
+ const double* coords,
+ const int numDims,
const spatialdata::geocoords::CoordSys* pCSQuery)
{ // query
+ assert(0 != coords);
+
if (0 == _querySize) {
std::ostringstream msg;
msg
<< "Values to be returned by spatial database " << _db.label() << "\n"
- << "have not been set. Please call QueryVals() before Query().\n";
+ << "have not been set. Please call queryVals() before query().\n";
throw std::runtime_error(msg.str());
} // if
else if (numVals != _querySize) {
@@ -125,14 +126,13 @@
} // if
const int numLocs = 1;
- double coords[3];
- coords[0] = x;
- coords[1] = y;
- coords[2] = z;
- spatialdata::geocoords::Converter::convert(coords, numLocs, _db._pCS, pCSQuery);
- _q[0] = coords[0];
- _q[1] = coords[1];
- _q[2] = coords[2];
+ _q[0] = 0.0;
+ _q[1] = 0.0;
+ _q[2] = 0.0;
+ for (int i=0; i < numDims; ++i)
+ _q[i] = coords[i];
+ spatialdata::geocoords::Converter::convert(_q, numLocs, numDims,
+ _db._cs, pCSQuery);
switch (_queryType)
{ // switch
@@ -155,22 +155,28 @@
{ // _queryNearest
assert( (0 < numVals && 0 != vals) ||
(0 == numVals && 0 == vals) );
- assert(0 != _db._pData);
+ assert(0 != _db._data);
assert(numVals == _querySize);
int iNear = 0;
- double nearDist =
- _distSquared(_q, SimpleDBTypes::dataCoords(*_db._pData, iNear));
- const int numLocs = _db._pData->numLocs;
+ 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);
+ double nearDist = _distSquared(_q, pt);
+ const int numLocs = _db._data->numLocs;
for (int iLoc=1; iLoc < numLocs; ++iLoc) {
- const double dist =
- _distSquared(_q, SimpleDBTypes::dataCoords(*_db._pData, iLoc));
+ SimpleDBTypes::dataCoords(pt, 3, *_db._data, iLoc);
+ const double dist = _distSquared(_q, pt);
if (dist < nearDist) {
nearDist = dist;
iNear = iLoc;
} // if
} // for
- const double* nearVals = SimpleDBTypes::dataVals(*_db._pData, iNear);
+ const double* nearVals = SimpleDBTypes::dataVals(*_db._data, iNear);
const int querySize = _querySize;
for (int iVal=0; iVal < querySize; ++iVal)
vals[iVal] = nearVals[_queryVals[iVal]];
@@ -184,12 +190,12 @@
{ // _queryLinear
assert( (0 < numVals && 0 != vals) ||
(0 == numVals && 0 == vals) );
- assert(0 != _db._pData);
+ assert(0 != _db._data);
assert(numVals == _querySize);
- if (SimpleDB::POINT == _db._pData->topology) {
+ if (0 == _db._data->dataDim) {
const int index = 0;
- const double* nearVals = SimpleDBTypes::dataVals(*_db._pData, index);
+ const double* nearVals = SimpleDBTypes::dataVals(*_db._data, index);
const int querySize = _querySize;
for (int iVal=0; iVal < querySize; ++iVal)
vals[iVal] = nearVals[_queryVals[iVal]];
@@ -208,7 +214,7 @@
double val = 0;
for (int iWt=0; iWt < numWts; ++iWt) {
const int iLoc = _nearest[weights[iWt].nearIndex];
- const double* locVals = SimpleDBTypes::dataVals(*_db._pData, iLoc);
+ const double* locVals = SimpleDBTypes::dataVals(*_db._data, iLoc);
val += weights[iWt].wt * locVals[_queryVals[iVal]];
} // for
vals[iVal] = val;
@@ -220,10 +226,10 @@
void
spatialdata::spatialdb::SimpleDBQuery::_findNearest(void)
{ // _findNearest
- assert(0 != _db._pData);
+ assert(0 != _db._data);
const int maxnear = 100;
- const int numLocs = _db._pData->numLocs;
+ const int numLocs = _db._data->numLocs;
const int nearSize = (numLocs < maxnear) ? numLocs : maxnear;
_nearest.resize(nearSize);
std::fill(_nearest.begin(), _nearest.end(), -1);
@@ -232,10 +238,14 @@
std::fill(nearestDist.begin(), nearestDist.end(), MAXFLOAT);
// find closest nearSize points
+ double pt[3];
+ pt[0] = 0.0;
+ pt[1] = 0.0;
+ pt[2] = 0.0;
for (int iLoc=0; iLoc < numLocs; ++iLoc) {
// use square of distance to find closest
- const double dist2 =
- _distSquared(_q, SimpleDBTypes::dataCoords(*_db._pData, iLoc));
+ SimpleDBTypes::dataCoords(pt, 3, *_db._data, iLoc);
+ const double dist2 = _distSquared(_q, pt);
// find place in nearest list if it exists
const std::vector<double>::iterator pNearDist =
@@ -267,7 +277,7 @@
void
spatialdata::spatialdb::SimpleDBQuery::_getWeights(std::vector<WtStruct>* pWeights)
{ // _getWeights
- assert(0 != _db._pData);
+ assert(0 != _db._data);
assert(0 != pWeights);
/* Start with nearest point. Add next nearest points as necessary
@@ -276,49 +286,37 @@
* interpolation, etc.
*/
- switch (_db._pData->topology)
- { // switch
- case SimpleDB::POINT : {
- const int numWts = 1;
- pWeights->resize(numWts);
- _findPointPt(pWeights);
- break;
- } // POINT
- case SimpleDB::LINE : {
- const int numWts = 2;
- pWeights->resize(numWts);
- _findPointPt(pWeights);
- _findLinePt(pWeights);
- break;
- } // LINE
- case SimpleDB::AREA : {
- const int numWts = 3;
- pWeights->resize(numWts);
- _findPointPt(pWeights);
- _findLinePt(pWeights);
- _findAreaPt(pWeights);
- break;
- } // AREA
- case SimpleDB::VOLUME : {
- const int numWts = 4;
- pWeights->resize(numWts);
- _findPointPt(pWeights);
- _findLinePt(pWeights);
- _findAreaPt(pWeights);
- _findVolumePt(pWeights);
- break;
- } // VOLUME
- default :
- throw std::runtime_error("Could not set weights for unknown topology "
- "type.");
- } // switch
+ if (0 == _db._data->dataDim) {
+ const int numWts = 1;
+ pWeights->resize(numWts);
+ _findPointPt(pWeights);
+ } else if (1 == _db._data->dataDim) {
+ const int numWts = 2;
+ pWeights->resize(numWts);
+ _findPointPt(pWeights);
+ _findLinePt(pWeights);
+ } 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) {
+ const int numWts = 4;
+ pWeights->resize(numWts);
+ _findPointPt(pWeights);
+ _findLinePt(pWeights);
+ _findAreaPt(pWeights);
+ _findVolumePt(pWeights);
+ } else
+ throw std::runtime_error("Could not set weights for unknown data dimension.");
} // _getWeights
// ----------------------------------------------------------------------
void
spatialdata::spatialdb::SimpleDBQuery::_findPointPt(std::vector<WtStruct>* pWeights)
{ // _findPointPt
- assert(0 != _db._pData);
+ assert(0 != _db._data);
assert(0 != pWeights);
(*pWeights)[0].wt = 1.0;
@@ -329,24 +327,34 @@
void
spatialdata::spatialdb::SimpleDBQuery::_findLinePt(std::vector<WtStruct>* pWeights)
{ // _findPointPt
- assert(0 != _db._pData);
+ assert(0 != _db._data);
assert(0 != pWeights);
+
+ const int spaceDim = _db._data->spaceDim;
// best case is to use next nearest pt
const int nearIndexA = (*pWeights)[0].nearIndex;
int nearIndexB = nearIndexA + 1;
const int locIndexA = _nearest[nearIndexA];
- const double* ptA = SimpleDBTypes::dataCoords(*_db._pData, locIndexA);
+ double ptA[3];
+ ptA[0] = 0.0;
+ ptA[1] = 0.0;
+ ptA[2] = 0.0;
+ SimpleDBTypes::dataCoords(ptA, 3, *_db._data, locIndexA);
double wtA = 0;
double wtB = 0;
// 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];
- const double* ptB = SimpleDBTypes::dataCoords(*_db._pData, locIndexB);
+ SimpleDBTypes::dataCoords(ptB, 3, *_db._data, locIndexB);
// wtA = DotProduct(pb, ab) / DotProduct(ab, ab)
// wtB = DotProduct(ap, ab) / DotProduct(ab, ab)
@@ -380,7 +388,7 @@
void
spatialdata::spatialdb::SimpleDBQuery::_findAreaPt(std::vector<WtStruct>* pWeights)
{ // _findAreaPt
- assert(0 != _db._pData);
+ assert(0 != _db._data);
assert(0 != pWeights);
const int numCoords = 3;
@@ -388,11 +396,19 @@
// best case is to use next nearest pt
const int nearIndexA = (*pWeights)[0].nearIndex;
const int locIndexA = _nearest[nearIndexA];
- const double* ptA = SimpleDBTypes::dataCoords(*_db._pData, locIndexA);
+ double ptA[3];
+ ptA[0] = 0.0;
+ ptA[1] = 0.0;
+ ptA[2] = 0.0;
+ SimpleDBTypes::dataCoords(ptA, 3, *_db._data, locIndexA);
const int nearIndexB = (*pWeights)[1].nearIndex;
const int locIndexB = _nearest[nearIndexB];
- const double* ptB = SimpleDBTypes::dataCoords(*_db._pData, locIndexB);
+ double ptB[3];
+ ptB[0] = 0.0;
+ ptB[1] = 0.0;
+ ptB[2] = 0.0;
+ SimpleDBTypes::dataCoords(ptB, 3, *_db._data, locIndexB);
double wtA = 0;
double wtB = 0;
@@ -401,9 +417,13 @@
// 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];
- const double* ptC = SimpleDBTypes::dataCoords(*_db._pData, locIndexC);
+ SimpleDBTypes::dataCoords(ptC, 3, *_db._data, locIndexC);
// make sure A,B,C are not collinear by checking if area of
// triangle ABC is not a tiny fraction of the distance AB
@@ -471,22 +491,34 @@
void
spatialdata::spatialdb::SimpleDBQuery::_findVolumePt(std::vector<WtStruct>* pWeights)
{ // _findVolumePt
- assert(0 != _db._pData);
+ assert(0 != _db._data);
assert(0 != pWeights);
// best case is to use next nearest pt
const int nearIndexA = (*pWeights)[0].nearIndex;
const int locIndexA = _nearest[nearIndexA];
- const double* ptA = SimpleDBTypes::dataCoords(*_db._pData, locIndexA);
+ double ptA[3];
+ ptA[0] = 0.0;
+ ptA[1] = 0.0;
+ ptA[2] = 0.0;
+ SimpleDBTypes::dataCoords(ptA, 3, *_db._data, locIndexA);
const int nearIndexB = (*pWeights)[1].nearIndex;
const int locIndexB = _nearest[nearIndexB];
- const double* ptB = SimpleDBTypes::dataCoords(*_db._pData, locIndexB);
+ double ptB[3];
+ ptB[0] = 0.0;
+ ptB[1] = 0.0;
+ ptB[2] = 0.0;
+ SimpleDBTypes::dataCoords(ptB, 3, *_db._data, locIndexB);
const int nearIndexC = (*pWeights)[2].nearIndex;
const int locIndexC = _nearest[nearIndexC];
- const double* ptC = SimpleDBTypes::dataCoords(*_db._pData, locIndexC);
+ double ptC[3];
+ ptC[0] = 0.0;
+ ptC[1] = 0.0;
+ ptC[2] = 0.0;
+ SimpleDBTypes::dataCoords(ptC, 3, *_db._data, locIndexC);
double wtA = 0;
@@ -497,9 +529,13 @@
// 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];
- const double* ptD = SimpleDBTypes::dataCoords(*_db._pData, locIndexD);
+ SimpleDBTypes::dataCoords(ptD, 3, *_db._data, locIndexD);
// 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
@@ -633,7 +669,5 @@
return (det1 + det2 + det3 + det4) / 6.0;
} // _volume
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBQuery.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -62,16 +62,14 @@
*
* @param vals Array for computed values (output from query)
* @param numVals Number of values expected (size of pVals array)
- * @param x X coordinate of location for query
- * @param y Y coordinate of location for query
- * @param z Z coordinate of location for query
+ * @param coords Coordinates of point to query
+ * @param numDims Number of dimensions for coordinates
* @param pCSQuery Coordinate system of coordinates
*/
void query(double* vals,
const int numVals,
- const double x,
- const double y,
- const double z,
+ const double* coords,
+ const int numDims,
const spatialdata::geocoords::CoordSys* pCSQuery);
private :
@@ -150,7 +148,7 @@
* @param b Coordinates of point B
*/
static double _distSquared(const double a[3],
- const double b[3]);
+ const double b[3]);
/** Compute area and "direction" of triangle abc. Direction is vector
* normal to triangular surface.
@@ -202,7 +200,5 @@
#endif // spatialdata_spatialdb_spatialdbquery_hh
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -26,7 +26,8 @@
std::string* valUnits;
int numLocs;
int numVals;
- TopoEnum topology;
+ int dataDim;
+ int spaceDim;
}; // DataStruct
namespace spatialdata {
@@ -49,6 +50,18 @@
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
@@ -63,7 +76,5 @@
#endif // spatialdata_spatialdb_simpledbtypes_hh
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.icc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.icc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleDBTypes.icc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -14,13 +14,16 @@
#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*(3+data.numVals)); }
+ const int index) {
+ return data.data+(index*(data.spaceDim+data.numVals));
+}
// Get values of location in database.
inline
@@ -28,9 +31,21 @@
spatialdata::spatialdb::SimpleDBTypes::dataVals(
const SimpleDB::DataStruct& data,
const int index)
-{ return data.data+(index*(3+data.numVals)+3); }
+{ return data.data+(index*(data.spaceDim+data.numVals)+data.spaceDim); }
-// version
-// $Id$
+// 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 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -20,6 +20,8 @@
#include <string> // USES std::string
#include "SimpleDBTypes.hh" // USES SimpleDBTypes
+#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
+
#include <stdexcept> // USES std::runtime_error, std::exception
#include <sstream> // USES std::ostringsgream
@@ -38,50 +40,36 @@
// ----------------------------------------------------------------------
void
spatialdata::spatialdb::SimpleIO::checkCompatibility(
- const SimpleDB::DataStruct& data)
+ const SimpleDB::DataStruct& data,
+ const spatialdata::geocoords::CoordSys* pCS)
{ // checkCompatibility
+ assert(0 != pCS);
+
const int numLocs = data.numLocs;
- switch (data.topology)
- { // switch
- case SimpleDB::POINT :
- if (numLocs > 1) {
- std::ostringstream msg;
- msg << "Point spatial distribution must have only 1 point. "
- << "Found " << numLocs << " points in distribution.";
- throw std::runtime_error(msg.str());
- } // if
- break;
- case SimpleDB::LINE :
- if (numLocs < 2) {
- std::ostringstream msg;
- msg << "Linear spatial distribution must have at least 2 points. "
- << "Found " << numLocs << " points in distribution.";
- throw std::runtime_error(msg.str());
- } // if
- break;
- case SimpleDB::AREA :
- if (numLocs < 3) {
- std::ostringstream msg;
- msg << "Areal spatial distribution must have at least 3 points. "
- << "Found " << numLocs << " points in distribution.";
- throw std::runtime_error(msg.str());
- } // if
- break;
- case SimpleDB::VOLUME :
- if (numLocs < 4) {
- std::ostringstream msg;
- msg << "Volumetric spatial distribution must have at least 4 points. "
- << "Found " << numLocs << " points in distribution.";
- throw std::runtime_error(msg.str());
- } // if
- break;
- default :
- throw std::runtime_error("Could not check compatiblity for unrecognized "
- "topology type.");
- } // switch
+ 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
+ << " must have at least " << 1+dataDim << " points. "
+ << "Found " << numLocs << " points in distribution.";
+ throw std::runtime_error(msg.str());
+ } // if
+ if (dataDim > spaceDim) {
+ std::ostringstream msg;
+ msg << "Dimension of data in spatial distribution (" << dataDim
+ << ") exceeds the number of dimensions of the coordinates ("
+ << spaceDim << ").";
+ throw std::runtime_error(msg.str());
+ } // if
+ if (spaceDim != pCS->spaceDim()) {
+ std::ostringstream msg;
+ msg << "Number of dimensions in coordinates of spatial distribution ("
+ << spaceDim << ") does not match number of dimensions in coordinate "
+ << "system (" << pCS->spaceDim() << ")";
+ throw std::runtime_error(msg.str());
+ } // if
} // checkCompatibility
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIO.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -87,8 +87,10 @@
* does not check the actual topology of the distribution.
*
* @param data Database data
+ * @param pCS Pointer to coordinate system
*/
- static void checkCompatibility(const SimpleDB::DataStruct& data);
+ static void checkCompatibility(const SimpleDB::DataStruct& data,
+ const spatialdata::geocoords::CoordSys* pCS);
private :
// PRIVATE METHODS ////////////////////////////////////////////////////
@@ -107,7 +109,5 @@
#endif // spatialdata_spatialdb_simpleio_hh
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -33,11 +33,6 @@
// ----------------------------------------------------------------------
const char* spatialdata::spatialdb::SimpleIOAscii::HEADER = "#SPATIAL.ascii";
-const char* spatialdata::spatialdb::SimpleIOAscii::POINTSTRING = "point";
-const char* spatialdata::spatialdb::SimpleIOAscii::LINESTRING = "line";
-const char* spatialdata::spatialdb::SimpleIOAscii::AREASTRING = "area";
-const char* spatialdata::spatialdb::SimpleIOAscii::VOLSTRING = "volume";
-
// ----------------------------------------------------------------------
// Read ascii database file.
void
@@ -101,6 +96,8 @@
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;
std::string name;
@@ -137,11 +134,12 @@
filein.ignore(maxIgnore, '=');
for (int iVal=0; iVal < numVals; ++iVal)
filein >> pData->valUnits[iVal];
- } else if (0 == strcasecmp(token.c_str(), "topology")) {
+ } else if (0 == strcasecmp(token.c_str(), "data-dim")) {
filein.ignore(maxIgnore, '=');
- std::string topoString;
- filein >> topoString;
- pData->topology = parseTopoString(topoString.c_str());
+ filein >> pData->dataDim;
+ } else if (0 == strcasecmp(token.c_str(), "space-dim")) {
+ filein.ignore(maxIgnore, '=');
+ filein >> pData->spaceDim;
} else if (0 == strcasecmp(token.c_str(), "cs-data")) {
spatialdata::geocoords::CSPicklerAscii::unpickle(filein, ppCS);
} else {
@@ -180,15 +178,15 @@
throw std::runtime_error(msg.str());
} // else
- const int numCoords = 3;
- const int dataSize = pData->numLocs * (numCoords + pData->numVals);
+ const int dataSize = pData->numLocs * (pData->spaceDim + pData->numVals);
delete[] pData->data;
pData->data = (dataSize > 0) ? new double[dataSize] : 0;
for (int i=0; i < dataSize; ++i)
filein >> pData->data[i];
- // Check compatibility of topology and number of points
- checkCompatibility(*pData);
+ // Check compatibility of dimension of data, spatial dimension and
+ // number of points
+ checkCompatibility(*pData, *ppCS);
(*ppCS)->initialize();
} // ReadV1
@@ -226,7 +224,8 @@
fileout << "\n";
fileout
<< " num-locs = " << std::setw(6) << numLocs << "\n"
- << " topology = " << topoString(data.topology) << "\n"
+ << " data-dim = " << std::setw(4) << data.dataDim << "\n"
+ << " space-dim = " << std::setw(4) << data.spaceDim << "\n"
<< " cs-data = ";
spatialdata::geocoords::CSPicklerAscii::pickle(fileout, pCS);
fileout << "}\n";
@@ -235,7 +234,7 @@
<< std::resetiosflags(std::ios::fixed)
<< std::setiosflags(std::ios::scientific)
<< std::setprecision(6);
- const int numCoords = 3;
+ 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)
@@ -247,57 +246,5 @@
} // for
} // write
-// ----------------------------------------------------------------------
-// Parse string into topology type.
-spatialdata::spatialdb::SimpleDB::TopoEnum
-spatialdata::spatialdb::SimpleIOAscii::parseTopoString(const char* str)
-{ // parseTopoString
- SimpleDB::TopoEnum topoType = SimpleDB::POINT;
- if (strcasecmp(str, POINTSTRING) == 0)
- topoType = SimpleDB::POINT;
- else if (strcasecmp(str, LINESTRING) == 0)
- topoType = SimpleDB::LINE;
- else if (strcasecmp(str, AREASTRING) == 0)
- topoType = SimpleDB::AREA;
- else if (strcasecmp(str, VOLSTRING) == 0)
- topoType = SimpleDB::VOLUME;
- else {
- std::ostringstream msg;
- msg << "Could not parse topology string '" << str << "' into a known "
- << "topology.";
- throw std::runtime_error(msg.str());
- } // else
- return topoType;
-} // parseTopoString
-// ----------------------------------------------------------------------
-// Get string associated with topology type.
-const char*
-spatialdata::spatialdb::SimpleIOAscii::topoString(SimpleDB::TopoEnum topoType)
-{ // topoString
- const char* str = POINTSTRING;
- switch (topoType)
- { // switch
- case SimpleDB::POINT :
- str = POINTSTRING;
- break;
- case SimpleDB::LINE :
- str = LINESTRING;
- break;
- case SimpleDB::AREA :
- str = AREASTRING;
- break;
- case SimpleDB::VOLUME :
- str = VOLSTRING;
- break;
- default :
- throw std::runtime_error("Could not find string associated with "
- "topology type.");
- } // switch
- return str;
-} // topoString
-
-// version
-// $Id$
-
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SimpleIOAscii.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -75,37 +75,9 @@
spatialdata::geocoords::CoordSys** ppCS,
std::istream& filein);
- /** Parse string into topology type.
- *
- * @param str String associated with topology
- *
- * @returns Topology type
- */
- static SimpleDB::TopoEnum parseTopoString(const char* str);
-
- /** Get string associated with topology type.
- *
- * @param topoType Topology type
- *
- * @returns String associated with topology
- */
- static const char* topoString(const SimpleDB::TopoEnum topoType);
-
private :
// PRIVATE MEMBERS ////////////////////////////////////////////////////
- /** String associated with 0-D distribution of data */
- static const char* POINTSTRING;
-
- /** String associated with 1-D distribution of data */
- static const char* LINESTRING;
-
- /** String associated with 2-D distribution of data */
- static const char* AREASTRING;
-
- /** String associated with 3-D distribution of data */
- static const char* VOLSTRING;
-
/** Magic header in ascii files */
static const char* HEADER;
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/SpatialDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/SpatialDB.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/SpatialDB.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -83,18 +83,16 @@
* @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 x X coordinate of location for query
- * @param y Y coordinate of location for query
- * @param z Z coordinate of location for query
+ * @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)
*/
virtual int query(double* vals,
const int numVals,
- const double x,
- const double y,
- const double z,
+ const double* coords,
+ const int numDims,
const spatialdata::geocoords::CoordSys* pCSQuery) = 0;
private :
@@ -115,7 +113,5 @@
#endif // spatialdata_spatialdb_spatialdb_hh
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -27,9 +27,8 @@
spatialdb_query(void* db,
double* vals,
const int numVals,
- const double x,
- const double y,
- const double z,
+ const double* coords,
+ const int numDims,
const void* cs)
{ // spatialdb_query
spatialdata::spatialdb::SpatialDB* pDB =
@@ -38,10 +37,8 @@
(const spatialdata::geocoords::CoordSys*) cs;
assert(0 != pDB);
assert(0 != pCS);
- return pDB->query(vals, numVals, x, y, z, pCS);
+ return pDB->query(vals, numVals, coords, numDims, pCS);
} // spatialdb_query
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.h
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.h 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/cspatialdb.h 2007-01-07 20:24:35 UTC (rev 5689)
@@ -19,9 +19,8 @@
* @param vals Array for computed values (output from query), must be
* allocated BEFORE calling spatialdb_query*()
* @param numVals Number of values expected (size of pVals array)
- * @param x C coordinate of location for query
- * @param y Y coordinate of location for query
- * @param z Z coordinate of location for query
+ * @param coords Coordinates of point for query
+ * @param numDims Number of dimensions for coordinates
* @param cs Pointer to CoordSys
*
* @returns 0 on success, 1 on failure (i.e., values not set)
@@ -29,9 +28,8 @@
int spatialdb_query(void* db,
double* vals,
const int numVals,
- const double x,
- const double y,
- const double z,
+ const double* coords,
+ const int numDims,
const void* cs);
#endif /* spatialdata_cspatialdb_h */
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.cc
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -27,9 +27,8 @@
void spatialdb_query_f(void* db,
double* vals,
const int* numVals,
- const double* x,
- const double* y,
- const double* z,
+ const double* coords,
+ const int* numDims,
const void* cs,
int* ok)
{ // spatialdb_query_f
@@ -39,11 +38,11 @@
(const spatialdata::geocoords::CoordSys*) cs;
assert(0 != pDB);
assert(0 != pCS);
- assert(0 != x);
- assert(0 != y);
- assert(0 != z);
+ assert(0 != numVals);
+ assert(0 != coords);
+ assert(0 != numDims);
assert(0 != ok);
- *ok = pDB->query(vals, *numVals, *x, *y, *z, pCS);
+ *ok = pDB->query(vals, *numVals, coords, *numDims, pCS);
} // spatialdb_query_f
// version
Modified: cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.h
===================================================================
--- cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.h 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/libsrc/spatialdb/f77spatialdb.h 2007-01-07 20:24:35 UTC (rev 5689)
@@ -22,11 +22,9 @@
*
* @param db Pointer to SpatialDB
* @param vals Array for computed values (output from query)
- * @param addrF Fortran address used to access values
- * @param addrOffset Offset used to access values from Fortran
- * @param x Pointer to x coordinate of location for query
- * @param y Pointer to y coordinate of location for query
- * @param z Pointer to z coordinate of location for 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 Pointer to CS
* @param ok Set to 0 on success, 1 on failure (i.e., values not set)
*/
@@ -34,9 +32,8 @@
void spatialdb_query_f(void* db,
double* vals,
const int* numVals,
- const double* x,
- const double* y,
- const double* z,
+ const double* coords,
+ const int* numDims,
const void* cs,
int* ok);
Modified: cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/modulesrc/geocoords/geocoords.pyxe 2007-01-07 20:24:35 UTC (rev 5689)
@@ -71,6 +71,24 @@
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)
+ ((spatialdata::geocoords::CoordSys*) pObj)->setSpaceDim(ndims);
+ #}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)
+ return ((spatialdata::geocoords::CoordSys*) pObj)->spaceDim();
+ #}embed
+ return CoordSys_spaceDim_get(self.thisptr)
+
+
# ----------------------------------------------------------------------
cdef class CSCart(CoordSys):
@@ -105,24 +123,6 @@
return CSCart_toMeters_get(self.thisptr)
- property spaceDim:
- def __set__(self, ndims):
- """Set number of dimensions for coordinates."""
- # create shim for method 'spaceDim'
- #embed{ void CSCart_spaceDim_set(void* pObj, int ndims)
- ((spatialdata::geocoords::CSCart*) pObj)->spaceDim(ndims);
- #}embed
- CSCart_spaceDim_set(self.thisptr, ndims)
-
- def __get__(self):
- """Get number of dimensions for coordinates."""
- # create shim for method 'spaceDim'
- #embed{ int CSCart_spaceDim_get(void* pObj)
- return ((spatialdata::geocoords::CSCart*) pObj)->spaceDim();
- #}embed
- return CSCart_spaceDim_get(self.thisptr)
-
-
# ----------------------------------------------------------------------
cdef class CSGeo(CoordSys):
@@ -229,24 +229,6 @@
return CSGeo_toMeters_get(self.thisptr)
- property spaceDim:
- def __set__(self, ndims):
- """Set number of dimensions for coordinates."""
- # create shim for method 'spaceDim'
- #embed{ void CSGeo_spaceDim_set(void* pObj, int ndims)
- ((spatialdata::geocoords::CSGeo*) pObj)->spaceDim(ndims);
- #}embed
- CSGeo_spaceDim_set(self.thisptr, ndims)
-
- def __get__(self):
- """Get number of dimensions for coodinates."""
- # create shim for method 'spaceDim'
- #embed{ int CSGeo_spaceDim_get(void* pObj)
- return ((spatialdata::geocoords::CSGeo*) pObj)->spaceDim();
- #}embed
- return CSGeo_spaceDim_get(self.thisptr)
-
-
# ----------------------------------------------------------------------
cdef class CSGeoLocalCart(CSGeo):
Modified: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/generator/generator.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/generator/generator.pyxe 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/generator/generator.pyxe 2007-01-07 20:24:35 UTC (rev 5689)
@@ -43,7 +43,7 @@
# ----------------------------------------------------------------------
-def create(coords, locCount, locDim, numValues, topology):
+def create(coords, locCount, locDim, numValues, spaceDim, dataDim):
"""Create structure for simple database."""
# create C++ shim
#embed{ void GenSimpleDB_tearDownData(void* pDataObj)
@@ -58,7 +58,7 @@
#}embed
# create C++ shim
- #embed{ void* GenSimpleDB_create(void* pCoordsObj, int locCount, int locDim, int numValues, char* topology)
+ #embed{ void* GenSimpleDB_create(void* pCoordsObj, int locCount, int locDim, int numValues, int spaceDim, int dataDim)
spatialdata::spatialdb::SimpleDB::DataStruct* pData =
new spatialdata::spatialdb::SimpleDB::DataStruct;
const int totalNumValues = locDim + numValues;
@@ -70,14 +70,8 @@
pData->numVals = numValues;
pData->valNames = (numValues > 0) ? new std::string[numValues] : 0;
pData->valUnits = (numValues > 0) ? new std::string[numValues] : 0;
- if (0 == strcasecmp("point", topology))
- pData->topology = spatialdata::spatialdb::SimpleDB::POINT;
- else if (0 == strcasecmp("line", topology))
- pData->topology = spatialdata::spatialdb::SimpleDB::LINE;
- else if (0 == strcasecmp("area", topology))
- pData->topology = spatialdata::spatialdb::SimpleDB::AREA;
- else if (0 == strcasecmp("volume", topology))
- pData->topology = spatialdata::spatialdb::SimpleDB::VOLUME;
+ pData->spaceDim = spaceDim;
+ pData->dataDim = dataDim;
} // if
double* pCoords = (double*) pCoordsObj;
for (int iLoc=0; iLoc < locCount; ++iLoc) {
@@ -89,18 +83,12 @@
return (void*) pData;
#}embed
- if not (topology == "point" or
- topology == "line" or
- topology == "area" or
- topology == "volume"):
- raise ValueError, "Argument 'topology' must be 'point', 'line', " \
- "'area', or 'volume'."
-
cdef void* pCoordsObj
pCoordsObj = PyCObject_AsVoidPtr(coords)
return PyCObject_FromVoidPtr(
- GenSimpleDB_create(pCoordsObj, locCount, locDim, numValues, topology),
+ GenSimpleDB_create(pCoordsObj,
+ locCount, locDim, numValues, spaceDim, dataDim),
GenSimpleDB_tearDownData)
@@ -159,9 +147,7 @@
double val = 0;
int err = 0;
for (int iLoc=0, index=0; iLoc < locCount; ++iLoc, index += 3) {
- err = pDB->query(&val, 1,
- pLocs[index], pLocs[index+1], pLocs[index+2],
- pCS);
+ err = pDB->query(&val, 1, &pLocs[index], 3, pCS);
if (0 != err)
val = defaultValue;
pFilterData[iLoc] = val;
Modified: cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe
===================================================================
--- cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/modulesrc/spatialdb/spatialdb.pyxe 2007-01-07 20:24:35 UTC (rev 5689)
@@ -122,10 +122,11 @@
def query(self, locs, cs, nvals):
"""Query db to get values at locations."""
# create shim for method 'query'
- #embed{ void SpatialDB_query(void* pObj, double* vals, int nvals, double x, double y, double z, void* csObj)
+ #embed{ void SpatialDB_query(void* pObj, double* vals, int nvals, double* coords, int spaceDim, void* csObj)
spatialdata::geocoords::CoordSys* pCS =
(spatialdata::geocoords::CoordSys*) csObj;
- ((spatialdata::spatialdb::SpatialDB*) pObj)->query(vals, nvals, x, y, z,
+ ((spatialdata::spatialdb::SpatialDB*) pObj)->query(vals, nvals,
+ coords, spaceDim,
pCS);
#}embed
@@ -145,10 +146,7 @@
raise TypeError, \
"Argument 'nvals' must be a positive integer."
- (nlocs, ncoords) = locs.shape
- if not ncoords == 3:
- raise ValueError, \
- "Argument 'locs' must have 3 coordinates per location."
+ (nlocs, spaceDim) = locs.shape
cdef double* pLocs
pLocs = <double*> PyCObject_AsVoidPtr(locs.data)
@@ -161,9 +159,8 @@
for iloc from 0 <= iloc < nlocs:
SpatialDB_query(self.thisptr, valbuffer, nvals,
- pLocs[ncoords*iloc ],
- pLocs[ncoords*iloc+1],
- pLocs[ncoords*iloc+2], ptrFromHandle(cs))
+ &pLocs[spaceDim*iloc], spaceDim,
+ ptrFromHandle(cs))
for ival from 0 <= ival < nvals:
pVals[nvals*iloc+ival] = valbuffer[ival]
free(<void*> valbuffer)
Added: cs/spatialdata-0.1/trunk/spatialdata/utils/CppData.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/utils/CppData.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/spatialdata/utils/CppData.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,302 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/utils/CppData.py
+
+## @brief Python object to create C++ object holding data values.
+
+## Useful in unit testing of C++ objects where data is generate with
+## Python code.
+##
+## If parent property is set, we assume object is providing only the
+## data, so data is private and object needs a constructor and
+## destructor. Otherwise, object just has public data and no methods.
+
+from pyre.components.Component import Component
+
+import string
+import numpy
+
+# CppData class
+class CppData(Component):
+ """
+ Python objec to create C++ object holding data values.
+ """
+
+ class Inventory(Component.Inventory):
+ """
+ Python object for managing CppData facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing CppData facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b header Filename for header for C++ files
+ ## @li \b objname Name of C++ object
+ ## @li \b namespace Tuple of strings forming namespace for object
+ ## @li \b parent Name of parent object
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ header = pyre.inventory.str("header", default="header.hh")
+ header.meta['tip'] = "Filename for header for C++ files."
+
+ objname = pyre.inventory.str("object", default="object")
+ objname.meta['tip'] = "Name of C++ object"
+
+ namespace = pyre.inventory.list("namespace", default=["pylith"])
+ namespace.meta['tip'] = "Tuple of strings forming namspace for object."
+
+ parent = pyre.inventory.str("parent", default="")
+ parent.meta['tip'] = "Name of parent object."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="cppdata"):
+ """
+ Constructor.
+ """
+ Component.__init__(self, name, facility="cppdata")
+ self.scalars = []
+ self.arrays = []
+ self.app = ""
+ return
+
+
+ def write(self, app):
+ """
+ Write header and implementation file.
+ """
+ self.app = app
+ self._writeHeader()
+ self._writeSource()
+ return
+
+
+ def addScalar(self, vtype, name, value, format):
+ """
+ Add scalar to object's members.
+ """
+ data = {'type': vtype,
+ 'name': name,
+ 'value': value,
+ 'format': format}
+ self.scalars.append(data)
+ return
+
+
+ def addArray(self, vtype, name, values, format, ncols):
+ """
+ Add array to object's members.
+ """
+ data = {'type': vtype,
+ 'name': name,
+ 'values': values,
+ 'format': format,
+ 'ncols': ncols}
+ self.arrays.append(data)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based using inventory.
+ """
+ self.header = self.inventory.header
+ self.objname = self.inventory.objname
+ self.namespace = self.inventory.namespace
+ self.parent = self.inventory.parent
+ return
+
+
+ def _writeHeader(self):
+ """
+ Write C++ header file.
+ """
+
+ filename = "%s.hh" % self.objname
+
+ fileOut = open(filename, "w")
+ self._insertHeader(fileOut)
+
+ # Write define information
+ hhname = "%s_%s_hh" % (string.join(self.namespace, "_"),
+ self.objname.lower())
+ fileOut.write("#if !defined(%s)\n" % hhname)
+ fileOut.write("#define %s\n" % hhname)
+ fileOut.write("\n")
+
+ if self.parent != "":
+ fileOut.write("#include \"%s.hh\"\n\n" % self.parent)
+
+ # Write namespace information
+ level = 0
+ for name in self.namespace:
+ fileOut.write("%s" % string.join([" "]*level))
+ fileOut.write("namespace %s {\n" % name)
+ level += 1
+ fileOut.write("%s" % string.join([" "]*level))
+ fileOut.write("class %s;\n" % self.objname)
+ level -= 1
+ for name in self.namespace:
+ fileOut.write("%s" % string.join([" "]*level))
+ fileOut.write("} // %s\n" % name)
+ level -= 1
+ fileOut.write("\n")
+
+ # Write class opening
+ fileOut.write("class %s::%s" % \
+ (string.join(self.namespace, "::"),
+ self.objname))
+ if self.parent != "":
+ fileOut.write(" : public %s\n" % self.parent)
+ else:
+ fileOut.write("\n")
+ fileOut.write("{\n\n")
+
+ # Write data
+ if self.parent != "":
+ fileOut.write("public: \n\n")
+ fileOut.write(" /// Constructor\n")
+ fileOut.write(" %s(void);\n\n" % self.objname)
+ fileOut.write(" /// Destructor\n")
+ fileOut.write(" ~%s(void);\n\n" % self.objname)
+
+ fileOut.write("private:\n\n")
+ else:
+ fileOut.write("public:\n\n")
+
+ # Write scalar information
+ for scalar in self.scalars:
+ fileOut.write(" static const %s %s;\n\n" % \
+ (scalar['type'], scalar['name']))
+
+ # Write array information
+ for array in self.arrays:
+ fileOut.write(" static const %s %s[];\n\n" % \
+ (array['type'], array['name']))
+
+
+ # Write class closing
+ fileOut.write("};\n\n")
+ fileOut.write("#endif // %s\n" % hhname)
+
+ self._insertFooter(fileOut)
+ fileOut.close()
+ return
+
+
+ def _writeSource(self):
+ """
+ Write C++ source file.
+ """
+
+ filename = "%s.cc" % self.objname
+
+ fileOut = open(filename, "w")
+ self._insertHeader(fileOut)
+
+ fileOut.write("#include \"%s.hh\"\n" % self.objname)
+ fileOut.write("\n")
+
+ # Write scalar information
+ for scalar in self.scalars:
+ cppformat = "const %s %s::%s::%s = " + scalar['format'] + ";\n\n"
+ fileOut.write(cppformat % \
+ (scalar['type'],
+ string.join(self.namespace, "::"), self.objname,
+ scalar['name'], scalar['value']))
+
+ # Write array information
+ for array in self.arrays:
+ cppformat = "const %s %s::%s::%s[] = {\n"
+ fileOut.write(cppformat % \
+ (array['type'],
+ string.join(self.namespace, "::"), self.objname,
+ array['name']))
+ icol = 0
+ for value in numpy.ravel(array['values']):
+ cppformat = "%s," % array['format']
+ fileOut.write(cppformat % value)
+ icol += 1
+ if icol == array['ncols']:
+ fileOut.write("\n")
+ icol = 0
+ fileOut.write("};\n\n")
+
+ if self.parent != "":
+ self._writeLifecycle(fileOut)
+
+ self._insertFooter(fileOut)
+ fileOut.close()
+ return
+
+
+ def _writeLifecycle(self, fileOut):
+ """
+ Write default constructor and destructor.
+ """
+ # Constructor
+ fileOut.write("%s::%s::%s(void)\n" % \
+ (string.join(self.namespace, "::"),
+ self.objname, self.objname))
+
+ fileOut.write("{ // constructor\n")
+
+ for scalar in self.scalars:
+ n = scalar['name']
+ fileOut.write(" %s = %s;\n" % (n[1:], n))
+ for array in self.arrays:
+ n = array['name']
+ fileOut.write(" %s = const_cast<%s*>(%s);\n" % \
+ (n[1:], array['type'], n))
+ fileOut.write("} // constructor\n\n")
+
+ # Destructor
+ fileOut.write("%s::%s::~%s(void)\n" % \
+ (string.join(self.namespace, "::"),
+ self.objname, self.objname))
+ fileOut.write("{}\n\n")
+ return
+
+
+ def _insertHeader(self, fileOut):
+ """
+ Insert header file into output file.
+ """
+ fileIn = open(self.header, "r")
+ for line in fileIn:
+ fileOut.write(line)
+ fileIn.close()
+
+ fileOut.write("// DO NOT EDIT THIS FILE\n")
+ fileOut.write("// This file was generated from python application "
+ "%s.\n\n" % self.app)
+ return
+
+
+ def _insertFooter(self, fileOut):
+ """
+ Insert footer into output file.
+ """
+ fileOut.write("\n// End of file\n")
+ return
+
+
+# End of file
Modified: cs/spatialdata-0.1/trunk/spatialdata/utils/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/utils/Makefile.am 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/spatialdata/utils/Makefile.am 2007-01-07 20:24:35 UTC (rev 5689)
@@ -17,6 +17,7 @@
__init__.py \
ChangeCoordSys.py \
ConvertApp.py \
+ CppData.py \
PointsStream.py
# version
Modified: cs/spatialdata-0.1/trunk/spatialdata/utils/__init__.py
===================================================================
--- cs/spatialdata-0.1/trunk/spatialdata/utils/__init__.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/spatialdata/utils/__init__.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -14,9 +14,9 @@
## @brief Python spatialdata utils module initialization.
__all__ = ['ChangeCoordSys',
+ 'ConvertApp',
+ 'CppData',
'PointsStream']
-# version
-__id__ = "$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 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/Makefile.am 2007-01-07 20:24:35 UTC (rev 5689)
@@ -21,27 +21,30 @@
testspatial_SOURCES = \
TestSimpleDBQuery.cc \
+ TestSimpleDBQuery3D.cc \
TestSimpleDB.cc \
- TestSimpleDBPoint.cc \
- TestSimpleDBLine.cc \
- TestSimpleDBArea.cc \
- TestSimpleDBVolume.cc \
+ TestSimpleDBPoint3D.cc \
+ TestSimpleDBLine3D.cc \
+ TestSimpleDBArea3D.cc \
+ TestSimpleDBVolume3D.cc \
TestSimpleIOAscii.cc \
TestSpatialDB.cc \
testcquery.c \
testspatial.cc
noinst_HEADERS = \
- TestSimpleDBArea.hh \
+ TestSimpleDBQuery.hh \
+ TestSimpleDBQuery3D.cc \
TestSimpleDB.hh \
- TestSimpleDBLine.hh \
- TestSimpleDBPoint.hh \
- TestSimpleDBQuery.hh \
- TestSimpleDBVolume.hh \
+ TestSimpleDBPoint3D.hh \
+ TestSimpleDBLine3D.hh \
+ TestSimpleDBArea3D.hh \
+ TestSimpleDBVolume3D.hh \
TestSimpleIOAscii.hh \
testcquery.h \
TestSpatialDB.hh
+
testspatial_LDFLAGS =
INCLUDES +=
@@ -51,7 +54,25 @@
$(top_builddir)/libsrc/spatialdb/libspatialdataspatialdb.la \
$(top_builddir)/libsrc/geocoords/libspatialdatageocoords.la
-# version
-# $Id$
+# Source files associated with testing data
+testspatial_SOURCES += \
+ data/SimpleDBQueryData.cc \
+ data/SimpleDBQueryData3D.cc \
+ data/SimpleDBData.cc \
+ data/SimpleDBDataPoint3D.cc \
+ data/SimpleDBDataLine3D.cc \
+ data/SimpleDBDataArea3D.cc \
+ data/SimpleDBDataVolume3D.cc
+
+noinst_HEADERS += \
+ data/SimpleDBQueryData.hh \
+ data/SimpleDBQueryData3D.hh \
+ data/SimpleDBData.hh \
+ data/SimpleDBDataPoint3D.hh \
+ data/SimpleDBDataLine3D.hh \
+ data/SimpleDBDataArea3D.hh \
+ data/SimpleDBDataVolume3D.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 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -12,60 +12,21 @@
#include <portinfo>
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SimpleDB
#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
#include "TestSimpleDB.hh" // Implementation of class methods
+#include "data/SimpleDBData.hh" // USES SimpleDBData
+
#include "spatialdata/spatialdb/SimpleDBTypes.hh" // USES SimpleDBTypes
#include "spatialdata/spatialdb/SimpleDBQuery.hh" // USES SimpleDBQuery
-#include "spatialdata/geocoords/CoordSys.hh" // USE CSCart
#include "spatialdata/geocoords/CSCart.hh" // USE CSCart
// ----------------------------------------------------------------------
-// Setup test subject
-void
-spatialdata::spatialdb::TestSimpleDB::setUp(void)
-{ // setUp
- SimpleDB::DataStruct* pData = new SimpleDB::DataStruct;
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDB );
- const int numCoords = 3;
- const int numLocs = _numLocs();
- const int numVals = _numVals();
-
- const int dataSize = numLocs*(numCoords+numVals);
- CPPUNIT_ASSERT(0 < dataSize);
- pData->data = new double[dataSize];
- memcpy(pData->data, _data(), dataSize*sizeof(double));
-
- pData->valNames = new std::string[numVals];
- for (int i=0; i < numVals; ++i)
- pData->valNames[i] = _names()[i];
-
- pData->valUnits = new std::string[numVals];
- for (int i=0; i < numVals; ++i)
- pData->valUnits[i] = _units()[i];
-
- pData->numLocs = numLocs;
- pData->numVals = numVals;
- pData->topology = _topology();
-
- _pDB = new SimpleDB;
- _pDB->_pData = pData;
- _pDB->_pQuery = new SimpleDBQuery(*_pDB);
- _pDB->_pCS = new spatialdata::geocoords::CSCart();
-} // setUp
-
// ----------------------------------------------------------------------
-// Cleanup test subject
-void
-spatialdata::spatialdb::TestSimpleDB::tearDown(void)
-{ // tearDown
- delete _pDB; _pDB = 0;
-} // tearDown
-
-// ----------------------------------------------------------------------
// Test constructor
void
spatialdata::spatialdb::TestSimpleDB::testConstructorA(void)
@@ -95,29 +56,148 @@
} // testLabel
// ----------------------------------------------------------------------
-// Test Query() using nearest neighbor
+// Test query() using nearest neighbor
void
-spatialdata::spatialdb::TestSimpleDB::testQueryNearest(void)
-{ // testQueryNearest
- SimpleDB* pDB = _database();
- CPPUNIT_ASSERT(0 != pDB);
+spatialdata::spatialdb::TestSimpleDB::_testQueryNearest(
+ const SimpleDBData& data)
+{ // _testQueryNearest
+ SimpleDB db;
+ _setupDB(&db, data);
+ db.queryType(SimpleDB::NEAREST);
+ _checkQuery(db, data.names, data.queryNearest, 0,
+ data.numQueries, data.spaceDim, data.numVals);
+} // _testQueryNearest
- pDB->queryType(SimpleDB::NEAREST);
- _checkQuery(_queryNearest(), 0);
-} // testQueryNearest
+// ----------------------------------------------------------------------
+// Test query() using linear interpolation
+void
+spatialdata::spatialdb::TestSimpleDB::_testQueryLinear(
+ const SimpleDBData& data)
+{ // _testQueryLinear
+ SimpleDB db;
+ _setupDB(&db, data);
+ db.queryType(SimpleDB::LINEAR);
+ _checkQuery(db, data.names, data.queryLinear, data.errFlags,
+ data.numQueries, data.spaceDim, data.numVals);
+} // _testQueryLinear
// ----------------------------------------------------------------------
-// Test Query() using linear interpolation
+// Populate database with data.
void
-spatialdata::spatialdb::TestSimpleDB::testQueryLinear(void)
-{ // testQueryLinear
- CPPUNIT_ASSERT(0 != _pDB);
+spatialdata::spatialdb::TestSimpleDB::_setupDB(SimpleDB* const db,
+ const SimpleDBData& data)
+{ // _setupDB
+ SimpleDB::DataStruct* dbData = new SimpleDB::DataStruct;
- _pDB->queryType(SimpleDB::LINEAR);
- _checkQuery(_queryLinear(), _errFlags());
-} // testQueryLinear
+ 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();
+} // _setupDB
+
// ----------------------------------------------------------------------
+// Test query method by doing query and checking values returned.
+void
+spatialdata::spatialdb::TestSimpleDB::_checkQuery(SimpleDB& db,
+ char** const names,
+ const double* queryData,
+ const int* flagsE,
+ const int numQueries,
+ const int spaceDim,
+ const int numVals)
+{ // _checkQuery
+ CPPUNIT_ASSERT(0 != names);
+ CPPUNIT_ASSERT(0 != queryData);
+ CPPUNIT_ASSERT(0 != numQueries);
+ CPPUNIT_ASSERT(0 != spaceDim);
+ CPPUNIT_ASSERT(0 != numVals);
+
+ // reverse order of vals in queries
+ const char* valNames[numVals];
+ for (int i=0; i < numVals; ++i)
+ valNames[numVals-i-1] = names[i];
+ db.queryVals(valNames, numVals);
+
+ double* vals = (0 < numVals) ? new double[numVals] : 0;
+ const double tolerance = 1.0e-06;
+
+ const int locSize = spaceDim + numVals;
+ spatialdata::geocoords::CSCart csCart;
+ for (int iQuery=0; iQuery < numQueries; ++iQuery) {
+ const double* coords = &queryData[iQuery*locSize];
+ const double* valsE = &queryData[iQuery*locSize+spaceDim];
+ const int err = db.query(vals, numVals, coords, spaceDim, &csCart);
+ if (0 != flagsE)
+ CPPUNIT_ASSERT(err == flagsE[iQuery]);
+ else
+ CPPUNIT_ASSERT(0 == err);
+ for (int iVal=0; iVal < numVals; ++iVal)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[iVal]/valsE[numVals-iVal-1],
+ tolerance);
+ } // for
+ delete[] vals; vals = 0;
+} // _checkQuery
+
+#if 0
+// ----------------------------------------------------------------------
+// Setup test subject
+void
+spatialdata::spatialdb::TestSimpleDB::setUp(void)
+{ // setUp
+ SimpleDB::DataStruct* pData = new SimpleDB::DataStruct;
+
+ const int numLocs = _numLocs();
+ const int spaceDim = _spaceDim();
+ const int numVals = _numVals();
+ const int dataDim = _dataDim();
+
+ const int dataSize = numLocs*(spaceDim+numVals);
+ CPPUNIT_ASSERT(0 < dataSize);
+ pData->data = new double[dataSize];
+ memcpy(pData->data, _data(), dataSize*sizeof(double));
+
+ pData->valNames = new std::string[numVals];
+ for (int i=0; i < numVals; ++i)
+ pData->valNames[i] = _names()[i];
+
+ pData->valUnits = new std::string[numVals];
+ for (int i=0; i < numVals; ++i)
+ pData->valUnits[i] = _units()[i];
+
+ pData->numLocs = numLocs;
+ pData->spaceDim = spaceDim;
+ pData->numVals = numVals;
+ pData->dataDim = _dataDim;
+
+ _pDB = new SimpleDB;
+ _pDB->_pData = pData;
+ _pDB->_pQuery = new SimpleDBQuery(*_pDB);
+ _pDB->_pCS = new spatialdata::geocoords::CSCart();
+} // setUp
+
+// ----------------------------------------------------------------------
// Check query values.
void
spatialdata::spatialdb::TestSimpleDB::_checkQuery(const double* queryData,
@@ -127,6 +207,7 @@
CPPUNIT_ASSERT(0 != _pDB);
const int numVals = _numVals();
+ const int spaceDim = _spaceDim();
// reverse order of vals in queries
const char* valNames[numVals];
@@ -138,13 +219,12 @@
const double tolerance = 1.0e-06;
const int numQueries = _numQueries();
- const int locSize = 3+numVals;
+ const int locSize = spaceDim+numVals;
spatialdata::geocoords::CSCart csCart;
for (int iQuery=0; iQuery < numQueries; ++iQuery) {
const double* qCoords = &queryData[iQuery*locSize];
- const double* qVals = &queryData[iQuery*locSize+3];
- const int err = _pDB->query(vals, numVals,
- qCoords[0], qCoords[1], qCoords[2], &csCart);
+ const double* qVals = &queryData[iQuery*locSize+spaceDim];
+ const int err = _pDB->query(vals, numVals, qCoords, spaceDim, &csCart);
if (0 != queryErrFlags)
CPPUNIT_ASSERT(err == queryErrFlags[iQuery]);
else
@@ -155,8 +235,7 @@
} // for
delete[] vals; vals = 0;
} // CheckQuery
+#endif
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDB.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -15,9 +15,7 @@
* @brief C++ TestSimpleDB object
*
* C++ unit testing for SimpleDB. This object is an abstract base
- * class. The actual testing is done in objects derived from this one
- * (TestSimpleDBPoint, TestSimpleDBLine, TestSimpleDBArea,
- * TestSimpleDBVolume).
+ * class with children classes specific to the type of data in the database.
*/
#if !defined(spatialdata_spatialdb_testsimpledb_hh)
@@ -30,6 +28,7 @@
namespace spatialdb {
class TestSimpleDB;
class SimpleDB; // USES SimpleDB
+ class SimpleDBData; // USES SimpleDBData
} // spatialdb
} // spatialdata
@@ -37,132 +36,72 @@
class spatialdata::spatialdb::TestSimpleDB : public CppUnit::TestFixture
{ // class TestSimpleDB
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleDB );
+ CPPUNIT_TEST( testConstructorA );
+ CPPUNIT_TEST( testConstructorB );
+ CPPUNIT_TEST( testLabel );
+ CPPUNIT_TEST_SUITE_END();
+
// PUBLIC METHODS /////////////////////////////////////////////////////
public :
- /// Setup test subject
- void setUp(void);
-
- /// Cleanup test subject
- void tearDown(void);
-
/// Test constructor
void testConstructorA(void);
/// Test constructor with label
void testConstructorB(void);
- /// Test Label()
+ /// Test label()
void testLabel(void);
- /// Test Query() using nearest neighbor
- void testQueryNearest(void);
-
- /// Test Query() using linear interpolation
- void testQueryLinear(void);
-
protected :
// PROTECTED METHODS //////////////////////////////////////////////////
- /** Get database.
+ /** Test query() using nearest neighbor
*
- * @returns Pointer to database
+ * @param data Data for database
*/
- SimpleDB* _database(void);
+ void _testQueryNearest(const SimpleDBData& data);
- /** Get data for database.
+ /** Test query() using linear interpolation
*
- * @returns Pointer to data
+ * @param data Data for database
*/
- virtual const double* _data(void) const = 0;
+ void _testQueryLinear(const SimpleDBData& data);
- /** Get expected return values for queries.
- *
- * @returns Pointer to head of array
- */
- virtual const int* _errFlags(void) const = 0;
-
- /** Get names of values in database.
- *
- * @returns Pointer to names
- */
- virtual const char** _names(void) const = 0;
-
- /** Get units of values in database.
- *
- * @returns Pointer to units
- */
- virtual const char** _units(void) const = 0;
-
- /** Get number of locations in database.
- *
- * @returns Number of locations
- */
- virtual int _numLocs(void) const = 0;
-
- /** Get number of values at each location in database.
- *
- * @returns Number of values
- */
- virtual int _numVals(void) const = 0;
-
- /** Get topology of data in database.
- *
- * @returns Topology of data
- */
- virtual SimpleDB::TopoEnum _topology(void) const = 0;
-
- /** Get number of queries.
- *
- * @returns Number of queries
- */
- virtual int _numQueries(void) const = 0;
-
- /** Get query data for nearest neighbor algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- virtual const double* _queryNearest(void) const = 0;
-
- /** Get query data for linear interpolation algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- virtual const double* _queryLinear(void) const = 0;
-
// PRIVATE METHODS ////////////////////////////////////////////////////
private :
- /** Check query values.
+ /** Populate database with data.
*
- * Do query and check values returned.
+ * @param db Database
+ * @param data Data for database
+ */
+ void _setupDB(SimpleDB* const db,
+ const SimpleDBData& data);
+
+ /** Test query method by doing query and checking values returned.
*
+ * @param db Database to query
+ * @param names Names of values in database
* @param queryData Query locations and expected values
- * @param queryErrFlags Array of exepcted return values
+ * @param flagsE Array of expected return values
+ * @param numQueries Number of queries
+ * @param spaceDim Number of coordinates per location
+ * @param numVals Number of values in database
*/
- void _checkQuery(const double* queryData,
- const int* queryErrFlags) const;
+ void _checkQuery(SimpleDB& db,
+ char** const names,
+ const double* queryData,
+ const int* flagsE,
+ const int numQueries,
+ const int spaceDim,
+ const int numVals);
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-private :
-
- SimpleDB* _pDB; ///< Test subject
-
}; // class TestSimpleDB
-#include "TestSimpleDB.icc" // inline methods
-
#endif // spatialdata_spatialdb_testsimpledb_hh
-// version
-// $Id$
// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,30 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SimpleDB
-#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
-
-#include "TestSimpleDB.hh" // ISA TestSimpleDB
-#include "TestSimpleDBArea.hh" // Implementation of class methods
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBArea );
-
-// ----------------------------------------------------------------------
-#include "data/TestSimpleDBArea.dat"
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,137 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/** @file tests/libtests/spatialdb/TestSimpleDBArea.hh
- *
- * @brief C++ TestSimpleDBArea object
- *
- * C++ unit testing for SimpleDB. This object tests the areal
- * interpolation.
- */
-
-#if !defined(spatialdata_spatialdb_testsimpledbarea_hh)
-#define spatialdata_spatialdb_testsimpledbarea_hh
-
-/// Namespace for spatial package
-namespace spatialdata {
- namespace spatialdb {
- class TestSimpleDB;
- class TestSimpleDBArea;
- } // spatialdb
-} // spatialdata
-
-/// C++ unit testing for SimpleDB
-class spatialdata::spatialdb::TestSimpleDBArea : public TestSimpleDB
-{ // class TestSimpleDBArea
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestSimpleDBArea );
- CPPUNIT_TEST( testQueryNearest );
- CPPUNIT_TEST( testQueryLinear );
- CPPUNIT_TEST_SUITE_END();
-
-protected :
- // PROTECTED METHODS //////////////////////////////////////////////////
-
- /** Get data for database.
- *
- * @returns Pointer to data
- */
- const double* _data(void) const;
-
- /** Get expected return values for queries.
- *
- * @returns Pointer to head of array
- */
- const int* _errFlags(void) const;
-
- /** Get names of values in database.
- *
- * @returns Pointer to names
- */
- const char** _names(void) const;
-
- /** Get units of values in database.
- *
- * @returns Pointer to units
- */
- const char** _units(void) const;
-
- /** Get number of locations in database.
- *
- * @returns Number of locations
- */
- int _numLocs(void) const;
-
- /** Get number of values at each location in database.
- *
- * @returns Number of values
- */
- int _numVals(void) const;
-
- /** Get topology of data in database.
- *
- * @returns Topology of data
- */
- SimpleDB::TopoEnum _topology(void) const;
-
- /** Get number of queries.
- *
- * @returns Number of queries
- */
- int _numQueries(void) const;
-
- /** Get query data for nearest neighbor algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- const double* _queryNearest(void) const;
-
- /** Get query data for linear interpolation algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- const double* _queryLinear(void) const;
-
-private :
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-
- static const double DATA[]; ///< Data for database
- static const int ERRFLAGS[]; ///< Expected query return values
- static const char* NAMES[]; ///< Names of values in database
- static const char* UNITS[]; ///< Units of values in database
- static const int NUMLOCS; ///< Number of locations in database
- static const int NUMVALS; ///< Number of values in database
- static const SimpleDB::TopoEnum TOPOLOGY; ///< Topology of data in database
-
- static const int NUMQUERIES; ///< Number of queries
- static const double QUERYNEAREST[]; ///< Data for nearest neighbor queries
- static const double QUERYLINEAR[]; ///< Data for linear interpolation queries
-
-}; // class TestSimpleDBArea
-
-#include "TestSimpleDBArea.icc" // inline methods
-
-#endif // spatialdata_spatialdb_testsimpledbarea_hh
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.icc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.icc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea.icc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(spatialdata_spatialdb_testsimpledbarea_hh)
-#error "TestSimpleDBArea.icc must only be included from TestSimpleDBArea.hh"
-#endif
-
-// Get data for database.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBArea::_data(void) const
-{ return DATA; }
-
-// Get expected return values for queries.
-inline
-const int*
-spatialdata::spatialdb::TestSimpleDBArea::_errFlags(void) const
-{ return ERRFLAGS; }
-
-// Get names of values in database.
-inline
-const char**
-spatialdata::spatialdb::TestSimpleDBArea::_names(void) const
-{ return NAMES; }
-
-// Get units of values in database.
-inline
-const char**
-spatialdata::spatialdb::TestSimpleDBArea::_units(void) const
-{ return UNITS; }
-
-// Get number of locations in database.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBArea::_numLocs(void) const
-{ return NUMLOCS; }
-
-// Get number of values at each location in database.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBArea::_numVals(void) const
-{ return NUMVALS; }
-
-// Get topology of data in database.
-inline
-spatialdata::spatialdb::SimpleDB::TopoEnum
-spatialdata::spatialdb::TestSimpleDBArea::_topology(void) const
-{ return TOPOLOGY; }
-
-// Get number of queries.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBArea::_numQueries(void) const
-{ return NUMQUERIES; }
-
-// Get query data for nearest neighbor algorithm.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBArea::_queryNearest(void) const
-{ return QUERYNEAREST; }
-
-// Get query data for linear interpolation algorithm.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBArea::_queryLinear(void) const
-{ return QUERYLINEAR; }
-
-// version
-// $Id$
-
-// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestSimpleDBArea3D.hh" // Implementation of class methods
+
+#include "data/SimpleDBDataArea3D.hh"
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBArea3D );
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
+spatialdata::spatialdb::TestSimpleDBArea3D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleDBDataArea3D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleDBArea3D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleDBDataArea3D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBArea3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file tests/libtests/spatialdb/TestSimpleDBArea3D.hh
+ *
+ * @brief C++ TestSimpleDBArea3D object
+ *
+ * C++ unit testing for SimpleDB. This object tests the areal
+ * interpolation.
+ */
+
+#if !defined(spatialdata_spatialdb_testsimpledbarea3d_hh)
+#define spatialdata_spatialdb_testsimpledbarea3d_hh
+
+#include "TestSimpleDB.hh" // ISA TestSimpleDB
+
+/// Namespace for spatial package
+namespace spatialdata {
+ namespace spatialdb {
+ class TestSimpleDBArea3D;
+ } // spatialdb
+} // spatialdata
+
+/// C++ unit testing for SimpleDB
+class spatialdata::spatialdb::TestSimpleDBArea3D : public TestSimpleDB
+{ // class TestSimpleDBArea3D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleDBArea3D );
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleDBArea3D
+
+#endif // spatialdata_spatialdb_testsimpledbarea3d_hh
+
+
+// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,30 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SimpleDB
-#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
-
-#include "TestSimpleDB.hh" // ISA TestSimpleDB
-#include "TestSimpleDBLine.hh" // Implementation of class methods
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBLine );
-
-// ----------------------------------------------------------------------
-#include "data/TestSimpleDBLine.dat"
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,137 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/** @file tests/libtests/spatialdb/TestSimpleDBLine.hh
- *
- * @brief C++ TestSimpleDBLine object
- *
- * C++ unit testing for SimpleDB. This object tests the linear
- * interpolation.
- */
-
-#if !defined(spatialdata_spatialdb_testsimpledbline_hh)
-#define spatialdata_spatialdb_testsimpledbline_hh
-
-/// Namespace for spatial package
-namespace spatialdata {
- namespace spatialdb {
- class TestSimpleDB;
- class TestSimpleDBLine;
- } // spatialdb
-} // spatialdata
-
-/// C++ unit testing for SimpleDB
-class spatialdata::spatialdb::TestSimpleDBLine : public TestSimpleDB
-{ // class TestSimpleDBLine
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestSimpleDBLine );
- CPPUNIT_TEST( testQueryNearest );
- CPPUNIT_TEST( testQueryLinear );
- CPPUNIT_TEST_SUITE_END();
-
-protected :
- // PROTECTED METHODS //////////////////////////////////////////////////
-
- /** Get data for database.
- *
- * @returns Pointer to data
- */
- const double* _data(void) const;
-
- /** Get expected return values for queries.
- *
- * @returns Pointer to head of array
- */
- const int* _errFlags(void) const;
-
- /** Get names of values in database.
- *
- * @returns Pointer to names
- */
- const char** _names(void) const;
-
- /** Get units of values in database.
- *
- * @returns Pointer to units
- */
- const char** _units(void) const;
-
- /** Get number of locations in database.
- *
- * @returns Number of locations
- */
- int _numLocs(void) const;
-
- /** Get number of values at each location in database.
- *
- * @returns Number of values
- */
- int _numVals(void) const;
-
- /** Get topology of data in database.
- *
- * @returns Topology of data
- */
- SimpleDB::TopoEnum _topology(void) const;
-
- /** Get number of queries.
- *
- * @returns Number of queries
- */
- int _numQueries(void) const;
-
- /** Get query data for nearest neighbor algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- const double* _queryNearest(void) const;
-
- /** Get query data for linear interpolation algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- const double* _queryLinear(void) const;
-
-private :
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-
- static const double DATA[]; ///< Data for database
- static const int ERRFLAGS[]; ///< Expected query return values
- static const char* NAMES[]; ///< Names of values in database
- static const char* UNITS[]; ///< Units of values in database
- static const int NUMLOCS; ///< Number of locations in database
- static const int NUMVALS; ///< Number of values in database
- static const SimpleDB::TopoEnum TOPOLOGY; ///< Topology of data in database
-
- static const int NUMQUERIES; ///< Number of queries
- static const double QUERYNEAREST[]; ///< Data for nearest neighbor queries
- static const double QUERYLINEAR[]; ///< Data for linear interpolation queries
-
-}; // class TestSimpleDBLine
-
-#include "TestSimpleDBLine.icc" // inline methods
-
-#endif // spatialdata_spatialdb_testsimpledbline_hh
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.icc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.icc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine.icc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(spatialdata_spatialdb_testsimpledbline_hh)
-#error "TestSimpleDBLine.icc must only be included from TestSimpleDBLine.hh"
-#endif
-
-// Get data for database.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBLine::_data(void) const
-{ return DATA; }
-
-// Get expected return values for queries.
-inline
-const int*
-spatialdata::spatialdb::TestSimpleDBLine::_errFlags(void) const
-{ return ERRFLAGS; }
-
-// Get names of values in database.
-inline
-const char**
-spatialdata::spatialdb::TestSimpleDBLine::_names(void) const
-{ return NAMES; }
-
-// Get units of values in database.
-inline
-const char**
-spatialdata::spatialdb::TestSimpleDBLine::_units(void) const
-{ return UNITS; }
-
-// Get number of locations in database.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBLine::_numLocs(void) const
-{ return NUMLOCS; }
-
-// Get number of values at each location in database.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBLine::_numVals(void) const
-{ return NUMVALS; }
-
-// Get topology of data in database.
-inline
-spatialdata::spatialdb::SimpleDB::TopoEnum
-spatialdata::spatialdb::TestSimpleDBLine::_topology(void) const
-{ return TOPOLOGY; }
-
-// Get number of queries.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBLine::_numQueries(void) const
-{ return NUMQUERIES; }
-
-// Get query data for nearest neighbor algorithm.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBLine::_queryNearest(void) const
-{ return QUERYNEAREST; }
-
-// Get query data for linear interpolation algorithm.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBLine::_queryLinear(void) const
-{ return QUERYLINEAR; }
-
-// version
-// $Id$
-
-// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestSimpleDBLine3D.hh" // Implementation of class methods
+
+#include "data/SimpleDBDataLine3D.hh"
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBLine3D );
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
+spatialdata::spatialdb::TestSimpleDBLine3D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleDBDataLine3D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleDBLine3D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleDBDataLine3D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBLine3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file tests/libtests/spatialdb/TestSimpleDBLine3D.hh
+ *
+ * @brief C++ TestSimpleDBLine3d object
+ *
+ * C++ unit testing for SimpleDB. This object tests the linear
+ * interpolation.
+ */
+
+#if !defined(spatialdata_spatialdb_testsimpledbline3d_hh)
+#define spatialdata_spatialdb_testsimpledbline3d_hh
+
+#include "TestSimpleDB.hh" // ISA TestSimpleDB
+
+/// Namespace for spatial package
+namespace spatialdata {
+ namespace spatialdb {
+ class TestSimpleDBLine3D;
+ } // spatialdb
+} // spatialdata
+
+/// C++ unit testing for SimpleDB
+class spatialdata::spatialdb::TestSimpleDBLine3D : public TestSimpleDB
+{ // class TestSimpleDBLine3D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleDBLine3D );
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleDBLine3D
+
+#endif // spatialdata_spatialdb_testsimpledbline3d_hh
+
+
+// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,30 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SimpleDB
-#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
-
-#include "TestSimpleDB.hh" // ISA TestSimpleDB
-#include "TestSimpleDBPoint.hh" // Implementation of class methods
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBPoint );
-
-// ----------------------------------------------------------------------
-#include "data/TestSimpleDBPoint.dat"
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,140 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/** @file tests/libtests/spatialdb/TestSimpleDBPoint.hh
- *
- * @brief C++ TestSimpleDBPoint object
- *
- * C++ unit testing for SimpleDB. This object tests the pointwise
- * interpolation.
- */
-
-#if !defined(spatialdata_spatialdb_testsimpledbpoint_hh)
-#define spatialdata_spatialdb_testsimpledbpoint_hh
-
-/// Namespace for spatial package
-namespace spatialdata {
- namespace spatialdb {
- class TestSimpleDB;
- class TestSimpleDBPoint;
- } // spatialdb
-} // spatialdata
-
-/// C++ unit testing for SimpleDB
-class spatialdata::spatialdb::TestSimpleDBPoint : public TestSimpleDB
-{ // class TestSimpleDBPoint
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestSimpleDBPoint );
- CPPUNIT_TEST( testConstructorA );
- CPPUNIT_TEST( testConstructorB );
- CPPUNIT_TEST( testLabel );
- CPPUNIT_TEST( testQueryNearest );
- CPPUNIT_TEST( testQueryLinear );
- CPPUNIT_TEST_SUITE_END();
-
-protected :
- // PROTECTED METHODS //////////////////////////////////////////////////
-
- /** Get data for database.
- *
- * @returns Pointer to data
- */
- const double* _data(void) const;
-
- /** Get expected return values for queries.
- *
- * @returns Pointer to head of array
- */
- const int* _errFlags(void) const;
-
- /** Get names of values in database.
- *
- * @returns Pointer to names
- */
- const char** _names(void) const;
-
- /** Get units of values in database.
- *
- * @returns Pointer to units
- */
- const char** _units(void) const;
-
- /** Get number of locations in database.
- *
- * @returns Number of locations
- */
- int _numLocs(void) const;
-
- /** Get number of values at each location in database.
- *
- * @returns Number of values
- */
- int _numVals(void) const;
-
- /** Get topology of data in database.
- *
- * @returns Topology of data
- */
- SimpleDB::TopoEnum _topology(void) const;
-
- /** Get number of queries.
- *
- * @returns Number of queries
- */
- int _numQueries(void) const;
-
- /** Get query data for nearest neighbor algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- const double* _queryNearest(void) const;
-
- /** Get query data for linear interpolation algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- const double* _queryLinear(void) const;
-
-private :
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-
- static const double DATA[]; ///< Data for database
- static const int ERRFLAGS[]; ///< Expected query return values
- static const char* NAMES[]; ///< Names of values in database
- static const char* UNITS[]; ///< Units of values in database
- static const int NUMLOCS; ///< Number of locations in database
- static const int NUMVALS; ///< Number of values in database
- static const SimpleDB::TopoEnum TOPOLOGY; ///< Topology of data in database
-
- static const int NUMQUERIES; ///< Number of queries
- static const double QUERYNEAREST[]; ///< Data for nearest neighbor queries
- static const double QUERYLINEAR[]; ///< Data for linear interpolation queries
-
-}; // class TestSimpleDBPoint
-
-#include "TestSimpleDBPoint.icc" // inline methods
-
-#endif // spatialdata_spatialdb_testsimpledbpoint_hh
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.icc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.icc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.icc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(spatialdata_spatialdb_testsimpledbpoint_hh)
-#error "TestSimpleDBPoint.icc must only be included from TestSimpleDBPoint.hh"
-#endif
-
-// Get data for database.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBPoint::_data(void) const
-{ return DATA; }
-
-// Get expected return values for queries.
-inline
-const int*
-spatialdata::spatialdb::TestSimpleDBPoint::_errFlags(void) const
-{ return ERRFLAGS; }
-
-// Get names of values in database.
-inline
-const char**
-spatialdata::spatialdb::TestSimpleDBPoint::_names(void) const
-{ return NAMES; }
-
-// Get units of values in database.
-inline
-const char**
-spatialdata::spatialdb::TestSimpleDBPoint::_units(void) const
-{ return UNITS; }
-
-// Get number of locations in database.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBPoint::_numLocs(void) const
-{ return NUMLOCS; }
-
-// Get number of values at each location in database.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBPoint::_numVals(void) const
-{ return NUMVALS; }
-
-// Get topology of data in database.
-inline
-spatialdata::spatialdb::SimpleDB::TopoEnum
-spatialdata::spatialdb::TestSimpleDBPoint::_topology(void) const
-{ return TOPOLOGY; }
-
-// Get number of queries.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBPoint::_numQueries(void) const
-{ return NUMQUERIES; }
-
-// Get query data for nearest neighbor algorithm.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBPoint::_queryNearest(void) const
-{ return QUERYNEAREST; }
-
-// Get query data for linear interpolation algorithm.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBPoint::_queryLinear(void) const
-{ return QUERYLINEAR; }
-
-// version
-// $Id$
-
-// End of file
Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.cc (from rev 5688, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.cc)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestSimpleDBPoint3D.hh" // Implementation of class methods
+
+#include "data/SimpleDBDataPoint3D.hh"
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBPoint3D );
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
+spatialdata::spatialdb::TestSimpleDBPoint3D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleDBDataPoint3D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleDBPoint3D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleDBDataPoint3D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// End of file
Copied: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.hh (from rev 5688, cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.hh)
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBPoint3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file tests/libtests/spatialdb/TestSimpleDBPoint3D.hh
+ *
+ * @brief C++ TestSimpleDBPoint3D object
+ *
+ * C++ unit testing for SimpleDB. This object tests the point
+ * interpolation.
+ */
+
+#if !defined(spatialdata_spatialdb_testsimpledbpoint3d_hh)
+#define spatialdata_spatialdb_testsimpledbpoint3d_hh
+
+#include "TestSimpleDB.hh" // ISA TestSimpleDB
+
+/// Namespace for spatial package
+namespace spatialdata {
+ namespace spatialdb {
+ class TestSimpleDBPoint3D;
+ } // spatialdb
+} // spatialdata
+
+/// C++ unit testing for SimpleDB
+class spatialdata::spatialdb::TestSimpleDBPoint3D : public TestSimpleDB
+{ // class TestSimpleDBPoint3D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleDBPoint3D );
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleDBPoint3D
+
+#endif // spatialdata_spatialdb_testsimpledbpoint3d_hh
+
+
+// End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -12,66 +12,23 @@
#include <portinfo>
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SimpleDB
-#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
-
#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
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBQuery );
+#include "spatialdata/geocoords/CSCart.hh" // USE CSCart
-// ----------------------------------------------------------------------
-// Get static members
-#include "data/TestSimpleDBQuery.dat"
+#include "data/SimpleDBQueryData.hh"
// ----------------------------------------------------------------------
-/// Setup test subject
-void
-spatialdata::spatialdb::TestSimpleDBQuery::setUp(void)
-{ // setUp
- SimpleDB::DataStruct* pData = new SimpleDB::DataStruct;
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBQuery );
- const int numCoords = 3;
- const int numLocs = NUMLOCS;
- const int numVals = NUMVALS;
-
- const int dataSize = numLocs*(numCoords+numVals);
- CPPUNIT_ASSERT(0 < dataSize);
- pData->data = new double[dataSize];
- memcpy(pData->data, DATA, dataSize*sizeof(double));
-
- pData->valNames = new std::string[numVals];
- for (int i=0; i < numVals; ++i)
- pData->valNames[i] = NAMES[i];
-
- pData->valUnits = new std::string[numVals];
- for (int i=0; i < numVals; ++i)
- pData->valUnits[i] = UNITS[i];
-
- pData->numLocs = numLocs;
- pData->numVals = numVals;
- pData->topology = TOPOLOGY;
-
- _pDB = new SimpleDB;
- _pDB->_pData = pData;
- _pQuery = new SimpleDBQuery(*_pDB);
-} // setUp
-
// ----------------------------------------------------------------------
-/// Cleanup test subject
+// Test Constructor()
void
-spatialdata::spatialdb::TestSimpleDBQuery::tearDown(void)
-{ // tearDown
- delete _pQuery; _pQuery = 0;
- delete _pDB; _pDB = 0;
-} // tearDown
-
-// ----------------------------------------------------------------------
-/// Test Constructor()
-void
spatialdata::spatialdb::TestSimpleDBQuery::testConstructor(void)
{ // testConstructor
SimpleDB db;
@@ -79,109 +36,147 @@
} // testConstructor
// ----------------------------------------------------------------------
-/// Test DistSquared()
+// Test QueryType()
void
-spatialdata::spatialdb::TestSimpleDBQuery::testDistSquared(void)
-{ // testDistSquared
- CPPUNIT_ASSERT(2 <= NUMPTS);
- const int numCoords = 3;
- const double dist2 =
- SimpleDBQuery::_distSquared(&COORDS[0], &COORDS[1*numCoords]);
- const double tolerance = 1.0e-06;
- CPPUNIT_ASSERT_DOUBLES_EQUAL(dist2/DIST2, 1.0, tolerance);
-} // testDistSquared
-
-// ----------------------------------------------------------------------
-/// Test Area()
-void
-spatialdata::spatialdb::TestSimpleDBQuery::testArea(void)
-{ // testArea
- CPPUNIT_ASSERT(3 <= NUMPTS);
- const int numCoords = 3;
- double area = 0;
- double dir[numCoords];
- SimpleDBQuery::_area(&area, dir, &COORDS[0*numCoords],
- &COORDS[1*numCoords], &COORDS[2*numCoords]);
- const double tolerance = 1.0e-06;
- CPPUNIT_ASSERT_DOUBLES_EQUAL(area/AREA, 1.0, tolerance);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(dir[0]/AREADIR[0], 1.0, tolerance);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(dir[1]/AREADIR[1], 1.0, tolerance);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(dir[2]/AREADIR[2], 1.0, tolerance);
-} // testArea
-
-// ----------------------------------------------------------------------
-/// Test Volume()
-void
-spatialdata::spatialdb::TestSimpleDBQuery::testVolume(void)
-{ // testVolume
- CPPUNIT_ASSERT(4 <= NUMPTS);
- const int numCoords = 3;
- const double volume =
- SimpleDBQuery::_volume(&COORDS[0*numCoords], &COORDS[1*numCoords],
- &COORDS[2*numCoords], &COORDS[3*numCoords]);
- const double tolerance = 1.0e-06;
- CPPUNIT_ASSERT_DOUBLES_EQUAL(volume/VOLUME, 1.0, tolerance);
-} // testVolume
-
-// ----------------------------------------------------------------------
-/// Test QueryType()
-void
spatialdata::spatialdb::TestSimpleDBQuery::testQueryType(void)
{ // testQueryType
- CPPUNIT_ASSERT(0 != _pQuery);
+ SimpleDB db;
+ SimpleDBQuery query(db);
{ // test A
const SimpleDB::QueryEnum queryType = SimpleDB::NEAREST;
- _pQuery->queryType(queryType);
- CPPUNIT_ASSERT(_pQuery->_queryType == queryType);
+ query.queryType(queryType);
+ CPPUNIT_ASSERT(queryType == query._queryType);
} // test A
{ // test B
const SimpleDB::QueryEnum queryType = SimpleDB::LINEAR;
- _pQuery->queryType(queryType);
- CPPUNIT_ASSERT(queryType == _pQuery->_queryType);
+ query.queryType(queryType);
+ CPPUNIT_ASSERT(queryType == query._queryType);
} // test B
} // testQueryType
// ----------------------------------------------------------------------
-/// Test QueryVals()
+// Populate database with data.
void
-spatialdata::spatialdb::TestSimpleDBQuery::testQueryVals(void)
-{ // testQueryVals
- CPPUNIT_ASSERT(0 != _pQuery);
+spatialdata::spatialdb::TestSimpleDBQuery::_setupDB(SimpleDB* const db,
+ const SimpleDBQueryData& data)
+{ // _setupDB
+ SimpleDB::DataStruct* pData = new SimpleDB::DataStruct;
+ 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();
+} // _setupDB
+
+// ----------------------------------------------------------------------
+// Test queryVals()
+void
+spatialdata::spatialdb::TestSimpleDBQuery::_testQueryVals(const SimpleDBQueryData& data)
+{ // _testQueryVals
+ SimpleDB db;
+ _setupDB(&db, data);
+ CPPUNIT_ASSERT(0 != db._query);
+
{ // test A
const char* names[] = { "one" };
const int numNames = 1;
const int vals[] = {0};
- _pQuery->queryVals(names, numNames);
- CPPUNIT_ASSERT(numNames == _pQuery->_querySize);
+ db._query->queryVals(names, numNames);
+ CPPUNIT_ASSERT(numNames == db._query->_querySize);
for (int i=0; i < numNames; ++i)
- CPPUNIT_ASSERT(vals[i] == _pQuery->_queryVals[i]);
+ CPPUNIT_ASSERT(vals[i] == db._query->_queryVals[i]);
} // test A
{ // test B
const char* names[] = { "two" };
const int numNames = 1;
const int vals[] = {1};
- _pQuery->queryVals(names, numNames);
- CPPUNIT_ASSERT(numNames == _pQuery->_querySize);
+ db._query->queryVals(names, numNames);
+ CPPUNIT_ASSERT(numNames == db._query->_querySize);
for (int i=0; i < numNames; ++i)
- CPPUNIT_ASSERT(vals[i] == _pQuery->_queryVals[i]);
+ CPPUNIT_ASSERT(vals[i] == db._query->_queryVals[i]);
} // test B
{ // test C
const char* names[] = { "two", "one" };
const int numNames = 2;
const int vals[] = {1, 0};
- _pQuery->queryVals(names, numNames);
- CPPUNIT_ASSERT(numNames == _pQuery->_querySize);
+ db._query->queryVals(names, numNames);
+ CPPUNIT_ASSERT(numNames == db._query->_querySize);
for (int i=0; i < numNames; ++i)
- CPPUNIT_ASSERT(vals[i] == _pQuery->_queryVals[i]);
+ CPPUNIT_ASSERT(vals[i] == db._query->_queryVals[i]);
} // test C
-} // testQueryVals
+} // _testQueryVals
-// version
-// $Id$
+#include <iostream>
+// ----------------------------------------------------------------------
+// Test distSquared()
+void
+spatialdata::spatialdb::TestSimpleDBQuery::_testDistSquared(const SimpleDBQueryData& data)
+{ // _testDistSquared
+ CPPUNIT_ASSERT(2 <= data.numPts);
+ const int numCoords = data.spaceDim;
+ const double dist2 =
+ SimpleDBQuery::_distSquared(&data.coords[0], &data.coords[1*numCoords]);
+ const double tolerance = 1.0e-06;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, dist2/data.dist2, tolerance);
+} // _testDistSquared
+// ----------------------------------------------------------------------
+// Test area()
+void
+spatialdata::spatialdb::TestSimpleDBQuery::_testArea(const SimpleDBQueryData& data)
+{ // _testArea
+ CPPUNIT_ASSERT(3 <= data.numPts);
+ const int numCoords = data.spaceDim;
+ double area = 0;
+ double dir[numCoords];
+ SimpleDBQuery::_area(&area, dir, &data.coords[0*numCoords],
+ &data.coords[1*numCoords], &data.coords[2*numCoords]);
+ const double tolerance = 1.0e-06;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, area/data.area, tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(dir[0]/data.areaDir[0], 1.0, tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(dir[1]/data.areaDir[1], 1.0, tolerance);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(dir[2]/data.areaDir[2], 1.0, tolerance);
+} // _testArea
+
+// ----------------------------------------------------------------------
+// Test volume()
+void
+spatialdata::spatialdb::TestSimpleDBQuery::_testVolume(const SimpleDBQueryData& data)
+{ // _testVolume
+ CPPUNIT_ASSERT(4 <= data.numPts);
+ const int numCoords = data.spaceDim;
+ const double volume =
+ SimpleDBQuery::_volume(&data.coords[0*numCoords],
+ &data.coords[1*numCoords],
+ &data.coords[2*numCoords],
+ &data.coords[3*numCoords]);
+ const double tolerance = 1.0e-06;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, volume/data.volume, tolerance);
+} // _testVolume
+
+
// End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -27,7 +27,7 @@
namespace spatialdb {
class TestSimpleDBQuery;
class SimpleDB; // USES SimpleDB
- class SimpleDBQuery; // USES SimpleDBQuery
+ class SimpleDBQueryData; // USES TestSimpleDBQueryData
} // spatialdb
} // spatialdata
@@ -38,65 +38,59 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestSimpleDBQuery );
CPPUNIT_TEST( testConstructor );
- CPPUNIT_TEST( testDistSquared );
- CPPUNIT_TEST( testArea );
- CPPUNIT_TEST( testVolume );
CPPUNIT_TEST( testQueryType );
- CPPUNIT_TEST( testQueryVals );
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
public :
- /// Setup test subject
- void setUp(void);
-
- /// Cleanup test subject
- void tearDown(void);
-
/// Test constructor
void testConstructor(void);
- /// Test DistSquared()
- void testDistSquared(void);
+ /// Test queryType()
+ void testQueryType(void);
- /// Test Area()
- void testArea(void);
+protected :
+ // PROTECTED METHODS //////////////////////////////////////////////////
- /// Test Volume()
- void testVolume(void);
+ /* Test queryVals()
+ *
+ * @param data Data for database
+ */
+ void _testQueryVals(const SimpleDBQueryData& data);
- /// Test QueryType()
- void testQueryType(void);
+ /** Test distSquared()
+ *
+ * @param data Data for database
+ */
+ void _testDistSquared(const SimpleDBQueryData& data);
- /// Test QueryVals()
- void testQueryVals(void);
+ /** Test area().
+ *
+ * @param data Data for database
+ */
+ void _testArea(const SimpleDBQueryData& data);
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
+ /* Test volume()
+ *
+ * @param data Data for database
+ */
+ void _testVolume(const SimpleDBQueryData& data);
+
+ // PRIVATE METHODS ////////////////////////////////////////////////////
private :
- SimpleDB* _pDB; ///< Database for test subject
- SimpleDBQuery* _pQuery; ///< Test subject
+ /** Populate database with data.
+ *
+ * @param db Database
+ * @param data Data for database
+ */
+ void _setupDB(SimpleDB* const db,
+ const SimpleDBQueryData& data);
- static const double DATA[]; ///< Data for database
- static const char* NAMES[]; ///< Names of values in database
- static const char* UNITS[]; ///< Units of values in database
- static const int NUMLOCS; ///< Number of locations in database
- static const int NUMVALS; ///< Number of values in database
- static const SimpleDB::TopoEnum TOPOLOGY; ///< Topology of data in database
-
- static const double COORDS[]; ///< Coordinates for points
- static const double AREADIR[]; ///< Direction associated with area
- static const int NUMPTS; ///< Number of points
- static const double DIST2; ///< Square of distance b/t points 0 and 1
- static const double AREA; ///< Area of triangle formed by pts 0, 1, 2
- static const double VOLUME; ///< Volume of tetrahedron formed by pts 0,1,2,3
-
}; // class TestSimpleDBQuery
#endif // spatialdata_spatialdb_testsimpledbquery_hh
-// version
-// $Id$
// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestSimpleDBQuery3D.hh" // Implementation of class methods
+
+#include "data/SimpleDBQueryData3D.hh"
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBQuery3D );
+
+// ----------------------------------------------------------------------
+// Test queryVals()
+void
+spatialdata::spatialdb::TestSimpleDBQuery3D::testQueryVals(void)
+{ // testQueryVals
+ SimpleDBQueryData3D data;
+ _testQueryVals(data);
+} // testQueryVals
+
+// ----------------------------------------------------------------------
+// Test distSquared()
+void
+spatialdata::spatialdb::TestSimpleDBQuery3D::testDistSquared(void)
+{ // testDistSquared
+ SimpleDBQueryData3D data;
+ _testDistSquared(data);
+} // testDistSquared
+
+// ----------------------------------------------------------------------
+// Test area()
+void
+spatialdata::spatialdb::TestSimpleDBQuery3D::testArea(void)
+{ // testArea
+ SimpleDBQueryData3D data;
+ _testArea(data);
+} // testArea
+
+// ----------------------------------------------------------------------
+// Test volume()
+void
+spatialdata::spatialdb::TestSimpleDBQuery3D::testVolume(void)
+{ // testVolume
+ SimpleDBQueryData3D data;
+ _testVolume(data);
+} // tetVolume
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBQuery3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file tests/libtests/spatialdb/TestSimpleDBQuery3D.hh
+ *
+ * @brief C++ TestSimpleDBQuery3D object
+ *
+ * C++ unit testing for SimpleDBQuery.
+ */
+
+#if !defined(spatialdata_spatialdb_testsimpledbquery3d_hh)
+#define spatialdata_spatialdb_testsimpledbquery3d_hh
+
+#include "TestSimpleDBQuery.hh" // ISA TestSimpleDBQuery
+
+/// Namespace for spatial package
+namespace spatialdata {
+ namespace spatialdb {
+ class TestSimpleDBQuery3D;
+ } // spatialdb
+} // spatialdata
+
+/// C++ unit testing for SimpleDB
+class spatialdata::spatialdb::TestSimpleDBQuery3D : public TestSimpleDBQuery
+{ // class TestSimpleDBQuery3D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleDBQuery3D );
+ CPPUNIT_TEST( testQueryVals );
+ CPPUNIT_TEST( testDistSquared );
+ CPPUNIT_TEST( testArea );
+ CPPUNIT_TEST( testVolume );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryVals()
+ void testQueryVals(void);
+
+ /// Test distSquared()
+ void testDistSquared(void);
+
+ /// Test area()
+ void testArea(void);
+
+ /// Test volume()
+ void testVolume(void);
+
+}; // class TestSimpleDBQuery3D
+
+#endif // spatialdata_spatialdb_testsimpledbquery3d_hh
+
+
+// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,30 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SimpleDB
-#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
-
-#include "TestSimpleDB.hh" // ISA TestSimpleDB
-#include "TestSimpleDBVolume.hh" // Implementation of class methods
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBVolume );
-
-// ----------------------------------------------------------------------
-#include "data/TestSimpleDBVolume.dat"
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,137 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/** @file tests/libtests/spatialdb/TestSimpleDBVolume.hh
- *
- * @brief C++ TestSimpleDBVolume object
- *
- * C++ unit testing for SimpleDB. This object tests the volumetric
- * interpolation.
- */
-
-#if !defined(spatialdata_spatialdb_testsimpledbvolume_hh)
-#define spatialdata_spatialdb_testsimpledbvolume_hh
-
-/// Namespace for spatial package
-namespace spatialdata {
- namespace spatialdb {
- class TestSimpleDB;
- class TestSimpleDBVolume;
- } // spatialdb
-} // spatialdata
-
-/// C++ unit testing for SimpleDB
-class spatialdata::spatialdb::TestSimpleDBVolume : public TestSimpleDB
-{ // class TestSimpleDBVolume
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestSimpleDBVolume );
- CPPUNIT_TEST( testQueryNearest );
- CPPUNIT_TEST( testQueryLinear );
- CPPUNIT_TEST_SUITE_END();
-
-protected :
- // PROTECTED METHODS //////////////////////////////////////////////////
-
- /** Get data for database.
- *
- * @returns Pointer to data
- */
- const double* _data(void) const;
-
- /** Get expected return values for queries.
- *
- * @returns Pointer to head of array
- */
- const int* _errFlags(void) const;
-
- /** Get names of values in database.
- *
- * @returns Pointer to names
- */
- const char** _names(void) const;
-
- /** Get units of values in database.
- *
- * @returns Pointer to units
- */
- const char** _units(void) const;
-
- /** Get number of locations in database.
- *
- * @returns Number of locations
- */
- int _numLocs(void) const;
-
- /** Get number of values at each location in database.
- *
- * @returns Number of values
- */
- int _numVals(void) const;
-
- /** Get topology of data in database.
- *
- * @returns Topology of data
- */
- SimpleDB::TopoEnum _topology(void) const;
-
- /** Get number of queries.
- *
- * @returns Number of queries
- */
- int _numQueries(void) const;
-
- /** Get query data for nearest neighbor algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- const double* _queryNearest(void) const;
-
- /** Get query data for linear interpolation algorithm.
- *
- * numCoords = 3
- * Coordinates for iQuery begin at iQuery*(numCoords+numVals)
- * Expected values for iQuery begin at iQuery*(numCoords+numVals)+numCoords
- *
- * @returns Pointer to data
- */
- const double* _queryLinear(void) const;
-
-private :
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-
- static const double DATA[]; ///< Data for database
- static const int ERRFLAGS[]; ///< Expected query return values
- static const char* NAMES[]; ///< Names of values in database
- static const char* UNITS[]; ///< Units of values in database
- static const int NUMLOCS; ///< Number of locations in database
- static const int NUMVALS; ///< Number of values in database
- static const SimpleDB::TopoEnum TOPOLOGY; ///< Topology of data in database
-
- static const int NUMQUERIES; ///< Number of queries
- static const double QUERYNEAREST[]; ///< Data for nearest neighbor queries
- static const double QUERYLINEAR[]; ///< Data for linear interpolation queries
-
-}; // class TestSimpleDBVolume
-
-#include "TestSimpleDBVolume.icc" // inline methods
-
-#endif // spatialdata_spatialdb_testsimpledbvolume_hh
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.icc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.icc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume.icc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,80 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(spatialdata_spatialdb_testsimpledbvolume_hh)
-#error "TestSimpleDBVolume.icc must only be included from TestSimpleDBVolume.hh"
-#endif
-
-// Get data for database.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBVolume::_data(void) const
-{ return DATA; }
-
-// Get expected return values for queries.
-inline
-const int*
-spatialdata::spatialdb::TestSimpleDBVolume::_errFlags(void) const
-{ return ERRFLAGS; }
-
-// Get names of values in database.
-inline
-const char**
-spatialdata::spatialdb::TestSimpleDBVolume::_names(void) const
-{ return NAMES; }
-
-// Get units of values in database.
-inline
-const char**
-spatialdata::spatialdb::TestSimpleDBVolume::_units(void) const
-{ return UNITS; }
-
-// Get number of locations in database.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBVolume::_numLocs(void) const
-{ return NUMLOCS; }
-
-// Get number of values at each location in database.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBVolume::_numVals(void) const
-{ return NUMVALS; }
-
-// Get topology of data in database.
-inline
-spatialdata::spatialdb::SimpleDB::TopoEnum
-spatialdata::spatialdb::TestSimpleDBVolume::_topology(void) const
-{ return TOPOLOGY; }
-
-// Get number of queries.
-inline
-int
-spatialdata::spatialdb::TestSimpleDBVolume::_numQueries(void) const
-{ return NUMQUERIES; }
-
-// Get query data for nearest neighbor algorithm.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBVolume::_queryNearest(void) const
-{ return QUERYNEAREST; }
-
-// Get query data for linear interpolation algorithm.
-inline
-const double*
-spatialdata::spatialdb::TestSimpleDBVolume::_queryLinear(void) const
-{ return QUERYLINEAR; }
-
-// version
-// $Id$
-
-// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestSimpleDBVolume3D.hh" // Implementation of class methods
+
+#include "data/SimpleDBDataVolume3D.hh"
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleDBVolume3D );
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
+spatialdata::spatialdb::TestSimpleDBVolume3D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleDBDataVolume3D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleDBVolume3D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleDBDataVolume3D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleDBVolume3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file tests/libtests/spatialdb/TestSimpleDBVolume3D.hh
+ *
+ * @brief C++ TestSimpleDBVolume3D object
+ *
+ * C++ unit testing for SimpleDB. This object tests the volumetric
+ * interpolation.
+ */
+
+#if !defined(spatialdata_spatialdb_testsimpledbvolume3d_hh)
+#define spatialdata_spatialdb_testsimpledbvolume3d_hh
+
+#include "TestSimpleDB.hh" // ISA TestSimpleDB
+
+/// Namespace for spatial package
+namespace spatialdata {
+ namespace spatialdb {
+ class TestSimpleDBVolume3D;
+ } // spatialdb
+} // spatialdata
+
+/// C++ unit testing for SimpleDB
+class spatialdata::spatialdb::TestSimpleDBVolume3D : public TestSimpleDB
+{ // class TestSimpleDBVolume3D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleDBVolume3D );
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleDBVolume3D
+
+#endif // spatialdata_spatialdb_testsimpledbvolume3d_hh
+
+
+// End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSimpleIOAscii.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -39,12 +39,12 @@
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 int numCoords = 3;
+ const int spaceDim = 3;
const int numLocs = 5;
const int numVals = 2;
+ const int dataDim = 3;
const char* names[] = { "One", "Two" };
const char* units[] = { "m", "m" };
- const SimpleDB::TopoEnum topology = SimpleDB::VOLUME;
SimpleDB::DataStruct dbOut;
dbOut.data = (double*) data;
@@ -56,7 +56,8 @@
dbOut.valUnits[iVal] = units[iVal];
dbOut.numLocs = numLocs;
dbOut.numVals = numVals;
- dbOut.topology = topology;
+ dbOut.dataDim = dataDim;
+ dbOut.spaceDim = dataDim;
geocoords::CSCart csOut;
@@ -74,12 +75,13 @@
CPPUNIT_ASSERT(numLocs == dbIn.numLocs);
CPPUNIT_ASSERT(numVals == dbIn.numVals);
- CPPUNIT_ASSERT(topology == dbIn.topology);
+ CPPUNIT_ASSERT(dataDim == dbIn.dataDim);
+ CPPUNIT_ASSERT(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()));
} // for
- const int dataSize = numLocs*(numCoords+numVals);
+ 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);
@@ -92,7 +94,5 @@
delete pCSIn; pCSIn = 0;
} // testIO
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -69,14 +69,14 @@
const double queryLoc[] = { 1.0, 2.0, 3.0 };
const double vals[] = { 6.3, 4.7 };
const int errFlags[] = { 0 };
+ const int spaceDim = 3;
_pDB->queryVals(names, numVals);
double* valsQ = (0 < numVals) ? new double[numVals] : 0;
spatialdata::geocoords::CSCart csCart;
csCart.initialize();
- const int err = _pDB->query(valsQ, numVals,
- queryLoc[0], queryLoc[1], queryLoc[2],
+ const int err = _pDB->query(valsQ, numVals, queryLoc, spaceDim,
&csCart);
CPPUNIT_ASSERT(err == errFlags[0]);
@@ -100,6 +100,7 @@
const char* units[] = {"m", "m"};
const int numVals = 2;
const double queryLoc[] = { 1.0, 2.0, 3.0 };
+ const int spaceDim = 3;
const double vals[] = { 6.3, 4.7 };
const int errFlags[] = { 0 };
@@ -110,7 +111,7 @@
csCart.initialize();
const int err = testcquery((void*) _pDB, valsQ, numVals,
- queryLoc[0], queryLoc[1], queryLoc[2],
+ queryLoc, spaceDim,
(void*) &csCart);
CPPUNIT_ASSERT(err == errFlags[0]);
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/TestSpatialDB.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -64,7 +64,5 @@
#endif // spatialdata_spatialdb_testspatialdb_hh
-// version
-// $Id$
// End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/Makefile.am
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/Makefile.am 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/Makefile.am 2007-01-07 20:24:35 UTC (rev 5689)
@@ -17,11 +17,7 @@
spatial.dat
noinst_HEADERS = \
- TestSimpleDBArea.dat \
- TestSimpleDBLine.dat \
- TestSimpleDBPoint.dat \
- TestSimpleDBQuery.dat \
- TestSimpleDBVolume.dat
+ header.hh
# 'export' the input files by performing a mock install
export_datadir = $(top_builddir)/tests/libtests/spatialdb/data
@@ -34,43 +30,7 @@
$(export_datadir)/$(noinst_DATA) \
$(export_datadir)/$(noinst_TMP)
-datfiles: \
- TestSimpleDBQuery \
- TestSimpleDBPoint \
- TestSimpleDBLine \
- TestSimpleDBArea \
- TestSimpleDBVolume
+datafiles:
+ bash generate.sh all
-TestSimpleDBQuery:
- TestSimpleDBQuery.py \
- --dumper.className=spatialdata::spatialdb::TestSimpleDBQuery \
- --dumper.filename=TestSimpleDBQuery.dat
-
-TestSimpleDBPoint:
- TestSimpleDBDataApp.py \
- --query_data=testsimpledbpoint \
- --dumper.className=spatialdata::spatialdb::TestSimpleDBPoint \
- --dumper.filename=TestSimpleDBPoint.dat
-
-TestSimpleDBLine:
- TestSimpleDBDataApp.py \
- --query_data=testsimpledbline \
- --dumper.className=spatialdata::spatialdb::TestSimpleDBLine \
- --dumper.filename=TestSimpleDBLine.dat
-
-TestSimpleDBArea:
- TestSimpleDBDataApp.py \
- --query_data=testsimpledbarea \
- --dumper.className=spatialdata::spatialdb::TestSimpleDBArea \
- --dumper.filename=TestSimpleDBArea.dat
-
-TestSimpleDBVolume:
- TestSimpleDBDataApp.py \
- --query_data=testsimpledbvolume \
- --dumper.className=spatialdata::spatialdb::TestSimpleDBVolume \
- --dumper.filename=TestSimpleDBVolume.dat
-
-# version
-# $Id$
-
# End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBApp.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBApp.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBApp.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/libtests/spatialdb/data/SimpleDBApp.py
+
+## @brief Python application for generating C++ data files for testing
+## C++ SimpleDB objects.
+
+from pyre.applications.Script import Script
+
+# SimpleDBApp class
+class SimpleDBApp(Script):
+ """
+ Python application for generating C++ data files for testing C++
+ SimpleDB objects.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Script.Inventory):
+ """Python object for managing SimpleDBApp facilities and properties."""
+
+ ## @class Inventory
+ ## Python object for managing SimpleDBApp facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li \b data Data manager.
+
+ import pyre.inventory
+
+ from spatialdata.utils.CppData import CppData
+ data = pyre.inventory.facility("data", factory=CppData)
+ data.meta['tip'] = "Data manager."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="simpledbapp"):
+ """
+ Constructor.
+ """
+ Script.__init__(self, name)
+
+ # Database information
+ self.numLocs = None
+ self.spaceDim = None
+ self.numVals = None
+ self.dataDim = None
+ self.dbData = None
+ self.names = None
+ self.units = None
+
+ # Query information
+ self.numQueries = None
+ self.queryNearest = None
+ self.queryLinear = None
+ self.errFlags = None
+
+ return
+
+
+ def main(self):
+ """
+ Run the application.
+ """
+ self._compute()
+ self._initData()
+ self.data.write(self.name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members using inventory.
+ """
+ Script._configure(self)
+ self.data = self.inventory.data
+ return
+
+
+ def _compute(self):
+ """
+ Compute query data.
+ """
+ raise NotImplementedError
+ return
+
+
+ def _initData(self):
+ self.data.addScalar(vtype="int", name="_numLocs", value=self.numLocs,
+ format="%d")
+ self.data.addScalar(vtype="int", name="_spaceDim", value=self.spaceDim,
+ format="%d")
+ self.data.addScalar(vtype="int", name="_numVals", value=self.numVals,
+ format="%d")
+ self.data.addScalar(vtype="int", name="_dataDim", value=self.dataDim,
+ format="%d")
+ self.data.addArray(vtype="double", name="_dbData", values=self.dbData,
+ format="%16.8e", ncols=self.spaceDim+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,
+ format="\"%s\"", ncols=1)
+
+ self.data.addScalar(vtype="int", name="_numQueries",
+ value=self.numQueries, format="%d")
+ self.data.addArray(vtype="double", name="_queryNearest",
+ values=self.queryNearest,
+ format="%16.8e", ncols=self.spaceDim+self.numVals)
+ self.data.addArray(vtype="double", name="_queryLinear",
+ values=self.queryLinear,
+ format="%16.8e", ncols=self.spaceDim+self.numVals)
+ self.data.addArray(vtype="int", name="_errFlags",
+ values=self.errFlags,
+ format="%2d", ncols=self.spaceDim+self.numQueries)
+
+ return
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,39 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBData.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,61 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,83 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,66 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataArea3D.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,125 @@
+#!/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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,82 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,66 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataLine3D.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,119 @@
+#!/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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,76 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,66 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataPoint3D.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,72 @@
+#!/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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,87 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,66 @@
+// -*- 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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBDataVolume3D.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,139 @@
+#!/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
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryApp.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryApp.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryApp.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/libtests/spatialdb/data/SimpleDBQueryApp.py
+
+## @brief Python application for generating C++ data files for testing
+## C++ SimpleDBQuery objects.
+
+from pyre.applications.Script import Script
+
+# SimpleDBQueryApp class
+class SimpleDBQueryApp(Script):
+ """
+ Python application for generating C++ data files for testing C++
+ SimpleDBQuery objects.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Script.Inventory):
+ """
+ Python object for managing SimpleDBQueryApp facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing SimpleDBQueryApp facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li \b data Data manager.
+
+ import pyre.inventory
+
+ from spatialdata.utils.CppData import CppData
+ data = pyre.inventory.facility("data", factory=CppData)
+ data.meta['tip'] = "Data manager."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="simpledbqueryapp"):
+ """
+ Constructor.
+ """
+ Script.__init__(self, name)
+
+ # Database information
+ self.numLocs = None
+ self.spaceDim = None
+ self.numVals = None
+ self.dataDim = None
+ self.dbData = None
+ self.names = None
+ self.units = None
+
+ # Query information
+ self.numPts = None
+ self.coords = None
+ self.dist2 = None
+ self.area = None
+ self.areaDir = None
+ self.volume = None
+
+ return
+
+
+ def main(self):
+ """
+ Run the application.
+ """
+ self._compute()
+ self._initData()
+ self.data.write(self.name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members using inventory.
+ """
+ Script._configure(self)
+ self.data = self.inventory.data
+ return
+
+
+ def _compute(self):
+ """
+ Compute query data.
+ """
+ raise NotImplementedError
+ return
+
+
+ def _initData(self):
+ self.data.addScalar(vtype="int", name="_numLocs", value=self.numLocs,
+ format="%d")
+ self.data.addScalar(vtype="int", name="_spaceDim", value=self.spaceDim,
+ format="%d")
+ self.data.addScalar(vtype="int", name="_numVals", value=self.numVals,
+ format="%d")
+ self.data.addScalar(vtype="int", name="_dataDim", value=self.dataDim,
+ format="%d")
+ self.data.addArray(vtype="double", name="_dbData", values=self.dbData,
+ format="%16.8e", ncols=self.spaceDim+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,
+ format="\"%s\"", ncols=1)
+
+ self.data.addScalar(vtype="int", name="_numPts",
+ value=self.numPts, format="%d")
+ self.data.addArray(vtype="double", name="_coords",
+ values=self.coords,
+ format="%16.8e", ncols=self.spaceDim)
+ self.data.addScalar(vtype="double", name="_dist2",
+ value=self.dist2, format="%16.8e")
+ self.data.addScalar(vtype="double", name="_area",
+ value=self.area, format="%16.8e")
+ self.data.addArray(vtype="double", name="_areaDir",
+ values=self.areaDir,
+ format="%16.8e", ncols=self.numPts)
+ self.data.addScalar(vtype="double", name="_volume",
+ value=self.volume, format="%16.8e")
+ return
+
+
+# End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "SimpleDBQueryData.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+spatialdata::spatialdb::SimpleDBQueryData::SimpleDBQueryData(void) :
+ numLocs(0),
+ spaceDim(0),
+ numVals(0),
+ dataDim(0),
+ dbData(0),
+ names(0),
+ units(0),
+ numPts(0),
+ coords(0),
+ dist2(0),
+ area(0),
+ areaDir(0),
+ volume(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+spatialdata::spatialdb::SimpleDBQueryData::~SimpleDBQueryData(void)
+{ // destructor
+} // destructor
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(spatialdata_spatialdb_simpledbquerydata_hh)
+#define spatialdata_spatialdb_simpledbquerydata_hh
+
+namespace spatialdata {
+ namespace spatialdb {
+ class SimpleDBQueryData;
+ } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleDBQueryData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ SimpleDBQueryData(void);
+
+ /// Destructor
+ ~SimpleDBQueryData(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 numPts; ///< Number of points for locations
+ double* coords; ///< Coordinates of query locations
+ double dist2; ///< Expected value for distance squared
+ double area; ///< Expected value for area
+ double* areaDir; ///< Expected value for area direction
+ double volume; ///< Expected value for volume
+ //@}
+
+
+};
+
+#endif // spatialdata_spatialdb_simpledbquerydata_hh
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.cc
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.cc 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.cc 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbquerydata3d.
+
+#include "SimpleDBQueryData3D.hh"
+
+const int spatialdata::spatialdb::SimpleDBQueryData3D::_numLocs = 5;
+
+const int spatialdata::spatialdb::SimpleDBQueryData3D::_spaceDim = 3;
+
+const int spatialdata::spatialdb::SimpleDBQueryData3D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleDBQueryData3D::_dataDim = 4;
+
+const int spatialdata::spatialdb::SimpleDBQueryData3D::_numPts = 4;
+
+const double spatialdata::spatialdb::SimpleDBQueryData3D::_dist2 = 9.86850000e+00;
+
+const double spatialdata::spatialdb::SimpleDBQueryData3D::_area = 7.28666752e+00;
+
+const double spatialdata::spatialdb::SimpleDBQueryData3D::_volume = 2.95458000e+00;
+
+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,
+};
+
+const char* spatialdata::spatialdb::SimpleDBQueryData3D::_names[] = {
+"One",
+"Two",
+};
+
+const char* spatialdata::spatialdb::SimpleDBQueryData3D::_units[] = {
+"m",
+"m",
+};
+
+const double spatialdata::spatialdb::SimpleDBQueryData3D::_coords[] = {
+ 2.95000000e+00, 4.48000000e+00, 3.44000000e+00,
+ 5.80000000e+00, 5.32000000e+00, 4.46000000e+00,
+ 7.97000000e+00, 1.06200000e+01, 7.00000000e+00,
+ 8.38000000e+00, 1.30100000e+01, 9.34000000e+00,
+};
+
+const double spatialdata::spatialdb::SimpleDBQueryData3D::_areaDir[] = {
+ -2.24547092e-01, -3.44848999e-01, 9.11404285e-01,};
+
+spatialdata::spatialdb::SimpleDBQueryData3D::SimpleDBQueryData3D(void)
+{ // constructor
+ numLocs = _numLocs;
+ spaceDim = _spaceDim;
+ numVals = _numVals;
+ dataDim = _dataDim;
+ numPts = _numPts;
+ dist2 = _dist2;
+ area = _area;
+ volume = _volume;
+ dbData = const_cast<double*>(_dbData);
+ names = const_cast<char**>(_names);
+ units = const_cast<char**>(_units);
+ coords = const_cast<double*>(_coords);
+ areaDir = const_cast<double*>(_areaDir);
+} // constructor
+
+spatialdata::spatialdb::SimpleDBQueryData3D::~SimpleDBQueryData3D(void)
+{}
+
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// DO NOT EDIT THIS FILE
+// This file was generated from python application simpledbquerydata3d.
+
+#if !defined(spatialdata_spatialdb_simpledbquerydata3d_hh)
+#define spatialdata_spatialdb_simpledbquerydata3d_hh
+
+#include "SimpleDBQueryData.hh"
+
+namespace spatialdata {
+ namespace spatialdb {
+ class SimpleDBQueryData3D;
+ } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleDBQueryData3D : public SimpleDBQueryData
+{
+
+public:
+
+ /// Constructor
+ SimpleDBQueryData3D(void);
+
+ /// Destructor
+ ~SimpleDBQueryData3D(void);
+
+private:
+
+ static const int _numLocs;
+
+ static const int _spaceDim;
+
+ static const int _numVals;
+
+ static const int _dataDim;
+
+ static const int _numPts;
+
+ static const double _dist2;
+
+ static const double _area;
+
+ static const double _volume;
+
+ static const double _dbData[];
+
+ static const char* _names[];
+
+ static const char* _units[];
+
+ static const double _coords[];
+
+ static const double _areaDir[];
+
+};
+
+#endif // spatialdata_spatialdb_simpledbquerydata3d_hh
+
+// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/SimpleDBQueryData3D.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/libtests/spatialdb/data/SimpleDBQueryData3D.py
+
+## @brief Python application for generating C++ data files for testing
+## C++ SimpleDBQuery objects.
+
+import numpy
+from numpy.linalg import det
+
+from SimpleDBQueryApp import SimpleDBQueryApp
+
+# SimpleDBQueryData3D class
+class SimpleDBQueryData3D(SimpleDBQueryApp):
+ """
+ Python application for generating C++ data files for testing C++
+ SimpleDBQuery objects.
+ """
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="simpledbquerydata3d"):
+ """
+ Constructor.
+ """
+ SimpleDBQueryApp.__init__(self, name)
+
+ # Database information
+ 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] ],
+ dtype=numpy.float64)
+ self.names = [ "One", "Two" ]
+ self.units = [ "m", "m" ]
+
+ # Query information
+ self.numPts = None
+ self.coords = None
+ self.dist2 = None
+ self.area = None
+ self.areaDir = None
+ self.volume = None
+
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _compute(self):
+ """
+ Compute query data.
+ """
+ self._transformCoords()
+ self._calcDist2()
+ self._calcArea()
+ self._calcAreaDir()
+ self._calcVolume()
+ return
+
+
+ def _transformCoords(self):
+ """Transform coordinates."""
+ pqr = numpy.array([ [0.1, 0.0, 0.0],
+ [0.4, 0.0, 0.0],
+ [0.3, 0.6, 0.0],
+ [0.3, 0.4, 0.5] ],
+ dtype=numpy.float64)
+ self.numPts = pqr.shape[0]
+ o = numpy.array([2.0, 4.2, 3.1], dtype=numpy.float64)
+ a = numpy.array([9.5, 2.8, 3.4], dtype=numpy.float64)
+ b = numpy.array([5.2, 9.3, 4.8], dtype=numpy.float64)
+ c = numpy.array([2.9, 8.5, 6.6], dtype=numpy.float64)
+ self.coords = numpy.zeros( (pqr.shape), dtype=numpy.float64)
+ iPt = 0
+ for xyz in pqr:
+ self.coords[iPt,:] = o + a*xyz[0] + b*xyz[1] + c*xyz[2]
+ iPt += 1
+ return
+
+
+ def _calcDist2(self):
+ a = self.coords[0]
+ b = self.coords[1]
+ J = numpy.array( ( [-a[0]+b[0], -a[1]+b[1], -a[2]+b[2] ] ),
+ dtype=numpy.float64)
+ self.dist2 = numpy.dot(J, numpy.transpose(J))
+ return
+
+
+ def _calcArea(self):
+ a = self.coords[0]
+ b = self.coords[1]
+ c = self.coords[2]
+ J = numpy.array(( [-a[0]+b[0], -a[1]+b[1], -a[2]+b[2]],
+ [-a[0]+c[0], -a[1]+c[1], -a[2]+c[2]]),
+ dtype=numpy.float64)
+ self.area = 0.5*numpy.sqrt(det(numpy.dot(J, numpy.transpose(J))))
+ return
+
+
+ def _calcAreaDir(self):
+ a = self.coords[0]
+ b = self.coords[1]
+ c = self.coords[2]
+ u = [-a[0]+b[0], -a[1]+b[1], -a[2]+b[2]]
+ v = [-a[0]+c[0], -a[1]+c[1], -a[2]+c[2]]
+ self.areaDir = [ 0.5*(u[1]*v[2]-u[2]*v[1])/self.area,
+ 0.5*(u[2]*v[0]-u[0]*v[2])/self.area,
+ 0.5*(u[0]*v[1]-u[1]*v[0])/self.area]
+ return
+
+
+ def _calcVolume(self):
+ a = self.coords[0]
+ b = self.coords[1]
+ c = self.coords[2]
+ d = self.coords[3]
+ J = numpy.array(([-a[0]+b[0], -a[1]+b[1], -a[2]+b[2]],
+ [-a[0]+c[0], -a[1]+c[1], -a[2]+c[2]],
+ [-a[0]+d[0], -a[1]+d[1], -a[2]+d[2]]),
+ dtype=numpy.float64)
+ self.volume = det(J)/6.0
+ return
+
+
+# MAIN /////////////////////////////////////////////////////////////////
+if __name__ == "__main__":
+
+ app = SimpleDBQueryData3D()
+ app.run()
+
+
+# End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBArea.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBArea.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBArea.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,58 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from the python application areadata.
-
-const int spatialdata::spatialdb::TestSimpleDBArea::NUMLOCS = 6;
-const int spatialdata::spatialdb::TestSimpleDBArea::NUMVALS = 2;
-const double spatialdata::spatialdb::TestSimpleDBArea::DATA[] = {
- 3.4000000000e+00, 9.5000000000e+00, 8.7000000000e+00, 1.0000000000e-01, 1.1000000000e+00,
- 4.2944271910e+00, 9.5000000000e+00, 9.1472135955e+00, 3.0000000000e-01, 3.3000000000e+00,
- 6.9777087640e+00, 9.5000000000e+00, 1.0488854382e+01, 2.0000000000e-01, 2.2000000000e+00,
- 7.6323624347e+00, 1.2118614683e+01, 9.1795470406e+00, 1.0000000000e-01, 1.1000000000e+00,
- 3.8364357805e+00, 1.1245743122e+01, 7.8271284391e+00, -4.0000000000e-01, -4.4000000000e+00,
- 4.0546536707e+00, 1.2118614683e+01, 7.3906926586e+00, -3.0000000000e-01, -3.2000000000e+00,
-};
-const int spatialdata::spatialdb::TestSimpleDBArea::ERRFLAGS[] = {
- 0,
- 0,
- 1,
- 0,
-};
-const char* spatialdata::spatialdb::TestSimpleDBArea::NAMES[] = {
- "One",
- "Two",
-};
-const char* spatialdata::spatialdb::TestSimpleDBArea::UNITS[] = {
- "m",
- "m",
-};
-const spatialdata::spatialdb::SimpleDB::TopoEnum spatialdata::spatialdb::TestSimpleDBArea::TOPOLOGY = spatialdata::spatialdb::SimpleDB::AREA;
-const int spatialdata::spatialdb::TestSimpleDBArea::NUMQUERIES = 4;
-const double spatialdata::spatialdb::TestSimpleDBArea::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 double spatialdata::spatialdb::TestSimpleDBArea::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,
-};
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBDataApp.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBDataApp.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBDataApp.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-## @file tests/libtests/data/TestSimpleDBDataApp.py
-## @brief Python application to generate data for SimpleDB tests.
-
-from pyre.applications.Script import Script
-
-# TestSimpleDBDataApp class
-class TestSimpleDBDataApp(Script):
- """Python application to generate data for SimpleDB tests."""
-
- def main(self, *args, **kwds):
- """Run the application."""
- data = self.inventory.data
- data.initialize()
- data.dump(self.inventory.dumper)
-
- def __init__(self):
- """Constructor."""
- Script.__init__(self, 'testsimpledbdataapp')
- return
-
- class Inventory(Script.Inventory):
- ## @class Inventory
- ## Python object for managing TestSimpleDBDataApp facilities
- ## and properties.
- ##
- ## \b Properties
- ## @li None
- ##
- ## \b Facilities
- ## @li \b query_data Query data to dump
- ## @li \b dumper Dump data to file
-
- import pyre.inventory
-
- from SimpleDBQueryData import SimpleDBQueryData
- data = pyre.inventory.facility('query_data', factory=SimpleDBQueryData)
-
- from pythiautil.DumpCpp import DumpCpp
- dumper = pyre.inventory.facility('dumper', factory=DumpCpp)
-
-
-# main
-if __name__ == '__main__':
- app = TestSimpleDBDataApp()
- app.run()
-
-# version
-__id__ = "$Id: TestSimpleDBDataApp.py,v 1.1 2005/05/25 18:43:07 baagaard Exp $"
-
-# End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBLine.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBLine.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBLine.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,57 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from the python application linedata.
-
-const int spatialdata::spatialdb::TestSimpleDBLine::NUMLOCS = 5;
-const int spatialdata::spatialdb::TestSimpleDBLine::NUMVALS = 2;
-const double spatialdata::spatialdb::TestSimpleDBLine::DATA[] = {
- 3.4000000000e+00, 9.5000000000e+00, 8.7000000000e+00, 1.0000000000e-01, 1.1000000000e+00,
- 5.7000000000e+00, 9.9000000000e+00, 1.8500000000e+01, 3.0000000000e-01, 3.3000000000e+00,
- 6.8500000000e+00, 1.0100000000e+01, 2.3400000000e+01, 2.0000000000e-01, 2.2000000000e+00,
- 8.0000000000e+00, 1.0300000000e+01, 2.8300000000e+01, 1.0000000000e-01, 1.1000000000e+00,
- 1.4900000000e+01, 1.1500000000e+01, 5.7700000000e+01, -4.0000000000e-01, -4.4000000000e+00,
-};
-const int spatialdata::spatialdb::TestSimpleDBLine::ERRFLAGS[] = {
- 0,
- 0,
- 1,
- 0,
-};
-const char* spatialdata::spatialdb::TestSimpleDBLine::NAMES[] = {
- "One",
- "Two",
-};
-const char* spatialdata::spatialdb::TestSimpleDBLine::UNITS[] = {
- "m",
- "m",
-};
-const spatialdata::spatialdb::SimpleDB::TopoEnum spatialdata::spatialdb::TestSimpleDBLine::TOPOLOGY = spatialdata::spatialdb::SimpleDB::LINE;
-const int spatialdata::spatialdb::TestSimpleDBLine::NUMQUERIES = 4;
-const double spatialdata::spatialdb::TestSimpleDBLine::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 double spatialdata::spatialdb::TestSimpleDBLine::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,
-};
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBPoint.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBPoint.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBPoint.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,50 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from the python application pointdata.
-
-const int spatialdata::spatialdb::TestSimpleDBPoint::NUMLOCS = 1;
-const int spatialdata::spatialdb::TestSimpleDBPoint::NUMVALS = 2;
-const double spatialdata::spatialdb::TestSimpleDBPoint::DATA[] = {
- 1.0000000000e-01, 2.0000000000e-01, 3.0000000000e-01, 6.3000000000e+00, 7.4000000000e+00,
-};
-const int spatialdata::spatialdb::TestSimpleDBPoint::ERRFLAGS[] = {
- 0,
- 0,
- 0,
-};
-const char* spatialdata::spatialdb::TestSimpleDBPoint::NAMES[] = {
- "One",
- "Two",
-};
-const char* spatialdata::spatialdb::TestSimpleDBPoint::UNITS[] = {
- "m",
- "m",
-};
-const spatialdata::spatialdb::SimpleDB::TopoEnum spatialdata::spatialdb::TestSimpleDBPoint::TOPOLOGY = spatialdata::spatialdb::SimpleDB::POINT;
-const int spatialdata::spatialdb::TestSimpleDBPoint::NUMQUERIES = 3;
-const double spatialdata::spatialdb::TestSimpleDBPoint::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 double spatialdata::spatialdb::TestSimpleDBPoint::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,
-};
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBQuery.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBQuery.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBQuery.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,51 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from the python application testsimpledbquery.
-
-const int spatialdata::spatialdb::TestSimpleDBQuery::NUMLOCS = 5;
-const int spatialdata::spatialdb::TestSimpleDBQuery::NUMVALS = 2;
-const double spatialdata::spatialdb::TestSimpleDBQuery::DATA[] = {
- 0.0000e+00, 0.0000e+00, 0.0000e+00, 1.1000e+00, 5.5000e+00,
- 1.0000e+00, 1.0000e-01, 3.0000e-01, 2.2000e+00, 6.6000e+00,
- 2.0000e+00, 2.0000e-01, 2.0000e-01, 3.3000e+00, 7.7000e+00,
- 3.0000e+00, 3.0000e-01, 1.0000e-01, 4.4000e+00, 8.8000e+00,
- 4.0000e+00, 4.0000e-01, 9.0000e-01, 4.5000e+00, 9.9000e+00,
-};
-const char* spatialdata::spatialdb::TestSimpleDBQuery::NAMES[] = {
- "One",
- "Two",
-};
-const char* spatialdata::spatialdb::TestSimpleDBQuery::UNITS[] = {
- "m",
- "m",
-};
-const spatialdata::spatialdb::SimpleDB::TopoEnum spatialdata::spatialdb::TestSimpleDBQuery::TOPOLOGY = spatialdata::spatialdb::SimpleDB::VOLUME;
-const double spatialdata::spatialdb::TestSimpleDBQuery::COORDS[] = {
- 2.950000000000e+00, 4.480000000000e+00, 3.440000000000e+00,
- 5.800000000000e+00, 5.320000000000e+00, 4.460000000000e+00,
- 7.970000000000e+00, 1.062000000000e+01, 7.000000000000e+00,
- 8.380000000000e+00, 1.301000000000e+01, 9.340000000000e+00,
-};
-const int spatialdata::spatialdb::TestSimpleDBQuery::NUMPTS = 4;
-const double spatialdata::spatialdb::TestSimpleDBQuery::DIST2 = 9.868500000000e+00;
-const double spatialdata::spatialdb::TestSimpleDBQuery::AREA = 7.286667516087e+00;
-const double spatialdata::spatialdb::TestSimpleDBQuery::AREADIR[] = {
- -2.245470918479e-01, -3.448489991416e-01, 9.114042853387e-01,
-};
-const double spatialdata::spatialdb::TestSimpleDBQuery::VOLUME = 2.954580000000e+00;
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBQuery.py
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBQuery.py 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBQuery.py 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,147 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-## @file tests/libtests/data/TestSimpleDBQuery.py
-## @brief Python application to generate data for SimpleDBQuery tests.
-
-from Numeric import *
-from LinearAlgebra import *
-
-from pyre.applications.Script import Script
-
-# TestSimpleDBQuery class
-class TestSimpleDBQuery(Script):
- """Python application to generate data for SimpleDBQuery tests."""
-
- def main(self, *args, **kwds):
- """Run the application."""
- self._transformCoords()
- self._dump()
-
- def __init__(self):
- """Constructor."""
- Script.__init__(self, 'testsimpledbquery')
- self._numLocs = 5
- self._numVals = 2
- self._data = [ 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._names = [ "One", "Two" ]
- self._units = [ "m", "m" ]
- self._topology = "spatialdata::spatialdb::SimpleDB::VOLUME"
-
- self._pqr = [ [0.1, 0.0, 0.0],
- [0.4, 0.0, 0.0],
- [0.3, 0.6, 0.0],
- [0.3, 0.4, 0.5] ]
- return
-
- def _transformCoords(self):
- """Transform coordinates."""
- o = [2.0, 4.2, 3.1]
- a = [9.5, 2.8, 3.4]
- b = [5.2, 9.3, 4.8]
- c = [2.9, 8.5, 6.6]
- self._xyz = []
- for pqr in self._pqr:
- x = o[0] + a[0]*pqr[0] + b[0]*pqr[1] + c[0]*pqr[2];
- y = o[1] + a[1]*pqr[0] + b[1]*pqr[1] + c[1]*pqr[2];
- z = o[2] + a[2]*pqr[0] + b[2]*pqr[1] + c[2]*pqr[2];
- self._xyz.append([x, y, z])
- return
-
- def _dump(self):
- """Dump data to file."""
- dumper = self.inventory.dumper
- dumper.open(self.name)
-
- dumper.writeVal("int", "NUMLOCS", self._numLocs, "%d")
- dumper.writeVal("int", "NUMVALS", self._numVals, "%d")
- dumper.writeArray("double", "DATA", self._data, "%12.4e,", 5)
- dumper.writeArray("char*", "NAMES", self._names, " \"%s\",", 1)
- dumper.writeArray("char*", "UNITS", self._units, " \"%s\",", 1)
- dumper.writeVal("spatialdata::spatialdb::SimpleDB::TopoEnum", "TOPOLOGY",
- self._topology, "%s")
-
- dumper.writeArray("double", "COORDS", ravel(self._xyz), "%20.12e,", 3)
- dumper.writeVal("int", "NUMPTS", len(self._xyz), "%d")
- dumper.writeVal("double", "DIST2", self._distSquared(), "%20.12e")
- dumper.writeVal("double", "AREA", self._area(), "%20.12e")
- dumper.writeArray("double", "AREADIR", self._areaDir(), "%20.12e,", 3)
- dumper.writeVal("double", "VOLUME", self._volume(), "%20.12e")
-
- dumper.close()
- return
-
- def _distSquared(self):
- a = self._xyz[0]
- b = self._xyz[1]
- J = array( ( [-a[0]+b[0], -a[1]+b[1], -a[2]+b[2] ] ), Float)
- dist2 = matrixmultiply(J, transpose(J))
- return dist2
-
- def _area(self):
- a = self._xyz[0]
- b = self._xyz[1]
- c = self._xyz[2]
- J = array(( [-a[0]+b[0], -a[1]+b[1], -a[2]+b[2]],
- [-a[0]+c[0], -a[1]+c[1], -a[2]+c[2]]), Float)
- area = 0.5*sqrt(determinant(matrixmultiply(J, transpose(J))))
- return area
-
- def _areaDir(self):
- a = self._xyz[0]
- b = self._xyz[1]
- c = self._xyz[2]
- u = [-a[0]+b[0], -a[1]+b[1], -a[2]+b[2]]
- v = [-a[0]+c[0], -a[1]+c[1], -a[2]+c[2]]
- area = self._area()
- dirABC = [ 0.5*(u[1]*v[2]-u[2]*v[1])/area,
- 0.5*(u[2]*v[0]-u[0]*v[2])/area,
- 0.5*(u[0]*v[1]-u[1]*v[0])/area]
- return dirABC
-
- def _volume(self):
- a = self._xyz[0]
- b = self._xyz[1]
- c = self._xyz[2]
- d = self._xyz[3]
- J = array(([-a[0]+b[0], -a[1]+b[1], -a[2]+b[2]],
- [-a[0]+c[0], -a[1]+c[1], -a[2]+c[2]],
- [-a[0]+d[0], -a[1]+d[1], -a[2]+d[2]]), Float)
- volume = determinant(J)/6.0
- return volume
-
- class Inventory(Script.Inventory):
- ## @class Inventory
- ## Python object for managing TestSimpleDBQuery facilities and properties.
- ##
- ## \b Properties
- ## @li None
- ##
- ## \b Facilities
- ## @li \b dumper Dump data to file
-
- import pyre.inventory
- from pythiautil.DumpCpp import DumpCpp
- dumper = pyre.inventory.facility('dumper', factory=DumpCpp)
-
-# main
-if __name__ == '__main__':
- app = TestSimpleDBQuery()
- app.run()
-
-# version
-__id__ = "$Id: TestSimpleDBQuery.py,v 1.1 2005/05/25 18:43:07 baagaard Exp $"
-
-# End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBVolume.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBVolume.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/TestSimpleDBVolume.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,63 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-// DO NOT EDIT THIS FILE
-// This file was generated from the python application volumedata.
-
-const int spatialdata::spatialdb::TestSimpleDBVolume::NUMLOCS = 8;
-const int spatialdata::spatialdb::TestSimpleDBVolume::NUMVALS = 2;
-const double spatialdata::spatialdb::TestSimpleDBVolume::DATA[] = {
- 4.4665693299e+00, 8.1391784026e+00, 8.8029293176e+00, 1.0000000000e-01, 1.1000000000e+00,
- 2.6777149479e+00, 8.1391784026e+00, 7.9085021266e+00, 3.0000000000e-01, 3.3000000000e+00,
- 4.9030051104e+00, 9.8849215245e+00, 7.9300577567e+00, 2.0000000000e-01, 2.2000000000e+00,
- 3.1141507284e+00, 9.8849215245e+00, 7.0356305657e+00, 1.0000000000e-01, 1.1000000000e+00,
- 3.6858492716e+00, 9.1150784755e+00, 1.0364369434e+01, 4.0000000000e-01, 4.6000000000e+00,
- 1.8969948896e+00, 9.1150784755e+00, 9.4699422433e+00, 3.0000000000e-01, 3.2000000000e+00,
- 4.1222850521e+00, 1.0860821597e+01, 9.4914978734e+00, 7.0000000000e-01, 5.2000000000e+00,
- 2.3334306701e+00, 1.0860821597e+01, 8.5970706824e+00, 5.0000000000e-01, 4.6000000000e+00,
-};
-const int spatialdata::spatialdb::TestSimpleDBVolume::ERRFLAGS[] = {
- 0,
- 0,
- 1,
- 0,
- 0,
-};
-const char* spatialdata::spatialdb::TestSimpleDBVolume::NAMES[] = {
- "One",
- "Two",
-};
-const char* spatialdata::spatialdb::TestSimpleDBVolume::UNITS[] = {
- "m",
- "m",
-};
-const spatialdata::spatialdb::SimpleDB::TopoEnum spatialdata::spatialdb::TestSimpleDBVolume::TOPOLOGY = spatialdata::spatialdb::SimpleDB::VOLUME;
-const int spatialdata::spatialdb::TestSimpleDBVolume::NUMQUERIES = 5;
-const double spatialdata::spatialdb::TestSimpleDBVolume::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 double spatialdata::spatialdb::TestSimpleDBVolume::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,
-};
-
-// version
-// $Id$
-
-// End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/footer.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/footer.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/footer.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,5 +0,0 @@
-
-// version
-// $Id: footer.dat,v 1.1 2005/05/25 18:43:07 baagaard Exp $
-
-// End of file
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/generate.sh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/generate.sh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/generate.sh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,56 @@
+#!/bin/bash
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+if (( $# != 1 )); then
+ echo "usage: generate.sh simpledbquery|simpledb|all"
+ exit 1
+fi
+
+# //////////////////////////////////////////////////////////////////////
+if [ $1 == "simpledbquery" ] || [ $1 == "all" ]; then
+
+ python SimpleDBQueryData3D.py \
+ --data.namespace=spatialdata,spatialdb \
+ --data.object=SimpleDBQueryData3D \
+ --data.parent=SimpleDBQueryData
+
+fi
+
+# //////////////////////////////////////////////////////////////////////
+if [ $1 == "simpledb" ] || [ $1 == "all" ]; then
+
+ # Point --------------------------------------------------------------
+
+ python SimpleDBDataPoint3D.py \
+ --data.namespace=spatialdata,spatialdb \
+ --data.object=SimpleDBDataPoint3D \
+ --data.parent=SimpleDBData
+
+ python SimpleDBDataLine3D.py \
+ --data.namespace=spatialdata,spatialdb \
+ --data.object=SimpleDBDataLine3D \
+ --data.parent=SimpleDBData
+
+ python SimpleDBDataArea3D.py \
+ --data.namespace=spatialdata,spatialdb \
+ --data.object=SimpleDBDataArea3D \
+ --data.parent=SimpleDBData
+
+ python SimpleDBDataVolume3D.py \
+ --data.namespace=spatialdata,spatialdb \
+ --data.object=SimpleDBDataVolume3D \
+ --data.parent=SimpleDBData
+
+fi
+
+
+# End of file
Property changes on: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/generate.sh
___________________________________________________________________
Name: svn:executable
+ *
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/header.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/header.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/header.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,12 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
Added: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/header.hh
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/header.hh 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/header.hh 2007-01-07 20:24:35 UTC (rev 5689)
@@ -0,0 +1,12 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/spatialdb.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/spatialdb.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/spatialdb.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -4,7 +4,7 @@
value-names = One Two
value-units = m m
num-locs = 1
- topology = point
+ data-dim = 0
cs-data = cartesian {
to-meters = 1.0
}
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbarea.odb
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbarea.odb 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbarea.odb 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,107 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-## @file tests/libtests/data/testsimpledbarea.odb
-## @brief Python data generator for tests of C++ SimpleDB using
-## TestSimpleDBArea.
-
-def query_data():
- """Factory method for facility query_data."""
- return AreaData()
-
-from SimpleDBQueryData import SimpleDBQueryData
-
-# AreaData class
-class AreaData(SimpleDBQueryData):
- """Python data generator for tests of C++ SimpleDBQuery using
- TestSimpleDBArea."""
-
- def initialize(self):
- """Initialize."""
-
- self._names = [ "One", "Two" ]
- self._units = [ "m", "m" ]
- self._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} ]
- self._topology = "spatialdata::spatialdb::SimpleDB::AREA"
-
- self._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}]} ]
- self._errFlags = [ 0, 0, 1, 0 ]
- self._numLocs = len(self._tdata)
- self._numVals = len(self._names)
- self._numQueries = len(self._qtdata)
-
- self._compute()
- return
-
- def _compute(self):
- """Compute locations of points and values."""
- o = [3.4, 9.5, 8.7]
- sqrt5 = 5**0.5
- sqrt21 = 21**0.5
- a = [2.0/sqrt5, 0, 1.0/sqrt5]
- b = [1.0/sqrt21, 4/sqrt21, -2/sqrt21]
- self._data = []
- for loc in self._tdata:
- s = loc['s']
- t = loc['t']
- x = o[0] + a[0]*s + b[0]*t
- y = o[1] + a[1]*s + b[1]*t
- z = o[2] + a[2]*s + b[2]*t
- self._data += [x, y, z, loc['one'], loc['two']]
-
- self._qldata = []
- self._qndata = []
- for qloc in self._qtdata:
- s = qloc['s']
- t = qloc['t']
- x = o[0] + a[0]*s + b[0]*t
- y = o[1] + a[1]*s + b[1]*t
- z = o[2] + a[2]*s + b[2]*t
- v1 = 0
- v2 = 0
- for wt in qloc['wts']:
- v1 += self._tdata[wt['i']]['one']*wt['w']
- v2 += self._tdata[wt['i']]['two']*wt['w']
- self._qldata += [x, y, z, v1, v2]
- v1 = self._tdata[qloc['ni']]['one']
- v2 = self._tdata[qloc['ni']]['two']
- self._qndata += [x, y, z, v1, v2]
- return
-
- def __init__(self):
- """Constructor."""
- SimpleDBQueryData.__init__(self, name="areadata")
- return
-
-# version
-__id__ = "$Id: testsimpledbarea.odb,v 1.1 2005/05/25 18:43:08 baagaard Exp $"
-
-# End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbline.odb
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbline.odb 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbline.odb 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-## @file tests/libtests/data/testsimpledbline.odb
-## @brief Python data generator for tests of C++ SimpleDB using
-## TestSimpleDBLine.
-
-def query_data():
- """Factory method for facility query_data."""
- return LineData()
-
-from SimpleDBQueryData import SimpleDBQueryData
-
-# LineData class
-class LineData(SimpleDBQueryData):
- """Python data generator for tests of C++ SimpleDBQuery using
- TestSimpleDBLine."""
-
- def initialize(self):
- """Initialize."""
-
- self._names = [ "One", "Two" ]
- self._units = [ "m", "m" ]
- self._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} ]
- self._topology = "spatialdata::spatialdb::SimpleDB::LINE"
-
- self._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}]} ]
- self._errFlags = [ 0, 0, 1, 0 ]
- self._numLocs = len(self._tdata)
- self._numVals = len(self._names)
- self._numQueries = len(self._qtdata)
-
- self._compute()
- return
-
- def _compute(self):
- """Compute locations of points and values."""
- o = [3.4, 9.5, 8.7]
- a = [2.3, 0.4, 9.8]
- self._data = []
- for loc in self._tdata:
- t = loc['t']
- x = o[0] + a[0]*t
- y = o[1] + a[1]*t
- z = o[2] + a[2]*t
- self._data += [x, y, z, loc['one'], loc['two']]
-
- self._qldata = []
- self._qndata = []
- for qloc in self._qtdata:
- t = qloc['t']
- x = o[0] + a[0]*t
- y = o[1] + a[1]*t
- z = o[2] + a[2]*t
- v1 = 0
- v2 = 0
- for wt in qloc['wts']:
- v1 += self._tdata[wt['i']]['one']*wt['w']
- v2 += self._tdata[wt['i']]['two']*wt['w']
- self._qldata += [x, y, z, v1, v2]
- v1 = self._tdata[qloc['ni']]['one']
- v2 = self._tdata[qloc['ni']]['two']
- self._qndata += [x, y, z, v1, v2]
- return
-
- def __init__(self):
- """Constructor."""
- SimpleDBQueryData.__init__(self, name="linedata")
- return
-
-# version
-__id__ = "$Id: testsimpledbline.odb,v 1.1 2005/05/25 18:43:08 baagaard Exp $"
-
-# End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbpoint.odb
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbpoint.odb 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbpoint.odb 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-## @file tests/libtests/data/testsimpledbpoint.odb
-## @brief Python data generator for tests of C++ SimpleDB using
-## TestSimpleDBPoint.
-
-def query_data():
- """Factory method for facility query_data."""
- return PointData()
-
-from SimpleDBQueryData import SimpleDBQueryData
-
-# PointData class
-class PointData(SimpleDBQueryData):
- """Python data generator for tests of C++ SimpleDBQuery using
- TestSimpleDBPoint."""
-
- def initialize(self):
- """Initialize."""
- self._numLocs = 1
- self._numVals = 2
- self._names = [ "One", "Two" ]
- self._units = [ "m", "m" ]
- self._topology = "spatialdata::spatialdb::SimpleDB::POINT"
- self._data = [0.1, 0.2, 0.3, 6.3, 7.4]
- self._errFlags = [ 0, 0, 0 ]
- self._numQueries = 3
- self._qndata = [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]
- self._qldata = [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]
- return
-
- def __init__(self):
- """Constructor."""
- SimpleDBQueryData.__init__(self, name="pointdata")
- return
-
-# version
-__id__ = "$Id: testsimpledbpoint.odb,v 1.1 2005/05/25 18:43:08 baagaard Exp $"
-
-# End of file
Deleted: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbvolume.odb
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbvolume.odb 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/data/testsimpledbvolume.odb 2007-01-07 20:24:35 UTC (rev 5689)
@@ -1,122 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-## @file tests/libtests/data/testsimpledbvolume.odb
-## @brief Python data generator for tests of C++ SimpleDB using
-## TestSimpleDBVolume.
-
-def query_data():
- """Factory method for facility query_data."""
- return VolumeData()
-
-from SimpleDBQueryData import SimpleDBQueryData
-
-# VolumeData class
-class VolumeData(SimpleDBQueryData):
- """Python data generator for tests of C++ SimpleDBQuery using
- TestSimpleDBVolume."""
-
- def initialize(self):
- """Initialize."""
-
- self._names = [ "One", "Two" ]
- self._units = [ "m", "m" ]
- self._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}]
- self._topology = "spatialdata::spatialdb::SimpleDB::VOLUME"
-
- self._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}]} ]
- self._errFlags = [ 0, 0, 1, 0, 0 ]
- self._numLocs = len(self._tdata)
- self._numVals = len(self._names)
- self._numQueries = len(self._qtdata)
-
- self._compute()
- return
-
- def _compute(self):
- """Compute locations of points and values."""
- o = [3.4, 9.5, 8.7]
- sqrt5 = 5**0.5
- sqrt21 = 21**0.5
- sqrt105 = 105**0.5
- a = [2.0/sqrt5, 0, 1.0/sqrt5]
- b = [1.0/sqrt21, 4.0/sqrt21, -2.0/sqrt21]
- c = [-4.0/sqrt105, 5.0/sqrt105, 8.0/sqrt105]
- self._data = []
- for loc in self._tdata:
- r = loc['r']
- s = loc['s']
- t = loc['t']
- x = o[0] + a[0]*r + b[0]*s + c[0]*t
- y = o[1] + a[1]*r + b[1]*s + c[1]*t
- z = o[2] + a[2]*r + b[2]*s + c[2]*t
- self._data += [x, y, z, loc['one'], loc['two']]
-
- self._qldata = []
- self._qndata = []
- for qloc in self._qtdata:
- r = qloc['r']
- s = qloc['s']
- t = qloc['t']
- x = o[0] + a[0]*r + b[0]*s + c[0]*t
- y = o[1] + a[1]*r + b[1]*s + c[1]*t
- z = o[2] + a[2]*r + b[2]*s + c[2]*t
- v1 = 0
- v2 = 0
- for wt in qloc['wts']:
- v1 += self._tdata[wt['i']]['one']*wt['w']
- v2 += self._tdata[wt['i']]['two']*wt['w']
- self._qldata += [x, y, z, v1, v2]
- v1 = self._tdata[qloc['ni']]['one']
- v2 = self._tdata[qloc['ni']]['two']
- self._qndata += [x, y, z, v1, v2]
- return
-
- def __init__(self):
- """Constructor."""
- SimpleDBQueryData.__init__(self, name="volumedata")
- return
-
-# version
-__id__ = "$Id: testsimpledbvolume.odb,v 1.1 2005/05/25 18:43:08 baagaard Exp $"
-
-# End of file
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.c
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.c 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.c 2007-01-07 20:24:35 UTC (rev 5689)
@@ -18,12 +18,11 @@
testcquery(void* db,
double* vals,
int numVals,
- double x,
- double y,
- double z,
+ const double* coords,
+ const int numDims,
void* cs)
{ // testcquery
- return spatialdb_query(db, vals, numVals, x, y, z, cs);
+ return spatialdb_query(db, vals, numVals, coords, numDims, cs);
} // testcquery
/* End of file */
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.h
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.h 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testcquery.h 2007-01-07 20:24:35 UTC (rev 5689)
@@ -18,9 +18,8 @@
* @param db Pointer to SpatialDB
* @param vals Array for computed values (output from query)
* @param numVals Number of values expected (size of pVals array)
- * @param x C coordinate of location for query
- * @param y Y coordinate of location for query
- * @param z Z coordinate of location for query
+ * @param coords Coordinates of location for query
+ * @param numDims Number of dimensions for coordinates
* @param cs Pointer to CoordSys
*
* @returns 0 on success, 1 on failure (i.e., values not set)
@@ -28,9 +27,8 @@
int testcquery(void* db,
double* vals,
int numVals,
- double x,
- double y,
- double z,
+ const double* coords,
+ const int numDims,
void* cs);
#endif /* spatialdata_spatialdb_testcquery_h */
Modified: cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testf77query.h
===================================================================
--- cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testf77query.h 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/libtests/spatialdb/testf77query.h 2007-01-07 20:24:35 UTC (rev 5689)
@@ -21,9 +21,8 @@
* @param db Pointer to SpatialDB
* @param vals Array for computed values (output from query)
* @param numVals Number of values expected (size of pVals array)
- * @param x C coordinate of location for query
- * @param y Y coordinate of location for query
- * @param z Z coordinate of location for query
+ * @param coords Coordinates of location for query
+ * @param numDims Number of dimensions for coordinates
* @param cs Pointer to CoordSys
*
* @returns 0 on success, 1 on failure (i.e., values not set)
@@ -31,9 +30,8 @@
int testf77query(void* db,
double* vals,
int numVals,
- double x,
- double y,
- double z,
+ const double* coords,
+ const int numDims,
void* cs);
#endif /* spatialdata_spatialdb_testf77query_h */
Modified: cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/data/spatialdb.dat
===================================================================
--- cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/data/spatialdb.dat 2007-01-06 02:11:26 UTC (rev 5688)
+++ cs/spatialdata-0.1/trunk/tests/pytests/spatialdb/data/spatialdb.dat 2007-01-07 20:24:35 UTC (rev 5689)
@@ -4,7 +4,7 @@
value-names = One Two
value-units = m m
num-locs = 1
- topology = point
+ data-dim = 0
cs-data = cartesian {
to-meters = 1.0
}
More information about the cig-commits
mailing list