writeObjects: Prepend field expression names with "expr"
for example
cacheTemporaryObjects
(
"((1|((1|(1|A(U)))-H(1)))-(1|A(U)))"
);
functions
{
#includeFunc writeObjects(regExp=off, "((1|((1|(1|A(U)))-H(1)))-(1|A(U)))")
}
writes the temporary field with the name
"expr((1|((1|(1|A(U)))-H(1)))-(1|A(U)))" so that it can be read by paraFoam and
other post-processing tools.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,7 +75,7 @@ void Foam::functionObjects::writeObjects::writeObject
|
||||
{
|
||||
case writeOption::AUTO_WRITE:
|
||||
{
|
||||
if(obj.writeOpt() != IOobject::AUTO_WRITE)
|
||||
if (obj.writeOpt() != IOobject::AUTO_WRITE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -84,7 +84,7 @@ void Foam::functionObjects::writeObjects::writeObject
|
||||
}
|
||||
case writeOption::NO_WRITE:
|
||||
{
|
||||
if(obj.writeOpt() != IOobject::NO_WRITE)
|
||||
if (obj.writeOpt() != IOobject::NO_WRITE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -115,7 +115,19 @@ void Foam::functionObjects::writeObjects::writeObject
|
||||
}
|
||||
else
|
||||
{
|
||||
writeObjectsBase::writeObject(obj);
|
||||
if (obj.name()[0] == '(')
|
||||
{
|
||||
// If the object is a temporary field expression prepend with "expr"
|
||||
const word name(obj.name());
|
||||
regIOobject& objRef = const_cast<regIOobject&>(obj);
|
||||
objRef.IOobject::rename("expr" + name);
|
||||
writeObjectsBase::writeObject(obj);
|
||||
objRef.IOobject::rename(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeObjectsBase::writeObject(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user