Dune Core Modules (2.3.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#include <dune/grid/alugrid/3d/topology.hh>
9#include <dune/grid/common/entity.hh>
10
11namespace Dune
12{
13
14 // External Forward Declarations
15 // -----------------------------
16
17 template< int, int, class >
18 class ALU3dGridEntity;
19
20 template< ALU3dGridElementType, class >
21 struct ALU3dImplTraits;
22
23
24
25 namespace GeoGrid
26 {
27
28 // HostCorners
29 // -----------
30
31 template< class HostEntity >
32 class HostCorners
33 {
34 typedef typename HostEntity::Geometry HostGeometry;
35
36 public:
37 typedef typename HostGeometry::GlobalCoordinate Coordinate;
38
39 explicit HostCorners ( const HostEntity &hostEntity )
40 : hostGeometry_( hostEntity.geometry() )
41 {}
42
43 GeometryType type () const
44 {
45 return hostGeometry_.type();
46 }
47
48 Coordinate operator[] ( int i ) const
49 {
50 return hostGeometry_.corner( i );
51 }
52
53 std::size_t size () const
54 {
55 return hostGeometry_.corners();
56 }
57
58 private:
59 HostGeometry hostGeometry_;
60 };
61
62
63
64 // HostCorners for ALU3dGrid
65 // -------------------------
66
67#if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
68 template< int dim, class Grid >
69 class HostCorners< Dune::Entity< 0, dim, Grid, ALU3dGridEntity > >
70 {
72
73 typedef double ALUCoordinate[ 3 ];
74
75 static const ALU3dGridElementType elementType = remove_const< Grid >::type::elementType;
76 typedef Dune::ElementTopologyMapping< elementType > ElementTopologyMapping;
77
78 typedef typename remove_const< Grid >::type::MPICommunicatorType Comm;
79 typedef ALU3dImplTraits< elementType, Comm > ImplTraits;
80
81 public:
82 typedef FieldVector< double, 3 > Coordinate;
83
84 explicit HostCorners ( const HostEntity &hostEntity )
85 : item_( hostEntity.impl().getItem() )
86 {}
87
88 GeometryType type () const
89 {
90 if( elementType == tetra )
91 return GeometryType( GenericGeometry::SimplexTopology< dim >::type::id, dim );
92 else
93 return GeometryType( GenericGeometry::CubeTopology< dim >::type::id, dim );
94 }
95
96 Coordinate operator[] ( int i ) const
97 {
99 const ALUCoordinate &point = item_.myvertex( j )->Point();
100
101 Coordinate corner;
102 for( int k = 0; k < 3; ++k )
103 corner[ k ] = point[ k ];
104 return corner;
105 }
106
107 std::size_t size () const
108 {
109 return (elementType == tetra ? dim+1 : (1 << dim));
110 }
111
112 private:
113 const typename ImplTraits::IMPLElementType &item_;
114 };
115#endif // #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
116
117 } // namespace GeoGrid
118
119} // namespace Dune
120
121#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:57
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Dune namespace.
Definition: alignment.hh:14
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 (Jul 15, 22:36, 2024)