SheafSystem  0.0.0.0
unstructured_block_builder.h
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Interface for class UNSTRUCTURED_BLOCK_BUILDER
19 
20 #ifndef UNSTRUCTURED_BLOCK_BUILDER_H
21 #define UNSTRUCTURED_BLOCK_BUILDER_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef BASE_SPACE_POSET_H
28 #include "SheafSystem/base_space_poset.h"
29 #endif
30 
31 #ifndef BLOCK_H
32 #include "SheafSystem/block.h"
33 #endif
34 
35 #ifndef STD_UNORDERED_MAP_H
36 #include "SheafSystem/std_unordered_map.h"
37 #endif
38 
39 #ifndef STD_STACK_H
40 #include "SheafSystem/std_stack.h"
41 #endif
42 
43 #ifndef STD_LIST_H
44 #include "SheafSystem/std_list.h"
45 #endif
46 
47 #ifndef SUBPOSET_H
48 #include "SheafSystem/subposet.h"
49 #endif
50 
51 #ifndef ZN_TO_BOOL_H
52 #include "SheafSystem/zn_to_bool.h"
53 #endif
54 
55 namespace sheaf
56 {
57 
58 class poset_member;
59 class triorder_iterator;
60 
61 template<class T>
63 
64 }
65 
66 namespace fiber_bundle
67 {
68 
69 class base_space_member;
70 class unstructured_block;
71 
72  using namespace sheaf;
73 
74 
75 
76 
77 
83 class SHEAF_DLL_SPEC unstructured_block_builder
84 {
85 
86 public:
87 
91  virtual bool invariant() const;
92 
97 
102 
106  typedef std::list<pod_index_type> list_type;
107 
108  //$$TYPE_SAFE_IDS_TODO: Change glue_map_type to use scoped_index..
109 
113  typedef unordered::unordered_map<int, int> glue_map_type;
114 
115  //$$TYPE_SAFE_IDS_ISSUE: Remove when no longer used?
116 
124  void build_block_pa(const base_space_member* xtemplate,
125  const int* xglue,
126  size_type xglue_ub,
127  unstructured_block* result,
128  bool xcompute_upper_cover,
129  bool xauto_access);
130 
138  void build_block_pa(const base_space_member* xtemplate,
139  const scoped_index* xglue,
140  size_type xglue_ub,
141  unstructured_block* result,
142  bool xcompute_upper_cover,
143  bool xauto_access);
144 
150  static void build_block_decomposition(base_space_poset* xmesh,
151  const block<int>& xblock_ids,
152  const block<int>& xblock_dbs,
153  const block<poset_path>& xblock_local_cell_paths,
154  const ragged_array<int>& xblock_nbrs,
155  bool xauto_access);
156 
162  static void build_block_decomposition(base_space_poset* xmesh,
163  const block<int>& xblock_ids,
164  int xblock_db,
165  const poset_path& xblock_local_cell_path,
166  const ragged_array<int>& xblock_nbrs,
167  bool xauto_access);
168 
172  static bool name_mode();
173 
180  static void put_name_mode(bool xmode);
181 
182 private:
183 
187  base_space_member* _template;
188 
192  base_space_poset _template_host;
193 
198  unordered::unordered_map<int, int> _template_map;
199 
203  int _template_db;
204 
208  void initialize_template(const base_space_member* xtemplate);
209 
213  int* _glue;
214 
218  int _glue_ub;
219 
223  int _glue_index;
224 
228  void initialize_glue(const int* xglue, int xglue_ub);
229 
233  unstructured_block* _block;
234 
238  base_space_poset _block_host;
239 
243  subposet _block_mbrs_sp;
244 
248  block<scoped_index> _block_mbrs;
249 
253  void initialize_block(unstructured_block* result);
254 
258  int _boundary_db;
259 
264  bool _template_has_boundary;
265 
269  subposet _boundary_jims;
270 
274  subposet _block_boundaries;
275 
279  void initialize_boundary();
280 
284  block<scoped_index> _dof_tuple_id_map;
285 
289  void initialize_dof_maps();
290 
294  void make_block(bool xcompute_upper_cover);
295 
299  std::stack<list_type*> _used_covers;
300 
304  std::stack<list_type*> _free_covers;
305 
309  void previsit_action(const triorder_iterator& xtmplt_itr, bool& xtruncate);
310 
314  void link_action(const triorder_iterator& xtmplt_itr);
315 
319  void postvisit_action(const triorder_iterator& xtmplt_itr);
320 
328  void make_boundary();
329 
333  void clean_up();
334 
339  void update_boundary(pod_index_type xhub_id);
340 
345  void update_boundary(const scoped_index& xid);
346 
350  static bool _name_mode;
351 
356  static void make_block_neighborhoods(base_space_poset* xmesh,
357  const block<int>& xblock_ids,
358  const ragged_array<int>& xblock_nbrs,
359  const index_space_handle& xid_space);
360 
361 };
362 
363 } // namespace fiber_bundle
364 
365 #endif // ifndef UNSTRUCTURED_BLOCK_BUILDER_H
OBSOLETE: use zone_nodes_block or point_block_*d. A builder object for constructing unstructured bloc...
A client handle for a subposet.
Definition: subposet.h:86
unordered::unordered_map< int, int > glue_map_type
The type of the glue map.
std::list< pod_index_type > list_type
The type of the temporary cover set lists.
A path defined by a poset name and a member name separated by a forward slash (&#39;/&#39;). For example: "cell_definitions/triangle".
Definition: poset_path.h:48
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
OBSOLETE: use zone_nodes_block or point_block_*d. A client handle for a base space member which repre...
A client handle for a member of a base space poset.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
Namespace for the sheaves component of the sheaf system.
A two index array with variable length rows.
Namespace for the fiber_bundles component of the sheaf system.