Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
46f3420e
Commit
46f3420e
authored
Apr 20, 2010
by
Alexander Wiebel
Browse files
[CHANGE
#282
] added some WAsserts instead of asserts
parent
11f9089d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
27 deletions
+15
-27
src/dataHandler/WDataSetScalar.cpp
src/dataHandler/WDataSetScalar.cpp
+4
-11
src/dataHandler/WDataSetSingle.cpp
src/dataHandler/WDataSetSingle.cpp
+6
-4
src/dataHandler/WDataSetVector.cpp
src/dataHandler/WDataSetVector.cpp
+5
-12
No files found.
src/dataHandler/WDataSetScalar.cpp
View file @
46f3420e
...
...
@@ -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
);
...
...
src/dataHandler/WDataSetSingle.cpp
View file @
46f3420e
...
...
@@ -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:
a
ssert
(
false
&&
"Unknow data type in dataset."
);
WA
ssert
(
false
,
"Unknow data type in dataset."
);
}
return
0.0
;
...
...
src/dataHandler/WDataSetVector.cpp
View file @
46f3420e
...
...
@@ -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:
a
ssert
(
false
&&
"Unknow data type in dataset."
);
WA
ssert
(
false
,
"Unknow data type in dataset."
);
}
return
wmath
::
WVector3D
(
0
,
0
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment