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
/
unitcube_alugrid.hh
70 lines (56 loc) · 1.69 KB
/
unitcube_alugrid.hh
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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef UNITCUBE_ALUGRID_HH
#define UNITCUBE_ALUGRID_HH
#include <array>
#include <memory>
#include "unitcube.hh"
#if HAVE_DUNE_ALUGRID
#include <dune/alugrid/grid.hh>
#include <dune/alugrid/3d/gridfactory.hh>
// ALU3dGrid and ALU2dGrid simplex specialization.
// Note: element type determined by type
template<int dim>
class UnitCube<Dune::ALUGrid<dim,dim,Dune::simplex,Dune::nonconforming>,1>
{
public:
typedef Dune::ALUGrid<dim,dim,Dune::simplex,Dune::nonconforming> GridType;
private:
std::shared_ptr<GridType> grid_;
public:
UnitCube ()
{
Dune::FieldVector<typename GridType::ctype,dim> lowerLeft(0);
Dune::FieldVector<typename GridType::ctype,dim> upperRight(1);
std::array<unsigned int,dim> elements;
std::fill(elements.begin(), elements.end(), 1);
grid_ = Dune::StructuredGridFactory<GridType>::createSimplexGrid(lowerLeft, upperRight, elements);
}
GridType &grid ()
{
return *grid_;
}
};
// ALU3dGrid hexahedra specialization. Note: element type determined by type
template<>
class UnitCube<Dune::ALUGrid<3,3,Dune::cube,Dune::nonconforming>,1>
{
public:
typedef Dune::ALUGrid<3,3,Dune::cube,Dune::nonconforming> GridType;
private:
std::shared_ptr<GridType> grid_;
public:
UnitCube ()
{
Dune::FieldVector<GridType::ctype,3> lowerLeft(0);
Dune::FieldVector<GridType::ctype,3> upperRight(1);
std::array<unsigned int,3> elements = { {1,1,1} };
grid_ = Dune::StructuredGridFactory<GridType>::createCubeGrid(lowerLeft, upperRight, elements);
}
GridType &grid ()
{
return *grid_;
}
};
#endif // HAVE_DUNE_ALUGRID
#endif // UNITCUBE_ALUGRID_HH