1 #include "rheolef/geo.h"
22 #include "rheolef/geo_domain.h"
23 #include "rheolef/rheostream.h"
24 #include "rheolef/iorheo.h"
25 #include "rheolef/space_numbering.h"
43 typedef typename disarray_t::const_iterator const_iterator_by_variant_tmp;
46 build_connectivity_sides (
map_dim-1, tmp_geo_element);
47 build_connectivity_sides (
map_dim-2, tmp_geo_element);
57 typedef typename disarray_t::const_iterator const_iterator_by_variant_tmp;
58 if (side_dim == 0)
return;
75 for (const_iterator_by_variant_tmp iter = tmp_geo_element [
variant].begin(),
76 last = tmp_geo_element [
variant].end();
77 iter != last; iter++) {
80 for (
size_type loc_isid = 0, loc_nsid = K.
n_subgeo(side_dim); loc_isid < loc_nsid; loc_isid++) {
85 for (
size_type sid_jloc = 1, sid_nloc = K.
subgeo_size (side_dim, loc_isid); sid_jloc < sid_nloc; sid_jloc++) {
91 check_macro (isid_set.size() <= 1,
"connectivity problem");
92 if (isid_set.size() == 1) {
96 for (
size_type sid_jloc = 0, sid_nloc = K.
subgeo_size (side_dim, loc_isid); sid_jloc < sid_nloc; sid_jloc++) {
101 size_by_variant [S_variant]++;
115 tmp_geo_element [side_variant].resize (size_by_variant [side_variant], init_val);
116 base::_gs.ownership_by_variant [side_variant] = tmp_geo_element [side_variant].ownership();
117 first_by_variant [side_variant+1] = first_by_variant [side_variant] + size_by_variant [side_variant];
120 base::_gs.ownership_by_dimension [side_dim] =
distributor (nsid, base::comm(), nsid);
133 for (const_iterator_by_variant_tmp iter = tmp_geo_element [
variant].begin(),
134 last = tmp_geo_element [
variant].end();
135 iter != last; iter++) {
138 for (
size_type loc_isid = 0, loc_nsid = K.
n_subgeo(side_dim); loc_isid < loc_nsid; loc_isid++) {
143 for (
size_type sid_jloc = 1, sid_nloc = K.
subgeo_size (side_dim, loc_isid); sid_jloc < sid_nloc; sid_jloc++) {
149 check_macro (isid_set.size() <= 1,
"connectivity problem");
150 if (isid_set.size() == 1) {
154 for (
size_type sid_jloc = 0, sid_nloc = K.
subgeo_size (side_dim, loc_isid); sid_jloc < sid_nloc; sid_jloc++) {
159 size_type isid_by_variant = count_by_variant [S_variant];
160 count_by_variant [S_variant]++;
165 size_type ige = first_by_variant[S_variant] + isid_by_variant;
170 for (
size_type sid_jlocnod = 0, sid_nlocnod = S_n_node; sid_jlocnod < sid_nlocnod; sid_jlocnod++) {
173 S[sid_jlocnod] = jnod;
176 tmp_geo_element [S_variant][isid_by_variant] = S;
193 check_macro (ips.good(),
"bad input stream for geo.");
194 istream& is = ips.is();
202 check_macro (ips.good(),
"bad input stream for geo.");
209 std::array<disarray_t, reference_element::max_variant> tmp_geo_element;
215 tmp_geo_element [
variant].get_values (ips);
216 check_macro (ips.good(),
"bad input stream for geo.");
222 bool do_upgrade = iorheo::getupgrade(is);
223 build_from_data (hdr, node, tmp_geo_element, do_upgrade);
227 vector<index_set> ball [4];
229 while (dom.
get (ips, *
this, ball)) {
230 base::_domains.push_back (dom);
246 typedef typename disarray_t::const_iterator const_iterator_by_variant_tmp;
247 typedef typename disarray_t::iterator iterator_by_variant_tmp;
251 base::_have_connectivity =
false;
253 base::_name =
"unnamed";
257 base::_piola_basis.reset_family_index (hdr.
order);
266 base::_gs.node_ownership = base::_node.ownership();
274 if (base::_gs._map_dimension > 0) {
277 base::_gs.ownership_by_variant [
variant] = tmp_geo_element [
variant].ownership();
279 base::_gs.ownership_by_dimension [base::_gs._map_dimension] =
distributor (n_elt, base::comm(), n_elt);
283 std::vector<size_type> node_subgeo_dim (
nnod,
size_type(-1));
287 for (const_iterator_by_variant_tmp iter = tmp_geo_element [
variant].begin(),
288 last = tmp_geo_element [
variant].end();
289 iter != last; iter++) {
292 check_macro (prev_variant <= K.
variant(),
"elements should be numbered by increasing variants (petqTPH)");
294 for (
size_type d = 0;
d <= base::_gs._map_dimension;
d++) {
296 check_macro (K[loc_inod] <
nnod,
"inod K["<<loc_inod<<
"]="<<K[loc_inod]
297 <<
" is out of range [0:"<<
nnod<<
"[; K.dis_ie="<<K.
dis_ie());
298 node_subgeo_dim [K[loc_inod]] =
d;
305 for (
typename std::vector<size_type>::const_iterator iter = node_subgeo_dim.begin(), last = node_subgeo_dim.end();
306 iter != last; iter++, i_curr_node++) {
307 check_macro (prev_node_dim <= *iter,
"nodes should be numbered by increasing subgeo dimension (prev="
308 << prev_node_dim <<
" > subgeo_dim(node("<<i_curr_node<<
"))=" << *iter <<
")");
309 prev_node_dim = *iter;
314 if (base::_gs._map_dimension == 0) {
317 vector<size_t> is_vertex (
nnod, 0);
321 for (iterator_by_variant_tmp iter = tmp_geo_element [
variant].begin(),
322 last = tmp_geo_element [
variant].end();
323 iter != last; iter++, ie++) {
329 for (
size_type iloc = 0, nloc = K.
size(); iloc < nloc; iloc++) {
330 is_vertex [K[iloc]] = 1;
338 n_vert = accumulate (is_vertex.begin(), is_vertex.end(), 0);
347 size_type first_iv = base::_node.ownership().first_index();
351 iter != last; iter++, iv++) {
353 P[0] = first_iv + iv;
364 build_connectivity (tmp_geo_element);
374 base::_geo_element [
variant].resize (tmp_geo_element [
variant].size(), param);
377 for (const_iterator_by_variant_tmp iter = tmp_geo_element [
variant].begin(),
378 last = tmp_geo_element [
variant].end();
379 iter != last; iter++, iter2++) {
388 set_element_side_index (1);
389 set_element_side_index (2);
395 std::vector<size_type> inod2new_inod (base::_node.size(), std::numeric_limits<size_type>::max());
396 std::vector<size_t> K_new_inod;
400 const_iterator_by_variant_tmp tmp_iter = tmp_geo_element [
variant].begin();
402 last = base::_geo_element [
variant].end();
403 iter != last; iter++, tmp_iter++) {
410 size_type new_inod = K_new_inod [loc_inod];
411 if (inod2new_inod [inod] != std::numeric_limits<size_type>::max())
continue;
412 inod2new_inod [inod] = new_inod;
417 #ifdef _RHEOLEF_PARANO
419 std::vector<size_type> new_inod2inod (base::_node.size(), std::numeric_limits<size_type>::max());
421 check_macro (inod2new_inod [inod] <
nnod,
"invalid renumbering: inod2new_inod ["<<inod<<
"] = "
422 << inod2new_inod [inod] <<
" is out of range [0:"<<
nnod<<
"[");
423 new_inod2inod [inod2new_inod [inod]] = inod;
426 check_macro (new_inod2inod [inod2new_inod [inod]] == inod,
"invalid permutation");
432 size_type new_inod = inod2new_inod [inod];
433 new_node [new_inod] = base::_node [inod];
435 base::_node = new_node;
440 if (! base::_have_connectivity && ! do_upgrade) {
441 warning_macro (
"mesh without connectivity is obsolete (HINT: see geo -upgrade)");
444 base::_have_connectivity =
true;
see the disarray page for the full documentation
see the distributor page for the full documentation
idiststream & get(idiststream &ips, const geo_rep< T, sequential > &omega, std::vector< index_set > *ball)
geo_element_hack::size_type size_type
hack_array< geo_element_hack >::iterator iterator_by_variant
hack_array< geo_element_hack >::const_iterator const_iterator_by_variant
base class for M=sequential or distributed meshes representations
void reset(variant_type variant, size_type order)
see the geo_element page for the full documentation
size_type subgeo_n_node(size_type subgeo_dim, size_type loc_isid) const
size_type subgeo_local_vertex(size_type subgeo_dim, size_type i_subgeo, size_type i_subgeo_vertex) const
size_type first_inod(size_type subgeo_dim) const
void set_ios_dis_ie(size_type ios_dis_ie)
size_type subgeo_size(size_type subgeo_dim, size_type loc_isid) const
variant_type variant() const
size_type & node(size_type loc_inod)
size_type n_subgeo(size_type subgeo_dim) const
size_type subgeo_local_node(size_type subgeo_dim, size_type loc_isid, size_type loc_jsidnod) const
size_type last_inod(size_type subgeo_dim) const
void set_dis_ie(size_type dis_ie)
sequential mesh representation
void inplace_intersection(const index_set &b)
static const variant_type max_variant
static variant_type last_variant_by_dimension(size_type dim)
static variant_type first_variant_by_dimension(size_type dim)
static const variant_type p
variant_type variant() const
static std::set< size_t > empty_set
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
void dis_idof(const basis_basic< T > &b, const geo_size &gs, const geo_element &K, typename std::vector< size_type >::iterator dis_idof_tab)
size_type nnod(const basis_basic< T > &b, const geo_size &gs, size_type map_dim)
This file is part of Rheolef.
void compute_bbox(const geo_base_rep< T, M > &omega, const geo_element &K, point_basic< T > &xmin, point_basic< T > &xmax)