rheolef  6.5
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
54