ENH: subModelBase - added localPath() helper function for file writing

This commit is contained in:
Andrew Heather
2019-12-06 22:05:02 +00:00
committed by Mark Olesen
parent e753125669
commit b576f9dcc7
5 changed files with 34 additions and 4 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -169,6 +170,17 @@ bool Foam::subModelBase::writeTime() const
}
Foam::fileName Foam::subModelBase::localPath() const
{
if (modelName_ != word::null)
{
return modelName_;
}
return baseName_;
}
bool Foam::subModelBase::getModelDict
(
const word& entryName,

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -157,6 +158,9 @@ public:
//- Flag to indicate when to write a property
virtual bool writeTime() const;
//- Output directory
virtual fileName localPath() const;
// Edit

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,9 +66,7 @@ Foam::CloudFunctionObject<CloudType>::CloudFunctionObject
(
owner.mesh().time().globalPath()
/ functionObject::outputPrefix
/ cloud::prefix
/ owner.name()
/ this->modelName()
/ this->localPath();
);
outputDir_.clean(); // Remove unneeded ".."

View File

@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "CloudSubModelBase.H"
#include "cloud.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -125,6 +126,18 @@ bool Foam::CloudSubModelBase<CloudType>::writeTime() const
}
template<class CloudType>
Foam::fileName Foam::CloudSubModelBase<CloudType>::localPath() const
{
if (modelName_ != word::null)
{
return cloud::prefix/owner_.name()/modelName_;
}
return cloud::prefix/owner_.name()/baseName_;
}
template<class CloudType>
void Foam::CloudSubModelBase<CloudType>::write(Ostream& os) const
{

View File

@ -109,6 +109,9 @@ public:
//- Flag to indicate when to write a property
virtual bool writeTime() const;
//- Output directory
virtual fileName localPath() const;
// Edit