30 #include "../../common/WStringUtils.h"
31 #include "../../common/WTransferable.h"
32 #include "../../common/datastructures/WUnionFind.h"
33 #include "../../common/exceptions/WNotImplemented.h"
34 #include "../WValueSet.h"
35 #include "WJoinContourTree.h"
44 m_elementIndices( dataset->getValueSet()->size() ),
45 m_joinTree( dataset->getValueSet()->size() ),
46 m_lowestVoxel( dataset->getValueSet()->size() )
48 if( dataset->getValueSet()->order() != 0 || dataset->getValueSet()->dimension() != 1 )
50 throw WNotImplemented( std::string(
"ATM there is only support for scalar fields" ) );
55 throw WNotImplemented( std::string(
"ATM there is only support for scalar fields with doubles as scalars" ) );
60 throw WNotImplemented( std::string(
"Only WGridRegular3D is supported, despite that its not a simplicial mesh!" ) );
80 for(
size_t i = 0; i <
m_joinTree.size(); ++i )
83 std::vector< size_t > neighbours =
m_grid->getNeighbours( m_elementIndices[i] );
84 std::vector< size_t >::const_iterator n = neighbours.begin();
85 for( ; n != neighbours.end(); ++n )
87 if( uf.find( m_elementIndices[i] ) == uf.find( *n ) ||
m_valueSet->getScalar( *n ) <=
m_valueSet->getScalar( m_elementIndices[i] ) )
93 uf.merge( m_elementIndices[i], *n );
95 m_lowestVoxel[ uf.find( *n ) ] = m_elementIndices[i];
103 boost::shared_ptr< std::vector< size_t > > result(
new std::vector< size_t >(
m_elementIndices ) );
121 if(
m_valueSet->getScalar( target ) >= isoValue )
123 uf.merge( target, m_elementIndices[i] );
127 return uf.getMaxSet();
131 : m_valueSet( valueSet )