25 #ifndef WDATASETVECTOR_TEST_H
26 #define WDATASETVECTOR_TEST_H
30 #include <boost/array.hpp>
32 #include <cxxtest/TestSuite.h>
34 #include "../../common/WLogger.h"
35 #include "../WDataSetVector.h"
56 boost::shared_ptr< WGrid > grid = boost::shared_ptr< WGrid >(
new WGridRegular3D( 5, 3, 3 ) );
57 boost::shared_ptr< std::vector< double > > data = boost::shared_ptr< std::vector< double > >(
new std::vector< double >( grid->size() * 3 ) );
58 for(
size_t i = 0; i < grid->size() * 3; ++i )
62 boost::shared_ptr< WValueSet< double > > valueSet(
new WValueSet< double >( 1, 3, data, W_DT_DOUBLE ) );
103 TS_ASSERT( success );
107 TS_ASSERT( success );
139 boost::shared_ptr< WGrid > grid = boost::shared_ptr< WGrid >(
new WGridRegular3D( 2, 2, 2 ) );
140 boost::shared_ptr< std::vector< double > > data(
new std::vector< double > );
141 boost::array< WPosition, 8 > d = { {
WPosition( -1, 0, 0 ),
150 for(
size_t i = 0; i < grid->size(); ++i )
152 data->push_back( d[i][0] );
153 data->push_back( d[i][1] );
154 data->push_back( d[i][2] );
156 boost::shared_ptr< WValueSet< double > > valueSet(
new WValueSet< double >( 1, 3, data, W_DT_DOUBLE ) );
159 bool success =
false;
161 TS_ASSERT( success );
162 TS_ASSERT_DELTA( ds.
interpolate(
WPosition( 0.9999, 0.9999, 0.9999 ), &success )[0], d[7][0], 1e-9 );
163 TS_ASSERT_DELTA( ds.
interpolate(
WPosition( 0.9999, 0.9999, 0.9999 ), &success )[1], d[7][1], 1e-9 );
164 TS_ASSERT_DELTA( ds.
interpolate(
WPosition( 0.9999, 0.9999, 0.9999 ), &success )[2], d[7][2], 1e-9 );
165 TS_ASSERT( success );
168 TS_ASSERT( success );
170 TS_ASSERT( success );
175 TS_ASSERT( success );
178 TS_ASSERT( success );
187 boost::shared_ptr< WGridRegular3D > grid = boost::shared_ptr< WGridRegular3D >(
new WGridRegular3D( 3, 4, 5 ) );
188 bool success =
false;
189 boost::shared_ptr< std::vector< double > > data = boost::shared_ptr< std::vector< double > >(
new std::vector< double >( grid->size() * 3 ) );
190 for(
size_t i = 0; i < grid->size() * 3; ++i )
194 boost::shared_ptr< WValueSet< double > > valueSet(
new WValueSet< double >( 1, 3, data, W_DT_DOUBLE ) );
197 TS_ASSERT( !success );
201 #endif // WDATASETVECTOR_TEST_H