Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
geo_seq_put.cc
Go to the documentation of this file.
1
21#include "rheolef/geo.h"
22#include "rheolef/geo_domain.h"
23
24namespace rheolef {
25
26// external graphic drivers:
27template <class T> odiststream& visu_gnuplot (odiststream&, const geo_basic<T,sequential>&);
28template <class T> odiststream& visu_vtk_paraview (odiststream&, const geo_basic<T,sequential>&);
29template <class T> odiststream& geo_put_gmsh (odiststream&, const geo_basic<T,sequential>&);
30template <class T> odiststream& geo_put_bamg (odiststream&, const geo_basic<T,sequential>&);
31
32template <class T>
33odiststream&
35 iorheo::flag_type format = iorheo::flags(ops.os()) & iorheo::format_field;
36 if (format [iorheo::gnuplot]) { return visu_gnuplot (ops,*this); }
37 if (format [iorheo::paraview]){ return visu_vtk_paraview (ops,*this); }
38 if (format [iorheo::gmsh]) { return geo_put_gmsh (ops,*this); }
39 if (format [iorheo::bamg]) { return geo_put_bamg (ops,*this); }
40 return base::data().put (ops); // in .geo format
41}
42template <class T>
45 using namespace std;
46 size_type n_vert = base::_node.dis_size ();
47 size_type n_elt = base::_gs.ownership_by_dimension[base::_gs._map_dimension].dis_size ();
48 //
49 // put header
50 //
51 ops.os() << std::setprecision(numeric_limits<T>::digits10);
52 ops << "#!geo" << endl
53 << endl
54 << "mesh" << endl
55 << base::_version;
56
57 if (base::_version == 4) {
58 geo_header h;
59 h.dimension = base::_dimension;
60 h.sys_coord = base::_sys_coord;
61 h.order = base::order();
62 h.dis_size_by_variant [0] = base::_node.dis_size();
63 if (base::_have_connectivity) {
64 // put all
65 for (size_type variant = 1; variant < reference_element::max_variant; variant++) {
66 h.dis_size_by_variant [variant] = base::_geo_element [variant].dis_size();
67 }
68 } else {
69 // put only d-dimensional elements, as was the input
70 for (size_type variant = reference_element::first_variant_by_dimension(base::_gs._map_dimension);
71 variant < reference_element:: last_variant_by_dimension(base::_gs._map_dimension); variant++) {
72 h.dis_size_by_variant [variant] = base::_geo_element [variant].dis_size();
73 }
74 }
75 ops << endl << h << endl;
76 }
77 //
78 // put nodes
79 //
80 T rounding_prec = iorheo::getrounding_precision(ops.os());
81 if (rounding_prec == 0) {
82 base::_node.put_values (ops, _point_put<T>(base::_dimension));
83 } else {
84 base::_node.put_values (ops, _round_point_put<T>(base::_dimension, rounding_prec));
85 }
86 ops << endl;
87 //
88 // put elements
89 //
90 if (base::_gs._map_dimension > 0) {
91 for (size_type variant = reference_element::first_variant_by_dimension(base::_gs._map_dimension);
92 variant < reference_element:: last_variant_by_dimension(base::_gs._map_dimension); variant++) {
93 base::_geo_element [variant].put_values (ops);
94 }
95 ops << endl;
96 }
97 //
98 // put faces & edges
99 //
100 if (base::_gs._map_dimension > 1 && base::_have_connectivity) {
101 for (size_type side_dim = base::_gs._map_dimension - 1; side_dim >= 1; side_dim--) {
103 variant < reference_element:: last_variant_by_dimension(side_dim); variant++) {
104 base::_geo_element [variant].put_values (ops);
105 }
106 }
107 }
108 //
109 // put domains
110 //
111 for (typename std::vector<domain_indirect_basic<sequential> >::const_iterator
112 iter = base::_domains.begin(), last = base::_domains.end();
113 iter != last; ++iter) {
114 ops << endl;
115 (*iter).put (ops);
116 }
117 return ops;
118}
119// ----------------------------------------------------------------------------
120// instanciation in library
121// ----------------------------------------------------------------------------
122template class geo_rep <Float,sequential>;
124
125} // namespace rheolef
the finite element boundary domain
generic mesh with rerefence counting
Definition geo.h:1089
base::size_type size_type
Definition geo.h:791
sequential mesh representation
Definition geo.h:778
std::bitset< last > flag_type
Definition iorheo.h:440
static flag_type format_field
Definition iorheo.h:445
odiststream: see the diststream page for the full documentation
Definition diststream.h:137
std::ostream & os()
Definition diststream.h:247
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:230
This file is part of Rheolef.
odiststream & geo_put_bamg(odiststream &, const geo_basic< T, sequential > &)
odiststream & visu_vtk_paraview(odiststream &, const field_basic< T, sequential > &)
odiststream & visu_gnuplot(odiststream &, const field_basic< T, sequential > &)
odiststream & geo_put_gmsh(odiststream &ods, const geo_basic< T, sequential > &)
STL namespace.
point output helper
Definition geo.h:163
point output helper, with rounding feature
Definition geo.h:171