1
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
// vi: set et ts=8 sw=2 sts=2:
1
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
// vi: set et ts=4 sw=2 sts=2:
4
4
#ifndef DUNE_GRID_UTILITY_ALU_TO_VTK_MAIN_VOLUME_HH
5
5
#define DUNE_GRID_UTILITY_ALU_TO_VTK_MAIN_VOLUME_HH
17
17
#include <dune/common/exceptions.hh>
18
#include <dune/common/mpihelper.hh>
18
#include <dune/common/parallel/mpihelper.hh>
20
20
#include <dune/grid/common/mcmgmapper.hh>
21
21
#include <dune/grid/io/file/vtk/common.hh>
41
41
if(aluName == "" || vtkName == "" || argc > 4) {
42
42
if(Dune::MPIHelper::getCollectiveCommunication().rank() == 0)
44
"Convert a ALU-macrogridfile to VTK\n"
47
" " << programName << " ALU_PREFIX VTK_PREFIX [TAGS_PREFIX]\n"
50
" ALU_PREFIX Filename-prefix for ALUGrid to read the macrogrid from. Each\n"
51
" process appends its rank to this filename to form something like\n"
53
" VTK_FILENAME Filename-prefix for VTK to write to.\n"
54
" TAGS_PREFIX If given, read element tag numbers from a series of files of\n"
55
" the form TAG_PREFIX.RANK. The file format is the same the output of\n"
56
" gmsh-to-alu: ASCII with one line per mesh element, each line consisting\n"
57
" of an integral tag number. White space in the beginning and the end of\n"
58
" the line is ignored. Comment lines start with '#' as the first non-\n"
59
" whitespace character, they are ignored, as are line consisting of\n"
44
"Convert a ALU-macrogridfile to VTK\n"
47
" " << programName << " ALU_PREFIX VTK_PREFIX [TAGS_PREFIX]\n"
50
" ALU_PREFIX Filename-prefix for ALUGrid to read the macrogrid from. Each\n"
51
" process appends its rank to this filename to form something like\n"
53
" VTK_FILENAME Filename-prefix for VTK to write to.\n"
54
" TAGS_PREFIX If given, read element tag numbers from a series of files of\n"
55
" the form TAG_PREFIX.RANK. The file format is the same the output of\n"
56
" gmsh-to-alu: ASCII with one line per mesh element, each line consisting\n"
57
" of an integral tag number. White space in the beginning and the end of\n"
58
" the line is ignored. Comment lines start with '#' as the first non-\n"
59
" whitespace character, they are ignored, as are line consisting of\n"
74
74
Grid grid(rankName.str());
75
75
typedef Grid::LevelGridView GV;
76
const GV &gv = grid.levelView(0);
76
const GV &gv = grid.levelGridView(0);
78
78
//////////////////////////////////////////////////////////////////////
83
83
std::vector<int> elementTags;
84
84
if(tagsName != "") {
85
85
typedef Dune::MultipleCodimMultipleGeomTypeMapper<
86
GV, Dune::MCMGElementLayout
86
GV, Dune::MCMGElementLayout
89
89
elementTags.resize(mapper.size(), 0);
146
146
std::size_t pos = vtkName.rfind('/');
148
case std::string::npos:
148
case std::string::npos :
150
150
basename = vtkName;
154
154
basename = vtkName.substr(1);
157
157
path = vtkName.substr(0, pos);
158
158
basename = vtkName.substr(pos+1);