mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
Conflicts: src/thermophysicalModels/reactionThermo/Make/options src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C src/thermophysicalModels/solidSpecie/solidSpecie/solidSpecie.C tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/chemistryProperties tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/panelRegion/thermophysicalProperties tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFZones tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/RASProperties tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/boundary
This commit is contained in:
@ -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
|
||||
@ -80,12 +80,18 @@ void Foam::regExp::set(const char* pattern, const bool ignoreCase) const
|
||||
cflags |= REG_ICASE;
|
||||
}
|
||||
|
||||
if (regcomp(preg_, pattern, cflags) != 0)
|
||||
int err = regcomp(preg_, pattern, cflags);
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
char errbuf[200];
|
||||
regerror(err, preg_, errbuf, sizeof(errbuf));
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"regExp::set(const char*)"
|
||||
) << "Failed to compile regular expression '" << pattern << "'"
|
||||
<< nl << errbuf
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,6 +202,7 @@ $(dll)/codedBase/codedBase.C
|
||||
|
||||
db/functionObjects/functionObject/functionObject.C
|
||||
db/functionObjects/functionObjectList/functionObjectList.C
|
||||
db/functionObjects/functionObjectFile/functionObjectFile.C
|
||||
db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.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
|
||||
@ -27,8 +27,6 @@ License
|
||||
#include "int.H"
|
||||
#include "token.H"
|
||||
#include <cctype>
|
||||
#include "IOstreams.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
@ -243,6 +241,44 @@ Foam::Istream& Foam::ISstream::read(token& t)
|
||||
}
|
||||
}
|
||||
|
||||
case '$':
|
||||
{
|
||||
// Look ahead
|
||||
char nextC;
|
||||
if (read(nextC).bad())
|
||||
{
|
||||
// Return $ as word
|
||||
t = token(word(c));
|
||||
return *this;
|
||||
}
|
||||
else if (nextC == token::BEGIN_BLOCK)
|
||||
{
|
||||
putback(nextC);
|
||||
putback(c);
|
||||
|
||||
string* sPtr = new string;
|
||||
|
||||
if (readVariable(*sPtr).bad())
|
||||
{
|
||||
delete sPtr;
|
||||
t.setBad();
|
||||
}
|
||||
else
|
||||
{
|
||||
t = sPtr;
|
||||
t.type() = token::VARIABLE;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
else
|
||||
{
|
||||
putback(nextC);
|
||||
putback(c);
|
||||
readWordToken(t);
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
// Number: integer or floating point
|
||||
//
|
||||
// ideally match the equivalent of this regular expression
|
||||
@ -549,6 +585,127 @@ Foam::Istream& Foam::ISstream::read(string& str)
|
||||
}
|
||||
|
||||
|
||||
// Special handling of '{' in variables
|
||||
Foam::Istream& Foam::ISstream::readVariable(string& str)
|
||||
{
|
||||
static const int maxLen = 1024;
|
||||
static const int errLen = 80; // truncate error message for readability
|
||||
static char buf[maxLen];
|
||||
|
||||
register int nChar = 0;
|
||||
register int blockCount = 0;
|
||||
char c;
|
||||
|
||||
if (!get(c) || c != '$')
|
||||
{
|
||||
FatalIOErrorIn("ISstream::readVariable(string&)", *this)
|
||||
<< "invalid first character found : " << c
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
buf[nChar++] = c;
|
||||
|
||||
// Read next character to see if '{'
|
||||
if (get(c) && c == token::BEGIN_BLOCK)
|
||||
{
|
||||
// Read, counting brackets
|
||||
buf[nChar++] = c;
|
||||
|
||||
while
|
||||
(
|
||||
get(c)
|
||||
&& (
|
||||
c == token::BEGIN_BLOCK
|
||||
|| c == token::END_BLOCK
|
||||
|| word::valid(c)
|
||||
)
|
||||
)
|
||||
{
|
||||
buf[nChar++] = c;
|
||||
if (nChar == maxLen)
|
||||
{
|
||||
buf[errLen] = '\0';
|
||||
|
||||
FatalIOErrorIn("ISstream::readVariable(string&)", *this)
|
||||
<< "word '" << buf << "...'\n"
|
||||
<< " is too long (max. " << maxLen << " characters)"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
if (c == token::BEGIN_BLOCK)
|
||||
{
|
||||
blockCount++;
|
||||
}
|
||||
else if (c == token::END_BLOCK)
|
||||
{
|
||||
if (blockCount)
|
||||
{
|
||||
blockCount--;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buf[nChar++] = c;
|
||||
|
||||
while (get(c) && word::valid(c))
|
||||
{
|
||||
buf[nChar++] = c;
|
||||
if (nChar == maxLen)
|
||||
{
|
||||
buf[errLen] = '\0';
|
||||
|
||||
FatalIOErrorIn("ISstream::readVariable(string&)", *this)
|
||||
<< "word '" << buf << "...'\n"
|
||||
<< " is too long (max. " << maxLen << " characters)"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// we could probably skip this check
|
||||
if (bad())
|
||||
{
|
||||
buf[errLen] = buf[nChar] = '\0';
|
||||
|
||||
FatalIOErrorIn("ISstream::readVariable(string&)", *this)
|
||||
<< "problem while reading string '" << buf << "...' after "
|
||||
<< nChar << " characters\n"
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
if (nChar == 0)
|
||||
{
|
||||
FatalIOErrorIn("ISstream::readVariable(string&)", *this)
|
||||
<< "invalid first character found : " << c
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// done reading
|
||||
buf[nChar] = '\0';
|
||||
str = buf;
|
||||
|
||||
// Note: check if we exited due to '}' or just !word::valid.
|
||||
if (c != token::END_BLOCK)
|
||||
{
|
||||
putback(c);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::ISstream::readVerbatim(string& str)
|
||||
{
|
||||
static const int maxLen = 8000;
|
||||
|
||||
@ -71,6 +71,8 @@ class ISstream
|
||||
//- Read a verbatim string (excluding block delimiters).
|
||||
Istream& readVerbatim(string&);
|
||||
|
||||
//- Read a variable name (includes '{')
|
||||
Istream& readVariable(string&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ISstream&);
|
||||
|
||||
@ -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
|
||||
@ -77,6 +77,7 @@ public:
|
||||
|
||||
PUNCTUATION,
|
||||
WORD,
|
||||
VARIABLE,
|
||||
STRING,
|
||||
VERBATIMSTRING,
|
||||
LABEL,
|
||||
@ -331,6 +332,8 @@ public:
|
||||
inline bool isWord() const;
|
||||
inline const word& wordToken() const;
|
||||
|
||||
inline bool isVariable() const;
|
||||
|
||||
inline bool isString() const;
|
||||
inline const string& stringToken() const;
|
||||
|
||||
|
||||
@ -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
|
||||
@ -39,7 +39,7 @@ inline void token::clear()
|
||||
{
|
||||
delete wordTokenPtr_;
|
||||
}
|
||||
else if (type_ == STRING || type_ == VERBATIMSTRING)
|
||||
else if (type_ == STRING || type_ == VARIABLE || type_ == VERBATIMSTRING)
|
||||
{
|
||||
delete stringTokenPtr_;
|
||||
}
|
||||
@ -88,6 +88,7 @@ inline token::token(const token& t)
|
||||
break;
|
||||
|
||||
case STRING:
|
||||
case VARIABLE:
|
||||
case VERBATIMSTRING:
|
||||
stringTokenPtr_ = new string(*t.stringTokenPtr_);
|
||||
break;
|
||||
@ -235,14 +236,19 @@ inline const word& token::wordToken() const
|
||||
}
|
||||
}
|
||||
|
||||
inline bool token::isVariable() const
|
||||
{
|
||||
return (type_ == VARIABLE);
|
||||
}
|
||||
|
||||
inline bool token::isString() const
|
||||
{
|
||||
return (type_ == STRING || type_ == VERBATIMSTRING);
|
||||
return (type_ == STRING || type_ == VARIABLE || type_ == VERBATIMSTRING);
|
||||
}
|
||||
|
||||
inline const string& token::stringToken() const
|
||||
{
|
||||
if (type_ == STRING || type_ == VERBATIMSTRING)
|
||||
if (type_ == STRING || type_ == VARIABLE || type_ == VERBATIMSTRING)
|
||||
{
|
||||
return *stringTokenPtr_;
|
||||
}
|
||||
@ -411,6 +417,7 @@ inline void token::operator=(const token& t)
|
||||
break;
|
||||
|
||||
case STRING:
|
||||
case VARIABLE:
|
||||
case VERBATIMSTRING:
|
||||
stringTokenPtr_ = new string(*t.stringTokenPtr_);
|
||||
break;
|
||||
@ -518,6 +525,7 @@ inline bool token::operator==(const token& t) const
|
||||
return *wordTokenPtr_ == *t.wordTokenPtr_;
|
||||
|
||||
case STRING:
|
||||
case VARIABLE:
|
||||
case VERBATIMSTRING:
|
||||
return *stringTokenPtr_ == *t.stringTokenPtr_;
|
||||
|
||||
@ -552,7 +560,11 @@ inline bool token::operator==(const word& w) const
|
||||
|
||||
inline bool token::operator==(const string& s) const
|
||||
{
|
||||
return ((type_ == STRING || type_ == VERBATIMSTRING) && stringToken() == s);
|
||||
return
|
||||
(
|
||||
(type_ == STRING || type_ == VARIABLE || type_ == VERBATIMSTRING)
|
||||
&& stringToken() == s
|
||||
);
|
||||
}
|
||||
|
||||
inline bool token::operator==(const label l) const
|
||||
|
||||
@ -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
|
||||
@ -74,6 +74,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& t)
|
||||
os << *t.stringTokenPtr_;
|
||||
break;
|
||||
|
||||
case token::VARIABLE:
|
||||
// Write variable as word so without ""
|
||||
os.writeQuoted(*t.stringTokenPtr_, false);
|
||||
break;
|
||||
|
||||
case token::LABEL:
|
||||
os << t.labelToken_;
|
||||
break;
|
||||
@ -157,6 +162,10 @@ ostream& Foam::operator<<(ostream& os, const InfoProxy<token>& ip)
|
||||
os << " the string " << t.stringToken();
|
||||
break;
|
||||
|
||||
case token::VARIABLE:
|
||||
os << " the variable " << t.stringToken();
|
||||
break;
|
||||
|
||||
case token::VERBATIMSTRING:
|
||||
os << " the verbatim string " << t.stringToken();
|
||||
break;
|
||||
@ -231,6 +240,10 @@ Ostream& operator<<(Ostream& os, const InfoProxy<token>& ip)
|
||||
os << " the string " << t.stringToken();
|
||||
break;
|
||||
|
||||
case token::VARIABLE:
|
||||
os << " the variable " << t.stringToken();
|
||||
break;
|
||||
|
||||
case token::VERBATIMSTRING:
|
||||
os << " the verbatim string " << t.stringToken();
|
||||
break;
|
||||
|
||||
@ -79,21 +79,35 @@ Foam::word Foam::Time::controlDictName("controlDict");
|
||||
|
||||
void Foam::Time::adjustDeltaT()
|
||||
{
|
||||
bool adjustTime = false;
|
||||
scalar timeToNextWrite = VGREAT;
|
||||
|
||||
if (writeControl_ == wcAdjustableRunTime)
|
||||
{
|
||||
scalar interval = writeInterval_;
|
||||
if (secondaryWriteControl_ == wcAdjustableRunTime)
|
||||
{
|
||||
interval = min(interval, secondaryWriteInterval_);
|
||||
}
|
||||
|
||||
|
||||
scalar timeToNextWrite = max
|
||||
adjustTime = true;
|
||||
timeToNextWrite = max
|
||||
(
|
||||
0.0,
|
||||
(outputTimeIndex_ + 1)*interval - (value() - startTime_)
|
||||
(outputTimeIndex_ + 1)*writeInterval_ - (value() - startTime_)
|
||||
);
|
||||
}
|
||||
if (secondaryWriteControl_ == wcAdjustableRunTime)
|
||||
{
|
||||
adjustTime = true;
|
||||
timeToNextWrite = max
|
||||
(
|
||||
0.0,
|
||||
min
|
||||
(
|
||||
timeToNextWrite,
|
||||
(secondaryOutputTimeIndex_ + 1)*secondaryWriteInterval_
|
||||
- (value() - startTime_)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (adjustTime)
|
||||
{
|
||||
scalar nSteps = timeToNextWrite/deltaT_ - SMALL;
|
||||
|
||||
// For tiny deltaT the label can overflow!
|
||||
@ -1130,10 +1144,10 @@ Foam::Time& Foam::Time::operator++()
|
||||
/ secondaryWriteInterval_
|
||||
);
|
||||
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1145,10 +1159,10 @@ Foam::Time& Foam::Time::operator++()
|
||||
returnReduce(elapsedCpuTime(), maxOp<double>())
|
||||
/ secondaryWriteInterval_
|
||||
);
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1160,10 +1174,10 @@ Foam::Time& Foam::Time::operator++()
|
||||
returnReduce(label(elapsedClockTime()), maxOp<label>())
|
||||
/ secondaryWriteInterval_
|
||||
);
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -51,6 +51,8 @@ void Foam::Time::readDict()
|
||||
}
|
||||
|
||||
scalar oldWriteInterval = writeInterval_;
|
||||
scalar oldSecondaryWriteInterval = secondaryWriteInterval_;
|
||||
|
||||
if (controlDict_.readIfPresent("writeInterval", writeInterval_))
|
||||
{
|
||||
if (writeControl_ == wcTimeStep && label(writeInterval_) < 1)
|
||||
@ -85,8 +87,8 @@ void Foam::Time::readDict()
|
||||
{
|
||||
if
|
||||
(
|
||||
secondaryWriteControl_
|
||||
== wcTimeStep && label(secondaryWriteInterval_) < 1
|
||||
secondaryWriteControl_ == wcTimeStep
|
||||
&& label(secondaryWriteInterval_) < 1
|
||||
)
|
||||
{
|
||||
FatalIOErrorIn("Time::readDict()", controlDict_)
|
||||
@ -124,6 +126,26 @@ void Foam::Time::readDict()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (oldSecondaryWriteInterval != secondaryWriteInterval_)
|
||||
{
|
||||
switch (secondaryWriteControl_)
|
||||
{
|
||||
case wcRunTime:
|
||||
case wcAdjustableRunTime:
|
||||
// Recalculate secondaryOutputTimeIndex_ to be in units of
|
||||
// current writeInterval.
|
||||
secondaryOutputTimeIndex_ = label
|
||||
(
|
||||
secondaryOutputTimeIndex_
|
||||
* oldSecondaryWriteInterval
|
||||
/ secondaryWriteInterval_
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (controlDict_.readIfPresent("purgeWrite", purgeWrite_))
|
||||
{
|
||||
|
||||
@ -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
|
||||
@ -37,6 +37,7 @@ Foam::TimeState::TimeState()
|
||||
deltaT0_(0),
|
||||
deltaTchanged_(false),
|
||||
outputTimeIndex_(0),
|
||||
secondaryOutputTimeIndex_(0),
|
||||
outputTime_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -61,9 +61,9 @@ protected:
|
||||
bool deltaTchanged_;
|
||||
|
||||
label outputTimeIndex_;
|
||||
label secondaryOutputTimeIndex_;
|
||||
bool outputTime_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -189,7 +189,7 @@ Foam::dictionary::dictionary
|
||||
parent_(parentDict)
|
||||
{
|
||||
transfer(dict());
|
||||
name() = parentDict.name() + "::" + name();
|
||||
name() = parentDict.name() + '.' + name();
|
||||
}
|
||||
|
||||
|
||||
@ -622,7 +622,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
|
||||
}
|
||||
else
|
||||
{
|
||||
return dictionary(*this, dictionary(name() + "::" + keyword));
|
||||
return dictionary(*this, dictionary(name() + '.' + keyword));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -690,7 +690,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||
{
|
||||
entryPtr->name() = name() + "::" + entryPtr->keyword();
|
||||
entryPtr->name() = name() + '.' + entryPtr->keyword();
|
||||
|
||||
if (entryPtr->keyword().isPattern())
|
||||
{
|
||||
@ -718,7 +718,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||
{
|
||||
entryPtr->name() = name() + "::" + entryPtr->keyword();
|
||||
entryPtr->name() = name() + '.' + entryPtr->keyword();
|
||||
IDLList<entry>::append(entryPtr);
|
||||
|
||||
if (entryPtr->keyword().isPattern())
|
||||
@ -925,7 +925,7 @@ bool Foam::dictionary::changeKeyword
|
||||
|
||||
// change name and HashTable, but leave DL-List untouched
|
||||
iter()->keyword() = newKeyword;
|
||||
iter()->name() = name() + "::" + newKeyword;
|
||||
iter()->name() = name() + '.' + newKeyword;
|
||||
hashedEntries_.erase(oldKeyword);
|
||||
hashedEntries_.insert(newKeyword, iter());
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ public:
|
||||
{
|
||||
const word scopedName = name_.name();
|
||||
|
||||
string::size_type i = scopedName.rfind(':');
|
||||
string::size_type i = scopedName.rfind('.');
|
||||
|
||||
if (i == scopedName.npos)
|
||||
{
|
||||
|
||||
@ -37,7 +37,7 @@ Foam::dictionary::dictionary
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
dictionaryName(parentDict.name() + "::" + name),
|
||||
dictionaryName(parentDict.name() + '.' + name),
|
||||
parent_(parentDict)
|
||||
{
|
||||
read(is);
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "functionEntry.H"
|
||||
#include "includeEntry.H"
|
||||
#include "inputModeEntry.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -110,8 +111,19 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is)
|
||||
else if
|
||||
(
|
||||
!disableFunctionEntries
|
||||
&& keyword[0] == '$') // ... Substitution entry
|
||||
&& keyword[0] == '$'
|
||||
) // ... Substitution entry
|
||||
{
|
||||
if (keyword.size() > 2 && keyword[1] == token::BEGIN_BLOCK)
|
||||
{
|
||||
// Recursive substitution mode. Replace between {} with
|
||||
// expansion.
|
||||
string s(keyword(2, keyword.size()-3));
|
||||
// Substitute dictionary and environment variables. Allow
|
||||
// empty substitutions.
|
||||
stringOps::inplaceExpand(s, parentDict, true, true);
|
||||
keyword.std::string::replace(1, keyword.size()-1, s);
|
||||
}
|
||||
parentDict.substituteScopedKeyword(keyword);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "dictionary.H"
|
||||
#include "IFstream.H"
|
||||
#include "addToMemberFunctionSelectionTable.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -68,11 +69,14 @@ namespace functionEntries
|
||||
|
||||
Foam::fileName Foam::functionEntries::includeEntry::includeFileName
|
||||
(
|
||||
Istream& is
|
||||
Istream& is,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
fileName fName(is);
|
||||
fName.expand();
|
||||
// Substitute dictionary and environment variables. Allow empty
|
||||
// substitutions.
|
||||
stringOps::inplaceExpand(fName, dict, true, true);
|
||||
|
||||
if (fName.empty() || fName.isAbsolute())
|
||||
{
|
||||
@ -94,7 +98,7 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const fileName fName(includeFileName(is));
|
||||
const fileName fName(includeFileName(is, parentDict));
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
@ -129,7 +133,7 @@ bool Foam::functionEntries::includeEntry::execute
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const fileName fName(includeFileName(is));
|
||||
const fileName fName(includeFileName(is, parentDict));
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
|
||||
@ -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
|
||||
@ -77,7 +77,7 @@ protected:
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read the include fileName from Istream, expand and return
|
||||
static fileName includeFileName(Istream&);
|
||||
static fileName includeFileName(Istream&, const dictionary&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -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
|
||||
@ -69,7 +69,7 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const fileName fName(includeFileName(is));
|
||||
const fileName fName(includeFileName(is, parentDict));
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
@ -92,7 +92,7 @@ bool Foam::functionEntries::includeIfPresentEntry::execute
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const fileName fName(includeFileName(is));
|
||||
const fileName fName(includeFileName(is, parentDict));
|
||||
IFstream ifs(fName);
|
||||
|
||||
if (ifs)
|
||||
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "primitiveEntry.H"
|
||||
#include "dictionary.H"
|
||||
#include "OSspecific.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -40,35 +41,52 @@ void Foam::primitiveEntry::append(const UList<token>& varTokens)
|
||||
|
||||
bool Foam::primitiveEntry::expandVariable
|
||||
(
|
||||
const word& w,
|
||||
const string& w,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word varName = w(1, w.size()-1);
|
||||
|
||||
// lookup the variable name in the given dictionary....
|
||||
// Note: allow wildcards to match? For now disabled since following
|
||||
// would expand internalField to wildcard match and not expected
|
||||
// internalField:
|
||||
// internalField XXX;
|
||||
// boundaryField { ".*" {YYY;} movingWall {value $internalField;}
|
||||
const entry* ePtr = dict.lookupScopedEntryPtr(varName, true, false);
|
||||
|
||||
// ...if defined append its tokens into this
|
||||
if (ePtr)
|
||||
if (w.size() > 2 && w[0] == '$' && w[1] == token::BEGIN_BLOCK)
|
||||
{
|
||||
append(ePtr->stream());
|
||||
// Recursive substitution mode. Replace between {} with
|
||||
// expansion.
|
||||
string s(w(2, w.size()-3));
|
||||
// Substitute dictionary and environment variables. Allow
|
||||
// empty substitutions.
|
||||
stringOps::inplaceExpand(s, dict, true, true);
|
||||
|
||||
string newW(w);
|
||||
newW.std::string::replace(1, newW.size()-1, s);
|
||||
|
||||
return expandVariable(newW, dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
// not in the dictionary - try an environment variable
|
||||
string envStr = getEnv(varName);
|
||||
string varName = w(1, w.size()-1);
|
||||
|
||||
if (envStr.empty())
|
||||
// lookup the variable name in the given dictionary....
|
||||
// Note: allow wildcards to match? For now disabled since following
|
||||
// would expand internalField to wildcard match and not expected
|
||||
// internalField:
|
||||
// internalField XXX;
|
||||
// boundaryField { ".*" {YYY;} movingWall {value $internalField;}
|
||||
const entry* ePtr = dict.lookupScopedEntryPtr(varName, true, false);
|
||||
|
||||
// ...if defined append its tokens into this
|
||||
if (ePtr)
|
||||
{
|
||||
return false;
|
||||
append(ePtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
// not in the dictionary - try an environment variable
|
||||
string envStr = getEnv(varName);
|
||||
|
||||
if (envStr.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
append(tokenList(IStringStream('(' + envStr + ')')()));
|
||||
}
|
||||
append(tokenList(IStringStream('(' + envStr + ')')()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -81,7 +99,7 @@ Foam::primitiveEntry::primitiveEntry(const keyType& key, const ITstream& is)
|
||||
entry(key),
|
||||
ITstream(is)
|
||||
{
|
||||
name() += "::" + keyword();
|
||||
name() += '.' + keyword();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -79,7 +79,7 @@ class primitiveEntry
|
||||
);
|
||||
|
||||
//- Expand the given variable (keyword starts with $)
|
||||
bool expandVariable(const word&, const dictionary&);
|
||||
bool expandVariable(const string&, const dictionary&);
|
||||
|
||||
//- Expand the given function (keyword starts with #)
|
||||
bool expandFunction
|
||||
|
||||
@ -55,6 +55,24 @@ void Foam::primitiveEntry::append
|
||||
newElmt(tokenIndex()++) = currToken;
|
||||
}
|
||||
}
|
||||
else if (currToken.isVariable())
|
||||
{
|
||||
const string& w = currToken.stringToken();
|
||||
|
||||
if
|
||||
(
|
||||
disableFunctionEntries
|
||||
|| w.size() <= 3
|
||||
|| !(
|
||||
w[0] == '$'
|
||||
&& w[1] == token::BEGIN_BLOCK
|
||||
&& expandVariable(w, dict)
|
||||
)
|
||||
)
|
||||
{
|
||||
newElmt(tokenIndex()++) = currToken;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newElmt(tokenIndex()++) = currToken;
|
||||
@ -186,7 +204,7 @@ Foam::primitiveEntry::primitiveEntry
|
||||
entry(key),
|
||||
ITstream
|
||||
(
|
||||
is.name() + "::" + key,
|
||||
is.name() + '.' + key,
|
||||
tokenList(10),
|
||||
is.format(),
|
||||
is.version()
|
||||
@ -201,7 +219,7 @@ Foam::primitiveEntry::primitiveEntry(const keyType& key, Istream& is)
|
||||
entry(key),
|
||||
ITstream
|
||||
(
|
||||
is.name() + "::" + key,
|
||||
is.name() + '.' + key,
|
||||
tokenList(10),
|
||||
is.format(),
|
||||
is.version()
|
||||
|
||||
@ -0,0 +1,266 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word Foam::functionObjectFile::outputPrefix = "postProcessing";
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::fileName Foam::functionObjectFile::baseFileDir() const
|
||||
{
|
||||
fileName baseDir = obr_.time().path();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
baseDir = baseDir/".."/outputPrefix;
|
||||
}
|
||||
else
|
||||
{
|
||||
baseDir = baseDir/outputPrefix;
|
||||
}
|
||||
|
||||
// append mesh name if not default region
|
||||
if (isA<polyMesh>(obr_))
|
||||
{
|
||||
const polyMesh& mesh = refCast<const polyMesh>(obr_);
|
||||
if (mesh.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
baseDir = baseDir/mesh.name();
|
||||
}
|
||||
}
|
||||
|
||||
return baseDir;
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::functionObjectFile::baseTimeDir() const
|
||||
{
|
||||
return baseFileDir()/prefix_/obr_.time().timeName();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::createFiles()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
const word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(wordHashSet, names_, iter)
|
||||
{
|
||||
if (!filePtrs_.set(i))
|
||||
{
|
||||
fileName outputDir(baseFileDir()/prefix_/startTimeName);
|
||||
|
||||
mkDir(outputDir);
|
||||
|
||||
filePtrs_.set(i, new OFstream(outputDir/(iter.key() + ".dat")));
|
||||
|
||||
writeFileHeader(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::writeFileHeader(const label i)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::write()
|
||||
{
|
||||
createFiles();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::resetNames(const wordList& names)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
names_.clear();
|
||||
names_.insert(names);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.toc().size());
|
||||
|
||||
createFiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::resetName(const word& name)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
names_.clear();
|
||||
names_.insert(name);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(1);
|
||||
|
||||
createFiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFile::functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix
|
||||
)
|
||||
:
|
||||
obr_(obr),
|
||||
prefix_(prefix),
|
||||
names_(),
|
||||
filePtrs_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::functionObjectFile::functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& name
|
||||
)
|
||||
:
|
||||
obr_(obr),
|
||||
prefix_(prefix),
|
||||
names_(),
|
||||
filePtrs_()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
names_.clear();
|
||||
names_.insert(name);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.toc().size());
|
||||
|
||||
// cannot create files - need to access virtual function
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::functionObjectFile::functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const wordList& names
|
||||
)
|
||||
:
|
||||
obr_(obr),
|
||||
prefix_(prefix),
|
||||
names_(names),
|
||||
filePtrs_()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
names_.clear();
|
||||
names_.insert(names);
|
||||
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.toc().size());
|
||||
|
||||
// cannot create files - need to access virtual function
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFile::~functionObjectFile()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordHashSet& Foam::functionObjectFile::names() const
|
||||
{
|
||||
return names_;
|
||||
}
|
||||
|
||||
|
||||
Foam::OFstream& Foam::functionObjectFile::file()
|
||||
{
|
||||
if (!Pstream::master())
|
||||
{
|
||||
FatalErrorIn("Foam::OFstream& Foam::functionObjectFile::file()")
|
||||
<< "Request for file() can only be done by the master process"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (filePtrs_.size() != 1)
|
||||
{
|
||||
WarningIn("Foam::Ostream& Foam::functionObjectFile::file()")
|
||||
<< "Requested single file, but multiple files are present"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return filePtrs_[0];
|
||||
}
|
||||
|
||||
|
||||
Foam::PtrList<Foam::OFstream>& Foam::functionObjectFile::files()
|
||||
{
|
||||
if (!Pstream::master())
|
||||
{
|
||||
FatalErrorIn("Foam::OFstream& Foam::functionObjectFile::files()")
|
||||
<< "Request for files() can only be done by the master process"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return filePtrs_;
|
||||
}
|
||||
|
||||
|
||||
Foam::OFstream& Foam::functionObjectFile::file(const label i)
|
||||
{
|
||||
if (!Pstream::master())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::OFstream& Foam::functionObjectFile::file(const label)"
|
||||
)
|
||||
<< "Request for file(i) can only be done by the master process"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return filePtrs_[i];
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,163 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjectFile
|
||||
|
||||
Description
|
||||
Base class for output file data handling
|
||||
|
||||
See Also
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
functionObjectFile.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjectFile_H
|
||||
#define functionObjectFile_H
|
||||
|
||||
#include "objectRegistry.H"
|
||||
#include "OFstream.H"
|
||||
#include "PtrList.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObjectFile Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class functionObjectFile
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Prefix
|
||||
const word& prefix_;
|
||||
|
||||
//- File names
|
||||
wordHashSet names_;
|
||||
|
||||
//- File pointer
|
||||
PtrList<OFstream> filePtrs_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Return the base directory for output
|
||||
virtual fileName baseFileDir() const;
|
||||
|
||||
//- Return the base directory for the current time value
|
||||
virtual fileName baseTimeDir() const;
|
||||
|
||||
//- Create the output file
|
||||
virtual void createFiles();
|
||||
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i = 0);
|
||||
|
||||
//- Write function
|
||||
virtual void write();
|
||||
|
||||
//- Reset the list of names from a wordList
|
||||
virtual void resetNames(const wordList& names);
|
||||
|
||||
//- Reset the list of names to a single name entry
|
||||
virtual void resetName(const word& name);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
functionObjectFile(const functionObjectFile&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const functionObjectFile&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Folder prefix
|
||||
static const word outputPrefix;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
functionObjectFile(const objectRegistry& obr, const word& prefix);
|
||||
|
||||
//- Construct from components
|
||||
functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& name
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
functionObjectFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const wordList& names
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~functionObjectFile();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return const access to the names
|
||||
const wordHashSet& names() const;
|
||||
|
||||
//- Return access to the file (if only 1)
|
||||
OFstream& file();
|
||||
|
||||
//- Return access to the files
|
||||
PtrList<OFstream>& files();
|
||||
|
||||
//- Return file 'i'
|
||||
OFstream& file(const label i);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
@ -105,83 +105,6 @@ void Foam::dimensionSet::reset(const dimensionSet& ds)
|
||||
}
|
||||
|
||||
|
||||
Foam::string Foam::dimensionSet::asText() const
|
||||
{
|
||||
OStringStream buf;
|
||||
|
||||
bool Dimensionless = true;
|
||||
|
||||
for (int Dimension=0; Dimension < dimensionSet::nDimensions-1; ++Dimension)
|
||||
{
|
||||
const scalar& expt = exponents_[Dimension];
|
||||
|
||||
if (expt < smallExponent && expt > -smallExponent)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Dimensionless)
|
||||
{
|
||||
Dimensionless = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf << ' ';
|
||||
}
|
||||
|
||||
// note: currently only handle SI
|
||||
switch (Dimension)
|
||||
{
|
||||
case MASS:
|
||||
buf << "kg";
|
||||
break;
|
||||
|
||||
case LENGTH:
|
||||
buf << "m";
|
||||
break;
|
||||
|
||||
case TIME:
|
||||
buf << "s";
|
||||
break;
|
||||
|
||||
case TEMPERATURE:
|
||||
buf << "K";
|
||||
break;
|
||||
|
||||
case MOLES:
|
||||
buf << "mol";
|
||||
break;
|
||||
|
||||
case CURRENT:
|
||||
buf << "A";
|
||||
break;
|
||||
|
||||
case LUMINOUS_INTENSITY:
|
||||
buf << "Cd";
|
||||
break;
|
||||
|
||||
default:
|
||||
buf << "??"; // this shouldn't be - flag as being weird
|
||||
break;
|
||||
}
|
||||
|
||||
if (expt != 1)
|
||||
{
|
||||
buf << '^' << expt;
|
||||
}
|
||||
}
|
||||
|
||||
if (Dimensionless)
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
else
|
||||
{
|
||||
return buf.str();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::dimensionSet::operator[](const dimensionType type) const
|
||||
@ -196,6 +119,18 @@ Foam::scalar& Foam::dimensionSet::operator[](const dimensionType type)
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::dimensionSet::operator[](const label type) const
|
||||
{
|
||||
return exponents_[type];
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar& Foam::dimensionSet::operator[](const label type)
|
||||
{
|
||||
return exponents_[type];
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dimensionSet::operator==(const dimensionSet& ds) const
|
||||
{
|
||||
for (int Dimension=0; Dimension < nDimensions; ++Dimension)
|
||||
|
||||
@ -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
|
||||
@ -40,10 +40,12 @@ SourceFiles
|
||||
#ifndef dimensionSet_H
|
||||
#define dimensionSet_H
|
||||
|
||||
#include "scalar.H"
|
||||
#include "bool.H"
|
||||
#include "dimensionedScalarFwd.H"
|
||||
#include "className.H"
|
||||
#include "scalarField.H"
|
||||
#include "PtrList.H"
|
||||
#include "HashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,6 +55,7 @@ namespace Foam
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class dimensionSet;
|
||||
class dimensionSets;
|
||||
|
||||
// Friend functions
|
||||
|
||||
@ -140,6 +143,64 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// Private classes
|
||||
|
||||
class tokeniser
|
||||
{
|
||||
// Private data
|
||||
|
||||
Istream& is_;
|
||||
|
||||
List<token> tokens_;
|
||||
|
||||
label start_;
|
||||
|
||||
label size_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void push(const token&);
|
||||
|
||||
token pop();
|
||||
|
||||
void unpop(const token&);
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
tokeniser(Istream&);
|
||||
|
||||
// Member Functions
|
||||
|
||||
Istream& stream()
|
||||
{
|
||||
return is_;
|
||||
}
|
||||
|
||||
bool hasToken() const;
|
||||
|
||||
token nextToken();
|
||||
|
||||
void putBack(const token&);
|
||||
|
||||
void splitWord(const word&);
|
||||
|
||||
static bool valid(char c);
|
||||
|
||||
static label priority(const token& t);
|
||||
|
||||
};
|
||||
|
||||
|
||||
dimensionedScalar parse
|
||||
(
|
||||
const label lastPrior,
|
||||
tokeniser& tis,
|
||||
const HashTable<dimensionedScalar>&
|
||||
) const;
|
||||
|
||||
|
||||
// private data
|
||||
|
||||
// dimensionSet stored as an array of dimension exponents
|
||||
@ -189,14 +250,56 @@ public:
|
||||
|
||||
void reset(const dimensionSet&);
|
||||
|
||||
//- Return a text representation for added readability
|
||||
string asText() const;
|
||||
|
||||
// I/O
|
||||
|
||||
//- Read using provided units. Used only in initial parsing
|
||||
Istream& read
|
||||
(
|
||||
Istream& is,
|
||||
scalar& multiplier,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Read using provided units
|
||||
Istream& read
|
||||
(
|
||||
Istream& is,
|
||||
scalar& multiplier,
|
||||
const HashTable<dimensionedScalar>&
|
||||
);
|
||||
|
||||
//- Read using system units
|
||||
Istream& read
|
||||
(
|
||||
Istream& is,
|
||||
scalar& multiplier
|
||||
);
|
||||
|
||||
//- Write using provided units
|
||||
Ostream& write
|
||||
(
|
||||
Ostream& os,
|
||||
scalar& multiplier,
|
||||
const dimensionSets&
|
||||
) const;
|
||||
|
||||
//- Write using system units
|
||||
Ostream& write
|
||||
(
|
||||
Ostream& os,
|
||||
scalar& multiplier
|
||||
) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
scalar operator[](const dimensionType) const;
|
||||
scalar& operator[](const dimensionType);
|
||||
|
||||
scalar operator[](const label) const;
|
||||
scalar& operator[](const label);
|
||||
|
||||
bool operator==(const dimensionSet&) const;
|
||||
bool operator!=(const dimensionSet&) const;
|
||||
|
||||
|
||||
@ -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
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "dimensionSet.H"
|
||||
#include "IOstreams.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -34,46 +35,670 @@ Foam::dimensionSet::dimensionSet(Istream& is)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
Foam::dimensionSet::tokeniser::tokeniser(Istream& is)
|
||||
:
|
||||
is_(is),
|
||||
tokens_(100),
|
||||
start_(0),
|
||||
size_(0)
|
||||
{}
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, dimensionSet& dset)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::dimensionSet::tokeniser::push(const token& t)
|
||||
{
|
||||
// Read begining of dimensionSet
|
||||
if (token(is) != token::BEGIN_SQR)
|
||||
label end = (start_+size_)%tokens_.size();
|
||||
tokens_[end] = t;
|
||||
if (size_ == tokens_.size())
|
||||
{
|
||||
Info<< "expected a " << token::BEGIN_SQR << " in dimensionSet"
|
||||
<< endl << "in stream " << is.info() << endl;
|
||||
start_ = tokens_.fcIndex(start_);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::token Foam::dimensionSet::tokeniser::pop()
|
||||
{
|
||||
token t = tokens_[start_];
|
||||
start_ = tokens_.fcIndex(start_);
|
||||
--size_;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
void Foam::dimensionSet::tokeniser::unpop(const token& t)
|
||||
{
|
||||
++size_;
|
||||
start_ = tokens_.rcIndex(start_);
|
||||
tokens_[start_] = t;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dimensionSet::tokeniser::hasToken() const
|
||||
{
|
||||
return size_ || is_.good();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dimensionSet::tokeniser::valid(char c)
|
||||
{
|
||||
return
|
||||
(
|
||||
!isspace(c)
|
||||
&& c != '"' // string quote
|
||||
&& c != '\'' // string quote
|
||||
&& c != '/' // div
|
||||
&& c != ';' // end statement
|
||||
&& c != '{' // beg subdict
|
||||
&& c != '}' // end subdict
|
||||
&& c != '(' // beg expr
|
||||
&& c != ')' // end expr
|
||||
&& c != '[' // beg dim
|
||||
&& c != ']' // end dim
|
||||
&& c != '^' // power
|
||||
&& c != '*' // mult
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::dimensionSet::tokeniser::priority(const token& t)
|
||||
{
|
||||
if (!t.isPunctuation())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if
|
||||
(
|
||||
t.pToken() == token::MULTIPLY
|
||||
|| t.pToken() == token::DIVIDE
|
||||
)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (t.pToken() == '^')
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::dimensionSet::tokeniser::splitWord(const word& w)
|
||||
{
|
||||
size_t start = 0;
|
||||
for (size_t i=0; i<w.size(); ++i)
|
||||
{
|
||||
if (!valid(w[i]))
|
||||
{
|
||||
if (i > start)
|
||||
{
|
||||
word subWord = w(start, i-start);
|
||||
if (isdigit(subWord[0]) || subWord[0] == token::SUBTRACT)
|
||||
{
|
||||
push(token(readLabel(IStringStream(subWord)())));
|
||||
}
|
||||
else
|
||||
{
|
||||
push(token(subWord));
|
||||
}
|
||||
}
|
||||
if (w[i] != token::SPACE)
|
||||
{
|
||||
if (isdigit(w[i]))
|
||||
{
|
||||
push(token(readLabel(IStringStream(w[i])())));
|
||||
}
|
||||
else
|
||||
{
|
||||
push(token::punctuationToken(w[i]));
|
||||
}
|
||||
}
|
||||
start = i+1;
|
||||
}
|
||||
}
|
||||
if (start < w.size())
|
||||
{
|
||||
word subWord = w(start, w.size()-start);
|
||||
if (isdigit(subWord[0]) || subWord[0] == token::SUBTRACT)
|
||||
{
|
||||
push(token(readLabel(IStringStream(subWord)())));
|
||||
}
|
||||
else
|
||||
{
|
||||
push(token(subWord));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::token Foam::dimensionSet::tokeniser::nextToken()
|
||||
{
|
||||
if (size_ == 0)
|
||||
{
|
||||
token t(is_);
|
||||
if (t.isWord())
|
||||
{
|
||||
splitWord(t.wordToken());
|
||||
return pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::dimensionSet::tokeniser::putBack(const token& t)
|
||||
{
|
||||
if (size_ == 0)
|
||||
{
|
||||
push(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
unpop(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionedScalar Foam::dimensionSet::parse
|
||||
(
|
||||
const label lastPrior,
|
||||
tokeniser& tis,
|
||||
const HashTable<dimensionedScalar>& readSet
|
||||
) const
|
||||
{
|
||||
dimensionedScalar ds("", dimless, 1.0);
|
||||
|
||||
// Get initial token
|
||||
token nextToken(tis.nextToken());
|
||||
|
||||
// Store type of last token read. Used to detect two consecutive
|
||||
// symbols and assume multiplication
|
||||
bool haveReadSymbol = false;
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (nextToken.isWord())
|
||||
{
|
||||
const word& unitName = nextToken.wordToken();
|
||||
const dimensionedScalar& unitDim = readSet[unitName];
|
||||
ds.dimensions() *= unitDim.dimensions();
|
||||
ds.value() *= unitDim.value();
|
||||
haveReadSymbol = true;
|
||||
}
|
||||
else if (nextToken.isNumber())
|
||||
{
|
||||
// no dimensions, just value
|
||||
ds.value() *= nextToken.number();
|
||||
haveReadSymbol = true;
|
||||
}
|
||||
else if (nextToken.isPunctuation())
|
||||
{
|
||||
label nextPrior = tokeniser::priority(nextToken);
|
||||
|
||||
if (nextToken.pToken() == token::BEGIN_SQR)
|
||||
{
|
||||
// No idea when this will happen
|
||||
tis.putBack(nextToken);
|
||||
return ds;
|
||||
}
|
||||
else if (nextToken.pToken() == token::END_SQR)
|
||||
{
|
||||
tis.putBack(nextToken);
|
||||
return ds;
|
||||
}
|
||||
else if (nextToken.pToken() == token::BEGIN_LIST)
|
||||
{
|
||||
dimensionedScalar sub(parse(nextPrior, tis, readSet));
|
||||
|
||||
token t = tis.nextToken();
|
||||
if (!t.isPunctuation() || t.pToken() != token::END_LIST)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dimensionSet::parse"
|
||||
"(const label, tokeniser&"
|
||||
", const HashTable<dimensionedScalar>&)",
|
||||
tis.stream()
|
||||
) << "Illegal token " << t << exit(FatalIOError);
|
||||
}
|
||||
|
||||
ds.dimensions() *= sub.dimensions();
|
||||
ds.value() *= sub.value();
|
||||
|
||||
haveReadSymbol = true;
|
||||
}
|
||||
else if (nextToken.pToken() == token::END_LIST)
|
||||
{
|
||||
tis.putBack(nextToken);
|
||||
return ds;
|
||||
}
|
||||
else if (nextToken.pToken() == token::MULTIPLY)
|
||||
{
|
||||
if (nextPrior > lastPrior)
|
||||
{
|
||||
dimensionedScalar sub(parse(nextPrior, tis, readSet));
|
||||
|
||||
ds.dimensions() *= sub.dimensions();
|
||||
ds.value() *= sub.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restore token
|
||||
tis.putBack(nextToken);
|
||||
return ds;
|
||||
}
|
||||
haveReadSymbol = false;
|
||||
}
|
||||
else if (nextToken.pToken() == token::DIVIDE)
|
||||
{
|
||||
if (nextPrior > lastPrior)
|
||||
{
|
||||
dimensionedScalar sub(parse(nextPrior, tis, readSet));
|
||||
|
||||
ds.dimensions() /= sub.dimensions();
|
||||
ds.value() /= sub.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
tis.putBack(nextToken);
|
||||
return ds;
|
||||
}
|
||||
haveReadSymbol = false;
|
||||
}
|
||||
else if (nextToken.pToken() == '^')
|
||||
{
|
||||
if (nextPrior > lastPrior)
|
||||
{
|
||||
dimensionedScalar exp(parse(nextPrior, tis, readSet));
|
||||
|
||||
ds.dimensions().reset(pow(ds.dimensions(), exp.value()));
|
||||
ds.value() = Foam::pow(ds.value(), exp.value());
|
||||
}
|
||||
else
|
||||
{
|
||||
tis.putBack(nextToken);
|
||||
return ds;
|
||||
}
|
||||
haveReadSymbol = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dimensionSet::parse"
|
||||
"(const label, tokeniser&"
|
||||
", const HashTable<dimensionedScalar>&)",
|
||||
tis.stream()
|
||||
) << "Illegal token " << nextToken << exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dimensionSet::parse"
|
||||
"(const label, tokeniser&"
|
||||
", const HashTable<dimensionedScalar>&)",
|
||||
tis.stream()
|
||||
) << "Illegal token " << nextToken << exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
if (!tis.hasToken())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
nextToken = tis.nextToken();
|
||||
if (nextToken.error())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (haveReadSymbol && (nextToken.isWord() || nextToken.isNumber()))
|
||||
{
|
||||
// Two consecutive symbols. Assume multiplication
|
||||
tis.putBack(nextToken);
|
||||
nextToken = token(token::MULTIPLY);
|
||||
}
|
||||
}
|
||||
|
||||
// Read first five dimensions
|
||||
for (int Dimension=0; Dimension<dimensionSet::CURRENT; Dimension++)
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::dimensionSet::read
|
||||
(
|
||||
Istream& is,
|
||||
scalar& multiplier,
|
||||
const HashTable<dimensionedScalar>& readSet
|
||||
)
|
||||
{
|
||||
multiplier = 1.0;
|
||||
|
||||
// Read begining of dimensionSet
|
||||
token startToken(is);
|
||||
|
||||
if (startToken != token::BEGIN_SQR)
|
||||
{
|
||||
is >> dset.exponents_[Dimension];
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dimensionSet::read"
|
||||
"(Istream&, scalar&, const HashTable<dimensionedScalar>&)",
|
||||
is
|
||||
) << "expected a " << token::BEGIN_SQR << " in dimensionSet"
|
||||
<< endl << "in stream " << is.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// Read next token
|
||||
token nextToken(is);
|
||||
|
||||
// If next token is another number
|
||||
// read last two dimensions
|
||||
// and then read another token for the end of the dimensionSet
|
||||
if (nextToken.isNumber())
|
||||
if (!nextToken.isNumber())
|
||||
{
|
||||
dset.exponents_[dimensionSet::CURRENT] = nextToken.number();
|
||||
is >> dset.exponents_[dimensionSet::LUMINOUS_INTENSITY];
|
||||
is >> nextToken;
|
||||
is.putBack(nextToken);
|
||||
|
||||
tokeniser tis(is);
|
||||
|
||||
dimensionedScalar ds(parse(0, tis, readSet));
|
||||
|
||||
multiplier = ds.value();
|
||||
for (int i=0; i < dimensionSet::nDimensions; ++i)
|
||||
{
|
||||
exponents_[i] = ds.dimensions()[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dset.exponents_[dimensionSet::CURRENT] = 0;
|
||||
dset.exponents_[dimensionSet::LUMINOUS_INTENSITY] = 0;
|
||||
// Read first five dimensions
|
||||
exponents_[dimensionSet::MASS] = nextToken.number();
|
||||
for (int Dimension=1; Dimension<dimensionSet::CURRENT; Dimension++)
|
||||
{
|
||||
is >> exponents_[Dimension];
|
||||
}
|
||||
|
||||
// Read next token
|
||||
token nextToken(is);
|
||||
|
||||
// If next token is another number
|
||||
// read last two dimensions
|
||||
// and then read another token for the end of the dimensionSet
|
||||
if (nextToken.isNumber())
|
||||
{
|
||||
exponents_[dimensionSet::CURRENT] = nextToken.number();
|
||||
is >> nextToken;
|
||||
exponents_[dimensionSet::LUMINOUS_INTENSITY] = nextToken.number();
|
||||
is >> nextToken;
|
||||
}
|
||||
else
|
||||
{
|
||||
exponents_[dimensionSet::CURRENT] = 0;
|
||||
exponents_[dimensionSet::LUMINOUS_INTENSITY] = 0;
|
||||
}
|
||||
|
||||
// Check end of dimensionSet
|
||||
if (nextToken != token::END_SQR)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dimensionSet::read"
|
||||
"(Istream&, scalar&, const HashTable<dimensionedScalar>&)",
|
||||
is
|
||||
) << "expected a " << token::END_SQR << " in dimensionSet "
|
||||
<< endl << "in stream " << is.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
// Check state of Istream
|
||||
is.check("Istream& operator>>(Istream&, dimensionSet&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::dimensionSet::read
|
||||
(
|
||||
Istream& is,
|
||||
scalar& multiplier
|
||||
)
|
||||
{
|
||||
return read(is, multiplier, unitSet());
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::dimensionSet::read
|
||||
(
|
||||
Istream& is,
|
||||
scalar& multiplier,
|
||||
const dictionary& readSet
|
||||
)
|
||||
{
|
||||
multiplier = 1.0;
|
||||
|
||||
// Read begining of dimensionSet
|
||||
token startToken(is);
|
||||
|
||||
if (startToken != token::BEGIN_SQR)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dimensionSet::read"
|
||||
"(Istream&, scalar&, const dictionary&)",
|
||||
is
|
||||
) << "expected a " << token::BEGIN_SQR << " in dimensionSet"
|
||||
<< endl << "in stream " << is.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// Check end of dimensionSet
|
||||
if (nextToken != token::END_SQR)
|
||||
// Read next token
|
||||
token nextToken(is);
|
||||
|
||||
if (nextToken.isWord())
|
||||
{
|
||||
Info<< "expected a " << token::END_SQR << " in dimensionSet"
|
||||
<< endl << "in stream " << is.info() << endl;
|
||||
bool continueParsing = true;
|
||||
do
|
||||
{
|
||||
word symbolPow = nextToken.wordToken();
|
||||
if (symbolPow[symbolPow.size()-1] == token::END_SQR)
|
||||
{
|
||||
symbolPow = symbolPow(0, symbolPow.size()-1);
|
||||
continueParsing = false;
|
||||
}
|
||||
|
||||
|
||||
// Parse unit
|
||||
dimensionSet symbolSet(dimless);
|
||||
|
||||
size_t index = symbolPow.find('^');
|
||||
if (index != string::npos)
|
||||
{
|
||||
word symbol = symbolPow(0, index);
|
||||
word exp = symbolPow(index+1, symbolPow.size()-index+1);
|
||||
scalar exponent = readScalar(IStringStream(exp)());
|
||||
|
||||
dimensionedScalar s;
|
||||
s.read(readSet[symbol], readSet);
|
||||
|
||||
symbolSet.reset(pow(s.dimensions(), exponent));
|
||||
multiplier *= Foam::pow(s.value(), exponent);
|
||||
}
|
||||
else
|
||||
{
|
||||
dimensionedScalar s;
|
||||
s.read(readSet[symbolPow], readSet);
|
||||
|
||||
symbolSet.reset(s.dimensions());
|
||||
multiplier *= s.value();
|
||||
}
|
||||
|
||||
// Add dimensions without checking
|
||||
for (int i=0; i < dimensionSet::nDimensions; ++i)
|
||||
{
|
||||
exponents_[i] += symbolSet[i];
|
||||
}
|
||||
|
||||
if (continueParsing)
|
||||
{
|
||||
nextToken = token(is);
|
||||
|
||||
if (!nextToken.isWord() || nextToken == token::END_SQR)
|
||||
{
|
||||
continueParsing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (continueParsing);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read first five dimensions
|
||||
exponents_[dimensionSet::MASS] = nextToken.number();
|
||||
for (int Dimension=1; Dimension<dimensionSet::CURRENT; Dimension++)
|
||||
{
|
||||
is >> exponents_[Dimension];
|
||||
}
|
||||
|
||||
// Read next token
|
||||
token nextToken(is);
|
||||
|
||||
// If next token is another number
|
||||
// read last two dimensions
|
||||
// and then read another token for the end of the dimensionSet
|
||||
if (nextToken.isNumber())
|
||||
{
|
||||
exponents_[dimensionSet::CURRENT] = nextToken.number();
|
||||
is >> nextToken;
|
||||
exponents_[dimensionSet::LUMINOUS_INTENSITY] = nextToken.number();
|
||||
is >> nextToken;
|
||||
}
|
||||
else
|
||||
{
|
||||
exponents_[dimensionSet::CURRENT] = 0;
|
||||
exponents_[dimensionSet::LUMINOUS_INTENSITY] = 0;
|
||||
}
|
||||
|
||||
// Check end of dimensionSet
|
||||
if (nextToken != token::END_SQR)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dimensionSet::read"
|
||||
"(Istream&, scalar&, const dictionary&)",
|
||||
is
|
||||
) << "expected a " << token::END_SQR << " in dimensionSet "
|
||||
<< endl << "in stream " << is.info()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
// Check state of Istream
|
||||
is.check("Istream& operator>>(Istream&, dimensionSet&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::dimensionSet::write
|
||||
(
|
||||
Ostream& os,
|
||||
scalar& multiplier,
|
||||
const dimensionSets& writeUnits
|
||||
) const
|
||||
{
|
||||
multiplier = 1.0;
|
||||
|
||||
os << token::BEGIN_SQR;
|
||||
|
||||
if (writeUnits.valid())
|
||||
{
|
||||
scalarField exponents(dimensionSet::nDimensions);
|
||||
for (int d=0; d<dimensionSet::nDimensions; d++)
|
||||
{
|
||||
exponents[d] = exponents_[d];
|
||||
}
|
||||
writeUnits.coefficients(exponents);
|
||||
|
||||
bool hasPrinted = false;
|
||||
forAll(exponents, i)
|
||||
{
|
||||
if (mag(exponents[i]) > smallExponent)
|
||||
{
|
||||
const dimensionedScalar& ds = writeUnits.units()[i];
|
||||
|
||||
if (hasPrinted)
|
||||
{
|
||||
os << token::SPACE;
|
||||
}
|
||||
hasPrinted = true;
|
||||
os << ds.name();
|
||||
if (mag(exponents[i]-1) > smallExponent)
|
||||
{
|
||||
os << '^' << exponents[i];
|
||||
|
||||
multiplier *= Foam::pow(ds.value(), exponents[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
multiplier *= ds.value();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int d=0; d<dimensionSet::nDimensions-1; d++)
|
||||
{
|
||||
os << exponents_[d] << token::SPACE;
|
||||
}
|
||||
os << exponents_[dimensionSet::nDimensions-1];
|
||||
}
|
||||
|
||||
os << token::END_SQR;
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const dimensionSet&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::dimensionSet::write
|
||||
(
|
||||
Ostream& os,
|
||||
scalar& multiplier
|
||||
) const
|
||||
{
|
||||
return write(os, multiplier, writeUnitSet());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, dimensionSet& dset)
|
||||
{
|
||||
scalar multiplier;
|
||||
dset.read(is, multiplier);
|
||||
|
||||
if (mag(multiplier-1.0) > dimensionSet::smallExponent)
|
||||
{
|
||||
FatalIOErrorIn("Foam::operator>>(Istream&, dimensionSet&)", is)
|
||||
<< "Cannot use scaled units in dimensionSet"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// Check state of Istream
|
||||
@ -85,13 +710,8 @@ Foam::Istream& Foam::operator>>(Istream& is, dimensionSet& dset)
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const dimensionSet& dset)
|
||||
{
|
||||
os << token::BEGIN_SQR;
|
||||
|
||||
for (int Dimension=0; Dimension<dimensionSet::nDimensions-1; Dimension++)
|
||||
{
|
||||
os << dset.exponents_[Dimension] << token::SPACE;
|
||||
}
|
||||
os << dset.exponents_[dimensionSet::nDimensions-1] << token::END_SQR;
|
||||
scalar multiplier;
|
||||
dset.write(os, multiplier);
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const dimensionSet&)");
|
||||
|
||||
@ -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,34 +24,210 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "dimensionSet.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::dimensionSet Foam::dimless(0, 0, 0, 0, 0, 0, 0);
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
const Foam::dimensionSet Foam::dimMass(1, 0, 0, 0, 0, 0, 0);
|
||||
const Foam::dimensionSet Foam::dimLength(0, 1, 0, 0, 0, 0, 0);
|
||||
const Foam::dimensionSet Foam::dimTime(0, 0, 1, 0, 0, 0, 0);
|
||||
const Foam::dimensionSet Foam::dimTemperature(0, 0, 0, 1, 0, 0, 0);
|
||||
const Foam::dimensionSet Foam::dimMoles(0, 0, 0, 0, 1, 0, 0);
|
||||
const Foam::dimensionSet Foam::dimCurrent(0, 0, 0, 0, 0, 1, 0);
|
||||
const Foam::dimensionSet Foam::dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1);
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::dimensionSet Foam::dimArea(sqr(dimLength));
|
||||
const Foam::dimensionSet Foam::dimVolume(pow3(dimLength));
|
||||
const Foam::dimensionSet Foam::dimVol(dimVolume);
|
||||
dictionary* dimensionSystemsPtr_(NULL);
|
||||
|
||||
const Foam::dimensionSet Foam::dimVelocity(dimLength/dimTime);
|
||||
const Foam::dimensionSet Foam::dimAcceleration(dimVelocity/dimTime);
|
||||
dictionary& dimensionSystems()
|
||||
{
|
||||
return debug::switchSet
|
||||
(
|
||||
"DimensionSets",
|
||||
dimensionSystemsPtr_
|
||||
);
|
||||
}
|
||||
|
||||
const Foam::dimensionSet Foam::dimDensity(dimMass/dimVolume);
|
||||
const Foam::dimensionSet Foam::dimForce(dimMass*dimAcceleration);
|
||||
const Foam::dimensionSet Foam::dimEnergy(dimForce*dimLength);
|
||||
const Foam::dimensionSet Foam::dimPower(dimEnergy/dimTime);
|
||||
|
||||
const Foam::dimensionSet Foam::dimPressure(dimForce/dimArea);
|
||||
const Foam::dimensionSet Foam::dimGasConstant(dimEnergy/dimMass/dimTemperature);
|
||||
const Foam::dimensionSet Foam::dimSpecificHeatCapacity(dimGasConstant);
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
autoPtr<HashTable<dimensionedScalar> > unitSetPtr_;
|
||||
autoPtr<dimensionSets> writeUnitSetPtr_;
|
||||
|
||||
|
||||
const HashTable<dimensionedScalar>& unitSet()
|
||||
{
|
||||
if (!unitSetPtr_.valid())
|
||||
{
|
||||
const dictionary& dict = dimensionSystems();
|
||||
|
||||
if (!dict.found("unitSet"))
|
||||
{
|
||||
FatalIOErrorIn("unitSet()", dict)
|
||||
<< "Cannot find unitSet in dictionary " << dict.name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
const word unitSetCoeffs(word(dict.lookup("unitSet")) + "Coeffs");
|
||||
|
||||
if (!dict.found(unitSetCoeffs))
|
||||
{
|
||||
FatalIOErrorIn("unitSet()", dict)
|
||||
<< "Cannot find " << unitSetCoeffs << " in dictionary "
|
||||
<< dict.name() << exit(FatalIOError);
|
||||
}
|
||||
|
||||
const dictionary& unitDict = dict.subDict(unitSetCoeffs);
|
||||
|
||||
unitSetPtr_.reset
|
||||
(
|
||||
new HashTable<dimensionedScalar>(unitDict.size())
|
||||
);
|
||||
|
||||
forAllConstIter(dictionary, unitDict, iter)
|
||||
{
|
||||
if (iter().keyword() != "writeUnits")
|
||||
{
|
||||
dimensionedScalar dt;
|
||||
dt.read(iter().stream(), unitDict);
|
||||
bool ok = unitSetPtr_->insert(iter().keyword(), dt);
|
||||
if (!ok)
|
||||
{
|
||||
FatalIOErrorIn("unitSet()", dict)
|
||||
<< "Duplicate unit " << iter().keyword()
|
||||
<< " in DimensionSets dictionary"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wordList writeUnitNames
|
||||
(
|
||||
unitDict.lookupOrDefault<wordList>
|
||||
(
|
||||
"writeUnits",
|
||||
wordList(0)
|
||||
)
|
||||
);
|
||||
|
||||
writeUnitSetPtr_.reset
|
||||
(
|
||||
new dimensionSets
|
||||
(
|
||||
unitSetPtr_(),
|
||||
writeUnitNames
|
||||
)
|
||||
);
|
||||
|
||||
if (writeUnitNames.size() != 0 && writeUnitNames.size() != 7)
|
||||
{
|
||||
FatalIOErrorIn("unitSet()", dict)
|
||||
<< "Cannot find entry \"writeUnits\" in " << unitDict.name()
|
||||
<< " or it is not a wordList of size 7"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
return unitSetPtr_();
|
||||
}
|
||||
|
||||
|
||||
const dimensionSets& writeUnitSet()
|
||||
{
|
||||
if (!writeUnitSetPtr_.valid())
|
||||
{
|
||||
(void)unitSet();
|
||||
}
|
||||
return writeUnitSetPtr_();
|
||||
}
|
||||
|
||||
|
||||
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0);
|
||||
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0);
|
||||
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0);
|
||||
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0);
|
||||
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0);
|
||||
const dimensionSet dimCurrent(0, 0, 0, 0, 0, 1, 0);
|
||||
const dimensionSet dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1);
|
||||
|
||||
const dimensionSet dimArea(sqr(dimLength));
|
||||
const dimensionSet dimVolume(pow3(dimLength));
|
||||
const dimensionSet dimVol(dimVolume);
|
||||
|
||||
const dimensionSet dimVelocity(dimLength/dimTime);
|
||||
const dimensionSet dimAcceleration(dimVelocity/dimTime);
|
||||
|
||||
const dimensionSet dimDensity(dimMass/dimVolume);
|
||||
const dimensionSet dimForce(dimMass*dimAcceleration);
|
||||
const dimensionSet dimEnergy(dimForce*dimLength);
|
||||
const dimensionSet dimPower(dimEnergy/dimTime);
|
||||
|
||||
const dimensionSet dimPressure(dimForce/dimArea);
|
||||
const dimensionSet dimGasConstant(dimEnergy/dimMass/dimTemperature);
|
||||
const dimensionSet dimSpecificHeatCapacity(dimGasConstant);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dimensionSets::dimensionSets
|
||||
(
|
||||
const HashTable<dimensionedScalar>& units,
|
||||
const wordList& unitNames
|
||||
)
|
||||
:
|
||||
units_(unitNames.size()),
|
||||
conversion_(unitNames.size()),
|
||||
conversionPivots_(unitNames.size()),
|
||||
valid_(false)
|
||||
{
|
||||
forAll(unitNames, i)
|
||||
{
|
||||
units_.set
|
||||
(
|
||||
i,
|
||||
new dimensionedScalar
|
||||
(
|
||||
units[unitNames[i]]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (unitNames.size() == 7)
|
||||
{
|
||||
valid_ = true;
|
||||
|
||||
// Determine conversion from basic units to write units
|
||||
for (label rowI = 0; rowI < conversion_.n(); rowI++)
|
||||
{
|
||||
scalar* row = conversion_[rowI];
|
||||
|
||||
for (label columnI = 0; columnI < conversion_.m(); columnI++)
|
||||
{
|
||||
const dimensionedScalar& dSet = units_[columnI];
|
||||
row[columnI] = dSet.dimensions()[rowI];
|
||||
}
|
||||
}
|
||||
conversionPivots_.setSize(conversion_.n());
|
||||
LUDecompose(conversion_, conversionPivots_);
|
||||
|
||||
//- possibly some optimisation here to detect identity matri
|
||||
//if
|
||||
//(
|
||||
// conversionPivots_ == identity(conversionPivots_.size())
|
||||
// && conversion_ == I)
|
||||
//)
|
||||
//{
|
||||
// identity_ = true;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::dimensionSets::coefficients(scalarField& exponents) const
|
||||
{
|
||||
LUBacksubstitute(conversion_, conversionPivots_, exponents);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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
|
||||
@ -36,6 +36,10 @@ SourceFiles
|
||||
#ifndef dimensionSets_H
|
||||
#define dimensionSets_H
|
||||
|
||||
#include "scalarMatrices.H"
|
||||
#include "dimensionedScalarFwd.H"
|
||||
#include "PtrList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -69,6 +73,65 @@ extern const dimensionSet dimGasConstant;
|
||||
extern const dimensionSet dimSpecificHeatCapacity;
|
||||
|
||||
|
||||
|
||||
class dimensionSets
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Set of dimensions
|
||||
PtrList<dimensionedScalar> units_;
|
||||
|
||||
//- LU decomposition of dimensions
|
||||
scalarSquareMatrix conversion_;
|
||||
|
||||
//- See above
|
||||
labelList conversionPivots_;
|
||||
|
||||
//- Is LU decomposition valid
|
||||
bool valid_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from all units and set of units to use for inversion
|
||||
// (writing)
|
||||
dimensionSets
|
||||
(
|
||||
const HashTable<dimensionedScalar>&,
|
||||
const wordList& unitNames
|
||||
);
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the units
|
||||
const PtrList<dimensionedScalar>& units() const
|
||||
{
|
||||
return units_;
|
||||
}
|
||||
|
||||
//- Is there a valid inverse of the selected unit
|
||||
bool valid() const
|
||||
{
|
||||
return valid_;
|
||||
}
|
||||
|
||||
//- (if valid) obtain set of coefficients of unitNames
|
||||
void coefficients(scalarField&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//- Top level dictionary
|
||||
dictionary& dimensionSystems();
|
||||
|
||||
//- Set of all dimensions
|
||||
const HashTable<dimensionedScalar>& unitSet();
|
||||
|
||||
//- Set of units
|
||||
const dimensionSets& writeUnitSet();
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -97,10 +97,10 @@ dimensioned<Type>::dimensioned
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
name_(is),
|
||||
dimensions_(is),
|
||||
value_(pTraits<Type>(is))
|
||||
{}
|
||||
dimensions_(dimless)
|
||||
{
|
||||
read(is);
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
@ -111,9 +111,13 @@ dimensioned<Type>::dimensioned
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
dimensions_(is),
|
||||
value_(pTraits<Type>(is))
|
||||
{}
|
||||
dimensions_(dimless)
|
||||
{
|
||||
scalar multiplier;
|
||||
dimensions_.read(is, multiplier);
|
||||
is >> value_;
|
||||
value_ *= multiplier;
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
@ -141,24 +145,29 @@ dimensioned<Type>::dimensioned
|
||||
}
|
||||
|
||||
// If the dimensions are provided compare with the argument
|
||||
scalar multiplier = 1.0;
|
||||
|
||||
if (nextToken == token::BEGIN_SQR)
|
||||
{
|
||||
dimensionSet dims(is);
|
||||
dimensionSet dims(dimless);
|
||||
dims.read(is, multiplier);
|
||||
|
||||
if (dims != dimensions_)
|
||||
{
|
||||
FatalErrorIn
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"dimensioned<Type>::dimensioned"
|
||||
"(const word&, const dimensionSet&, Istream&)"
|
||||
"(const word&, const dimensionSet&, Istream&)",
|
||||
is
|
||||
) << "The dimensions " << dims
|
||||
<< " provided do not match the required dimensions "
|
||||
<< dimensions_
|
||||
<< abort(FatalError);
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
is >> value_;
|
||||
value_ *= multiplier;
|
||||
}
|
||||
|
||||
|
||||
@ -247,6 +256,83 @@ bool dimensioned<Type>::readIfPresent(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
Foam::Istream& dimensioned<Type>::read(Istream& is, const dictionary& readSet)
|
||||
{
|
||||
// Read name
|
||||
is >> name_;
|
||||
|
||||
// Read dimensionSet + multiplier
|
||||
scalar mult;
|
||||
dimensions_.read(is, mult, readSet);
|
||||
|
||||
// Read value
|
||||
is >> value_;
|
||||
value_ *= mult;
|
||||
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Istream& dimensioned<Type>::read(Istream& is, const dictionary&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
Foam::Istream& dimensioned<Type>::read
|
||||
(
|
||||
Istream& is,
|
||||
const HashTable<dimensionedScalar>& readSet
|
||||
)
|
||||
{
|
||||
// Read name
|
||||
is >> name_;
|
||||
|
||||
// Read dimensionSet + multiplier
|
||||
scalar mult;
|
||||
dimensions_.read(is, mult, readSet);
|
||||
|
||||
// Read value
|
||||
is >> value_;
|
||||
value_ *= mult;
|
||||
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Istream& dimensioned<Type>::read"
|
||||
"(Istream& is, const HashTable<dimensionedScalar>&)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template <class Type>
|
||||
Foam::Istream& dimensioned<Type>::read(Istream& is)
|
||||
{
|
||||
// Read name
|
||||
is >> name_;
|
||||
|
||||
// Read dimensionSet + multiplier
|
||||
scalar mult;
|
||||
dimensions_.read(is, mult);
|
||||
|
||||
// Read value
|
||||
is >> value_;
|
||||
value_ *= mult;
|
||||
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"Istream& dimensioned<Type>::read(Istream& is)"
|
||||
);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template <class Type>
|
||||
@ -414,13 +500,15 @@ Istream& operator>>(Istream& is, dimensioned<Type>& dt)
|
||||
}
|
||||
|
||||
// If the dimensions are provided reset the dimensions to those read
|
||||
scalar multiplier = 1.0;
|
||||
if (nextToken == token::BEGIN_SQR)
|
||||
{
|
||||
is >> dt.dimensions_;
|
||||
dt.dimensions_.read(is, multiplier);
|
||||
}
|
||||
|
||||
// Read the value
|
||||
is >> dt.value_;
|
||||
dt.value_ *= multiplier;
|
||||
|
||||
// Check state of Istream
|
||||
is.check("Istream& operator>>(Istream&, dimensioned<Type>&)");
|
||||
@ -432,10 +520,17 @@ Istream& operator>>(Istream& is, dimensioned<Type>& dt)
|
||||
template <class Type>
|
||||
Ostream& operator<<(Ostream& os, const dimensioned<Type>& dt)
|
||||
{
|
||||
// do a stream write op for a dimensions()et
|
||||
os << dt.name() << token::SPACE
|
||||
<< dt.dimensions() << token::SPACE
|
||||
<< dt.value();
|
||||
// Write the name
|
||||
os << dt.name() << token::SPACE;
|
||||
|
||||
// Write the dimensions
|
||||
scalar mult;
|
||||
dt.dimensions().write(os, mult);
|
||||
|
||||
os << token::SPACE;
|
||||
|
||||
// Write the value
|
||||
os << dt.value()/mult;
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
|
||||
|
||||
@ -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
|
||||
@ -163,6 +163,17 @@ public:
|
||||
bool readIfPresent(const dictionary&);
|
||||
|
||||
|
||||
// I/O
|
||||
|
||||
//- Read using provided units. Only used during startup.
|
||||
Istream& read(Istream& is, const dictionary&);
|
||||
|
||||
//- Read using provided units
|
||||
Istream& read(Istream& is, const HashTable<dimensionedScalar>&);
|
||||
|
||||
//- Read using system units
|
||||
Istream& read(Istream& is);
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Return a component as a dimensioned<cmptType>
|
||||
|
||||
@ -48,8 +48,10 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
)
|
||||
{
|
||||
dictionary dict(readStream(typeName));
|
||||
this->dimensions().reset(dict.lookup("dimensions"));
|
||||
scalar multiplier;
|
||||
this->dimensions().read(dict.lookup("dimensions"), multiplier);
|
||||
dict.lookup("value") >> this->value();
|
||||
this->value() *= multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,8 +77,10 @@ Foam::UniformDimensionedField<Type>::UniformDimensionedField
|
||||
dimensioned<Type>(regIOobject::name(), dimless, pTraits<Type>::zero)
|
||||
{
|
||||
dictionary dict(readStream(typeName));
|
||||
this->dimensions().reset(dict.lookup("dimensions"));
|
||||
scalar multiplier;
|
||||
this->dimensions().read(dict.lookup("dimensions"), multiplier);
|
||||
dict.lookup("value") >> this->value();
|
||||
this->value() *= multiplier;
|
||||
}
|
||||
|
||||
|
||||
@ -92,9 +96,11 @@ Foam::UniformDimensionedField<Type>::~UniformDimensionedField()
|
||||
template<class Type>
|
||||
bool Foam::UniformDimensionedField<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("dimensions") << this->dimensions() << token::END_STATEMENT
|
||||
scalar multiplier;
|
||||
os.writeKeyword("dimensions");
|
||||
this->dimensions().write(os, multiplier) << token::END_STATEMENT
|
||||
<< nl;
|
||||
os.writeKeyword("value") << this->value() << token::END_STATEMENT
|
||||
os.writeKeyword("value") << this->value()/multiplier << token::END_STATEMENT
|
||||
<< nl << nl;
|
||||
|
||||
return (os.good());
|
||||
|
||||
@ -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
|
||||
@ -79,6 +79,9 @@ public:
|
||||
//- Construct copy and increment reference count
|
||||
inline tmp(const tmp<T>&);
|
||||
|
||||
//- Construct copy transferring content of temporary if required
|
||||
inline tmp(const tmp<T>&, bool allowTransfer);
|
||||
|
||||
|
||||
//- Destructor, delete object when reference count == 0
|
||||
inline ~tmp();
|
||||
|
||||
@ -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
|
||||
@ -68,6 +68,38 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t)
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::tmp<T>::tmp(const tmp<T>& t, bool allowTransfer)
|
||||
:
|
||||
isTmp_(t.isTmp_),
|
||||
ptr_(t.ptr_),
|
||||
ref_(t.ref_)
|
||||
{
|
||||
if (isTmp_)
|
||||
{
|
||||
if (allowTransfer)
|
||||
{
|
||||
const_cast<tmp<T>&>(t).ptr_ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr_)
|
||||
{
|
||||
ptr_->operator++();
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::tmp<T>::tmp(const tmp<T>&, bool allowTransfer)"
|
||||
) << "attempted copy of a deallocated temporary"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::tmp<T>::~tmp()
|
||||
{
|
||||
|
||||
@ -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
|
||||
@ -208,7 +208,7 @@ Foam::plane::plane(const dictionary& dict)
|
||||
}
|
||||
else if (planeType == "embeddedPoints")
|
||||
{
|
||||
const dictionary& subDict = dict.subDict("embeddedPoints");
|
||||
const dictionary& subDict = dict.subDict("embeddedPointsDict");
|
||||
|
||||
point point1(subDict.lookup("point1"));
|
||||
point point2(subDict.lookup("point2"));
|
||||
@ -226,11 +226,10 @@ Foam::plane::plane(const dictionary& dict)
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"plane::plane(const dictionary&)",
|
||||
dict
|
||||
) << "Invalid plane type: " << planeType
|
||||
FatalIOErrorIn("plane::plane(const dictionary&)", dict)
|
||||
<< "Invalid plane type: " << planeType << nl
|
||||
<< "Valid options include: planeEquation, embeddedPoints and "
|
||||
<< "pointAndNormal"
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,15 +35,16 @@ const Foam::interpolationWeights& Foam::TableBase<Type>::interpolator() const
|
||||
if (interpolatorPtr_.empty())
|
||||
{
|
||||
// Re-work table into linear list
|
||||
tableSamples_.setSize(table_.size());
|
||||
tableSamplesPtr_.reset(new scalarField(table_.size()));
|
||||
scalarField& tableSamples = tableSamplesPtr_();
|
||||
forAll(table_, i)
|
||||
{
|
||||
tableSamples_[i] = table_[i].first();
|
||||
tableSamples[i] = table_[i].first();
|
||||
}
|
||||
interpolatorPtr_ = interpolationWeights::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
tableSamples_
|
||||
tableSamples
|
||||
);
|
||||
}
|
||||
|
||||
@ -81,7 +82,7 @@ Foam::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
|
||||
interpolationScheme_(tbl.interpolationScheme_),
|
||||
table_(tbl.table_),
|
||||
dimensions_(tbl.dimensions_),
|
||||
tableSamples_(tbl.tableSamples_),
|
||||
tableSamplesPtr_(tbl.tableSamplesPtr_),
|
||||
interpolatorPtr_(tbl.interpolatorPtr_)
|
||||
{}
|
||||
|
||||
@ -341,7 +342,7 @@ void Foam::TableBase<Type>::convertTimeBase(const Time& t)
|
||||
table_[i].first() = t.userTimeToTime(value);
|
||||
}
|
||||
|
||||
tableSamples_.clear();
|
||||
tableSamplesPtr_.clear();
|
||||
interpolatorPtr_.clear();
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ protected:
|
||||
dimensionSet dimensions_;
|
||||
|
||||
//- Extracted values
|
||||
mutable scalarField tableSamples_;
|
||||
mutable autoPtr<scalarField> tableSamplesPtr_;
|
||||
|
||||
//- Interpolator method
|
||||
mutable autoPtr<interpolationWeights> interpolatorPtr_;
|
||||
@ -125,7 +125,7 @@ public:
|
||||
//- Construct from dictionary - note table is not populated
|
||||
TableBase(const word& name, const dictionary& dict);
|
||||
|
||||
//- Copy constructor
|
||||
//- Copy constructor. Note: steals interpolator, tableSamples
|
||||
TableBase(const TableBase<Type>& tbl);
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -248,6 +248,220 @@ Foam::string Foam::stringOps::expand
|
||||
}
|
||||
|
||||
|
||||
Foam::string Foam::stringOps::getVariable
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const bool allowEnvVars,
|
||||
const bool allowEmpty
|
||||
)
|
||||
{
|
||||
string value;
|
||||
|
||||
const entry* ePtr = dict.lookupScopedEntryPtr
|
||||
(
|
||||
name,
|
||||
true,
|
||||
false
|
||||
);
|
||||
if (ePtr)
|
||||
{
|
||||
OStringStream buf;
|
||||
// Force floating point numbers to be printed with at least
|
||||
// some decimal digits.
|
||||
buf << fixed;
|
||||
buf.precision(IOstream::defaultPrecision());
|
||||
|
||||
// fail for non-primitiveEntry
|
||||
dynamicCast<const primitiveEntry>
|
||||
(
|
||||
*ePtr
|
||||
).write(buf, true);
|
||||
|
||||
value = buf.str();
|
||||
}
|
||||
else if (allowEnvVars)
|
||||
{
|
||||
value = getEnv(name);
|
||||
|
||||
if (value.empty())
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"stringOps::getVariable\n"
|
||||
"(\n"
|
||||
" const word&,\n"
|
||||
" const dictionary&,\n"
|
||||
" const bool,\n"
|
||||
" const bool\n"
|
||||
")\n",
|
||||
dict
|
||||
) << "Cannot find dictionary or environment variable "
|
||||
<< name << exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"stringOps::getVariable\n"
|
||||
"(\n"
|
||||
" const word&,\n"
|
||||
" const dictionary&,\n"
|
||||
" const bool,\n"
|
||||
" const bool\n"
|
||||
")\n",
|
||||
dict
|
||||
) << "Cannot find environment variable "
|
||||
<< name << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Foam::string Foam::stringOps::expand
|
||||
(
|
||||
const string& s,
|
||||
string::size_type& index,
|
||||
const dictionary& dict,
|
||||
const bool allowEnvVars,
|
||||
const bool allowEmpty
|
||||
)
|
||||
{
|
||||
string newString;
|
||||
|
||||
while (index < s.size())
|
||||
{
|
||||
if (s[index] == '$' && s[index+1] == '{')
|
||||
{
|
||||
// Recurse to parse variable name
|
||||
index += 2;
|
||||
string val = expand(s, index, dict, allowEnvVars, allowEmpty);
|
||||
newString.append(val);
|
||||
}
|
||||
else if (s[index] == '}')
|
||||
{
|
||||
return getVariable(newString, dict, allowEnvVars, allowEmpty);
|
||||
}
|
||||
else
|
||||
{
|
||||
newString.append(string(s[index]));
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return newString;
|
||||
}
|
||||
|
||||
|
||||
Foam::string& Foam::stringOps::inplaceExpand
|
||||
(
|
||||
string& s,
|
||||
const dictionary& dict,
|
||||
const bool allowEnvVars,
|
||||
const bool allowEmpty,
|
||||
const char sigil
|
||||
)
|
||||
{
|
||||
string::size_type begVar = 0;
|
||||
|
||||
// Expand $VAR or ${VAR}
|
||||
// Repeat until nothing more is found
|
||||
while
|
||||
(
|
||||
(begVar = s.find(sigil, begVar)) != string::npos
|
||||
&& begVar < s.size()-1
|
||||
)
|
||||
{
|
||||
if (begVar == 0 || s[begVar-1] != '\\')
|
||||
{
|
||||
if (s[begVar+1] == '{')
|
||||
{
|
||||
// Recursive variable expansion mode
|
||||
label stringStart = begVar;
|
||||
begVar += 2;
|
||||
string varValue
|
||||
(
|
||||
expand
|
||||
(
|
||||
s,
|
||||
begVar,
|
||||
dict,
|
||||
allowEnvVars,
|
||||
allowEmpty
|
||||
)
|
||||
);
|
||||
|
||||
s.std::string::replace
|
||||
(
|
||||
stringStart,
|
||||
begVar - stringStart + 1,
|
||||
varValue
|
||||
);
|
||||
|
||||
begVar = stringStart+varValue.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
string::iterator iter = s.begin() + begVar + 1;
|
||||
|
||||
// more generous in accepting keywords than for env variables
|
||||
string::size_type endVar = begVar;
|
||||
while
|
||||
(
|
||||
iter != s.end()
|
||||
&&
|
||||
(
|
||||
isalnum(*iter)
|
||||
|| *iter == '.'
|
||||
|| *iter == ':'
|
||||
|| *iter == '_'
|
||||
)
|
||||
)
|
||||
{
|
||||
++iter;
|
||||
++endVar;
|
||||
}
|
||||
|
||||
const word varName
|
||||
(
|
||||
s.substr
|
||||
(
|
||||
begVar + 1,
|
||||
endVar - begVar
|
||||
),
|
||||
false
|
||||
);
|
||||
|
||||
string varValue
|
||||
(
|
||||
getVariable
|
||||
(
|
||||
varName,
|
||||
dict,
|
||||
allowEnvVars,
|
||||
allowEmpty
|
||||
)
|
||||
);
|
||||
|
||||
s.std::string::replace
|
||||
(
|
||||
begVar,
|
||||
varName.size()+1,
|
||||
varValue
|
||||
);
|
||||
begVar += varValue.size();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++begVar;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
Foam::string& Foam::stringOps::inplaceExpand
|
||||
(
|
||||
string& s,
|
||||
@ -322,7 +536,12 @@ Foam::string& Foam::stringOps::inplaceExpand
|
||||
|
||||
|
||||
// lookup in the dictionary
|
||||
const entry* ePtr = dict.lookupEntryPtr(varName, true, true);
|
||||
const entry* ePtr = dict.lookupScopedEntryPtr
|
||||
(
|
||||
varName,
|
||||
true,
|
||||
false // wildcards disabled. See primitiveEntry
|
||||
);
|
||||
|
||||
// if defined - copy its entries
|
||||
if (ePtr)
|
||||
@ -527,8 +746,7 @@ Foam::string& Foam::stringOps::inplaceExpand
|
||||
FatalErrorIn
|
||||
(
|
||||
"stringOps::inplaceExpand(string&, const bool)"
|
||||
)
|
||||
<< "Unknown variable name '" << varName << "'"
|
||||
) << "Unknown variable name '" << varName << "'"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -134,6 +134,49 @@ namespace stringOps
|
||||
);
|
||||
|
||||
|
||||
//- Get dictionary or (optionally) environment variable
|
||||
string getVariable
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const bool allowEnvVars,
|
||||
const bool allowEmpty
|
||||
);
|
||||
|
||||
|
||||
//- Recursively expands (dictionary or environment) variable
|
||||
// starting at index in string. Updates index.
|
||||
string expand
|
||||
(
|
||||
const string& s,
|
||||
string::size_type& index,
|
||||
const dictionary& dict,
|
||||
const bool allowEnvVars,
|
||||
const bool allowEmpty
|
||||
);
|
||||
|
||||
|
||||
//- Inplace expand occurences of variables according to the dictionary
|
||||
// and optionally environment variables
|
||||
// Expansion includes:
|
||||
// -# variables
|
||||
// - "$VAR", "${VAR}"
|
||||
//
|
||||
// with the "${}" syntax doing a recursive substitution.
|
||||
// Any unknown entries are left as-is
|
||||
//
|
||||
// \note the leading sigil can be changed to avoid conflicts with other
|
||||
// string expansions
|
||||
string& inplaceExpand
|
||||
(
|
||||
string& s,
|
||||
const dictionary& dict,
|
||||
const bool allowEnvVars,
|
||||
const bool allowEmpty,
|
||||
const char sigil = '$'
|
||||
);
|
||||
|
||||
|
||||
//- Inplace expand occurences of variables according to the dictionary
|
||||
// Expansion includes:
|
||||
// -# variables
|
||||
|
||||
@ -24,9 +24,10 @@ Class
|
||||
Foam::combustionModels::PaSR
|
||||
|
||||
Description
|
||||
Simple infinitely fast chemistry combustion model based on the principle
|
||||
mixed is burnt. Additional parameter C is used to distribute the heat
|
||||
release rate.in time
|
||||
Partially stirred reactor combustion model. The model calculates a finite
|
||||
rate, based on both turbulence and chemistry time scales. Depending on
|
||||
mesh resolution, the Cmix parameter can be used to scale the turbulence
|
||||
mixing time scale.
|
||||
|
||||
SourceFiles
|
||||
PaSR.C
|
||||
|
||||
@ -1,34 +1,35 @@
|
||||
basicSource/basicSource/basicSource.C
|
||||
basicSource/basicSource/basicSourceIO.C
|
||||
basicSource/basicSource/basicSourceList.C
|
||||
basicSource/basicSource/IObasicSourceList.C
|
||||
basicSource/basicSource.C
|
||||
basicSource/basicSourceIO.C
|
||||
basicSource/basicSourceList.C
|
||||
basicSource/IObasicSourceList.C
|
||||
|
||||
basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
||||
basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
|
||||
general/semiImplicitSource/semiImplicitSource.C
|
||||
general/explicitSetValue/explicitSetValue.C
|
||||
general/codedSource/codedSource.C
|
||||
|
||||
basicSource/explicitSource/explicitSource.C
|
||||
basicSource/explicitSetValue/explicitSetValue.C
|
||||
derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
||||
derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
|
||||
|
||||
basicSource/rotorDiskSource/rotorDiskSource.C
|
||||
basicSource/rotorDiskSource/bladeModel/bladeModel.C
|
||||
basicSource/rotorDiskSource/profileModel/profileModel.C
|
||||
basicSource/rotorDiskSource/profileModel/profileModelList.C
|
||||
basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C
|
||||
basicSource/rotorDiskSource/profileModel/series/seriesProfile.C
|
||||
basicSource/rotorDiskSource/trimModel/trimModel/trimModel.C
|
||||
basicSource/rotorDiskSource/trimModel/trimModel/trimModelNew.C
|
||||
basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C
|
||||
basicSource/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
|
||||
derived/rotorDiskSource/rotorDiskSource.C
|
||||
derived/rotorDiskSource/bladeModel/bladeModel.C
|
||||
derived/rotorDiskSource/profileModel/profileModel.C
|
||||
derived/rotorDiskSource/profileModel/profileModelList.C
|
||||
derived/rotorDiskSource/profileModel/lookup/lookupProfile.C
|
||||
derived/rotorDiskSource/profileModel/series/seriesProfile.C
|
||||
derived/rotorDiskSource/trimModel/trimModel/trimModel.C
|
||||
derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C
|
||||
derived/rotorDiskSource/trimModel/fixed/fixedTrim.C
|
||||
derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C
|
||||
|
||||
basicSource/actuationDiskSource/actuationDiskSource.C
|
||||
basicSource/radialActuationDiskSource/radialActuationDiskSource.C
|
||||
derived/actuationDiskSource/actuationDiskSource.C
|
||||
derived/radialActuationDiskSource/radialActuationDiskSource.C
|
||||
|
||||
interRegion = basicSource/interRegionHeatTransferModel
|
||||
interRegion = derived/interRegionHeatTransferModel
|
||||
$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C
|
||||
$(interRegion)/constantHeatTransfer/constantHeatTransfer.C
|
||||
$(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C
|
||||
$(interRegion)/variableHeatTransfer/variableHeatTransfer.C
|
||||
|
||||
basicSource/codedSource/codedSource.C
|
||||
derived/fixedTemperatureSource/fixedTemperatureSource.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfieldSources
|
||||
|
||||
@ -56,6 +56,12 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::basicSource::alwaysApply() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::basicSource::setSelection(const dictionary& dict)
|
||||
{
|
||||
switch (selectionMode_)
|
||||
@ -314,6 +320,7 @@ Foam::basicSource::~basicSource()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::basicSource::isActive()
|
||||
@ -341,6 +348,11 @@ bool Foam::basicSource::isActive()
|
||||
|
||||
Foam::label Foam::basicSource::applyToField(const word& fieldName) const
|
||||
{
|
||||
if (alwaysApply())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
forAll(fieldNames_, i)
|
||||
{
|
||||
if (fieldNames_[i] == fieldName)
|
||||
@ -150,6 +150,9 @@ protected:
|
||||
|
||||
// Protected functions
|
||||
|
||||
//- Flag to bypass the apply flag list checking
|
||||
virtual bool alwaysApply() const;
|
||||
|
||||
//- Set the cellSet or points selection
|
||||
void setSelection(const dictionary& dict);
|
||||
|
||||
@ -157,7 +157,7 @@ public:
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Write data to Istream
|
||||
//- Write data to Ostream
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
//- Ostream operator
|
||||
@ -0,0 +1,112 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "fixedTemperatureSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "basicThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fixedTemperatureSource, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basicSource,
|
||||
fixedTemperatureSource,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fixedTemperatureSource::fixedTemperatureSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
basicSource(name, modelType, dict, mesh),
|
||||
T_(readScalar(coeffs_.lookup("temperature")))
|
||||
{
|
||||
fieldNames_.setSize(1, "energy");
|
||||
applied_.setSize(1, false);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::fixedTemperatureSource::alwaysApply() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fixedTemperatureSource::setValue
|
||||
(
|
||||
fvMatrix<scalar>& eqn,
|
||||
const label
|
||||
)
|
||||
{
|
||||
const basicThermo& thermo =
|
||||
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
if (eqn.psi().name() == thermo.he().name())
|
||||
{
|
||||
const scalarField Tfield(cells_.size(), T_);
|
||||
eqn.setValues(cells_, thermo.he(thermo.p(), Tfield, cells_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fixedTemperatureSource::writeData(Ostream& os) const
|
||||
{
|
||||
os << indent << name_ << endl;
|
||||
dict_.write(os);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fixedTemperatureSource::read(const dictionary& dict)
|
||||
{
|
||||
if (basicSource::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("T", T_);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::fixedTemperatureSource
|
||||
|
||||
Description
|
||||
Fixed temperature equation constraint
|
||||
|
||||
Sources described by:
|
||||
|
||||
fixedTemperatureSourceCoeffs
|
||||
{
|
||||
fieldNames (h e hs); // names of fields to apply source
|
||||
temperature 500; // fixed temperature [K]
|
||||
}
|
||||
|
||||
|
||||
SourceFiles
|
||||
basicSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedTemperatureSource_H
|
||||
#define fixedTemperatureSource_H
|
||||
|
||||
#include "basicSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fixedTemperatureSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fixedTemperatureSource
|
||||
:
|
||||
public basicSource
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Fixed temperature [K]
|
||||
scalar T_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fixedTemperatureSource(const fixedTemperatureSource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fixedTemperatureSource&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fixedTemperatureSource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
fixedTemperatureSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fixedTemperatureSource()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual bool alwaysApply() const;
|
||||
|
||||
|
||||
// Set values directly
|
||||
|
||||
//- Scalar
|
||||
virtual void setValue(fvMatrix<scalar>& eqn, const label fieldI);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
|
||||
//- Read dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -210,7 +210,7 @@ void Foam::pressureGradientExplicitSource::setValue
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name_ + "::invA",
|
||||
name_ + ".invA",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
@ -105,7 +105,7 @@ public:
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Set value on vector field
|
||||
//- Set value on field
|
||||
virtual void setValue(fvMatrix<Type>& eqn, const label fieldI);
|
||||
|
||||
|
||||
@ -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
|
||||
@ -23,15 +23,16 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ExplicitSource.H"
|
||||
#include "SemiImplicitSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "fvmSup.H"
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList Foam::ExplicitSource<Type>::
|
||||
const Foam::wordList Foam::SemiImplicitSource<Type>::
|
||||
volumeModeTypeNames_
|
||||
(
|
||||
IStringStream("(absolute specific)")()
|
||||
@ -41,8 +42,8 @@ volumeModeTypeNames_
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
typename Foam::ExplicitSource<Type>::volumeModeType
|
||||
Foam::ExplicitSource<Type>::wordToVolumeModeType
|
||||
typename Foam::SemiImplicitSource<Type>::volumeModeType
|
||||
Foam::SemiImplicitSource<Type>::wordToVolumeModeType
|
||||
(
|
||||
const word& vmtName
|
||||
) const
|
||||
@ -57,8 +58,8 @@ Foam::ExplicitSource<Type>::wordToVolumeModeType
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"ExplicitSource<Type>::volumeModeType"
|
||||
"ExplicitSource<Type>::wordToVolumeModeType(const word&)"
|
||||
"SemiImplicitSource<Type>::volumeModeType"
|
||||
"SemiImplicitSource<Type>::wordToVolumeModeType(const word&)"
|
||||
) << "Unknown volumeMode type " << vmtName
|
||||
<< ". Valid volumeMode types are:" << nl << volumeModeTypeNames_
|
||||
<< exit(FatalError);
|
||||
@ -68,7 +69,7 @@ Foam::ExplicitSource<Type>::wordToVolumeModeType
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::word Foam::ExplicitSource<Type>::volumeModeTypeToWord
|
||||
Foam::word Foam::SemiImplicitSource<Type>::volumeModeTypeToWord
|
||||
(
|
||||
const volumeModeType& vmtType
|
||||
) const
|
||||
@ -85,7 +86,7 @@ Foam::word Foam::ExplicitSource<Type>::volumeModeTypeToWord
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::ExplicitSource<Type>::setFieldData(const dictionary& dict)
|
||||
void Foam::SemiImplicitSource<Type>::setFieldData(const dictionary& dict)
|
||||
{
|
||||
fieldNames_.setSize(dict.toc().size());
|
||||
injectionRate_.setSize(fieldNames_.size());
|
||||
@ -111,7 +112,7 @@ void Foam::ExplicitSource<Type>::setFieldData(const dictionary& dict)
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::ExplicitSource<Type>::ExplicitSource
|
||||
Foam::SemiImplicitSource<Type>::SemiImplicitSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
@ -131,7 +132,7 @@ Foam::ExplicitSource<Type>::ExplicitSource
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::ExplicitSource<Type>::addSup
|
||||
void Foam::SemiImplicitSource<Type>::addSup
|
||||
(
|
||||
fvMatrix<Type>& eqn,
|
||||
const label fieldI
|
||||
@ -139,15 +140,17 @@ void Foam::ExplicitSource<Type>::addSup
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "ExplicitSource<"<< pTraits<Type>::typeName
|
||||
Info<< "SemiImplicitSource<" << pTraits<Type>::typeName
|
||||
<< ">::addSup for source " << name_ << endl;
|
||||
}
|
||||
|
||||
const GeometricField<Type, fvPatchField, volMesh>& psi = eqn.psi();
|
||||
|
||||
DimensionedField<Type, volMesh> Su
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name_ + fieldNames_[fieldI] + "Sup",
|
||||
name_ + fieldNames_[fieldI] + "Su",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
@ -163,9 +166,31 @@ void Foam::ExplicitSource<Type>::addSup
|
||||
false
|
||||
);
|
||||
|
||||
UIndirectList<Type>(Su, cells_) = injectionRate_[fieldI]/VDash_;
|
||||
UIndirectList<Type>(Su, cells_) = injectionRate_[fieldI].first()/VDash_;
|
||||
|
||||
eqn += Su;
|
||||
DimensionedField<scalar, volMesh> Sp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name_ + fieldNames_[fieldI] + "Sp",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensioned<scalar>
|
||||
(
|
||||
"zero",
|
||||
Su.dimensions()/psi.dimensions(),
|
||||
0.0
|
||||
),
|
||||
false
|
||||
);
|
||||
|
||||
UIndirectList<scalar>(Sp, cells_) = injectionRate_[fieldI].second()/VDash_;
|
||||
|
||||
eqn += Su + fvm::Sp(Sp, psi);
|
||||
}
|
||||
|
||||
|
||||
@ -22,21 +22,33 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::ExplicitSource
|
||||
Foam::SemiImplicitSource
|
||||
|
||||
Description
|
||||
Explicit source
|
||||
Semi-implicit source, described using an input dictionary. The injection
|
||||
rate coefficients are specified as pairs of Su-Sp coefficients, i.e.
|
||||
|
||||
Sources described by:
|
||||
\f[
|
||||
S(x) = S_u + S_p x
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
S(x) | net source for field 'x'
|
||||
S_u | explicit source contribution
|
||||
S_p | linearised implicit contribution
|
||||
\endvartable
|
||||
|
||||
Example of the source specification:
|
||||
|
||||
\verbatim
|
||||
<Type>ExplicitSourceCoeffs
|
||||
<Type>SemiImplicitSourceCoeffs
|
||||
{
|
||||
volumeMode absolute; // specific
|
||||
injectionRate
|
||||
injectionRateSuSp
|
||||
{
|
||||
k 30.7;
|
||||
epsilon 1.5;
|
||||
k (30.7 0);
|
||||
epsilon (1.5 0);
|
||||
}
|
||||
}
|
||||
\verbatim
|
||||
@ -49,12 +61,12 @@ SeeAlso
|
||||
Foam::basicSource
|
||||
|
||||
SourceFiles
|
||||
ExplicitSource.C
|
||||
SemiImplicitSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ExplicitSource_H
|
||||
#define ExplicitSource_H
|
||||
#ifndef SemiImplicitSource_H
|
||||
#define SemiImplicitSource_H
|
||||
|
||||
#include "Tuple2.H"
|
||||
#include "basicSource.H"
|
||||
@ -69,7 +81,7 @@ namespace Foam
|
||||
class fvMesh;
|
||||
|
||||
template<class Type>
|
||||
class ExplicitSource;
|
||||
class SemiImplicitSource;
|
||||
|
||||
// Forward declaration of friend functions
|
||||
|
||||
@ -77,15 +89,15 @@ template<class Type>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const ExplicitSource<Type>&
|
||||
const SemiImplicitSource<Type>&
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ExplicitSource Declaration
|
||||
Class SemiImplicitSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class ExplicitSource
|
||||
class SemiImplicitSource
|
||||
:
|
||||
public basicSource
|
||||
{
|
||||
@ -115,7 +127,7 @@ protected:
|
||||
scalar VDash_;
|
||||
|
||||
//- Source field values
|
||||
List<Type> injectionRate_;
|
||||
List<Tuple2<Type, scalar> > injectionRate_;
|
||||
|
||||
|
||||
// Protected functions
|
||||
@ -133,13 +145,13 @@ protected:
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("ExplicitSource");
|
||||
TypeName("SemiImplicitSource");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
ExplicitSource
|
||||
SemiImplicitSource
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
@ -156,7 +168,7 @@ public:
|
||||
inline const volumeModeType& volumeMode() const;
|
||||
|
||||
//- Return const access to the source field values
|
||||
inline const List<Type>& injectionRate() const;
|
||||
inline const List<Tuple2<Type, scalar> >& injectionRate() const;
|
||||
|
||||
|
||||
// Edit
|
||||
@ -165,7 +177,7 @@ public:
|
||||
inline volumeModeType& volumeMode();
|
||||
|
||||
//- Return access to the source field values
|
||||
inline List<Type>& injectionRate();
|
||||
inline List<Tuple2<Type, scalar> >& injectionRate();
|
||||
|
||||
|
||||
// Evaluation
|
||||
@ -191,13 +203,13 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ExplicitSource.C"
|
||||
# include "ExplicitSourceIO.C"
|
||||
# include "SemiImplicitSource.C"
|
||||
# include "SemiImplicitSourceIO.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "ExplicitSourceI.H"
|
||||
#include "SemiImplicitSourceI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user