Commit 3fd38fce authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: make "file" property in functionObjects a relative path (issue #1125)

- partial solution for issue #1091

  This generates file properties that are case-relative,
  Eg,

      plane0
      {
          p
          {
              file "<case>/postProcessing/plane0/1/p_plane0.vtk";
          }
          U
          {
              file "<case>/postProcessing/plane0/1/U_plane0.vtk";
          }
      }

   This allows the case to be moved elsewhere and still find its files.

   This functionality was previously added for vtkCloud, but now also
   applies to streamLine, sampledSets and sampledSurfaces
parent 3d4e4a21
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -41,37 +41,35 @@ namespace runTimePostPro
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::runTimePostPro::functionObjectBase::removeFile
Foam::fileName
Foam::functionObjects::runTimePostPro::functionObjectBase::getFileName
(
const word& keyword,
const word& subDictName
)
) const
{
dictionary dict;
state_.getObjectDict(functionObjectName_, subDictName, dict);
fileName fName;
if (dict.readIfPresent(keyword, fName))
fileName f;
if (dict.readIfPresent<fileName>(keyword, f))
{
Foam::rm(fName);
return true;
f.expand();
}
return false;
return f;
}
Foam::fileName
Foam::functionObjects::runTimePostPro::functionObjectBase::getFileName
bool Foam::functionObjects::runTimePostPro::functionObjectBase::removeFile
(
const word& keyword,
const word& subDictName
) const
)
{
dictionary dict;
state_.getObjectDict(functionObjectName_, subDictName, dict);
// Foam::rm() ignores empty names etc.
return dict.lookupOrDefault<fileName>(keyword, fileName::null);
return Foam::rm(getFileName(keyword, subDictName));
}
......@@ -91,12 +89,6 @@ Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectBase
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::runTimePostPro::functionObjectBase::~functionObjectBase()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::functionObjects::runTimePostPro::functionObjectBase::clear()
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -62,17 +62,6 @@ class functionObjectBase
:
public fieldVisualisationBase
{
private:
// Private Member Functions
//- No copy construct
functionObjectBase(const functionObjectBase&) = delete;
//- No copy assignment
void operator=(const functionObjectBase&) = delete;
protected:
// Protected data
......@@ -100,11 +89,11 @@ protected:
// \verbatim
// T
// {
// file "path/T_object.vtk";
// file "<case>/relpath/T_object.vtk";
// }
// defaultCloud
// {
// file "path/cloud_0001.vtp";
// file "<case>/relpath/cloud_0001.vtp";
// fields (T U);
// }
// \endverbatim
......@@ -121,6 +110,12 @@ protected:
bool removeFile(const word& keyword, const word& subDictName);
//- No copy construct
functionObjectBase(const functionObjectBase&) = delete;
//- No copy assignment
void operator=(const functionObjectBase&) = delete;
public:
//- Run-time type information
......@@ -139,7 +134,7 @@ public:
//- Destructor
virtual ~functionObjectBase();
virtual ~functionObjectBase() = default;
// Member Functions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment