vtkout.hh
Go to the documentation of this file.
1 // Warning suppression for Dune includes.
2 #include <opm/common/utility/platform_dependent/disable_warnings.h>
3 #include <dune/grid/io/file/vtk/vtkwriter.hh>
4 #include <opm/common/utility/platform_dependent/reenable_warnings.h>
5 
6 #include <stdio.h>
7 
8 template<class G, class V>
9 void vtkout (const G& grid, const V& c, const char* name, int k, double time=0.0, int rank=0)
10 {
11  Dune::VTKWriter<typename G::LeafGridView> vtkwriter(grid.leafGridView());
12  char fname[128];
13  char sername[128];
14  sprintf(fname,"%s-%05d",name,k);
15  sprintf(sername,"%s.series",name);
16  vtkwriter.addCellData(c,"celldata");
17  vtkwriter.write(fname,Dune::VTK::ascii);
18  if ( rank == 0)
19  {
20  std::ofstream serstream(sername, (k==0 ? std::ios_base::out : std::ios_base::app));
21  serstream << k << " " << fname << ".vtu " << time << std::endl;
22  serstream.close();
23  }
24 }
void vtkout(const G &grid, const V &c, const char *name, int k, double time=0.0, int rank=0)
Definition: vtkout.hh:9