5#ifndef DUNE_DGF_INTERVALBLOCK_HH
6#define DUNE_DGF_INTERVALBLOCK_HH
12#include <dune/grid/io/file/dgfparser/blocks/basic.hh>
27 Interval(
const Interval& interval,
const std::vector<int>& map )
29 copy( interval, map );
31 void copy(
const Interval& interval,
const std::vector<int>& map )
33 const int size = map.size();
38 assert( size ==
int(interval.n.size()) );
39 for(
int i=0; i<size; ++i )
41 p[ 0 ][ i ] = interval.p[ 0 ][ map[ i ] ];
42 p[ 1 ][ i ] = interval.p[ 1 ][ map[ i ] ];
43 n[ i ] = interval.n[ map[ i ] ];
44 h[ i ] = interval.h[ map[ i ] ];
47 std::array< std::vector< double >, 2 > p;
48 std::vector< double > h;
53 std::vector< Interval > intervals_;
54 std::vector< int > map_;
59 explicit IntervalBlock ( std::istream &in );
61 void get ( std::vector< std::vector< double > > &vtx,
int &nofvtx,
62 std::vector< std::vector< unsigned int > > &
simplex,
int &nofsimpl )
64 for(
size_t i = 0; i < intervals_.size(); ++i )
67 nofvtx += getVtx( i, vtx );
68 nofsimpl += getHexa( i,
simplex, oldvtx );
72 void get ( std::vector< std::vector< double > > &vtx,
int &nofvtx )
74 for(
size_t i = 0; i < intervals_.size(); ++i )
75 nofvtx += getVtx( i, vtx );
78 const Interval &get (
int block )
const
80 return intervals_[ block ];
83 int numIntervals ()
const
85 return intervals_.size();
93 int getVtx (
int block, std::vector< std::vector< double > > &vtx )
const;
94 int getHexa (
int block, std::vector< std::vector< unsigned int > > &cubes,
95 int offset = 0 )
const;
97 int nofvtx (
int block )
const
99 const Interval &interval = get( block );
101 for(
int i = 0; i < dimw_; ++i )
102 n *= (interval.n[ i ] + 1);
106 int nofhexa (
int block )
const
108 const Interval &interval = get( block );
110 for(
int i = 0; i < dimw_; ++i )
111 n *= interval.n[ i ];
117 void parseLine ( std::vector< T > &v );
122 inline std::ostream &
123 operator<< ( std::ostream &out,
const IntervalBlock::Interval &interval )
125 if( interval.p[ 0 ].empty() || interval.p[ 1 ].empty() || interval.n.empty() )
126 return out <<
"Interval {}";
128 out <<
"Interval { p0 = (" << interval.p[ 0 ][ 0 ];
129 for(
size_t i = 1; i < interval.p[ 0 ].size(); ++i )
130 out <<
", " << interval.p[ 0 ][ i ];
131 out <<
"), p1 = (" << interval.p[ 1 ][ 0 ];
132 for(
size_t i = 1; i < interval.p[ 1 ].size(); ++i )
133 out <<
", " << interval.p[ 1 ][ i ];
134 out <<
"), n = (" << interval.n[ 0 ];
135 for(
size_t i = 1; i < interval.n.size(); ++i )
136 out <<
", " << interval.n[ i ];
Dune namespace.
Definition: alignedallocator.hh:13
@ simplex
use only simplex elements (i.e., triangles or tetrahedra)
Definition: declaration.hh:18