This repository has been archived by the owner on Jan 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvisualization.cc
101 lines (83 loc) · 2.28 KB
/
visualization.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include <config.h>
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <dune/common/parallel/mpihelper.hh> // include mpi helper class
#include <dune/grid/io/file/dgfparser/dgfparser.hh>
#include "elementdata.hh"
#include "vertexdata.hh"
#include "functors.hh"
#include "unitcube.hh"
#ifdef GRIDDIM
const int dimGrid = GRIDDIM;
#else
const int dimGrid = 2;
#endif
//! supply functor
template<class Grid>
void dowork ( Grid &grid, int refSteps = 5 )
{
// make function object
Exp<typename Grid::ctype,Grid::dimension> f;
// refine the grid
grid.globalRefine( refSteps );
// call the visualization functions
elementdata(grid,f);
vertexdata(grid,f);
}
int main(int argc, char **argv)
{
// initialize MPI, finalize is done automatically on exit
Dune::MPIHelper::instance(argc,argv);
// start try/catch block to get error messages from dune
try
{
if( argc > 1 )
{
typedef Dune::GridSelector::GridType DGFGridType;
// create grid pointer
Dune :: GridPtr< DGFGridType > gridPtr( argv[ 1 ] );
dowork( *gridPtr, 3 );
}
/*
UnitCube<Dune::OneDGrid,1> uc0;
*/
UnitCube<Dune::YaspGrid<dimGrid>,1> uc1;
dowork( uc1.grid(), 3 );
/*
#if HAVE_UG
UnitCube< Dune::UGGrid< dimGrid >, 2 > uc2;
dowork( uc2.grid(), 3 );
#endif
#if HAVE_ALBERTA
{
UnitCube< Dune::AlbertaGrid< dimGrid, dimGrid >, 1 > unitcube;
// note: The 3d cube cannot be bisected recursively
dowork( unitcube.grid(), (dimGrid < 3 ? 6 : 0) );
}
#endif // #if HAVE_ALBERTA
*/
#if HAVE_DUNE_ALUGRID
UnitCube< Dune::ALUGrid< dimGrid, dimGrid, Dune::simplex,
Dune::nonconforming > , 1 > uc5;
dowork( uc5.grid(), 3 );
#if GRIDDIM == 2 || GRIDDIM == 3
UnitCube< Dune::ALUGrid< dimGrid, dimGrid, Dune::cube,
Dune::nonconforming > , 1 > uc6;
dowork( uc6.grid(), 3 );
#endif // #if GRIDDIM == 2 || GRIDDIM == 3
#endif // #if HAVE_DUNE_ALUGRID
}
catch (std::exception & e) {
std::cout << "ERROR: " << e.what() << std::endl;
return 1;
}
catch (...) {
std::cout << "Unknown ERROR" << std::endl;
return 1;
}
// done
return 0;
}