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