Function1Types::Sine: Changed parameters to be of type Function1 for greater flexibility

Templated sine function with support for an offset level.

        \f[
            a sin(2 \pi f (t - t_0)) s + l
        \f]

    where

    \vartable
        symbol  | Description       | Data type
        a       | Amplitude         | Function1<scalar>
        f       | Frequency [1/s]   | Function1<scalar>
        s       | Type scale factor | Function1<Type>
        l       | Type offset level | Function1<Type>
        t_0     | Start time [s]    | scalar
        t       | Time [s]          | scalar
    \endvartable
This commit is contained in:
Henry Weller
2016-02-08 21:42:46 +00:00
parent d64e8f1414
commit 15cd7c14fc
3 changed files with 28 additions and 69 deletions

View File

@ -34,12 +34,13 @@ Description
where
\vartable
a | Amplitude
f | Frequency [1/s]
s | Type scale factor
l | Type offset level
t_0 | Start time [s]
t | Time [s]
symbol | Description | Data type
a | Amplitude | Function1<scalar>
f | Frequency [1/s] | Function1<scalar>
s | Type scale factor | Function1<Type>
l | Type offset level | Function1<Type>
t_0 | Start time [s] | scalar
t | Time [s] | scalar
\endvartable
Example for a scalar:
@ -80,16 +81,6 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
namespace Function1Types
{
template<class Type> class Sine;
};
template<class Type>
Ostream& operator<<(Ostream&, const Function1Types::Sine<Type>&);
namespace Function1Types
{
@ -108,16 +99,16 @@ class Sine
scalar t0_;
//- Scalar amplitude of the sin function
scalar amplitude_;
autoPtr<Function1<scalar>> amplitude_;
//- Frequency of the sin function
scalar frequency_;
autoPtr<Function1<scalar>> frequency_;
//- Scaling factor of the sin function
Type scale_;
autoPtr<Function1<Type>> scale_;
//- Level to which the sin function is added
Type level_;
autoPtr<Function1<Type>> level_;
// Private Member Functions
@ -167,16 +158,6 @@ public:
//- Integrate between the two time values t1 and t2
Type integrate(const scalar t1, const scalar t2) const;
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const Sine<Type>& cnst
);
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};