5#ifndef DUNE_POLYHEDRON_HH
6#define DUNE_POLYHEDRON_HH
10#include <dune/grid/io/file/dgfparser/blocks/polygon.hh>
21 struct PolyhedronBlock
24 explicit PolyhedronBlock ( std::istream &in,
int numPolys )
25 : BasicBlock( in,
"Polyhedron" ), numPolys_( numPolys )
28 int get ( std::vector< std::vector< int > > &polyhedra )
31 std::vector< int > polyhedron;
33 while( getnextline() )
36 for(
int polyIdx; getnextentry( polyIdx ); )
38 if( (polyIdx < 0) || (polyIdx > numPolys_) )
39 DUNE_THROW( DGFException,
"Error in " << *
this <<
": Invalid polygon index (" << polyIdx <<
" not int [0, " << numPolys_ <<
"])" );
41 minPolyId =
std::min( minPolyId, polyIdx );
42 polyhedron.push_back( polyIdx );
45 polyhedra.push_back( polyhedron );
51 const size_t polySize = polyhedra.size();
52 for(
size_t i=0; i<polySize; ++i )
54 const size_t pSize = polyhedra[ i ].size();
55 for(
size_t j=0; j<pSize; ++j )
57 polyhedra[ i ][ j ] -= minPolyId;
61 return polyhedra.size();
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
constexpr auto min
Function object that returns the smaller of the given values.
Definition: hybridutilities.hh:506
Dune namespace.
Definition: alignedallocator.hh:13
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
Return the entry at position pos of the given sequence.
Definition: integersequence.hh:22