21#include "rheolef/domain_indirect.h"
22#include "rheolef/geo.h"
23#include "rheolef/rheostream.h"
33 const std::string& name,
35 const communicator& comm,
36 const std::vector<size_type>& ie_list)
43 for (std::vector<size_type>::const_iterator iter = ie_list.begin(),
45 iter != last; iter++, oige_iter++) {
46 (*oige_iter).set (1, *iter);
60 "union: domains "<<a._name<<
" and " << b._name <<
" have incompatible dimensions");
61 _name = a._name +
"+" + b._name;
62 _map_dim = a._map_dim;
64 std::map<size_type,geo_element_indirect> c_map;
66 iter = a.begin(), last = a.end(); iter != last; ++iter) {
71 iter = b.begin(), last = b.end(); iter != last; ++iter) {
78 for (
typename std::map<size_type,geo_element_indirect>::const_iterator
79 iter = c_map.begin(), last = c_map.end(); iter != last; ++iter, ++oige_iter) {
80 *oige_iter = (*iter).second;
89 ops <<
"domain" << endl
90 << base::_name << endl
91 <<
"2 " << base::_map_dim <<
" " << size() << endl;
101 const std::vector<index_set>& ball,
106 if (S.
size() == 0)
return;
107 contains_S = ball[S[0]];
120 std::vector<index_set> *ball)
122 std::istream& is = ips.
is();
123 if (!
scatch(is,
"\ndomain")) {
124 is.setstate (std::ios::badbit);
128 is >> base::_name >> version >> base::_map_dim >> n_side;
129 check_macro (version <= 2,
"unexpected domain format version="<<version);
130 if (version == 2 || base::_map_dim == 0) {
136 for (
size_type ioige = 0, noige = size(); ioige < noige; ioige++) {
138 const geo_element& S = omega.get_geo_element (base::_map_dim, ige);
139 check_macro (prev_variant <= S.
variant(),
"elements should be sorted by increasing variant order");
145 check_macro (version == 1,
"unexpected domain format version="<<version);
146 check_macro (base::_map_dim <= omega.dimension(),
"unexpected domain dimension="
147 <<base::_map_dim<<
" > geometry dimension = " << omega.dimension());
157 disarray_t d_tmp (n_side, elem_init);
158 d_tmp.get_values (ips);
159 build_from_data (omega, d_tmp, ball);
168 std::vector<index_set>* ball)
174 if (d_tmp.size() == 0)
return;
175 base::_map_dim = d_tmp[0].dimension();
177 if (ball [base::_map_dim].size() == 0) {
178 ball [base::_map_dim].resize (omega.n_vertex());
179 for (
size_type ige = 0, nge = omega.geo_element_ownership(base::_map_dim).size(); ige < nge; ige++) {
180 const geo_element& E = omega.get_geo_element (base::_map_dim,ige);
182 ball [base::_map_dim] [E[iloc]] += ige;
186 disarray_t::const_iterator q = d_tmp.begin();
188 for (
iterator_ioige p = ioige_begin(), last = ioige_end();
p != last; ++
p, ++q) {
190 check_macro (prev_variant <= S.
variant(),
"elements should be sorted by increasing variant order");
194 check_macro (contains_S.size() >= 1,
"domain element not in mesh: S.dis_ie=" << S.
dis_ie());
195 check_macro (contains_S.size() <= 1,
"problem with domain element: S.dis_ie=" << S.
dis_ie());
197 size_type i_side = *(contains_S.begin());
198 const geo_element& S_orig = omega.get_geo_element (base::_map_dim, i_side);
202 "problem with domain element: S.dis_ie=" << S.
dis_ie());
203 (*p).set (orient, i_side, shift);
211 std::vector<index_set>* ball)
215 "build a domain for a geo_domain: not yet");
217 data().build_from_data (omega_data, d_tmp, ball);
227 std::vector<index_set> *ball);
235 std::vector<index_set>* ball);
238domain_indirect_basic<sequential>::domain_indirect_basic (
242 std::vector<index_set>* ball);
244#define _RHEOLEF_instanciation(M) \
245template class domain_indirect_base_rep<M>; \
248#ifdef _RHEOLEF_HAVE_MPI
#define _RHEOLEF_instanciation(T, M, A)
field::size_type size_type
see the disarray page for the full documentation
rep::base::const_iterator const_iterator
rep::base::iterator iterator
see the distributor page for the full documentation
static const size_type decide
void build_from_list(const std::string &name, size_type map_dim, const communicator &comm, const std::vector< size_type > &ie_list)
void build_union(const domain_indirect_base_rep< M > &a, const domain_indirect_base_rep< M > &b)
geo_element_indirect::size_type size_type
the finite element boundary domain
base::size_type size_type
base::iterator_ioige iterator_ioige
abstract base interface class
generic mesh with rerefence counting
see the geo_element page for the full documentation
geo_element_indirect::orientation_type orientation_type
bool get_orientation_and_shift(const geo_element &S, orientation_type &orient, shift_type &shift) const
return orientation and shift between *this element and S
reference_element::size_type size_type
variant_type variant() const
geo_element_indirect::shift_type shift_type
sequential mesh representation
idiststream: see the diststream page for the full documentation
void inplace_intersection(const index_set &b)
odiststream: see the diststream page for the full documentation
see the smart_pointer page for the full documentation
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
bool scatch(std::istream &in, const std::string &ch, bool full_match=true)
scatch: see the rheostream page for the full documentation
void build_set_that_contains_S(const geo_element &S, const std::vector< index_set > &ball, index_set &contains_S)
builds a set of elements that all contain S.