[cig-commits] r20877 - in cs/spatialdata/trunk: libsrc/spatialdb tests/libtests/spatialdb tests/libtests/spatialdb/data
brad at geodynamics.org
brad at geodynamics.org
Mon Oct 22 15:14:26 PDT 2012
Author: brad
Date: 2012-10-22 15:14:26 -0700 (Mon, 22 Oct 2012)
New Revision: 20877
Added:
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea2D.cc
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea2D.hh
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea3D.cc
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea3D.hh
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine1D.cc
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine1D.hh
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine2D.cc
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine2D.hh
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine3D.cc
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine3D.hh
Modified:
cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.cc
cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.hh
cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.icc
cs/spatialdata/trunk/tests/libtests/spatialdb/Makefile.am
cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDB.cc
cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDBCases.cc
cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDBCases.hh
cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataVolume3D.cc
Log:
Finished implementing SimpleGridDB object for 1-D and 2-D interpolation. Added corresponding unit tests.
Modified: cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.cc
===================================================================
--- cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.cc 2012-10-22 17:57:37 UTC (rev 20876)
+++ cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -191,10 +191,10 @@
// Query the database.
int
spatialdata::spatialdb::SimpleGridDB::query(double* vals,
- const int numVals,
- const double* coords,
- const int numDims,
- const spatialdata::geocoords::CoordSys* csQuery)
+ const int numVals,
+ const double* coords,
+ const int numDims,
+ const spatialdata::geocoords::CoordSys* csQuery)
{ // query
const int querySize = _querySize;
@@ -212,11 +212,11 @@
<< "(" << querySize << ") does not match size of array provided ("
<< numVals << ").\n";
throw std::runtime_error(msg.str());
- } else if (3 != numDims) {
+ } else if (numDims != _spaceDim) {
std::ostringstream msg;
msg
<< "Spatial dimension (" << numDims
- << ") when querying SCEC CVM-H must be 3.";
+ << ") does not match spatial dimension of spatial database (" << _spaceDim << ").";
throw std::runtime_error(msg.str());
} // if
@@ -231,16 +231,53 @@
double indexX = 0.0;
double indexY = 0.0;
double indexZ = 0.0;
- if (spaceDim > 2) {
+ int numX = 0;
+ int numY = 0;
+ int numZ = 0;
+ if (3 == spaceDim) {
indexX = _search(_xyz[0], _x, _numX);
indexY = _search(_xyz[1], _y, _numY);
indexZ = _search(_xyz[2], _z, _numZ);
- } else if (spaceDim > 1) {
+ numX = _numX;
+ numY = _numY;
+ numZ = _numZ;
+ if (2 == _dataDim) {
+ if (1 == _numX) {
+ indexX = indexY;
+ numX = _numY;
+ indexY = indexZ;
+ numY = _numZ;
+ indexZ = 0;
+ } else if (1 == numY) {
+ indexY = indexZ;
+ numY = _numZ;
+ indexZ = 0;
+ } // if/else
+ } else if (1 == _dataDim) {
+ if (_numY > 1) {
+ indexX = indexY;
+ numX = _numY;
+ indexY = 0;
+ } else if (_numZ > 1) {
+ indexX = indexZ;
+ numX = _numZ;
+ indexZ = 0;
+ } // if
+ } // if
+ } else if (2 == spaceDim) {
indexX = _search(_xyz[0], _x, _numX);
indexY = _search(_xyz[1], _y, _numY);
+ numX = _numX;
+ numY = _numY;
+ if (1 == _dataDim && 1 == _numX) {
+ indexX = indexY;
+ numX = _numY;
+ indexY = 0;
+ } // if
} else { // else
assert(1 == spaceDim);
indexX = _search(_xyz[0], _x, _numX);
+ numX = _numX;
} // if/else
if (-1.0 == indexX || -1.0 == indexY || -1.0 == indexZ) {
queryFlag = 1;
@@ -251,13 +288,11 @@
case LINEAR :
switch (_dataDim) {
case 1: {
- assert(false);
- throw std::logic_error("SimpleGridDB::query(): 1 == _dataDim not implemented.");
+ _interpolate1D(vals, numVals, indexX, numX);
break;
} // case 1
case 2: {
- assert(false);
- throw std::logic_error("SimpleGridDB::query(): 2 == _dataDim not implemented.");
+ _interpolate2D(vals, numVals, indexX, numX, indexY, numY);
break;
} // case 2
case 3 : {
@@ -278,6 +313,7 @@
vals[iVal] = _data[indexData+_queryVals[iVal]];
#if 0 // DEBUGGING
std::cout << "val["<<iVal<<"]: " << vals[iVal]
+ << ", indexData: " << indexData
<< ", indexX: " << indexX
<< ", indexY: " << indexY
<< ", indexZ: " << indexZ
@@ -440,6 +476,17 @@
if (!ok)
throw std::runtime_error(msg.str());
+ // Set dimensions without any data to 1.
+ if (0 == _numX) {
+ _numX = 1;
+ } // if
+ if (0 == _numY) {
+ _numY = 1;
+ } // if
+ if (0 == _numZ) {
+ _numZ = 1;
+ } // if
+
// Set data dimension based on dimensions of data.
_dataDim = 0;
if (_numX > 1) {
@@ -640,18 +687,17 @@
// Bilinear search for coordinate.
double
spatialdata::spatialdb::SimpleGridDB::_search(const double target,
- const double* vals,
- const int nvals)
+ const double* vals,
+ const int nvals)
{ // _search
+ if (1 == nvals) {
+ return 0.0;
+ } // if
+
assert(vals);
assert(nvals > 0);
double index = -1.0;
-
- if (1 == nvals) {
- return 0.0;
- } // if
-
int indexL = 0;
int indexR = nvals - 1;
const double tolerance = 1.0e-6;
@@ -679,6 +725,102 @@
} // _search
// ----------------------------------------------------------------------
+// Interpolate to get values at target location defined by indices in 1-D.
+void
+spatialdata::spatialdb::SimpleGridDB::_interpolate1D(double* vals,
+ const int numVals,
+ const double indexX,
+ const int numX) const
+{ // _interpolate1D
+ assert(numX >= 2);
+ const int indexX0 = std::min(numX-2, int(floor(indexX)));
+ const double wtX0 = 1.0 - (indexX - indexX0);
+ const int indexX1 = indexX0 + 1;
+ const double wtX1 = 1.0 - wtX0;
+ assert(0 <= indexX0 && indexX0 < numX);
+ assert(0 <= indexX1 && indexX1 < numX);
+
+ const int index000 = _dataIndex(indexX0, 0, 0);
+ const int index100 = _dataIndex(indexX1, 0, 0);
+
+ const double wt000 = wtX0;
+ const double wt100 = wtX1;
+
+ const int querySize = _querySize;
+ for (int iVal=0; iVal < querySize; ++iVal) {
+ const int qVal = _queryVals[iVal];
+ vals[iVal] =
+ wt000 * _data[index000+qVal] +
+ wt100 * _data[index100+qVal];
+#if 0 // DEBUGGING
+ std::cout << "val["<<iVal<<"]: " << vals[iVal]
+ << ", wt000: " << wt000 << ", data: " << _data[index000+qVal]
+ << ", wt100: " << wt100 << ", data: " << _data[index100+qVal]
+ << std::endl;
+#endif
+ } // for
+
+} // _interpolate1D
+
+
+// ----------------------------------------------------------------------
+// Interpolate to get values at target location defined by indices in 2-D.
+void
+spatialdata::spatialdb::SimpleGridDB::_interpolate2D(double* vals,
+ const int numVals,
+ const double indexX,
+ const int numX,
+ const double indexY,
+ const int numY) const
+{ // _interpolate2D
+ assert(numX >= 2);
+ const int indexX0 = std::min(numX-2, int(floor(indexX)));
+ const double wtX0 = 1.0 - (indexX - indexX0);
+ const int indexX1 = indexX0 + 1;
+ const double wtX1 = 1.0 - wtX0;
+ assert(0 <= indexX0 && indexX0 < numX);
+ assert(0 <= indexX1 && indexX1 < numX);
+
+ assert(numY >= 2);
+ const int indexY0 = std::min(numY-2, int(floor(indexY)));
+ const double wtY0 = 1.0 - (indexY - indexY0);
+ const int indexY1 = indexY0 + 1;
+ const double wtY1 = 1.0 - wtY0;
+ assert(0 <= indexY0 && indexY0 < numY);
+ assert(0 <= indexY1 && indexY1 < numY);
+
+ const int index000 = _dataIndex(indexX0, indexY0, 0);
+ const int index010 = _dataIndex(indexX0, indexY1, 0);
+ const int index100 = _dataIndex(indexX1, indexY0, 0);
+ const int index110 = _dataIndex(indexX1, indexY1, 0);
+
+ const double wt000 = wtX0 * wtY0;
+ const double wt010 = wtX0 * wtY1;
+ const double wt100 = wtX1 * wtY0;
+ const double wt110 = wtX1 * wtY1;
+
+ const int querySize = _querySize;
+ for (int iVal=0; iVal < querySize; ++iVal) {
+ const int qVal = _queryVals[iVal];
+ vals[iVal] =
+ wt000 * _data[index000+qVal] +
+ wt010 * _data[index010+qVal] +
+ wt100 * _data[index100+qVal] +
+ wt110 * _data[index110+qVal];
+#if 0 // DEBUGGING
+ std::cout << "val["<<iVal<<"]: " << vals[iVal]
+ << ", wt000: " << wt000 << ", data: " << _data[index000+qVal]
+ << ", wt010: " << wt010 << ", data: " << _data[index010+qVal]
+ << ", wt100: " << wt100 << ", data: " << _data[index100+qVal]
+ << ", wt110: " << wt110 << ", data: " << _data[index110+qVal]
+ << std::endl;
+#endif
+ } // for
+
+} // _interpolate2D
+
+
+// ----------------------------------------------------------------------
// Interpolate to get values at target location defined by indices in 3-D.
void
spatialdata::spatialdb::SimpleGridDB::_interpolate3D(double* vals,
Modified: cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.hh
===================================================================
--- cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.hh 2012-10-22 17:57:37 UTC (rev 20876)
+++ cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.hh 2012-10-22 22:14:26 UTC (rev 20877)
@@ -132,13 +132,46 @@
const double* vals,
const int nvals);
- /** Interpolate to get values at target location defined by indices.
+ /** Interpolate in 1-D to get values at target location defined by
+ * indices.
*
* @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 indexX Index along x dimension.
+ * @param numX Number of coordinates along x dimension.
+ */
+ void _interpolate1D(double* vals,
+ const int numVals,
+ const double indexX,
+ const int numX) const;
+
+ /** Interpolate in 2-D to get values at target location defined by
+ * indices.
+ *
+ * @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 indexX Index along x dimension.
+ * @param numX Number of coordinates along x dimension.
* @param indexY Index along y dimension.
+ * @param numY Number of coordinates along y dimension.
+ */
+ void _interpolate2D(double* vals,
+ const int numVals,
+ const double indexX,
+ const int numX,
+ const double indexY,
+ const int numY) const;
+
+ /** Interpolate in 3-D to get values at target location defined by
+ * indices.
+ *
+ * @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 indexX Index along x dimension.
+ * @param indexY Index along y dimension.
* @param indexZ Index along z dimension.
*/
void _interpolate3D(double* vals,
Modified: cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.icc
===================================================================
--- cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.icc 2012-10-22 17:57:37 UTC (rev 20876)
+++ cs/spatialdata/trunk/libsrc/spatialdb/SimpleGridDB.icc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -26,7 +26,8 @@
const int indexY,
const int indexZ) const
{ // _dataIndex
- const int locIndex = indexX*_numY*_numZ + indexY*_numZ + indexZ;
+ // Order points so indexing works in any dimension.
+ const int locIndex = indexZ*_numY*_numX + indexY*_numX + indexX;
return locIndex*_numValues;
} // _dataIndex
Modified: cs/spatialdata/trunk/tests/libtests/spatialdb/Makefile.am
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/Makefile.am 2012-10-22 17:57:37 UTC (rev 20876)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/Makefile.am 2012-10-22 22:14:26 UTC (rev 20877)
@@ -88,6 +88,11 @@
data/SimpleDBTestDataArea3D.cc \
data/SimpleDBTestDataVolume3D.cc \
data/SimpleGridDBTestData.cc \
+ data/SimpleGridDBTestDataLine1D.cc \
+ data/SimpleGridDBTestDataLine2D.cc \
+ data/SimpleGridDBTestDataLine3D.cc \
+ data/SimpleGridDBTestDataArea2D.cc \
+ data/SimpleGridDBTestDataArea3D.cc \
data/SimpleGridDBTestDataVolume3D.cc
noinst_HEADERS += \
@@ -99,6 +104,11 @@
data/SimpleDBTestDataArea3D.hh \
data/SimpleDBTestDataVolume3D.hh \
data/SimpleGridDBTestData.hh \
+ data/SimpleGridDBTestDataLine1D.hh \
+ data/SimpleGridDBTestDataLine2D.hh \
+ data/SimpleGridDBTestDataLine3D.hh \
+ data/SimpleGridDBTestDataArea2D.hh \
+ data/SimpleGridDBTestDataArea3D.hh \
data/SimpleGridDBTestDataVolume3D.hh
Modified: cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDB.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDB.cc 2012-10-22 17:57:37 UTC (rev 20876)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDB.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -156,13 +156,13 @@
db._numValues = 10;
CPPUNIT_ASSERT_EQUAL(0, db._dataIndex(0, 0, 0));
- CPPUNIT_ASSERT_EQUAL(10, db._dataIndex(0, 0, 1));
+ CPPUNIT_ASSERT_EQUAL(1*3*4*10, db._dataIndex(0, 0, 1));
- CPPUNIT_ASSERT_EQUAL(50, db._dataIndex(0, 1, 0));
- CPPUNIT_ASSERT_EQUAL(50+40, db._dataIndex(0, 1, 4));
+ CPPUNIT_ASSERT_EQUAL(1*4*10, db._dataIndex(0, 1, 0));
+ CPPUNIT_ASSERT_EQUAL(4*3*4*10 + 1*4*10, db._dataIndex(0, 1, 4));
- CPPUNIT_ASSERT_EQUAL(150, db._dataIndex(1, 0, 0));
- CPPUNIT_ASSERT_EQUAL(2*150+1*50+30, db._dataIndex(2, 1, 3));
+ CPPUNIT_ASSERT_EQUAL(1*10, db._dataIndex(1, 0, 0));
+ CPPUNIT_ASSERT_EQUAL(3*4*3*10 + 1*4*10 + 2*10, db._dataIndex(2, 1, 3));
} // testDataIndex
// ----------------------------------------------------------------------
Modified: cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDBCases.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDBCases.cc 2012-10-22 17:57:37 UTC (rev 20876)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDBCases.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -18,14 +18,129 @@
#include "TestSimpleGridDBCases.hh" // Implementation of class methods
+#include "data/SimpleGridDBTestDataLine1D.hh"
+#include "data/SimpleGridDBTestDataLine2D.hh"
+#include "data/SimpleGridDBTestDataLine3D.hh"
+#include "data/SimpleGridDBTestDataArea2D.hh"
+#include "data/SimpleGridDBTestDataArea3D.hh"
#include "data/SimpleGridDBTestDataVolume3D.hh"
// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleGridDBLine1D );
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleGridDBLine2D );
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleGridDBLine3D );
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleGridDBArea2D );
+CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleGridDBArea3D );
CPPUNIT_TEST_SUITE_REGISTRATION( spatialdata::spatialdb::TestSimpleGridDBVolume3D );
// ----------------------------------------------------------------------
// Test queryLinear()
void
+spatialdata::spatialdb::TestSimpleGridDBLine1D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleGridDBTestDataLine1D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleGridDBLine1D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleGridDBTestDataLine1D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
+spatialdata::spatialdb::TestSimpleGridDBLine2D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleGridDBTestDataLine2D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleGridDBLine2D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleGridDBTestDataLine2D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
+spatialdata::spatialdb::TestSimpleGridDBLine3D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleGridDBTestDataLine3D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleGridDBLine3D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleGridDBTestDataLine3D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
+spatialdata::spatialdb::TestSimpleGridDBArea2D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleGridDBTestDataArea2D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleGridDBArea2D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleGridDBTestDataArea2D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
+spatialdata::spatialdb::TestSimpleGridDBArea3D::testQueryLinear(void)
+{ // testQueryLinear
+ SimpleGridDBTestDataArea3D data;
+
+ _testQueryLinear(data);
+} // testQueryLinear
+
+// ----------------------------------------------------------------------
+// Test queryNearest()
+void
+spatialdata::spatialdb::TestSimpleGridDBArea3D::testQueryNearest(void)
+{ // testQueryNearest
+ SimpleGridDBTestDataArea3D data;
+
+ _testQueryNearest(data);
+} // testQueryNearest
+
+
+// ----------------------------------------------------------------------
+// Test queryLinear()
+void
spatialdata::spatialdb::TestSimpleGridDBVolume3D::testQueryLinear(void)
{ // testQueryLinear
SimpleGridDBTestDataVolume3D data;
Modified: cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDBCases.hh
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDBCases.hh 2012-10-22 17:57:37 UTC (rev 20876)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/TestSimpleGridDBCases.hh 2012-10-22 22:14:26 UTC (rev 20877)
@@ -29,11 +29,142 @@
/// Namespace for spatial package
namespace spatialdata {
namespace spatialdb {
+ class TestSimpleGridDBLine1D;
+ class TestSimpleGridDBLine2D;
+ class TestSimpleGridDBLine3D;
+ class TestSimpleGridDBArea2D;
+ class TestSimpleGridDBArea3D;
class TestSimpleGridDBVolume3D;
} // spatialdb
} // spatialdata
-/// C++ unit testing for SimpleGridDB with volume data.
+// ----------------------------------------------------------------------
+/// C++ unit testing for SimpleGridDB with line data.
+class spatialdata::spatialdb::TestSimpleGridDBLine1D : public TestSimpleGridDB
+{ // class TestSimpleGridDBLine1D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleGridDBLine1D );
+
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleGridDBLine1D
+
+
+// ----------------------------------------------------------------------
+/// C++ unit testing for SimpleGridDB with line data.
+class spatialdata::spatialdb::TestSimpleGridDBLine2D : public TestSimpleGridDB
+{ // class TestSimpleGridDBLine2D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleGridDBLine2D );
+
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleGridDBLine2D
+
+
+// ----------------------------------------------------------------------
+/// C++ unit testing for SimpleGridDB with line data.
+class spatialdata::spatialdb::TestSimpleGridDBLine3D : public TestSimpleGridDB
+{ // class TestSimpleGridDBLine3D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleGridDBLine3D );
+
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleGridDBLine3D
+
+
+// ----------------------------------------------------------------------
+/// C++ unit testing for SimpleGridDB with area data.
+class spatialdata::spatialdb::TestSimpleGridDBArea2D : public TestSimpleGridDB
+{ // class TestSimpleGridDBArea2D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleGridDBArea2D );
+
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleGridDBArea2D
+
+
+// ----------------------------------------------------------------------
+/// C++ unit testing for SimpleGridDB with area data.
+class spatialdata::spatialdb::TestSimpleGridDBArea3D : public TestSimpleGridDB
+{ // class TestSimpleGridDBArea3D
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestSimpleGridDBArea3D );
+
+ CPPUNIT_TEST( testQueryNearest );
+ CPPUNIT_TEST( testQueryLinear );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test queryNearest()
+ void testQueryNearest(void);
+
+ /// Test queryLinear()
+ void testQueryLinear(void);
+
+}; // class TestSimpleGridDBArea3D
+
+
+// ----------------------------------------------------------------------
+/// C++ unit testing for SimpleGridDB with area data.
class spatialdata::spatialdb::TestSimpleGridDBVolume3D : public TestSimpleGridDB
{ // class TestSimpleGridDBVolume3D
@@ -56,7 +187,7 @@
}; // class TestSimpleGridDBVolume3D
-#endif // spatialdata_spatialdb_testsimplegriddbvolume3d_hh
+#endif // spatialdata_spatialdb_testsimplegriddbcases_hh
// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea2D.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea2D.cc (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea2D.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include "SimpleGridDBTestDataArea2D.hh"
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_numX = 3;
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_numY = 2;
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_numZ = 0;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_spaceDim = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_dataDim = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_numQueries = 5;
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_dbX[_numX] = {
+ -3.0, 1.0, 2.0,
+};
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_dbY[_numY] = {
+ 2.0, 4.0,
+};
+const double* spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_dbZ = 0;
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_dbData[_numX*_numY*_numVals] = {
+ 1.00000000e-01, 1.10000000e+00, // 0,0
+ 0.00000000e-01, 1.20000000e+00, // 1,0
+ 5.00000000e-01, 1.60000000e+00, // 2,0
+ 4.00000000e-01, 4.60000000e+00, // 0,1
+ 9.00000000e-01, 4.70000000e+00, // 1,1
+ 7.00000000e-01, 4.80000000e+00, // 2,1
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_names[_numVals] = {
+ "One",
+ "Two",
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_units[_numVals] = {
+ "m",
+ "m",
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_queryNearest[_numQueries*(_spaceDim+_numVals)] = {
+ -3.2, 3.8, 4.00000000e-01, 4.60000000e+00, // (0,1)
+ 1.1, 1.3, 0.00000000e-01, 1.20000000e+00, // (1,0)
+ 0.0, -6.0, 0.00000000e-01, 1.20000000e+00, // (1,0)
+ 1.6, 3.4, 7.00000000e-01, 4.80000000e+00, // (2,1)
+ -2.0, 3.5, 4.00000000e-01, 4.60000000e+00, // (0,1)
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_queryLinear[_numQueries*(_spaceDim+_numVals)] = {
+ -3.0, 4.0, 4.00000000e-01, 4.60000000e+00, // (0,1)
+ -1.0, 2.5, 2.00000000e-01, 2.02500000e+00, // (0.5, 0.25)
+ 1.25, 3.0, 4.87500000e-01, 3.01250000e+00, // (1.25, 0.5)
+ 0.0, 4.1, 0.0, 0.0, // not found
+ 3.0, 2.0, 0.0, 0.0, // not fount
+};
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea2D::_errFlags[_numQueries] = {
+ 0, 0, 0, 1, 1,};
+
+spatialdata::spatialdb::SimpleGridDBTestDataArea2D::SimpleGridDBTestDataArea2D(void)
+{ // constructor
+ numX = _numX;
+ numY = _numY;
+ numZ = _numZ;
+ spaceDim = _spaceDim;
+ numVals = _numVals;
+ dataDim = _dataDim;
+ numQueries = _numQueries;
+ dbX = const_cast<double*>(_dbX);
+ dbY = const_cast<double*>(_dbY);
+ dbZ = const_cast<double*>(_dbZ);
+ 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::SimpleGridDBTestDataArea2D::~SimpleGridDBTestDataArea2D(void)
+{}
+
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea2D.hh
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea2D.hh (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea2D.hh 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(spatialdata_spatialdb_simplegriddbtestdataarea2d_hh)
+#define spatialdata_spatialdb_simplegriddbtestdataarea2d_hh
+
+#include "SimpleGridDBTestData.hh"
+
+namespace spatialdata {
+ namespace spatialdb {
+ class SimpleGridDBTestDataArea2D;
+ } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleGridDBTestDataArea2D : public SimpleGridDBTestData
+{
+
+public:
+
+ /// Constructor
+ SimpleGridDBTestDataArea2D(void);
+
+ /// Destructor
+ ~SimpleGridDBTestDataArea2D(void);
+
+private:
+
+ static const int _numX;
+
+ static const int _numY;
+
+ static const int _numZ;
+
+ static const int _spaceDim;
+
+ static const int _numVals;
+
+ static const int _dataDim;
+
+ static const int _numQueries;
+
+ static const double _dbX[];
+
+ static const double _dbY[];
+
+ static const double* _dbZ;
+
+ 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_simplegriddbtestdataarea2d_hh
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea3D.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea3D.cc (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea3D.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include "SimpleGridDBTestDataArea3D.hh"
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_numX = 3;
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_numY = 1;
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_numZ = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_spaceDim = 3;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_dataDim = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_numQueries = 5;
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_dbX[_numX] = {
+ -3.0, 1.0, 2.0,
+};
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_dbY[_numY] = {
+ 8.0,
+};
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_dbZ[_numZ] = {
+ 2.0, 4.0,
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_dbData[_numX*_numY*_numZ*_numVals] = {
+ 1.00000000e-01, 1.10000000e+00, // 0,0
+ 0.00000000e-01, 1.20000000e+00, // 1,0
+ 5.00000000e-01, 1.60000000e+00, // 2,0
+ 4.00000000e-01, 4.60000000e+00, // 0,1
+ 9.00000000e-01, 4.70000000e+00, // 1,1
+ 7.00000000e-01, 4.80000000e+00, // 2,1
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_names[_numVals] = {
+ "One",
+ "Two",
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_units[_numVals] = {
+ "m",
+ "m",
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_queryNearest[_numQueries*(_spaceDim+_numVals)] = {
+ -3.2, 7.8, 3.8, 4.00000000e-01, 4.60000000e+00, // (0,1)
+ 1.1, 3.3, 1.3, 0.00000000e-01, 1.20000000e+00, // (1,0)
+ 0.0, -5.0, -6.0, 0.00000000e-01, 1.20000000e+00, // (1,0)
+ 1.6, 9.4, 3.4, 7.00000000e-01, 4.80000000e+00, // (2,1)
+ -2.0, 2.5, 3.5, 4.00000000e-01, 4.60000000e+00, // (0,1)
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_queryLinear[_numQueries*(_spaceDim+_numVals)] = {
+ -3.0, 7.8, 4.0, 4.00000000e-01, 4.60000000e+00, // (0,1)
+ -1.0, 3.3, 2.5, 2.00000000e-01, 2.02500000e+00, // (0.5, 0.25)
+ 1.25, 5.0, 3.0, 4.87500000e-01, 3.01250000e+00, // (1.25, 0.5)
+ 0.0, 9.4, 4.1, 0.0, 0.0, // not found
+ 3.0, 2.5, 2.0, 0.0, 0.0, // not fount
+};
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataArea3D::_errFlags[_numQueries] = {
+ 0, 0, 0, 1, 1,};
+
+spatialdata::spatialdb::SimpleGridDBTestDataArea3D::SimpleGridDBTestDataArea3D(void)
+{ // constructor
+ numX = _numX;
+ numY = _numY;
+ numZ = _numZ;
+ spaceDim = _spaceDim;
+ numVals = _numVals;
+ dataDim = _dataDim;
+ numQueries = _numQueries;
+ dbX = const_cast<double*>(_dbX);
+ dbY = const_cast<double*>(_dbY);
+ dbZ = const_cast<double*>(_dbZ);
+ 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::SimpleGridDBTestDataArea3D::~SimpleGridDBTestDataArea3D(void)
+{}
+
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea3D.hh
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea3D.hh (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataArea3D.hh 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(spatialdata_spatialdb_simplegriddbtestdataarea3d_hh)
+#define spatialdata_spatialdb_simplegriddbtestdataarea3d_hh
+
+#include "SimpleGridDBTestData.hh"
+
+namespace spatialdata {
+ namespace spatialdb {
+ class SimpleGridDBTestDataArea3D;
+ } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleGridDBTestDataArea3D : public SimpleGridDBTestData
+{
+
+public:
+
+ /// Constructor
+ SimpleGridDBTestDataArea3D(void);
+
+ /// Destructor
+ ~SimpleGridDBTestDataArea3D(void);
+
+private:
+
+ static const int _numX;
+
+ static const int _numY;
+
+ static const int _numZ;
+
+ static const int _spaceDim;
+
+ static const int _numVals;
+
+ static const int _dataDim;
+
+ static const int _numQueries;
+
+ static const double _dbX[];
+
+ static const double _dbY[];
+
+ static const double _dbZ[];
+
+ 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_simplegriddbtestdataarea3d_hh
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine1D.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine1D.cc (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine1D.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include "SimpleGridDBTestDataLine1D.hh"
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_numX = 3;
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_numY = 0;
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_numZ = 0;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_spaceDim = 1;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_dataDim = 1;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_numQueries = 5;
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_dbX[_numX] = {
+ -3.0, 1.0, 2.0,
+};
+const double* spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_dbY = 0;
+const double* spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_dbZ = 0;
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_dbData[_numX*_numVals] = {
+ 1.00000000e-01, 1.10000000e+00, // 0,0,0
+ 0.00000000e-01, 1.20000000e+00, // 1,0,0
+ 5.00000000e-01, 1.60000000e+00, // 2,0,0
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_names[_numVals] = {
+ "One",
+ "Two",
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_units[_numVals] = {
+ "m",
+ "m",
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_queryNearest[_numQueries*(_spaceDim+_numVals)] = {
+ -3.2, 1.00000000e-01, 1.10000000e+00, // (0)
+ 1.1, 0.00000000e-01, 1.20000000e+00, // (1)
+ 0.0, 0.00000000e-01, 1.20000000e+00, // (1)
+ 1.6, 5.00000000e-01, 1.60000000e+00, // (2)
+ -2.0, 1.00000000e-01, 1.10000000e+00, // (0)
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_queryLinear[_numQueries*(_spaceDim+_numVals)] = {
+ -3.0, 1.00000000e-01, 1.10000000e+00, // (0)
+ -1.0, 0.50000000e-01, 1.05000000e+00, // (0.5)
+ 1.25, 0.12500000e-01, 1.30000000e+00, // (1.25)
+ -4.0, 0.0, 0.0, // not found
+ 3.0, 0.0, 0.0, // not fount
+};
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine1D::_errFlags[_numQueries] = {
+ 0, 0, 0, 1, 1,};
+
+spatialdata::spatialdb::SimpleGridDBTestDataLine1D::SimpleGridDBTestDataLine1D(void)
+{ // constructor
+ numX = _numX;
+ numY = _numY;
+ numZ = _numZ;
+ spaceDim = _spaceDim;
+ numVals = _numVals;
+ dataDim = _dataDim;
+ numQueries = _numQueries;
+ dbX = const_cast<double*>(_dbX);
+ dbY = const_cast<double*>(_dbY);
+ dbZ = const_cast<double*>(_dbZ);
+ 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::SimpleGridDBTestDataLine1D::~SimpleGridDBTestDataLine1D(void)
+{}
+
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine1D.hh
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine1D.hh (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine1D.hh 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(spatialdata_spatialdb_simplegriddbtestdataline1d_hh)
+#define spatialdata_spatialdb_simplegriddbtestdataline1d_hh
+
+#include "SimpleGridDBTestData.hh"
+
+namespace spatialdata {
+ namespace spatialdb {
+ class SimpleGridDBTestDataLine1D;
+ } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleGridDBTestDataLine1D : public SimpleGridDBTestData
+{
+
+public:
+
+ /// Constructor
+ SimpleGridDBTestDataLine1D(void);
+
+ /// Destructor
+ ~SimpleGridDBTestDataLine1D(void);
+
+private:
+
+ static const int _numX;
+
+ static const int _numY;
+
+ static const int _numZ;
+
+ static const int _spaceDim;
+
+ static const int _numVals;
+
+ static const int _dataDim;
+
+ static const int _numQueries;
+
+ static const double _dbX[];
+
+ static const double* _dbY;
+
+ static const double* _dbZ;
+
+ 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_simplegriddbtestdataline1d_hh
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine2D.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine2D.cc (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine2D.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include "SimpleGridDBTestDataLine2D.hh"
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_numX = 1;
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_numY = 3;
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_numZ = 0;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_spaceDim = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_dataDim = 1;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_numQueries = 5;
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_dbX[_numX] = {
+ 2.0,
+};
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_dbY[_numY] = {
+ -3.0, 1.0, 2.0,
+};
+const double* spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_dbZ = 0;
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_dbData[_numX*_numY*_numVals] = {
+ 1.00000000e-01, 1.10000000e+00, // 0,0
+ 0.00000000e-01, 1.20000000e+00, // 1,0
+ 5.00000000e-01, 1.60000000e+00, // 2,0
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_names[_numVals] = {
+ "One",
+ "Two",
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_units[_numVals] = {
+ "m",
+ "m",
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_queryNearest[_numQueries*(_spaceDim+_numVals)] = {
+ 3.8, -3.2, 1.00000000e-01, 1.10000000e+00, // (0)
+ 1.3, 1.1, 0.00000000e-01, 1.20000000e+00, // (1)
+ 6.0, 0.0, 0.00000000e-01, 1.20000000e+00, // (1)
+ 3.4, 1.6, 5.00000000e-01, 1.60000000e+00, // (2)
+ 3.5, -2.0, 1.00000000e-01, 1.10000000e+00, // (0)
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_queryLinear[_numQueries*(_spaceDim+_numVals)] = {
+ 3.8, -3.0, 1.00000000e-01, 1.10000000e+00, // (0)
+ 1.3, -1.0, 0.50000000e-01, 1.05000000e+00, // (0.5)
+ 6.0, 1.25, 0.12500000e-01, 1.30000000e+00, // (1.25)
+ 3.4, -4.0, 0.0, 0.0, // not found
+ 3.5, 3.0, 0.0, 0.0, // not fount
+};
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine2D::_errFlags[_numQueries] = {
+ 0, 0, 0, 1, 1,};
+
+spatialdata::spatialdb::SimpleGridDBTestDataLine2D::SimpleGridDBTestDataLine2D(void)
+{ // constructor
+ numX = _numX;
+ numY = _numY;
+ numZ = _numZ;
+ spaceDim = _spaceDim;
+ numVals = _numVals;
+ dataDim = _dataDim;
+ numQueries = _numQueries;
+ dbX = const_cast<double*>(_dbX);
+ dbY = const_cast<double*>(_dbY);
+ dbZ = const_cast<double*>(_dbZ);
+ 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::SimpleGridDBTestDataLine2D::~SimpleGridDBTestDataLine2D(void)
+{}
+
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine2D.hh
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine2D.hh (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine2D.hh 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(spatialdata_spatialdb_simplegriddbtestdataline2d_hh)
+#define spatialdata_spatialdb_simplegriddbtestdataline2d_hh
+
+#include "SimpleGridDBTestData.hh"
+
+namespace spatialdata {
+ namespace spatialdb {
+ class SimpleGridDBTestDataLine2D;
+ } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleGridDBTestDataLine2D : public SimpleGridDBTestData
+{
+
+public:
+
+ /// Constructor
+ SimpleGridDBTestDataLine2D(void);
+
+ /// Destructor
+ ~SimpleGridDBTestDataLine2D(void);
+
+private:
+
+ static const int _numX;
+
+ static const int _numY;
+
+ static const int _numZ;
+
+ static const int _spaceDim;
+
+ static const int _numVals;
+
+ static const int _dataDim;
+
+ static const int _numQueries;
+
+ static const double _dbX[];
+
+ static const double _dbY[];
+
+ static const double* _dbZ;
+
+ 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_simplegriddbtestdataline2d_hh
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine3D.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine3D.cc (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine3D.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#include "SimpleGridDBTestDataLine3D.hh"
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_numX = 1;
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_numY = 1;
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_numZ = 3;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_spaceDim = 3;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_numVals = 2;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_dataDim = 1;
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_numQueries = 5;
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_dbX[_numX] = {
+ 2.0,
+};
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_dbY[_numY] = {
+ 0.6,
+};
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_dbZ[_numZ] = {
+ -3.0, 1.0, 2.0,
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_dbData[_numX*_numY*_numZ*_numVals] = {
+ 1.00000000e-01, 1.10000000e+00, // 0,0
+ 0.00000000e-01, 1.20000000e+00, // 1,0
+ 5.00000000e-01, 1.60000000e+00, // 2,0
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_names[_numVals] = {
+ "One",
+ "Two",
+};
+
+const char* spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_units[_numVals] = {
+ "m",
+ "m",
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_queryNearest[_numQueries*(_spaceDim+_numVals)] = {
+ 3.8, 3.8, -3.2, 1.00000000e-01, 1.10000000e+00, // (0)
+ 1.3, 6.3, 1.1, 0.00000000e-01, 1.20000000e+00, // (1)
+ 6.0, 5.0, 0.0, 0.00000000e-01, 1.20000000e+00, // (1)
+ 3.4, 4.4, 1.6, 5.00000000e-01, 1.60000000e+00, // (2)
+ 3.5, 7.5, -2.0, 1.00000000e-01, 1.10000000e+00, // (0)
+};
+
+const double spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_queryLinear[_numQueries*(_spaceDim+_numVals)] = {
+ 3.8, 3.8, -3.0, 1.00000000e-01, 1.10000000e+00, // (0)
+ 1.3, 6.3, -1.0, 0.50000000e-01, 1.05000000e+00, // (0.5)
+ 6.0, 5.0, 1.25, 0.12500000e-01, 1.30000000e+00, // (1.25)
+ 3.4, 4.4, -4.0, 0.0, 0.0, // not found
+ 3.5, 7.5, 3.0, 0.0, 0.0, // not fount
+};
+
+const int spatialdata::spatialdb::SimpleGridDBTestDataLine3D::_errFlags[_numQueries] = {
+ 0, 0, 0, 1, 1,};
+
+spatialdata::spatialdb::SimpleGridDBTestDataLine3D::SimpleGridDBTestDataLine3D(void)
+{ // constructor
+ numX = _numX;
+ numY = _numY;
+ numZ = _numZ;
+ spaceDim = _spaceDim;
+ numVals = _numVals;
+ dataDim = _dataDim;
+ numQueries = _numQueries;
+ dbX = const_cast<double*>(_dbX);
+ dbY = const_cast<double*>(_dbY);
+ dbZ = const_cast<double*>(_dbZ);
+ 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::SimpleGridDBTestDataLine3D::~SimpleGridDBTestDataLine3D(void)
+{}
+
+
+// End of file
Added: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine3D.hh
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine3D.hh (rev 0)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataLine3D.hh 2012-10-22 22:14:26 UTC (rev 20877)
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard, U.S. Geological Survey
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2012 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(spatialdata_spatialdb_simplegriddbtestdataline3d_hh)
+#define spatialdata_spatialdb_simplegriddbtestdataline3d_hh
+
+#include "SimpleGridDBTestData.hh"
+
+namespace spatialdata {
+ namespace spatialdb {
+ class SimpleGridDBTestDataLine3D;
+ } // spatialdata
+} // spatialdb
+
+class spatialdata::spatialdb::SimpleGridDBTestDataLine3D : public SimpleGridDBTestData
+{
+
+public:
+
+ /// Constructor
+ SimpleGridDBTestDataLine3D(void);
+
+ /// Destructor
+ ~SimpleGridDBTestDataLine3D(void);
+
+private:
+
+ static const int _numX;
+
+ static const int _numY;
+
+ static const int _numZ;
+
+ static const int _spaceDim;
+
+ static const int _numVals;
+
+ static const int _dataDim;
+
+ static const int _numQueries;
+
+ static const double _dbX[];
+
+ static const double _dbY[];
+
+ static const double _dbZ[];
+
+ 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_simplegriddbtestdataline3d_hh
+
+// End of file
Modified: cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataVolume3D.cc
===================================================================
--- cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataVolume3D.cc 2012-10-22 17:57:37 UTC (rev 20876)
+++ cs/spatialdata/trunk/tests/libtests/spatialdb/data/SimpleGridDBTestDataVolume3D.cc 2012-10-22 22:14:26 UTC (rev 20877)
@@ -40,28 +40,28 @@
const double spatialdata::spatialdb::SimpleGridDBTestDataVolume3D::_dbData[_numX*_numY*_numZ*_numVals] = {
1.00000000e-01, 1.10000000e+00, // 0,0,0
+ 0.00000000e-01, 1.20000000e+00, // 1,0,0
+ 5.00000000e-01, 1.60000000e+00, // 2,0,0
+ 4.00000000e-01, 4.60000000e+00, // 0,1,0
+ 9.00000000e-01, 4.70000000e+00, // 1,1,0
+ 7.00000000e-01, 4.80000000e+00, // 2,1,0
3.00000000e-01, 3.30000000e+00, // 0,0,1
+ 1.00000000e-01, 3.40000000e+00, // 1,0,1
+ 3.00000000e-01, 3.30000000e+00, // 2,0,1
+ 3.00000000e-01, 3.20000000e+00, // 0,1,1
+ 4.00000000e-01, 3.30000000e+00, // 1,1,1
+ 4.00000000e-01, 3.40000000e+00, // 2,1,1
2.00000000e-01, 2.20000000e+00, // 0,0,2
+ 2.00000000e-01, 2.10000000e+00, // 1,0,2
+ 8.00000000e-01, 2.80000000e+00, // 2,0,2
+ 7.00000000e-01, 5.20000000e+00, // 0,1,2
+ 7.00000000e-01, 5.50000000e+00, // 1,1,2
+ 3.00000000e-01, 5.70000000e+00, // 2,1,2
1.00000000e-01, 1.10000000e+00, // 0,0,3
- 4.00000000e-01, 4.60000000e+00, // 0,1,0
- 3.00000000e-01, 3.20000000e+00, // 0,1,1
- 7.00000000e-01, 5.20000000e+00, // 0,1,2
+ 6.00000000e-01, 1.40000000e+00, // 1,0,3
+ 3.00000000e-01, 1.50000000e+00, // 2,0,3
5.00000000e-01, 4.60000000e+00, // 0,1,3
- 0.00000000e-01, 1.20000000e+00, // 1,0,0
- 1.00000000e-01, 3.40000000e+00, // 1,0,1
- 2.00000000e-01, 2.10000000e+00, // 1,0,2
- 6.00000000e-01, 1.40000000e+00, // 1,0,3
- 9.00000000e-01, 4.70000000e+00, // 1,1,0
- 4.00000000e-01, 3.30000000e+00, // 1,1,1
- 7.00000000e-01, 5.50000000e+00, // 1,1,2
6.00000000e-01, 4.70000000e+00, // 1,1,3
- 5.00000000e-01, 1.60000000e+00, // 2,0,0
- 3.00000000e-01, 3.30000000e+00, // 2,0,1
- 8.00000000e-01, 2.80000000e+00, // 2,0,2
- 3.00000000e-01, 1.50000000e+00, // 2,0,3
- 7.00000000e-01, 4.80000000e+00, // 2,1,0
- 4.00000000e-01, 3.40000000e+00, // 2,1,1
- 3.00000000e-01, 5.70000000e+00, // 2,1,2
4.00000000e-01, 4.50000000e+00, // 2,1,3
};
More information about the CIG-COMMITS
mailing list