Loading...
Searching...
No Matches
trigonometricfunction.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
#ifndef DUNE_FUNCTIONS_ANALYTICFUNCTIONS_TRIGONOMETRICFUNCTION_HH
#define DUNE_FUNCTIONS_ANALYTICFUNCTIONS_TRIGONOMETRICFUNCTION_HH
#include <cmath>
namespace Dune {
namespace Functions {
template<class K, int sinFactor, int cosFactor>
class TrigonometricFunction
{
public:
K operator () (const K& x) const
{
return sinFactor * std::sin(x) + cosFactor * std::cos(x);
}
};
template<class K, int sinFactor, int cosFactor>
TrigonometricFunction<K, -cosFactor, sinFactor> derivative(const TrigonometricFunction<K, sinFactor, cosFactor>& f)
{
return TrigonometricFunction<K, -cosFactor, sinFactor>();
}
}} // namespace Dune::Functions
#endif // DUNE_FUNCTIONS_ANALYTICFUNCTIONS_TRIGONOMETRICFUNCTION_HH
Dune::Functions::derivative
TrigonometricFunction< K, -cosFactor, sinFactor > derivative(const TrigonometricFunction< K, sinFactor, cosFactor > &f)
Obtain derivative of TrigonometricFunction function.
Definition trigonometricfunction.hh:43
Dune
Definition monomialset.hh:19
Dune::Functions
Definition monomialset.hh:19
Dune::Functions::TrigonometricFunction
A linear combination of trigonomic functions.
Definition trigonometricfunction.hh:31
Dune::Functions::TrigonometricFunction::operator()
K operator()(const K &x) const
Evaluate function.
Definition trigonometricfunction.hh:34