mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Refactored TimeFunction1 - now possible using Function1 directly
This commit is contained in:
committed by
Mark Olesen
parent
b9b011f5ea
commit
f29eb55cee
@ -224,7 +224,7 @@ Foam::Function1Types::CSV<Type>::CSV
|
||||
{
|
||||
read();
|
||||
|
||||
TableBase<Type>::check();
|
||||
TableBase<Type>::initialise();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -56,6 +56,11 @@ void Foam::Function1Types::Polynomial<Type>::checkCoefficients()
|
||||
<< "Polynomial " << this->name() << " cannot be integrated"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (this->isTime())
|
||||
{
|
||||
convertTimeBase(this->time());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -50,6 +50,11 @@ Foam::Function1Types::Sine<Type>::Sine
|
||||
{
|
||||
frequency_ = Function1<scalar>::New("frequency", dict);
|
||||
}
|
||||
|
||||
if (this->isTime())
|
||||
{
|
||||
convertTimeBase(this->time());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ Foam::Function1Types::Table<Type>::Table
|
||||
dict.readEntry("values", this->table_);
|
||||
}
|
||||
|
||||
TableBase<Type>::check();
|
||||
TableBase<Type>::initialise();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ Foam::Function1Types::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::Function1Types::TableBase<Type>::check() const
|
||||
void Foam::Function1Types::TableBase<Type>::initialise()
|
||||
{
|
||||
if (!table_.size())
|
||||
{
|
||||
@ -134,6 +134,11 @@ void Foam::Function1Types::TableBase<Type>::check() const
|
||||
prevValue = currValue;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (this->isTime())
|
||||
{
|
||||
convertTimeBase(this->time());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Check the table for size and consistency
|
||||
void check() const;
|
||||
void initialise();
|
||||
|
||||
//- Check minimum table bounds
|
||||
bool checkMinBounds(const scalar x, scalar& xDash) const;
|
||||
|
||||
@ -57,7 +57,7 @@ Foam::Function1Types::TableFile<Type>::TableFile
|
||||
|
||||
is >> this->table_;
|
||||
|
||||
TableBase<Type>::check();
|
||||
TableBase<Type>::initialise();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -34,6 +34,11 @@ void Foam::Function1Types::ramp::read(const dictionary& coeffs)
|
||||
{
|
||||
start_ = coeffs.getOrDefault<scalar>("start", 0);
|
||||
coeffs.readEntry("duration", duration_);
|
||||
|
||||
if (isTime())
|
||||
{
|
||||
convertTimeBase(time());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -42,7 +42,8 @@ Foam::TimeFunction1<Type>::TimeFunction1
|
||||
name_(entryName),
|
||||
entry_(Function1<Type>::New(entryName, dict, &runTime))
|
||||
{
|
||||
entry_->convertTimeBase(runTime);
|
||||
// Time conversion now handled by Function1 directly
|
||||
// entry_->convertTimeBase(runTime);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user