Rheolef  7.1
an efficient C++ finite element environment
geo_seq_put.cc
Go to the documentation of this file.
1 #include "rheolef/geo.h"
22 #include "rheolef/geo_domain.h"
23 #include "rheolef/rheostream.h"
24 #include "rheolef/iorheo.h"
25 
26 namespace rheolef {
27 
28 // external graphic drivers:
29 template <class T> odiststream& visu_gnuplot (odiststream&, const geo_basic<T,sequential>&);
30 template <class T> odiststream& visu_vtk_paraview (odiststream&, const geo_basic<T,sequential>&);
31 template <class T> odiststream& geo_put_gmsh (odiststream&, const geo_basic<T,sequential>&);
32 template <class T> odiststream& geo_put_bamg (odiststream&, const geo_basic<T,sequential>&);
33 
34 template <class T>
35 odiststream&
37  iorheo::flag_type format = iorheo::flags(ops.os()) & iorheo::format_field;
38  if (format [iorheo::gnuplot]) { return visu_gnuplot (ops,*this); }
39  if (format [iorheo::paraview]){ return visu_vtk_paraview (ops,*this); }
40  if (format [iorheo::gmsh]) { return geo_put_gmsh (ops,*this); }
41  if (format [iorheo::bamg]) { return geo_put_bamg (ops,*this); }
42  return base::data().put (ops); // in .geo format
43 }
44 template <class T>
47  using namespace std;
48  size_type n_vert = base::_node.dis_size ();
49  size_type n_elt = base::_gs.ownership_by_dimension[base::_gs._map_dimension].dis_size ();
50  //
51  // put header
52  //
53  ops << setprecision(numeric_limits<T>::digits10)
54  << "#!geo" << endl
55  << endl
56  << "mesh" << endl
57  << base::_version;
58 
59  if (base::_version == 4) {
60  geo_header h;
61  h.dimension = base::_dimension;
62  h.sys_coord = base::_sys_coord;
63  h.order = base::order();
64  h.dis_size_by_variant [0] = base::_node.dis_size();
65  if (base::_have_connectivity) {
66  // put all
68  h.dis_size_by_variant [variant] = base::_geo_element [variant].dis_size();
69  }
70  } else {
71  // put only d-dimensional elements, as was the input
72  for (size_type variant = reference_element::first_variant_by_dimension(base::_gs._map_dimension);
73  variant < reference_element:: last_variant_by_dimension(base::_gs._map_dimension); variant++) {
74  h.dis_size_by_variant [variant] = base::_geo_element [variant].dis_size();
75  }
76  }
77  ops << endl << h << endl;
78  }
79  //
80  // put nodes
81  //
82  T rounding_prec = iorheo::getrounding_precision(ops.os());
83  if (rounding_prec == 0) {
84  base::_node.put_values (ops, _point_put<T>(base::_dimension));
85  } else {
86  base::_node.put_values (ops, _round_point_put<T>(base::_dimension, rounding_prec));
87  }
88  ops << endl;
89  //
90  // put elements
91  //
92  if (base::_gs._map_dimension > 0) {
93  for (size_type variant = reference_element::first_variant_by_dimension(base::_gs._map_dimension);
94  variant < reference_element:: last_variant_by_dimension(base::_gs._map_dimension); variant++) {
95  base::_geo_element [variant].put_values (ops);
96  }
97  ops << endl;
98  }
99  //
100  // put faces & edges
101  //
102  if (base::_gs._map_dimension > 1 && base::_have_connectivity) {
103  for (size_type side_dim = base::_gs._map_dimension - 1; side_dim >= 1; side_dim--) {
106  base::_geo_element [variant].put_values (ops);
107  }
108  }
109  }
110  //
111  // put domains
112  //
114  iter = base::_domains.begin(), last = base::_domains.end();
115  iter != last; ++iter) {
116  ops << endl;
117  (*iter).put (ops);
118  }
119  return ops;
120 }
121 // ----------------------------------------------------------------------------
122 // instanciation in library
123 // ----------------------------------------------------------------------------
124 template class geo_rep <Float,sequential>;
126 
127 } // namespace rheolef
void put(idiststream &in, odiststream &out, bool do_proj, bool do_lumped_mass, bool def_fill_opt, size_type extract_id, const Float &scale_value, const std::pair< Float, Float > &u_range, render_type render)
Definition: branch.cc:500
geo_element_hack::size_type size_type
Definition: geo.h:260
sequential mesh representation
Definition: geo.h:778
odiststream: see the diststream page for the full documentation
Definition: diststream.h:126
std::ostream & os()
Definition: diststream.h:236
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)
Expr1::float_type T
Definition: field_expr.h:261
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format bamg
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format format format format format format paraview
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format format format format gnuplot
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format gmsh
This file is part of Rheolef.
odiststream & geo_put_bamg(odiststream &, const geo_basic< T, sequential > &)
odiststream & visu_gnuplot(odiststream &, const field_basic< T, sequential > &)
odiststream & geo_put_gmsh(odiststream &ods, const geo_basic< T, sequential > &)
odiststream & visu_vtk_paraview(odiststream &, const field_basic< T, sequential > &)
point output helper
Definition: geo.h:163
point output helper, with rounding feature
Definition: geo.h:171
geo iterator
Definition: geo.h:193