Dune Core Modules (2.9.0)

coordfunctioncaller.hh
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_GEOGRID_COORDFUNCTIONCALLER_HH
6#define DUNE_GEOGRID_COORDFUNCTIONCALLER_HH
7
8#include <dune/grid/geometrygrid/hostcorners.hh>
9#include <dune/grid/geometrygrid/coordfunction.hh>
10
11namespace Dune
12{
13
14 namespace GeoGrid
15 {
16
17 // CoordFunctionCaller
18 // -------------------
19
20 template< class HostEntity, class CoordFunctionInterface >
21 class CoordFunctionCaller;
22
23 template< class HostEntity, class ct, unsigned int dimD, unsigned int dimR, class Impl >
24 class CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >
25 {
26 typedef AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > CoordFunctionInterface;
27 typedef CoordFunctionCaller< HostEntity, CoordFunctionInterface > This;
28
29 static const int codimension = HostEntity::codimension;
30
31 public:
32 typedef typename CoordFunctionInterface::RangeVector RangeVector;
33
34 CoordFunctionCaller ( const HostEntity &hostEntity,
35 const CoordFunctionInterface &coordFunction )
36 : hostCorners_( hostEntity ),
37 coordFunction_( coordFunction )
38 {}
39
40 void evaluate ( unsigned int i, RangeVector &y ) const
41 {
42 coordFunction_.evaluate( hostCorners_[ i ], y );
43 }
44
45 GeometryType type () const
46 {
47 return hostCorners_.type();
48 }
49
50 std::size_t size () const
51 {
52 return hostCorners_.size();
53 }
54
55 private:
56 const HostCorners< HostEntity > hostCorners_;
57 const CoordFunctionInterface &coordFunction_;
58 };
59
60 template< class HostEntity, class ct, unsigned int dimR, class Impl >
61 class CoordFunctionCaller< HostEntity, DiscreteCoordFunctionInterface< ct, dimR, Impl > >
62 {
63 typedef DiscreteCoordFunctionInterface< ct, dimR, Impl > CoordFunctionInterface;
64 typedef CoordFunctionCaller< HostEntity, CoordFunctionInterface > This;
65
66 typedef typename CoordFunctionInterface::RangeVector RangeVector;
67
68 public:
69 CoordFunctionCaller ( const HostEntity &hostEntity,
70 const CoordFunctionInterface &coordFunction )
71 : hostEntity_( hostEntity ),
72 coordFunction_( coordFunction )
73 {}
74
75 void evaluate ( unsigned int i, RangeVector &y ) const
76 {
77 coordFunction_.evaluate( hostEntity_, i, y );
78 }
79
80 GeometryType type () const
81 {
82 return hostEntity_.type();
83 }
84
85 std::size_t size () const
86 {
87 auto refElement = referenceElement< ct, HostEntity::mydimension >( type() );
88 return refElement.size( HostEntity::mydimension );
89 }
90
91 private:
92 const HostEntity &hostEntity_;
93 const CoordFunctionInterface &coordFunction_;
94 };
95
96 } // namespace GeoGrid
97
98} // namespace Dune
99
100#endif // #ifndef DUNE_GEOGRID_COORDFUNCTIONCALLER_HH
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)