3#ifndef DUNE_DGF_INTERVALBLOCK_HH
4#define DUNE_DGF_INTERVALBLOCK_HH
11#include <dune/grid/io/file/dgfparser/blocks/basic.hh>
25 array< std::vector< double >, 2 > p;
26 std::vector< double > h;
31 std::vector< Interval > intervals_;
36 explicit IntervalBlock ( std::istream &in );
38 void get ( std::vector< std::vector< double > > &vtx,
int &nofvtx,
39 std::vector< std::vector< unsigned int > > &simplex,
int &nofsimpl )
41 for(
size_t i = 0; i < intervals_.size(); ++i )
44 nofvtx += getVtx( i, vtx );
45 nofsimpl += getHexa( i, simplex, oldvtx );
49 void get ( std::vector< std::vector< double > > &vtx,
int &nofvtx )
51 for(
size_t i = 0; i < intervals_.size(); ++i )
52 nofvtx += getVtx( i, vtx );
55 const Interval &get (
int block )
const
57 return intervals_[ block ];
60 int numIntervals ()
const
62 return intervals_.size();
70 int getVtx (
int block, std::vector< std::vector< double > > &vtx )
const;
71 int getHexa (
int block, std::vector< std::vector< unsigned int > > &cubes,
72 int offset = 0 )
const;
74 int nofvtx (
int block )
const
76 const Interval &interval = get( block );
78 for(
int i = 0; i < dimw_; ++i )
79 n *= (interval.n[ i ] + 1);
83 int nofhexa (
int block )
const
85 const Interval &interval = get( block );
87 for(
int i = 0; i < dimw_; ++i )
94 void parseLine ( std::vector< T > &v );
100 operator<< ( std::ostream &out,
const IntervalBlock::Interval &interval )
102 if( interval.p[ 0 ].empty() || interval.p[ 1 ].empty() || interval.n.empty() )
103 return out <<
"Interval {}";
105 out <<
"Interval { p0 = (" << interval.p[ 0 ][ 0 ];
106 for(
size_t i = 1; i < interval.p[ 0 ].size(); ++i )
107 out <<
", " << interval.p[ 0 ][ i ];
108 out <<
"), p1 = (" << interval.p[ 1 ][ 0 ];
109 for(
size_t i = 1; i < interval.p[ 1 ].size(); ++i )
110 out <<
", " << interval.p[ 1 ][ i ];
111 out <<
"), n = (" << interval.n[ 0 ];
112 for(
size_t i = 1; i < interval.n.size(); ++i )
113 out <<
", " << interval.n[ i ];
Fallback implementation of the std::array class (a static array)
std::ostream & operator<<(std::ostream &s, const array< T, N > &e)
Output operator for array.
Definition: array.hh:26
Dune namespace.
Definition: alignment.hh:10