Commit 46f3420e authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CHANGE #282] added some WAsserts instead of asserts

parent 11f9089d
......@@ -106,21 +106,14 @@ double WDataSetScalar::interpolate( const wmath::WPosition& pos, bool* success )
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
// TODO(wiebel): change this to eassert.
if( !grid )
{
throw WException( std::string( "This data set has a grid whose type is not yet supported for interpolation." ) );
}
// TODO(wiebel): change this to eassert.
WAssert( grid, "This data set has a grid whose type is not yet supported for interpolation." );
// TODO(wiebel): change this to WAssert.
// if( grid->getTransformationMatrix() != wmath::WMatrix<double>( 4, 4 ).makeIdentity() )
// {
// throw WException( std::string( "Only feasible for untranslated grid so far." ) );
// }
// TODO(wiebel): change this to eassert.
if( !( m_valueSet->order() == 0 && m_valueSet->dimension() == 1 ) )
{
throw WException( std::string( "Only implemented for scalar values so far." ) );
}
WAssert( ( m_valueSet->order() == 0 && m_valueSet->dimension() == 1 ),
"Only implemented for scalar values so far." );
*success = grid->encloses( pos );
......
......@@ -28,6 +28,7 @@
#include "WDataTexture3D.h"
#include "WValueSet.h"
#include "WGrid.h"
#include "../common/WAssert.h"
#include "../common/WPrototyped.h"
#include "../common/WException.h"
......@@ -40,9 +41,10 @@ WDataSetSingle::WDataSetSingle( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid )
: WDataSet()
{
assert( newValueSet );
assert( newGrid );
assert( newValueSet->size() == newGrid->size() );
WAssert( newValueSet, "Need a value set for new data set." );
WAssert( newGrid, "Need a grid for new data set." );
WAssert( newValueSet->size() == newGrid->size(),
"Number of grid position unequal number of values in value set." );
m_valueSet = newValueSet;
m_grid = newGrid;
......@@ -129,7 +131,7 @@ double WDataSetSingle::getValueAt( size_t id )
return static_cast< double >( boost::shared_dynamic_cast< WValueSet< double > >( getValueSet() )->getScalar( id ) );
}
default:
assert( false && "Unknow data type in dataset." );
WAssert( false, "Unknow data type in dataset." );
}
return 0.0;
......
......@@ -65,21 +65,14 @@ wmath::WVector3D WDataSetVector::interpolate( const wmath::WPosition& pos, bool
{
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( m_grid );
// TODO(wiebel): change this to eassert.
if( !grid )
{
throw WException( std::string( "This data set has a grid whose type is not yet supported for interpolation." ) );
}
// TODO(wiebel): change this to eassert.
WAssert( grid, "This data set has a grid whose type is not yet supported for interpolation." );
// TODO(wiebel): change this to WAssert.
// if( grid->getTransformationMatrix() != wmath::WMatrix<double>( 4, 4 ).makeIdentity() )
// {
// throw WException( std::string( "Only feasible for untranslated grid so far." ) );
// }
// TODO(wiebel): change this to eassert.
if( !( m_valueSet->order() == 1 && m_valueSet->dimension() == 3 ) )
{
throw WException( std::string( "Only implemented for 3D Vectors so far." ) );
}
WAssert( ( m_valueSet->order() == 1 && m_valueSet->dimension() == 3 ),
"Only implemented for 3D Vectors so far." );
*success = grid->encloses( pos );
......@@ -149,7 +142,7 @@ wmath::WVector3D WDataSetVector::getVectorAt( size_t index ) const
return boost::shared_dynamic_cast< WValueSet< double > >( getValueSet() )->getVector3D( index );
}
default:
assert( false && "Unknow data type in dataset." );
WAssert( false, "Unknow data type in dataset." );
}
return wmath::WVector3D( 0, 0, 0 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment