Skip to content
Snippets Groups Projects
Commit f29eb55c authored by Andrew Heather's avatar Andrew Heather Committed by Mark OLESEN
Browse files

ENH: Refactored TimeFunction1 - now possible using Function1 directly

parent b9b011f5
Branches
Tags
1 merge request!499Function1 objectRegistry access
......@@ -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);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment