~ubuntu-branches/ubuntu/utopic/dune-grid/utopic-proposed

« back to all changes in this revision

Viewing changes to src/alu-to-vtk/main-volume.hh

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2014-02-14 10:49:16 UTC
  • mfrom: (1.3.1) (5.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20140214104916-2clchnny3eu7ks4w
Tags: 2.3.0-2
InstallĀ /usr/share/dune-grid.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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:
3
3
 
4
4
#ifndef DUNE_GRID_UTILITY_ALU_TO_VTK_MAIN_VOLUME_HH
5
5
#define DUNE_GRID_UTILITY_ALU_TO_VTK_MAIN_VOLUME_HH
15
15
#include <vector>
16
16
 
17
17
#include <dune/common/exceptions.hh>
18
 
#include <dune/common/mpihelper.hh>
 
18
#include <dune/common/parallel/mpihelper.hh>
19
19
 
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)
43
43
        std::cerr <<
44
 
"Convert a ALU-macrogridfile to VTK\n"
45
 
"\n"
46
 
"SYNOPSIS:\n"
47
 
"  " << programName << " ALU_PREFIX VTK_PREFIX [TAGS_PREFIX]\n"
48
 
"\n"
49
 
"PARAMETERS:\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"
52
 
"    ALUPREFIX.RANK.\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"
60
 
"    whitespace only.\n"
61
 
                  << std::flush;
 
44
        "Convert a ALU-macrogridfile to VTK\n"
 
45
        "\n"
 
46
        "SYNOPSIS:\n"
 
47
        "  " << programName << " ALU_PREFIX VTK_PREFIX [TAGS_PREFIX]\n"
 
48
        "\n"
 
49
        "PARAMETERS:\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"
 
52
        "    ALUPREFIX.RANK.\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"
 
60
        "    whitespace only.\n"
 
61
        << std::flush;
62
62
      return 1;
63
63
    }
64
64
 
73
73
 
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);
77
77
 
78
78
    //////////////////////////////////////////////////////////////////////
79
79
    //
83
83
    std::vector<int> elementTags;
84
84
    if(tagsName != "") {
85
85
      typedef Dune::MultipleCodimMultipleGeomTypeMapper<
86
 
        GV, Dune::MCMGElementLayout
87
 
        > Mapper;
 
86
          GV, Dune::MCMGElementLayout
 
87
          > Mapper;
88
88
      Mapper mapper(gv);
89
89
      elementTags.resize(mapper.size(), 0);
90
90
 
145
145
 
146
146
    std::size_t pos = vtkName.rfind('/');
147
147
    switch(pos) {
148
 
    case std::string::npos:
 
148
    case std::string::npos :
149
149
      path = "";
150
150
      basename = vtkName;
151
151
      break;
152
 
    case 0:
 
152
    case 0 :
153
153
      path = "/";
154
154
      basename = vtkName.substr(1);
155
155
      break;
156
 
    default:
 
156
    default :
157
157
      path = vtkName.substr(0, pos);
158
158
      basename = vtkName.substr(pos+1);
159
159
      break;