5#ifndef DUNE_DGF_BOUNDARYDOMBLOCK_HH
6#define DUNE_DGF_BOUNDARYDOMBLOCK_HH
38 defaultData_( defaultData )
50 return (!parameter_.empty());
64 defaultData_ = defaultData;
75 os <<
"domain data: id = " << ddata.
id();
77 os <<
", parameter = " << ddata.
parameter();
101 data_( id, parameter )
106 "ERROR in " << *
this <<
"!");
120 "ERROR in " << *
this <<
"!");
127 left_( other.left_ ),
128 right_( other.right_ ),
134 "ERROR in " << *
this <<
"!");
144 "ERROR in " << *
this <<
"!");
148 right_= other.right_;
154 template<
class Vector >
160 if( x[ i ] < left_[ i ] || x[ i ] > right_[ i ] )
174 os <<
"domain: " << std::endl;
177 os << domain.left_[ i ] <<
" ";
181 os << domain.right_[ i ] <<
" ";
188 std::vector< double > left_, right_;
209 std::vector< Domain > domains_;
226 return ( counter_ < ndomains_ );
232 return domains_.at( counter_ );
238 return bool( default_ );
260 return ( counter_ <= ndomains_ );
265 template<
class Vector >
268 std::vector< int > index( ndomains_ );
269 for(
int i = 0; i < ndomains_; ++i)
273 for(
size_t i = 0; i < N; ++i )
278 const int n = index.size();
280 for(
int j = n-1; j >= 0; --j )
282 bool inside = domains_[ index[ j ] ].contains( v[ i ] );
284 index.erase( index.begin() + j );
293 if( index.size() > 1 )
294 dwarn <<
"WARNING: ambiguous boundary domain assignment, use first boundary domain in list" << std::endl;
296 return &domains_[ index[ 0 ] ].data();
Include standard header files.
Definition: agrid.hh:60
void reset()
Definition: basic.hh:51
Definition: boundarydom.hh:23
void reset(int id, BoundaryParameter parameter, bool defaultData=false)
Definition: boundarydom.hh:60
~DomainData()
Definition: boundarydom.hh:32
DGFBoundaryParameter::type BoundaryParameter
Definition: boundarydom.hh:24
DomainData()
Definition: boundarydom.hh:26
int id() const
Definition: boundarydom.hh:42
const BoundaryParameter & parameter() const
Definition: boundarydom.hh:54
friend std::ostream & operator<<(std ::ostream &os, const DomainData &ddata)
Definition: boundarydom.hh:73
bool hasParameter() const
Definition: boundarydom.hh:48
DomainData(int id, BoundaryParameter parameter, bool defaultData=false)
Definition: boundarydom.hh:35
bool isDefault() const
Definition: boundarydom.hh:68
Definition: boundarydom.hh:90
Domain(std::vector< double > p1, std::vector< double > p2, int id, BoundaryParameter ¶meter)
Definition: boundarydom.hh:97
Domain(const Domain &other)
Definition: boundarydom.hh:125
const int dimensionworld
Definition: boundarydom.hh:92
bool contains(const Vector &x) const
Definition: boundarydom.hh:155
DGFBoundaryParameter::type BoundaryParameter
Definition: boundarydom.hh:94
friend std::ostream & operator<<(std ::ostream &os, const Domain &domain)
Definition: boundarydom.hh:172
Domain & operator=(const Domain &other)
Definition: boundarydom.hh:139
const DomainData & data() const
Definition: boundarydom.hh:166
Domain(std::vector< double > p1, std::vector< double > p2, DomainData &data)
Definition: boundarydom.hh:111
Definition: boundarydom.hh:195
~BoundaryDomBlock()
Definition: boundarydom.hh:216
bool hasParameter() const
Definition: boundarydom.cc:138
const Domain & domain() const
Definition: boundarydom.hh:230
const DomainData * contains(const std::vector< Vector > &v) const
Definition: boundarydom.hh:266
bool next()
Definition: boundarydom.hh:223
void reset()
Definition: boundarydom.hh:251
bool ok()
Definition: boundarydom.hh:258
bool hasDefaultData() const
Definition: boundarydom.hh:236
BoundaryDomBlock(std::istream &in, int cdimworld)
Definition: boundarydom.cc:18
const DomainData * defaultData() const
Definition: boundarydom.hh:242
exception class for IO errors in the DGF parser
Definition: dgfexception.hh:16
Contains types for additional features.
Definition: parser.hh:23
std::string type
type of additional boundary parameters
Definition: parser.hh:25