3#ifndef DUNE_POLYHEDRON_HH
4#define DUNE_POLYHEDRON_HH
8#include <dune/grid/io/file/dgfparser/blocks/polygon.hh>
19 struct PolyhedronBlock
22 explicit PolyhedronBlock ( std::istream &in,
int numPolys )
23 : BasicBlock( in,
"Polyhedron" ), numPolys_( numPolys )
26 int get ( std::vector< std::vector< int > > &polyhedra )
29 std::vector< int > polyhedron;
31 while( getnextline() )
34 for(
int polyIdx; getnextentry( polyIdx ); )
36 if( (polyIdx < 0) || (polyIdx > numPolys_) )
37 DUNE_THROW( DGFException,
"Error in " << *
this <<
": Invalid polygon index (" << polyIdx <<
" not int [0, " << numPolys_ <<
"])" );
39 minPolyId = std::min( minPolyId, polyIdx );
40 polyhedron.push_back( polyIdx );
43 polyhedra.push_back( polyhedron );
49 const size_t polySize = polyhedra.size();
50 for(
size_t i=0; i<polySize; ++i )
52 const size_t pSize = polyhedra[ i ].size();
53 for(
size_t j=0; j<pSize; ++j )
55 polyhedra[ i ][ j ] -= minPolyId;
59 return polyhedra.size();
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
Dune namespace.
Definition: alignedallocator.hh:10