Flow123d  release_1.8.2-1603-g0109a2b
region.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file region.hh
15  * @brief
16  * @todo
17  * - komentar k RegionIdx
18  * - presun enum RegionType do public Region - komentar + pouzit v kodu
19  * - zkontrolovat chybove hlasky a ASSERTY, co z toho by melo byt pres exception?
20  *
21  * - Seems that GMSH allows repeating ID and Label on regions of different dimension, therefore
22  * label and ID are not unique without dimension.
23  *
24  */
25 
26 #ifndef REGION_HH_
27 #define REGION_HH_
28 
29 #include <string>
30 #include <vector>
31 #include <map>
32 
33 #include "system/system.hh"
34 #include "system/global_defs.h"
35 #include "system/exceptions.hh"
36 
38 #include "input/input_exception.hh"
39 
40 #include <boost/multi_index_container.hpp>
41 #include <boost/multi_index/ordered_index.hpp>
42 #include <boost/multi_index/random_access_index.hpp>
43 #include <boost/multi_index/hashed_index.hpp>
44 #include <boost/multi_index/member.hpp>
45 #include <boost/multi_index/mem_fun.hpp>
46 #include <boost/functional/hash.hpp>
47 
48 namespace BMI=::boost::multi_index;
49 
50 // forward declarations
51 class Region;
52 class RegionDB;
53 namespace Input {
54  namespace Type { class Record; }
55  class Record;
56  class Array;
57 }
58 
59 /**
60  * Base class that contains information about region:
61  * 1) contains integer value that specifies region
62  * 2) detects if region is valid
63  * 3) detects if the region is the bulk or boundary
64  * 4) detects boundary index of boundary region or bulk index of bulk region
65  */
66 class RegionIdx {
67 public:
68 
69  /// Default region is undefined/invalid
70  RegionIdx():idx_(undefined) {}
71 
72  /// Returns true if it is a Boundary region and false if it is a Bulk region.
73  inline bool is_boundary() const
74  { return !(idx_ & 1); }
75 
76  /// Returns false if the region has undefined/invalid value
77  inline bool is_valid() const
78  { return idx_!=undefined;}
79 
80  /// Returns a global index of the region.
81  inline unsigned int idx() const
82  { return idx_; }
83 
84  /// Returns index of the region in the boundary set.
85  inline unsigned int boundary_idx() const {
86  OLD_ASSERT( is_boundary(), "Try to get boundary index of a bulk region with internal idx: %d\n", idx_ );
87  return idx_ >> 1; }
88 
89  /// Returns index of the region in the bulk set.
90  inline unsigned int bulk_idx() const {
91  OLD_ASSERT( ! is_boundary(), "Try to get bulk index of boundary region with internal idx: %d\n", idx_ );
92  return idx_ >> 1; }
93 
94  /// Equality comparison operators for regions.
95  inline bool operator==(const RegionIdx &other) const
96  { return idx_ == other.idx_; }
97 
98  /// Equality comparison operators for regions.
99  inline bool operator!=(const RegionIdx &other) const
100  { return idx_ != other.idx_; }
101 
102 
103 protected:
104  /**
105  * Create accessor from the index. Should be private since implementation specific.
106  * We need some way how to iterate over: all regions, boundary regions, bulk regions -
107  * solution: have specific RegionSets for these three cases.
108  */
109  RegionIdx(unsigned int index)
110  : idx_(index) { }
111 
112  /**
113  * Internal region index. Regions of one RegionDB (corresponding to one mesh) forms more or less continuous sequence.
114  */
115  unsigned int idx_;
116 
117  /// index for undefined region
118  static const unsigned int undefined=0xffffffff;
119 
120  friend class Region;
121 };
122 
123 
124 
125 /**
126  * Class that represents disjoint part of computational domain (or domains). It consists of one integer value
127  * but provides access to other data stored in RegionDB. In particular provides string label and integer ID (unordered)
128  * further it provides fast (inlined) methods to:
129  * 1) detect if the region is the bulk region or boundary region
130  * 2) return index (this is used to select correct Field, possibly we can distinguish boundary_index and bulk_index)
131  *
132  * Implementation: currently we number bulk regions by odd indices and boundary regions by even indices.
133  *
134  */
135 class Region : public RegionIdx {
136 public:
137 
138  /**
139  * Types of region in mesh (bulk or boundary)
140  */
141  enum RegionType {
142  bulk=false,
143  boundary=true
144  };
145 
146 
147  /// Default region is undefined/invalid
149  : RegionIdx(), db_(NULL)
150  {}
151 
152  /// This should be used for construction from known RegionIdx. (e.g. in Mesh)
153  /// Do not use unless you can not get Region in other way.
154  Region(RegionIdx r_idx, const RegionDB & db)
155  : RegionIdx(r_idx), db_(&db)
156  {}
157 
158  RegionIdx operator() (const Region &)
159  {return RegionIdx(idx_); }
160 
161  /// Comparative method of two regions
162  static bool comp(const Region &a, const Region &b)
163  { return a.idx_ < b.idx_; }
164 
165  /// Returns label of the region (using RegionDB)
166  std::string label() const;
167 
168  /// Returns id of the region (using RegionDB)
169  unsigned int id() const;
170 
171  /// Returns dimension of the region.
172  unsigned int dim() const;
173 
174  /**
175  * Returns static region database. Meant to be used for getting range of
176  * global, boundary, and bulk region indices.
177  */
178  const RegionDB &db() {
179  return *db_;
180  }
181 
182 protected:
183  /**
184  * Create accessor from the index. Should be private since implementation specific.
185  * We need some way how to iterate over: all regions, boundary regions, bulk regions -
186  * solution: have specific RegionSets for these three cases.
187  */
188  Region(unsigned int index, const RegionDB &db)
189  : RegionIdx(index), db_(&db)
190  {}
191 
192  /// Global variable with information about all regions.
193  const RegionDB *db_;
194 
195  friend class RegionDB;
196  friend class Mesh;
197 };
198 
199 
200 
201 
202 /**
203  * Type representing a set of regions.
204  * CAn be used to set function(field) on more regions at once, possibly across meshes
205  *
206  * Regions stored in region set are always unique
207  */
209 /// Type representing a map of RegionSets.
211 
212 
213 /**
214  * Class for conversion between an index and string label of an material.
215  * Class contains only static members in order to provide globally consistent
216  * indexing of materials across various meshes and functions.
217  *
218  * The conversion should be performed only through the input and output so
219  * that the lookup overhead could be shadowed by IO operations.
220  *
221  * Taking sizes and creating region sets should be possible only after the database is closed.
222  * We assume that all regions are known at beginning of the program (typically after reading all meshes)
223  * however they need not be used through the whole computation.
224  *
225  * TODO:
226  * In order to support more meshes , possibly changing during the time we need better policy for RegionDB closing.
227  * Currently we close RegionDB at first call to any of @p size methods. We need size information for initialization of
228  * RegionFields. However, every RegionField should be used for assembly over just one mesh (or set of meshes - supermesh?),
229  * surly this mesh has to be initialized before assembly so it could be initialized before initialization of RegionField which
230  * lives on this mesh. So the solution can be: RegionDB keeps list of meshes that has their regions registered in RegionDB.
231  * RegionField has signature of its mesh and check if the mesh is registered in the RegionDB before initialization of REgionField.
232  *
233  * Update TODO:
234  *
235  * - make one instance of Region DB per mesh; put region indices into mesh elements make them private and provide
236  * method that returns Region accessor. ?? Speed concerns? This introduce needless copies of mesh pointer since
237  * in most cases we do not need methods label, id, dim where whole RegionnDB is needed. Thus possibly make
238  * class RegionIdx (without Mesh) and make some asking methods for label, id in RegionDB.
239  * - in RegionDB make support for sets:
240 
241 /// map set name to lists of indices of its regions
242 typedef std::vector<RegionIdx> RegionSet;
243 std::map<std::string, RegionSet > sets_;
244 
245 /// Add region to given set. Creat the set if it does not exist.
246 add_to_set( const string& set_name, RegionIdx region);
247 /// Add a set into map, delete possible previous value, do not worry about slow copies of
248 /// the set array.
249 add_set( const string& set_name, const RegionSet & set);
250 RegionSet union( const string & set_name_1, const string & set_name_2); // sort + std::set_union
251 RegionSet intersection( const string & set_name_1, const string & set_name_2);
252 RegionSet difference( const string & set_name_1, const string & set_name_2);
253 const RegionSet & get_set(const string & set_name);
254 void read_sets_from_input(Input::Record rec); // see structure of RegionDB::get_region_set_input_type()
255 
256 region_sets = [
257  { name="set name",
258  region_ids=[ int ...],
259  region_labels= ["..."], // these are merger together
260 
261  union=["set_1", "set_2"], // later overwrites previous
262  intersection=
263  difference=
264  }
265 ]
266  *
267  * - MODIFICATION IN MESH AND READER:
268  * Mesh reading proccess:
269  * 1) Read PhysicalNames form GMSH file, populate RegionDB (DONE in GMSH reader, may need small modifications)
270  * 2) Read region definitions from the input, see
271  * - Mesh::read_regions_from_input(Input::Array region_list);
272  * 3) Read nodes (DONE in GMSH reader)
273  * 4) Read elements, per element:
274  * - possibly modify region according map
275  * - find element ID:
276  * if found: add_region(ID, get_label, dim, get_boundary_flag) // possibly set dimension of the region if it is undefined
277  * not found: add_region(ID, default_label, dim, false)
278  * - if region is boundary put element into Mesh::bc_elements
279  * else put it into Mesh::element
280  * ---
281  * 5) Setup topology - we has to connect Boundary with existing bc_elements, and add the remaining elements,
282  * after we remove support for old bCD files we may skip creation of remaining boundary elements since there will be no way how to set
283  * BC on them.
284  *
285  */
286 
287 class RegionDB {
288 public:
289  /**
290  * Map representing the relevance of elements to regions
291  */
293 
294  TYPEDEF_ERR_INFO( EI_Label, const std::string);
295  TYPEDEF_ERR_INFO( EI_ID, unsigned int);
296  TYPEDEF_ERR_INFO( EI_IDOfOtherLabel, unsigned int);
297  TYPEDEF_ERR_INFO( EI_LabelOfOtherID, const std::string);
298  DECLARE_INPUT_EXCEPTION( ExcAddingIntoClosed, << "Can not add label=" << EI_Label::qval << " into closed MaterialDispatch.\n");
299  DECLARE_EXCEPTION( ExcNonuniqueID, << "Non-unique ID during add of elementary region id: " << EI_ID::val << ", label: " << EI_Label::qval << "\n" \
300  << "other elementary region with same ID but different label: " << EI_LabelOfOtherID::qval << " already exists\n");
301  DECLARE_INPUT_EXCEPTION( ExcNonuniqueLabel, << "Non-unique label during add of elementary region id: " << EI_ID::val << ", label: " << EI_Label::qval << "\n" \
302  << "other elementary region with same label but different ID: " << EI_IDOfOtherLabel::val << " already exists\n");
303  DECLARE_EXCEPTION( ExcInconsistentBoundary, << "Inconsistent add of elementary region with id: " << EI_ID::val << ", label: " << EI_Label::qval << "\n" \
304  << "both ID and label match an existing elementary region with different boundary flag.");
305 
306  DECLARE_INPUT_EXCEPTION( ExcCantAdd, << "Can not add new elementary region into DB, id: " << EI_ID::val <<", label: " << EI_Label::qval);
307 
308  DECLARE_INPUT_EXCEPTION( ExcUnusedRegion, << "Region with id: " << EI_ID::qval << " and label: " << EI_Label::qval
309  << " is not used in any element." );
310 
311  DECLARE_INPUT_EXCEPTION( ExcUnknownRegion, << "Unknown region with id: " << EI_ID::val );
312 
313  DECLARE_INPUT_EXCEPTION( ExcUnknownSet, << "Operation with unknown region set: " << EI_Label::qval );
314 
315  DECLARE_INPUT_EXCEPTION( ExcUnknownSetOperand, << "Operation with unknown region set: " << EI_Label::qval);
316 
317  DECLARE_INPUT_EXCEPTION(ExcUniqueRegionId, << "Id of elementary region must be unique, id: " << EI_ID::val );
318 
319  /// Default constructor
320  RegionDB();
321 
322  /**
323  * Introduce an artificial limit to keep all material indexed arrays
324  * of reasonable size.
325  */
326  static const unsigned int max_n_regions = 64000;
327 
328  /// Undefined dimension for regions introduced from mesh input record.
329  /// Dimensions 0,1,2,3 are valid.
330  static const unsigned int undefined_dim;
331 
332 
333  /**
334  * This method adds new region into the database and returns its index. This requires full
335  * specification of the region that is given in PhysicalNames section of the GMSH MSH format
336  * or in Mesh input record.
337  *
338  * If ID or label are found in the DB, we distinguish following cases:
339  * 1) ID is found, label is not found : warning ID has already assigned label
340  * 2) ID is not found, label is found : report error - assigning same label to different IDs
341  * 3) both ID and label are found, in same region : check remaining data, return existing region
342  * 4) , in different : warning ID has already assigned label
343  *
344  * Parameter @p id is any unique non-negative integer, parameter @p label is unique string identifier of the region,
345  * @p dim is dimension of reference elements in the region, @p boundary is true if the region consist of boundary elements
346  * (where one can apply boundary condition) and @p address contains source of region (address in input file or section in
347  * mesh file).
348  */
349  Region add_region(unsigned int id, const std::string &label, unsigned int dim, const std::string &address ="implicit");
350 
351  /**
352  * Change label of given Region.
353  */
354  Region rename_region( Region reg, const std::string &new_label );
355 
356  /**
357  * Returns region given the pair of id - dim.
358  * If region doesn't exist, checks if exists region with given id and undefined_dim, replaces
359  * its dimension and returns its. In other cases throws exception.
360  */
361  Region get_region(unsigned int id, unsigned int dim);
362 
363  /**
364  * Returns a @p Region with given @p label. If it is not found it returns @p undefined Region.
365  */
366  Region find_label(const std::string &label) const;
367 
368  /**
369  * Returns a @p Region with given @p id. If it is not found it returns @p undefined Region.
370  * Gmsh ID numbers are unique only over one dimension, so dimension @p dim must be provided as well.
371  */
372  Region find_id(unsigned int id, unsigned int dim) const;
373 
374  /**
375  * Slower version that tries to find region for given ID. If it is not unique it throws.
376  */
377  Region find_id(unsigned int id) const;
378 
379  /**
380  * Return original label for given index @p idx.
381  */
382  const std::string &get_label(unsigned int idx) const;
383 
384  /**
385  * Return original ID for given index @p idx.
386  */
387  unsigned int get_id(unsigned int idx) const;
388 
389  /**
390  * Return dimension of region with given index @p idx.
391  */
392  unsigned int get_dim(unsigned int idx) const;
393 
394  /**
395  * Close this class for adding labels. This is necessary to return correct size
396  * for material indexed arrays and vectors. After calling this method you can
397  * call method @p size and method @p idx_of_label rise an exception for any unknown label.
398  */
399  void close();
400 
401  /**
402  * Returns maximal index + 1
403  */
404  unsigned int size() const;
405 
406  /**
407  * Returns total number boundary regions.
408  */
409  unsigned int boundary_size() const;
410 
411  /**
412  * Returns total number bulk regions.
413  */
414  unsigned int bulk_size() const;
415 
416  /**
417  * Returns implicit boundary region. Is used for boundary elements created by Flow123d itself.
418  * This region has label "IMPLICIT_BOUNDARY" and it is obsolete, the name is not consistent
419  * with boundary label notation.
420  */
421  Region implicit_boundary_region();
422 
423  /*
424  * Add region to given set. Create the set if it does not exist.
425  *
426  * @param set_name Set to which it is added region
427  * @param region Added region
428  */
429  void add_to_set( const string& set_name, Region region);
430 
431  /**
432  * Add a set into map, delete possible previous value.
433  *
434  * @param set_name Name of added set
435  * @param set Added RegionSet
436  */
437  void add_set( const string& set_name, const RegionSet & set);
438 
439  /**
440  * Get region set of specified name. Three sets are defined by default:
441  * "ALL" - set of all regions both bulk and boundary.
442  * "BULK" - set of all bulk regions
443  * "BOUNDARY" - set of all boundary regions
444  *
445  * @param set_name Name of set
446  * @return RegionSet of specified name. Returns Empty vector if the set of given name doesn't exist.
447  */
448  RegionSet get_region_set(const string & set_name) const;
449 
450  /**
451  * Read two operands from input array of strings and check if given names
452  * are existing sets. Return pair of checked set names.
453  */
454  std::vector<string> get_and_check_operands(const Input::Array & operands) const;
455 
456  /**
457  * Print table with base information of all regions stored in RegionDB.
458  */
459  void print_region_table(ostream& stream) const;
460 
461  /**
462  * Create label of region in format: "region_"+id
463  *
464  * Use if label is not set.
465  */
466  string create_label_from_id(unsigned int id) const;
467 
468  /**
469  * Return address for given index @p idx.
470  */
471  const std::string & get_region_address(unsigned int idx) const;
472 
473  /**
474  * Mark region with given index @p idx as used.
475  *
476  * Use if region is assigned to element.
477  */
478  void mark_used_region(unsigned int idx);
479 
480  /**
481  * Create union of RegionSets of given names defined in @p set_names.
482  */
483  RegionSet union_set(std::vector<string> set_names) const;
484 
485 
486 private:
487 
488 
489  typedef std::pair<unsigned int, unsigned int> DimID;
490 
491  /// One item in region database
492  struct RegionItem {
493  RegionItem(unsigned int index, unsigned int id, const std::string &label, unsigned int dim, const std::string &address, bool used=false)
494  : index(index), id(dim, id), label(label), used(used), address(address) {}
495 
496  unsigned int get_id() const {return id.second;}
497  unsigned int dim() const {return id.first;}
498 
499  // unique identifiers
500  unsigned int index;
501  DimID id;
502  std::string label;
503  // Flag signed if region is assigned to element(s)
504  bool used;
505  // Address where region was created (address in input file or section in mesh file)
506  std::string address;
507  };
508 
509  // tags
510  struct DimId {};
511  struct OnlyID {};
512  struct Label {};
513  struct Index {};
514 
515  /// Region database
516  typedef BMI::multi_index_container<
517  RegionItem,
518  BMI::indexed_by<
519  // access by index
520  // Can not use random access without introducing "empty" RegionItems to fill holes in the case
521  // n_boundary != n_bulk. Empty items must be unsince we may have empty (and unmodifiable) holes ?? why)
522  //
523  // we need O(1) access
524  //BMI::random_access< BMI::tag<RandomIndex > >,
525  BMI::ordered_unique< BMI::tag<Index>, BMI::member<RegionItem, unsigned int, &RegionItem::index > >,
526  // use hashing for IDs, to get O(1) find complexity .. necessary for large meshes
527  BMI::hashed_unique< BMI::tag<DimId>, BMI::member<RegionItem, DimID, &RegionItem::id> >,
528  // non unique index for sole ID
529  BMI::hashed_non_unique< BMI::tag<OnlyID>, BMI::const_mem_fun<RegionItem, unsigned int, &RegionItem::get_id> >,
530  // ordered access (like stl::map) by label
531  BMI::ordered_unique< BMI::tag<Label>, BMI::member<RegionItem, std::string, &RegionItem::label> >
532  >
534 
535  // DimID and Label index iterators
536  typedef RegionTable::index<Label>::type::iterator LabelIter;
537  typedef RegionTable::index<DimId>::type::iterator DimIDIter;
538  typedef RegionTable::index<OnlyID>::type::iterator OnlyIDIter;
539 
540 
541  /// Database of all regions (both boundary and bulk).
543 
544  /// flag for closed database, no regions can be added, but you can add region sets
545  bool closed_;
546  /// Number of boundary regions
547  unsigned int n_boundary_;
548  /// Number of bulk regions
549  unsigned int n_bulk_;
550  /// Maximal value of Region::id()
551  unsigned int max_id_;
552 
553  /// Map of region sets
555 
556  /// Make part of general RegionSet table.
557  RegionSet all, bulk, boundary;
558 
559  /**
560  * Implicit bulk and boundary regions. For GMSH mesh format only implicit_boundary is used for boundary elements
561  * that are not explicitly in the mesh file.
562  */
563  Region implicit_bulk_, implicit_boundary_;
564 
565  /**
566  * Represents the relevance of elements to regions. Defined by user in input file.
567  */
568  MapElementIDToRegionID el_to_reg_map_;
569 
570  /**
571  * Insert new region into database.
572  */
573  Region insert_region(unsigned int id, const std::string &label, unsigned int dim, bool boundary, const std::string &address);
574 
575  /**
576  * Replace dimension of existing region with undefined_dim.
577  */
578  Region replace_region_dim(DimIDIter it_undef_dim, unsigned int dim, bool boundary);
579 
580  /**
581  * Find existing region given by pair (dim, id).
582  */
583  Region find_by_dimid(DimIDIter it_id, unsigned int id, const std::string &label, bool boundary);
584 
585  /*
586  * Add region to given set. Create the set if it does not exist.
587  *
588  * @param set_name Set from which it is erased region
589  * @param region Erased region
590  */
591  void erase_from_set( const string& set_name, Region region);
592 
593  /**
594  * Iterate all stored regions and check if regions are assigned to element(s).
595  *
596  * Unused region throws exception.
597  */
598  void check_regions();
599 
600  /**
601  * Return boundary flag for given label. Label of boundary region must start by '.' symbol.
602  */
603  inline bool is_boundary(const std::string &label) {
604  return (label.size() != 0) && (label[0] == '.');
605  }
606 
607  friend class Mesh;
608  friend class RegionSetBase;
609 };
610 
611 
612 
613 #endif /* REGION_HH_ */
std::string address
Definition: region.hh:506
Accessor to input data conforming to declared Array.
Definition: accessors.hh:552
RegionIdx()
Default region is undefined/invalid.
Definition: region.hh:70
bool is_boundary() const
Returns true if it is a Boundary region and false if it is a Bulk region.
Definition: region.hh:73
std::string label
Definition: region.hh:502
std::map< unsigned int, unsigned int > MapElementIDToRegionID
Definition: region.hh:292
TYPEDEF_ERR_INFO(EI_KeyName, const string)
MapElementIDToRegionID el_to_reg_map_
Definition: region.hh:568
RegionSetTable sets_
Map of region sets.
Definition: region.hh:554
Definition: mesh.h:99
static bool comp(const Region &a, const Region &b)
Comparative method of two regions.
Definition: region.hh:162
unsigned int index
Definition: region.hh:500
unsigned int max_id_
Maximal value of Region::id()
Definition: region.hh:551
unsigned int idx_
Definition: region.hh:115
One item in region database.
Definition: region.hh:492
std::vector< Region > RegionSet
Definition: region.hh:208
const RegionDB * db_
Global variable with information about all regions.
Definition: region.hh:193
unsigned int boundary_idx() const
Returns index of the region in the boundary set.
Definition: region.hh:85
#define OLD_ASSERT(...)
Definition: global_defs.h:128
Global macros to enhance readability and debugging, general constants.
unsigned int dim() const
Definition: region.hh:497
Region implicit_bulk_
Definition: region.hh:563
RegionSet bulk
Definition: region.hh:557
BMI::multi_index_container< RegionItem, BMI::indexed_by< BMI::ordered_unique< BMI::tag< Index >, BMI::member< RegionItem, unsigned int,&RegionItem::index > >, BMI::hashed_unique< BMI::tag< DimId >, BMI::member< RegionItem, DimID,&RegionItem::id > >, BMI::hashed_non_unique< BMI::tag< OnlyID >, BMI::const_mem_fun< RegionItem, unsigned int,&RegionItem::get_id > >, BMI::ordered_unique< BMI::tag< Label >, BMI::member< RegionItem, std::string,&RegionItem::label > > > > RegionTable
Region database.
Definition: region.hh:533
RegionType
Definition: region.hh:141
unsigned int get_id() const
Definition: region.hh:496
RegionTable::index< Label >::type::iterator LabelIter
Definition: region.hh:536
RegionItem(unsigned int index, unsigned int id, const std::string &label, unsigned int dim, const std::string &address, bool used=false)
Definition: region.hh:493
bool is_boundary(const std::string &label)
Definition: region.hh:603
unsigned int n_bulk_
Number of bulk regions.
Definition: region.hh:549
std::pair< unsigned int, unsigned int > DimID
Definition: region.hh:489
RegionIdx(unsigned int index)
Definition: region.hh:109
RegionTable::index< OnlyID >::type::iterator OnlyIDIter
Definition: region.hh:538
RegionTable::index< DimId >::type::iterator DimIDIter
Definition: region.hh:537
std::map< std::string, RegionSet > RegionSetTable
Type representing a map of RegionSets.
Definition: region.hh:210
bool operator!=(const RegionIdx &other) const
Equality comparison operators for regions.
Definition: region.hh:99
RegionTable region_table_
Database of all regions (both boundary and bulk).
Definition: region.hh:542
const RegionDB & db()
Definition: region.hh:178
unsigned int bulk_idx() const
Returns index of the region in the bulk set.
Definition: region.hh:90
DECLARE_EXCEPTION(ExcWrongDefault,<< "Default value "<< EI_DefaultStr::qval<< " do not match type: "<< EI_TypeName::qval<< ";\n"<< "During declaration of the key: "<< EI_KeyName::qval)
Region(RegionIdx r_idx, const RegionDB &db)
Definition: region.hh:154
static const unsigned int undefined_dim
Definition: region.hh:330
bool is_valid() const
Returns false if the region has undefined/invalid value.
Definition: region.hh:77
DECLARE_INPUT_EXCEPTION(ExcInputMessage,<< EI_Message::val)
Simple input exception that accepts just string message.
Region(unsigned int index, const RegionDB &db)
Definition: region.hh:188
bool closed_
flag for closed database, no regions can be added, but you can add region sets
Definition: region.hh:545
Region()
Default region is undefined/invalid.
Definition: region.hh:148
bool operator==(const RegionIdx &other) const
Equality comparison operators for regions.
Definition: region.hh:95
unsigned int n_boundary_
Number of boundary regions.
Definition: region.hh:547
unsigned int idx() const
Returns a global index of the region.
Definition: region.hh:81