rheolef  6.6
branch_seq_visu_vtk_paraview.cc
Go to the documentation of this file.
1 #include "rheolef/branch.h"
2 #include "rheolef/iofem.h"
3 #include "rheolef/iorheo.h"
4 #include "rheolef/rheostream.h"
5 namespace rheolef {
6 using namespace std;
7 
8 template <class T> odiststream& field_put_vtk (odiststream&, const field_basic<T,sequential>&, std::string, bool);
9 
10 template<class T>
11 void
13 {
14 }
15 template<class T>
16 void
18 {
19  ostream& out = ods.os();
20  string basename = iorheo::getbasename(out);
21  if (basename == "") basename = "output";
22  string data_file_name = basename + "-" + itos(b._count_value) + ".vtk";
23  ofstream vtk (data_file_name.c_str());
24  odiststream ods_vtk (vtk);
25  bool verbose = iorheo::getverbose(clog);
26  verbose && clog << "! file `" << data_file_name << "' created" << endl;
27  vtk << setbasename(basename)
28  << setprecision(numeric_limits<T>::digits10);
29 
30  check_macro (b.n_field() > 0, "empty branch (n_field = 0)");
31  const field_basic<T,sequential>& u0 = b[0].second;
32  string approx = u0.get_approx();
33  bool put_geo = true;
34  for (size_t i = 0; i < b.n_field(); i++) {
35  const string& name = b[i].first;
36  const field_basic<T,sequential>& ui = b[i].second;
37  check_macro (ui.get_approx() == approx,
38  "field #"<<i<<" name '"<<name<<": approx `"<<ui.get_approx()<<"' incompatible with field #0 approx `"<<approx<<"'");
39  field_put_vtk (ods_vtk, ui, name, put_geo);
40  put_geo = false;
41  }
42  vtk.close();
43 }
44 template<class T>
45 void
47 {
48 }
49 template void put_header_paraview (odiststream&, const branch_basic<Float,sequential>&);
50 template void put_event_paraview (odiststream&, const branch_basic<Float,sequential>&);
51 template void put_finalize_paraview (odiststream&, const branch_basic<Float,sequential>&);
52 
53 } // namespace rheolef
field - piecewise polynomial finite element field
Definition: field.h:225
idiststream, odiststream - distributed interface for large data streams
Definition: diststream.h:68
void put_finalize_paraview(odiststream &out, const branch_basic< T, sequential > &b)
std::string get_approx() const
Definition: field.h:274
STL namespace.
irheostream, orheostream - large data streams
Definition: compiler.h:7
string itos(string::size_type i)
Definition: rheostream.cc:38
branch - a parameter-dependent sequence of field
Definition: branch.h:46
void put_header_paraview(odiststream &out, const branch_basic< T, sequential > &)
#define check_macro(ok_condition, message)
Definition: compiler.h:104
void put_event_paraview(odiststream &ods, const branch_basic< T, sequential > &b)
size_type n_field() const
Definition: branch.h:324
odiststream & field_put_vtk(odiststream &, const field_basic< T, sequential > &, std::string, bool)
size_type _count_value
Definition: branch.h:160
std::ostream & os()
Definition: diststream.h:166
verbose clean transpose logscale grid shrink ball stereo iso volume velocity elevation bezieradapt label color color format format format format format format format format format format format format format format format format vtk