dune-common 2.12-git
Loading...
Searching...
No Matches
asnumber.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_COMMON_ASNUMBER_HH
6#define DUNE_COMMON_ASNUMBER_HH
7
11
12
13namespace Dune {
14
15namespace Impl {
16
28 template<class T>
30 const T& asNumber(const T& t)
31 {
32 return t;
33 }
34
41 template<class T>
42 const T& asNumber(const Dune::FieldVector<T, 1>& t)
43 {
44 return t[0];
45 }
46
53 template<class T>
54 const T& asNumber(const Dune::FieldMatrix<T, 1, 1>& t)
55 {
56 return t[0][0];
57 }
58
61} // end namespace Impl
62
63} // end namespace Dune
64
65#endif // DUNE_COMMON_ASNUMBER_HH
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Traits for type conversions and type information.
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace
Definition alignedallocator.hh:13
Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
Definition typetraits.hh:194
A dense n x m matrix.
Definition fmatrix.hh:142
vector space out of a tensor product of fields.
Definition fvector.hh:105