Dune Core Modules (2.4.1)

hostcorners.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_GEOGRID_HOSTCORNERS_HH
4#define DUNE_GEOGRID_HOSTCORNERS_HH
5
7
8#if HAVE_ALUGRID && DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
9#include <dune/grid/alugrid/3d/topology.hh>
10#endif
11#include <dune/grid/common/entity.hh>
12
13namespace Dune
14{
15
16 // External Forward Declarations
17 // -----------------------------
18
19#if HAVE_ALUGRID && DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
20 template< int, int, class >
21 class ALU3dGridEntity;
22
23 template< ALU3dGridElementType, class >
24 struct ALU3dImplTraits;
25#endif
26
27 namespace GeoGrid
28 {
29
30 // HostCorners
31 // -----------
32
33 template< class HostEntity >
34 class HostCorners
35 {
36 typedef typename HostEntity::Geometry HostGeometry;
37
38 public:
39 typedef typename HostGeometry::GlobalCoordinate Coordinate;
40
41 explicit HostCorners ( const HostEntity &hostEntity )
42 : hostGeometry_( hostEntity.geometry() )
43 {}
44
45 GeometryType type () const
46 {
47 return hostGeometry_.type();
48 }
49
50 Coordinate operator[] ( int i ) const
51 {
52 return hostGeometry_.corner( i );
53 }
54
55 std::size_t size () const
56 {
57 return hostGeometry_.corners();
58 }
59
60 private:
61 HostGeometry hostGeometry_;
62 };
63
64
65
66 // HostCorners for ALU3dGrid
67 // -------------------------
68
69#if HAVE_ALUGRID && DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
70 template< int dim, class Grid >
71 class HostCorners< Dune::Entity< 0, dim, Grid, ALU3dGridEntity > >
72 {
74
75 typedef double ALUCoordinate[ 3 ];
76
77 static const ALU3dGridElementType elementType = remove_const< Grid >::type::elementType;
78 typedef Dune::ElementTopologyMapping< elementType > ElementTopologyMapping;
79
80 typedef typename remove_const< Grid >::type::MPICommunicatorType Comm;
81 typedef ALU3dImplTraits< elementType, Comm > ImplTraits;
82
83 public:
84 typedef FieldVector< double, 3 > Coordinate;
85
86 explicit HostCorners ( const HostEntity &hostEntity )
87 : item_( hostEntity.impl().getItem() )
88 {}
89
90 GeometryType type () const
91 {
92 if( elementType == tetra )
93 return GeometryType( GenericGeometry::SimplexTopology< dim >::type::id, dim );
94 else
95 return GeometryType( GenericGeometry::CubeTopology< dim >::type::id, dim );
96 }
97
98 Coordinate operator[] ( int i ) const
99 {
101 const ALUCoordinate &point = item_.myvertex( j )->Point();
102
103 Coordinate corner;
104 for( int k = 0; k < 3; ++k )
105 corner[ k ] = point[ k ];
106 return corner;
107 }
108
109 std::size_t size () const
110 {
111 return (elementType == tetra ? dim+1 : (1 << dim));
112 }
113
114 private:
115 const typename ImplTraits::IMPLElementType &item_;
116 };
117#endif // #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
118
119 } // namespace GeoGrid
120
121} // namespace Dune
122
123#endif // #ifndef DUNE_GEOGRID_HOSTCORNERS_HH
Definition: topology.hh:41
static int dune2aluVertex(int index)
Maps vertex index from Dune onto ALU3dGrid reference element.
Definition: topology.hh:199
Wrapper class for entities.
Definition: entity.hh:62
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Dune namespace.
Definition: alignment.hh:10
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)