|
| | TYPEDEF_ERR_INFO (EI_Label, const std::string) |
| |
| | TYPEDEF_ERR_INFO (EI_ID, unsigned int) |
| |
| | TYPEDEF_ERR_INFO (EI_IDOfOtherLabel, unsigned int) |
| |
| | TYPEDEF_ERR_INFO (EI_LabelOfOtherID, const std::string) |
| |
| | DECLARE_EXCEPTION (ExcAddingIntoClosed,<< "Can not add label="<< EI_Label::qval<< " into closed MaterialDispatch.\n") |
| |
| | DECLARE_EXCEPTION (ExcNonuniqueID,<< "Non-unique ID during add of region id: "<< EI_ID::val<< ", label: "<< EI_Label::qval<< "\n"<< "other region with same ID but different label: "<< EI_LabelOfOtherID::qval<< " already exists\n") |
| |
| | DECLARE_EXCEPTION (ExcNonuniqueLabel,<< "Non-unique label during add of region id: "<< EI_ID::val<< ", label: "<< EI_Label::qval<< "\n"<< "other region with same label but different ID: "<< EI_IDOfOtherLabel::val<< " already exists\n") |
| |
| | DECLARE_EXCEPTION (ExcInconsistentBoundary,<< "Inconsistent add of region with id: "<< EI_ID::val<< ", label: "<< EI_Label::qval<< "\n"<< "both ID and label match an existing region with different boundary flag.") |
| |
| | DECLARE_EXCEPTION (ExcInconsistentDimension,<< "Inconsistent add of region with id: "<< EI_ID::val<< ", label: "<< EI_Label::qval<< "\n"<< "both ID and label match an existing region with different dimension.") |
| |
| | DECLARE_EXCEPTION (ExcCantAdd,<< "Can not add new region into DB, id: "<< EI_ID::val<<", label: "<< EI_Label::qval) |
| |
| | DECLARE_EXCEPTION (ExcUnknownSet,<< "Operation with unknown region set: "<< EI_Label::qval) |
| |
| | DECLARE_INPUT_EXCEPTION (ExcUnknownSetOperand,<< "Operation with unknown region set: "<< EI_Label::qval) |
| |
| | TYPEDEF_ERR_INFO (EI_NumOp, unsigned int) |
| |
| | DECLARE_INPUT_EXCEPTION (ExcWrongOpNumber,<< "Wrong number of operands. Expect 2, given: "<< EI_NumOp::val) |
| |
| | RegionDB () |
| | Default constructor. More...
|
| |
| Region | add_region (unsigned int id, const std::string &label, unsigned int dim, bool boundary) |
| |
| Region | add_region (unsigned int id, const std::string &label, unsigned int dim) |
| |
| Region | add_region (unsigned int id, unsigned int dim) |
| |
| Region | find_label (const std::string &label) const |
| |
| Region | find_id (unsigned int id) const |
| |
| const std::string & | get_label (unsigned int idx) const |
| |
| unsigned int | get_id (unsigned int idx) const |
| |
| unsigned int | get_dim (unsigned int idx) const |
| |
| void | close () |
| |
| unsigned int | size () const |
| |
| unsigned int | boundary_size () const |
| |
| unsigned int | bulk_size () const |
| |
| Region | implicit_boundary_region () |
| |
| void | add_to_set (const string &set_name, Region region) |
| |
| void | add_set (const string &set_name, const RegionSet &set) |
| |
| RegionSet | union_sets (const string &set_name_1, const string &set_name_2) |
| |
| RegionSet | intersection (const string &set_name_1, const string &set_name_2) |
| |
| RegionSet | difference (const string &set_name_1, const string &set_name_2) |
| |
| RegionSet | get_region_set (const string &set_name) const |
| |
| void | read_sets_from_input (Input::Array arr) |
| |
| void | read_regions_from_input (Input::Array region_list, MapElementIDToRegionID &map) |
| |
Class for conversion between an index and string label of an material. Class contains only static members in order to provide globally consistent indexing of materials across various meshes and functions.
The conversion should be performed only through the input and output so that the lookup overhead could be shadowed by IO operations.
Taking sizes and creating region sets should be possible only after the database is closed. We assume that all regions are known at beginning of the program (typically after reading all meshes) however they need not be used through the whole computation.
TODO: In order to support more meshes , possibly changing during the time we need better policy for RegionDB closing. Currently we close RegionDB at first call to any of size methods. We need size information for initialization of RegionFields. However, every RegionField should be used for assembly over just one mesh (or set of meshes - supermesh?), surly this mesh has to be initialized before assembly so it could be initialized before initialization of RegionField which lives on this mesh. So the solution can be: RegionDB keeps list of meshes that has their regions registered in RegionDB. RegionField has signature of its mesh and check if the mesh is registered in the RegionDB before initialization of REgionField.
Update TODO:
- make one instance of Region DB per mesh; put region indices into mesh elements make them private and provide method that returns Region accessor. ?? Speed concerns? This introduce needless copies of mesh pointer since in most cases we do not need methods label, id, dim where whole RegionnDB is needed. Thus possibly make class RegionIdx (without Mesh) and make some asking methods for label, id in RegionDB.
- in RegionDB make support for sets:
/ map set name to lists of indices of its regions typedef std::vector<RegionIdx> RegionSet; std::map<std::string, RegionSet > sets_;
/ Add region to given set. Creat the set if it does not exist. add_to_set( const string& set_name, RegionIdx region); / Add a set into map, delete possible previous value, do not worry about slow copies of / the set array. add_set( const string& set_name, const RegionSet & set); RegionSet union( const string & set_name_1, const string & set_name_2); // sort + std::set_union RegionSet intersection( const string & set_name_1, const string & set_name_2); RegionSet difference( const string & set_name_1, const string & set_name_2); const RegionSet & get_set(const string & set_name); void read_sets_from_input(Input::Record rec); // see structure of RegionDB::region_set_input_type
region_sets = [ { name="set name", region_ids=[ int ...], region_labels= ["..."], // these are merger together
union=["set_1", "set_2"], // later overwrites previous intersection= difference= } ]
- MODIFICATION IN MESH AND READER: Mesh reading proccess: 1) Read PhysicalNames form GMSH file, populate RegionDB (DONE in GMSH reader, may need small modifications) 2) Read region definitions from the input, see
typedef std::map<unsigned int, unsigned int> MapElementIDToRegionID; RegionDB::read_regions_from_input(Input::Array region_list, MapElementIDToRegionID &map);
(TODO in RegionDB, also creates (and return to Mesh) element regions modification map: std::map< unsigned int, RegionIdx>
that maps element IDs to the new region names, GMSH reader should have setter method to accept this map
and modify the elements during reading)
3) Read region sets - TODO in RegionDB 4) Read boundary key of the Mesh record and mark appropriate regions as boundary (TODO in RegionDB) 5) Read nodes (DONE in GMSH reader) 6) Read elements, per element:
- possibly modify region according map
- find element ID: if found: add_region(ID, get_label, dim, get_boundary_flag) // possibly set dimension of the region if it is undefined not found: add_region(ID, default_label, dim, false)
- if region is boundary put element into Mesh::bc_elements
7) Setup topology - we has to connect Boundary with existing bc_elements, and add the remaining elements, 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 BC on them.
Definition at line 296 of file region.hh.