21#include "rheolef/geo.h"
22#include "rheolef/geo_domain.h"
23#include "rheolef/rheostream.h"
24#include "rheolef/iorheo.h"
25#include "rheolef/rheostream.h"
29template <
class T> idiststream&
geo_get_vtk (idiststream& ips, geo_basic<T,sequential>& omega);
30template <
class T> idiststream&
geo_get_bamg (idiststream& ips, geo_basic<T,sequential>& omega);
44 base::operator= (ptr);
55 if (map_dimension() <= side_dim)
return;
63 for (
const_iterator iter = begin(side_dim), last = end(side_dim); iter != last; iter++, isid++) {
65 for (
size_type iloc = 0, nloc = S.
size(); iloc < nloc; iloc++) {
79 for (
size_type dim = side_dim+1; dim <= base::_gs._map_dimension; dim++) {
80 for (
iterator iter = begin(dim), last = end(dim); iter != last; iter++) {
82 for (
size_type loc_isid = 0, loc_nsid = K.
n_subgeo(side_dim); loc_isid < loc_nsid; loc_isid++) {
86 for (
size_type sid_jloc = 1, sid_nloc = K.
subgeo_size (side_dim, loc_isid); sid_jloc < sid_nloc; sid_jloc++) {
92 check_macro (isid_set.size() == 1,
"connectivity: side not found in the side set");
94 const geo_element& S = get_geo_element(side_dim,isid);
131 istream& is = ips.
is();
136 ips >> base::_version;
137 check_macro (base::_version == 4,
"mesh format version 4 expected, but format version " << base::_version <<
" founded");
140 bool do_upgrade = iorheo::getupgrade(is);
142 return get_upgrade (ips, hdr);
144 return get_standard (ips, hdr);
153 istream& is = ips.
is();
157 base::_have_connectivity =
true;
158 base::_name =
"unnamed";
162 base::_piola_basis.reset_family_index (hdr.
order);
170 base::_node.resize (nnod);
171 if (base::_dimension > 0) {
175 base::_gs.node_ownership = base::_node.ownership();
179 if (base::_gs._map_dimension > 0) {
184 base::_geo_element [variant].get_values (ips);
185 base::_gs.ownership_by_variant [variant] = base::_geo_element [variant].ownership();
187 base::_gs.ownership_by_dimension [base::_gs._map_dimension] =
distributor (n_elt, base::comm(), n_elt);
194 std::vector<size_type> node_subgeo_dim (nnod,
size_type(-1));
196 for (
iterator iter = begin(base::_gs._map_dimension), last = end(base::_gs._map_dimension); iter != last; iter++) {
198 check_macro (prev_variant <= K.
variant(),
"elements should be numbered by increasing variants (petqTPH)");
200 for (
size_type d = 0;
d <= base::_gs._map_dimension;
d++) {
202 node_subgeo_dim [K[loc_inod]] =
d;
207 for (
typename std::vector<size_type>::const_iterator iter = node_subgeo_dim.begin(), last = node_subgeo_dim.end();
208 iter != last; iter++) {
209 check_macro (prev_node_dim <= *iter,
"nodes should be numbered by increasing subgeo dimension");
210 prev_node_dim = *iter;
217 if (base::_gs._map_dimension == 0) {
220 std::vector<size_t> is_vertex (nnod, 0);
222 for (
iterator iter = begin(base::_gs._map_dimension), last = end(base::_gs._map_dimension); iter != last; iter++, ie++) {
226 if (base::order() > 1) {
227 for (
size_type iloc = 0, nloc = K.
size(); iloc < nloc; iloc++) {
228 is_vertex [K[iloc]] = 1;
232 if (base::order() == 1) {
235 n_vert = accumulate (is_vertex.begin(), is_vertex.end(), 0);
243 size_type first_iv = base::_node.ownership().first_index();
246 for (
iterator iter = begin(0), last = end(0); iter != last; iter++, iv++) {
248 P[0] = first_iv + iv;
259 if (base::_gs._map_dimension > 0) {
261 for (
size_type side_dim = base::_gs._map_dimension - 1; side_dim >= 1; side_dim--) {
266 base::_geo_element [variant].get_values (ips);
267 base::_gs.ownership_by_variant [variant] = base::_geo_element [variant].ownership();
270 base::_gs.ownership_by_dimension [side_dim] =
distributor (nsid, base::comm(), nsid);
272 for (
iterator iter = begin(side_dim), last = end(side_dim); iter != last; iter++, isid++) {
282 vector<index_set> ball [4];
284 while (dom.get (ips, *
this, ball)) {
285 base::_domains.push_back (dom);
290 set_element_side_index (1);
291 set_element_side_index (2);
295 base::compute_bbox();
304 std::ofstream os ((name +
"-dump.geo").c_str());
305 odiststream ods (os, base::_node.ownership().comm());
316 ips.
open (filename,
"geo");
317 check_macro(ips.
good(),
"\"" << filename <<
"[.geo[.gz]]\" not found.");
field::size_type size_type
see the communicator page for the full documentation
see the disarray page for the full documentation
see the distributor page for the full documentation
the finite element boundary domain
base class for M=sequential or distributed meshes representations
generic mesh with rerefence counting
void set(orientation_type orient, size_type ige, size_type shift=0)
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
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
const geo_element_indirect & edge_indirect(size_type i) const
variant_type variant() const
orientation_type get_edge_orientation(size_type dis_iv0, size_type dis_iv1) const
geo_element_indirect::shift_type shift_type
size_type n_subgeo(size_type subgeo_dim) const
const geo_element_indirect & face_indirect(size_type i) const
size_type last_inod(size_type subgeo_dim) const
void set_dis_ie(size_type dis_ie)
base::size_type size_type
base::const_iterator const_iterator
sequential mesh representation
idiststream: see the diststream page for the full documentation
void open(std::string filename, std::string suffix="", const communicator &comm=communicator())
This routine opens a physical input file.
const communicator & comm() const
void inplace_intersection(const index_set &b)
std::bitset< last > flag_type
static flag_type format_field
odiststream: see the diststream page for the full documentation
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
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.
string delete_suffix(const string &name, const string &suffix)
delete_suffix: see the rheostream page for the full documentation
idiststream & geo_get_bamg(idiststream &ips, geo_basic< T, sequential > &omega)
string get_basename(const string &name)
get_basename: see the rheostream page for the full documentation
idiststream & geo_get_vtk(idiststream &ips, geo_basic< T, sequential > &omega)
bool dis_scatch(idiststream &ips, const communicator &comm, std::string ch)
distributed version of scatch(istream&,string)