diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C index 0db3d8f472..01bd647b8a 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctree.C @@ -2525,7 +2525,10 @@ Foam::labelBits Foam::dynamicIndexedOctree::findNode template -Foam::label Foam::dynamicIndexedOctree::findInside(const point& sample) const +Foam::label Foam::dynamicIndexedOctree::findInside +( + const point& sample +) const { labelBits index = findNode(0, sample); @@ -2873,7 +2876,8 @@ Foam::label Foam::dynamicIndexedOctree::removeIndex if (newContent.size() == 0) { // Set to empty. - nodes_[nodIndex].subNodes_[octant] = emptyPlusOctant(octant); + nodes_[nodIndex].subNodes_[octant] + = emptyPlusOctant(octant); } contentList.transfer(newContent); @@ -3002,7 +3006,8 @@ bool Foam::dynamicIndexedOctree::write(Ostream& os) const template -Foam::Ostream& Foam::operator<<(Ostream& os, const dynamicIndexedOctree& t) +Foam::Ostream& +Foam::operator<<(Ostream& os, const dynamicIndexedOctree& t) { os << t.bb() << token::SPACE << t.nodes() << endl; diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H index 9afcb3e08c..225e995419 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -150,8 +150,8 @@ public: { notImplemented ( - "dynamicTreeDataPoint::intersects(const label, const point&," - "const point&, point&)" + "dynamicTreeDataPoint::intersects + "(const label, const point&, const point&, point&)" ); return false; } diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H index c95406350b..a506deed35 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -139,17 +139,28 @@ public: // Member Functions - //- Return Table value - virtual Type value(const scalar x) const - { - return TableBase::value(x); - } + // Manipulation - //- Integrate between two (scalar) values - virtual Type integrate(const scalar x1, const scalar x2) const - { - return TableBase::integrate(x1, x2); - } + //- Convert time + virtual void convertTimeBase(const Time& t) + { + TableBase::convertTimeBase(t); + } + + + // Evaluation + + //- Return Table value + virtual Type value(const scalar x) const + { + return TableBase::value(x); + } + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const + { + return TableBase::integrate(x1, x2); + } // I/O diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C index cb46155840..3b972949bb 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "DataEntry.H" +#include "Time.H" // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // @@ -59,6 +60,13 @@ const Foam::word& Foam::DataEntry::name() const } +template +void Foam::DataEntry::convertTimeBase(const Time&) +{ + // do nothing +} + + template Type Foam::DataEntry::value(const scalar x) const { diff --git a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H index 5b3e783101..6ab51b98d3 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,6 +45,7 @@ SourceFiles namespace Foam { +class Time; template class DataEntry; @@ -133,6 +134,12 @@ public: const word& name() const; + // Manipulation + + //- Convert time + virtual void convertTimeBase(const Time& t); + + // Evaluation //- Return value as a function of (scalar) independent variable diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H index c1ba2121e8..3f19ec38f2 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,17 +106,28 @@ public: // Member Functions - //- Return Table value - virtual Type value(const scalar x) const - { - return TableBase::value(x); - } + // Manipulation - //- Integrate between two (scalar) values - virtual Type integrate(const scalar x1, const scalar x2) const - { - return TableBase::integrate(x1, x2); - } + //- Convert time + virtual void convertTimeBase(const Time& t) + { + TableBase::convertTimeBase(t); + } + + + // Evaluation + + //- Return Table value + virtual Type value(const scalar x) const + { + return TableBase::value(x); + } + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const + { + return TableBase::integrate(x1, x2); + } // I/O diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C index 165b542ad8..cadc9c53a5 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "TableBase.H" +#include "Time.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -296,6 +297,17 @@ bool Foam::TableBase::checkMaxBounds } +template +void Foam::TableBase::convertTimeBase(const Time& t) +{ + forAll(table_, i) + { + scalar value = table_[i].first(); + table_[i].first() = t.userTimeToTime(value); + } +} + + template Type Foam::TableBase::value(const scalar x) const { diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H index f4d20028bc..50ee3b955a 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,9 @@ public: //- Check maximum table bounds bool checkMaxBounds(const scalar x, scalar& xDash) const; + //- Convert time + virtual void convertTimeBase(const Time& t); + //- Return Table value virtual Type value(const scalar x) const; diff --git a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H index 60106598b1..5c31c5cf68 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -122,17 +122,28 @@ public: // Member Functions - //- Return TableFile value - virtual Type value(const scalar x) const - { - return TableBase::value(x); - } + // Manipulation - //- Integrate between two (scalar) values - virtual Type integrate(const scalar x1, const scalar x2) const - { - return TableBase::integrate(x1, x2); - } + //- Convert time + virtual void convertTimeBase(const Time& t) + { + TableBase::convertTimeBase(t); + } + + + // Evaluation + + //- Return TableFile value + virtual Type value(const scalar x) const + { + return TableBase::value(x); + } + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const + { + return TableBase::integrate(x1, x2); + } // I/O diff --git a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C index 10111c8680..34c595f8ac 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "polynomial.H" +#include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -89,6 +90,16 @@ Foam::polynomial::~polynomial() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::polynomial::convertTimeBase(const Time& t) +{ + forAll(coeffs_, i) + { + scalar value = coeffs_[i].first(); + coeffs_[i].first() = t.userTimeToTime(value); + } +} + + Foam::scalar Foam::polynomial::value(const scalar x) const { scalar y = 0.0; diff --git a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H index 37a45b3316..2ed38a9f32 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -112,11 +112,19 @@ public: // Member Functions - //- Return polynomial value - scalar value(const scalar x) const; + // Manipulation - //- Integrate between two (scalar) values - scalar integrate(const scalar x1, const scalar x2) const; + //- Convert time + virtual void convertTimeBase(const Time& t); + + + // Evaluation + + //- Return polynomial value + scalar value(const scalar x) const; + + //- Integrate between two (scalar) values + scalar integrate(const scalar x1, const scalar x2) const; // I/O diff --git a/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C new file mode 100644 index 0000000000..b5e74a78c0 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.C @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "TimeDataEntry.H" + +// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // + +template +Foam::TimeDataEntry::TimeDataEntry +( + const Time& t, + const word& name, + const dictionary& dict +) +: + time_(t), + name_(name), + entry_(DataEntry::New(name, dict)) +{ + entry_->convertTimeBase(t); +} + + +template +Foam::TimeDataEntry::TimeDataEntry(const Time& t, const word& name) +: + time_(t), + name_(name), + entry_(NULL) +{} + + +template +Foam::TimeDataEntry::TimeDataEntry +( + const TimeDataEntry& tde +) +: + time_(tde.time_), + name_(tde.name_), + entry_(tde.entry_->clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::TimeDataEntry::~TimeDataEntry() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::TimeDataEntry::reset(const dictionary& dict) +{ + entry_.reset + ( + DataEntry::New + ( + name_, + dict + ).ptr() + ); + + entry_->convertTimeBase(time_); +} + + +template +const Foam::word& Foam::TimeDataEntry::name() const +{ + return entry_->name(); +} + + +template +Type Foam::TimeDataEntry::value(const scalar x) const +{ + return entry_->value(x); +} + + +template +Type Foam::TimeDataEntry::integrate +( + const scalar x1, + const scalar x2 +) const +{ + return entry_->integrate(x1, x2); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const TimeDataEntry& de +) +{ + return de.entry_->operator<<(os, de); +} + + +template +void Foam::TimeDataEntry::writeData(Ostream& os) const +{ + entry_->writeData(os); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.H b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.H new file mode 100644 index 0000000000..2cbe1a6115 --- /dev/null +++ b/src/OpenFOAM/primitives/functions/TimeDataEntry/TimeDataEntry/TimeDataEntry.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::TimeDataEntry + +Description + Light wrapper around DataEntry to provide a mechanism to update time-based + entries. + +SourceFiles + TimeDataEntry.C + +\*---------------------------------------------------------------------------*/ + +#ifndef TimeDataEntry_H +#define TimeDataEntry_H + +#include "DataEntry.H" +#include "Time.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +template +class TimeDataEntry; + +template +Ostream& operator<< +( + Ostream&, + const TimeDataEntry& +); + +/*---------------------------------------------------------------------------*\ + Class TimeDataEntry Declaration +\*---------------------------------------------------------------------------*/ + +template +class TimeDataEntry +{ + +protected: + + // Protected data + + //- Reference to the time database + const Time& time_; + + //- Name of the data entry + const word name_; + + //- The underlying DataEntry + autoPtr > entry_; + + +public: + + // Constructor + + //- Construct from entry name + TimeDataEntry + ( + const Time& t, + const word& name, + const dictionary& dict + ); + + //- Construct null from entry name + TimeDataEntry + ( + const Time& t, + const word& entryName + ); + + //- Copy constructor + TimeDataEntry(const TimeDataEntry& tde); + + + //- Destructor + virtual ~TimeDataEntry(); + + + // Member Functions + + // Access + + //- Reset entry by re-reading from dictionary + void reset(const dictionary& dict); + + //- Return the name of the entry + const word& name() const; + + + // Evaluation + + //- Return value as a function of (scalar) independent variable + virtual Type value(const scalar x) const; + + //- Integrate between two (scalar) values + virtual Type integrate(const scalar x1, const scalar x2) const; + + + // I/O + + //- Ostream Operator + friend Ostream& operator<< + ( + Ostream& os, + const TimeDataEntry& de + ); + + //- Write in dictionary format + virtual void writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "TimeDataEntry.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C index 68f0c2a5bf..878398220e 100644 --- a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C +++ b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C @@ -66,6 +66,12 @@ void Foam::actuationDiskSource::checkData() const << "disk direction vector is approximately zero" << exit(FatalIOError); } + if (returnReduce(upstreamCellId_, maxOp