20 #include "SheafSystem/adjacency_extractor.h" 21 #include "SheafSystem/connectivity_extractor.h" 22 #include "SheafSystem/id_map.h" 23 #include "SheafSystem/namespace_poset.h" 24 #include "SheafSystem/neighborhood_extractor.h" 25 #include "SheafSystem/postorder_member_iterator.h" 26 #include "SheafSystem/std_iostream.h" 27 #include "SheafSystem/stencil_extractor.h" 28 #include "SheafSystem/storage_agent.h" 34 char* sp_names[3] = {
const_cast<char *
>(
"__vertices"),
35 const_cast<char *>(
"__edges"),
36 const_cast<char *
>(
"__elements")};
40 init_id_array(
poset* mesh,
const string& sp_name,
int* domain_mbrs)
44 id_map* id_map = sp.id_map();
49 domain_mbrs[i++] = id_map->domain_id(itr.item().index());
53 sp.detach_from_state();
58 print_it(
int* ids,
int* ids_cts,
int* domain_mbrs,
int domain_mbrs_ct)
63 for(
int i=0; i<domain_mbrs_ct; i++)
65 cout <<
"mbr= " << setw(5) << domain_mbrs[i] <<
" ids=";
67 for(
int j=0; j<ids_cts[i]; j++)
69 cout <<
" " << setw(5) << *ids_p;
79 query_connectivity(
poset* mesh,
int upper_level,
int lower_level,
bool use_poset_api)
87 string ll_name(sp_names[lower_level]);
88 string ul_name(sp_names[upper_level]);
91 cout <<
"connectivity for " << ll_name <<
" and " << ul_name << endl;
95 connectivity_extractor ae(mesh, ll_name, ul_name);
100 int domain_mbrs_ct = ae.domain_mbrs_ct();
101 int conn_cts_ct = ae.connectivity_cts_ct();
102 int conn_ct = ae.connectivity_ct();
106 int* domain_mbrs =
new int[domain_mbrs_ct];
107 int* conn_cts =
new int[conn_cts_ct];
108 int* conn =
new int[conn_ct];
116 ae.extract(mesh_top, domain_mbrs, domain_mbrs_ct, conn_cts, conn_cts_ct, conn, conn_ct);
127 init_id_array(mesh, ul_name, domain_mbrs);
129 ae.extract(domain_mbrs, domain_mbrs_ct, conn_cts, conn_cts_ct, conn, conn_ct);
134 print_it(conn, conn_cts, domain_mbrs, domain_mbrs_ct);
140 query_adjacency(
poset* mesh,
int upper_level,
int lower_level,
bool use_poset_api)
148 string ul_name(sp_names[upper_level]);
149 string ll_name(sp_names[lower_level]);
151 cout << endl << endl;
152 cout <<
"adjacency for " << ll_name <<
" and " << ul_name << endl;
156 adjacency_extractor ae(mesh, ll_name, ul_name);
161 int domain_mbrs_ct = ae.domain_mbrs_ct();
162 int adj_cts_ct = ae.adjacency_cts_ct();
163 int adj_ct = ae.adjacency_ct();
167 int* domain_mbrs =
new int[domain_mbrs_ct];
168 int* adj_cts =
new int[adj_cts_ct];
169 int* adj =
new int[adj_ct];
177 ae.extract(mesh_top, domain_mbrs, domain_mbrs_ct, adj_cts, adj_cts_ct, adj, adj_ct);
188 init_id_array(mesh, ll_name, domain_mbrs);
190 ae.extract(domain_mbrs, domain_mbrs_ct, adj_cts, adj_cts_ct, adj, adj_ct);
196 print_it(adj, adj_cts, domain_mbrs, domain_mbrs_ct);
201 query_neighborhood(
poset* mesh,
204 bool includes_center,
213 string ll_name(sp_names[lower_level]);
214 string ul_name(sp_names[upper_level]);
216 cout << endl << endl;
217 cout <<
"neighborhood for " << ll_name <<
" and " << ul_name << endl;
221 neighborhood_extractor ae(mesh, ll_name, ul_name, includes_center);
226 int domain_mbrs_ct = ae.domain_mbrs_ct();
227 int nbr_cts_ct = ae.neighborhood_cts_ct();
228 int nbr_ct = ae.neighborhood_ct();
232 int* domain_mbrs =
new int[domain_mbrs_ct];
233 int* nbr_cts =
new int[nbr_cts_ct];
234 int* nbr =
new int[nbr_ct];
242 ae.extract(mesh_top, domain_mbrs, domain_mbrs_ct, nbr_cts, nbr_cts_ct, nbr, nbr_ct);
253 init_id_array(mesh, ul_name, domain_mbrs);
255 ae.extract(domain_mbrs, domain_mbrs_ct, nbr_cts, nbr_cts_ct, nbr, nbr_ct);
261 print_it(nbr, nbr_cts, domain_mbrs, domain_mbrs_ct);
268 query_stencil(
poset* mesh,
271 bool includes_center,
280 string ll_name(sp_names[lower_level]);
281 string ul_name(sp_names[upper_level]);
283 cout << endl << endl;
284 cout <<
"stencil for " << ll_name <<
" and " << ul_name << endl;
288 stencil_extractor ae(mesh, ll_name, ul_name, includes_center);
293 int domain_mbrs_ct = ae.domain_mbrs_ct();
294 int sten_cts_ct = ae.stencil_cts_ct();
295 int sten_ct = ae.stencil_ct();
299 int* domain_mbrs =
new int[domain_mbrs_ct];
300 int* sten_cts =
new int[sten_cts_ct];
301 int* sten =
new int[sten_ct];
309 ae.extract(mesh_top, domain_mbrs, domain_mbrs_ct, sten_cts, sten_cts_ct, sten, sten_ct);
320 init_id_array(mesh, ll_name, domain_mbrs);
322 ae.extract(domain_mbrs, domain_mbrs_ct, sten_cts, sten_cts_ct, sten, sten_ct);
328 print_it(sten, sten_cts, domain_mbrs, domain_mbrs_ct);
335 const string& mesh_name,
345 query_connectivity(mesh, 2, 0,
false);
347 query_connectivity(mesh, 2, 0,
true);
351 query_connectivity(mesh, 2, 1,
false);
353 query_connectivity(mesh, 2, 1,
true);
357 query_connectivity(mesh, 1, 0,
false);
359 query_connectivity(mesh, 1, 0,
true);
363 query_adjacency(mesh, 2, 0,
false);
365 query_adjacency(mesh, 2, 0,
true);
369 query_adjacency(mesh, 2, 1,
false);
371 query_adjacency(mesh, 2, 1,
true);
375 query_adjacency(mesh, 1, 0,
false);
377 query_adjacency(mesh, 1, 0,
true);
381 query_neighborhood(mesh, 2, 0,
false,
false);
383 query_neighborhood(mesh, 2, 0,
true,
true);
387 query_neighborhood(mesh, 2, 1,
false,
false);
389 query_neighborhood(mesh, 2, 1,
true,
true);
393 query_neighborhood(mesh, 1, 0,
false,
false);
395 query_neighborhood(mesh, 1, 0,
true,
true);
399 query_stencil(mesh, 2, 0,
false,
false);
401 query_stencil(mesh, 2, 0,
true,
true);
405 query_stencil(mesh, 2, 1,
false,
false);
407 query_stencil(mesh, 2, 1,
true,
true);
411 query_stencil(mesh, 1, 0,
false,
false);
413 query_stencil(mesh, 1, 0,
true,
true);
419 main(
int argc,
char** argv)
431 cerr <<
"usage: query_mesh sheaf_file mesh_name [use_poset_api]\n";
435 bool use_poset_api = argc > 3;
445 query_mesh(&ns, mesh_name, use_poset_api);
A client handle for a subposet.
abstract_poset_member & top()
The top member of the poset (mutable version)
The default name space; a poset which contains other posets as members.
A client handle for a mutable partially ordered set.
virtual void get_read_access() const
Get read access to the state associated with this.
virtual void next()
Makes this the next member of the iteration.
virtual void get_read_access() const
Get read access to the state associated with this.
An abstract client handle for a member of a poset.
Namespace for the fiber_bundles component of the sheaf system.
Agent responsible for importing and exporting posets from an external name space which resides on dis...