paraFoam: Added configuration file to set default fields loaded on start-up
The new default paraFoam configuration is in the files OpenFOAM-dev/etc/paraFoam
containing the entry
defaultFields (U p p_rgh T alpha.water alpha.air);
specifying the set of fields which are loaded by default if available. This
setting maybe overridden by providing additional paraFoam configuration files in
any of the OpenFOAM etc directories searched, listed using
foamEtcFile -list
e.g.
~/.OpenFOAM/dev
~/.OpenFOAM
~/OpenFOAM/site/dev
~/OpenFOAM/site
~/OpenFOAM/OpenFOAM-dev/etc
The new configurable set of default fields loaded replaces the original hard-coded default of
"p" and "U" and is much more convenient for current OpenFOAM usage.
This commit is contained in:
@ -31,6 +31,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "patchZones.H"
|
||||
#include "collatedFileOperation.H"
|
||||
#include "etcFiles.H"
|
||||
|
||||
// VTK includes
|
||||
#include "vtkDataArraySelection.h"
|
||||
@ -43,7 +44,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(vtkPVFoam, 0);
|
||||
defineTypeNameAndDebug(vtkPVFoam, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -250,7 +251,6 @@ Foam::vtkPVFoam::vtkPVFoam
|
||||
// For now just disable the threaded writer.
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
|
||||
// avoid argList and get rootPath/caseName directly from the file
|
||||
fileName fullCasePath(fileName(FileName).path());
|
||||
|
||||
@ -325,6 +325,12 @@ Foam::vtkPVFoam::vtkPVFoam
|
||||
|
||||
dbPtr_().functionObjects().off();
|
||||
|
||||
fileNameList configDictFiles = findEtcFiles("paraFoam", false);
|
||||
forAllReverse(configDictFiles, cdfi)
|
||||
{
|
||||
configDict_.merge(dictionary(IFstream(configDictFiles[cdfi])()));
|
||||
}
|
||||
|
||||
updateInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -250,6 +250,9 @@ class vtkPVFoam
|
||||
//- OpenFOAM time control
|
||||
autoPtr<Time> dbPtr_;
|
||||
|
||||
//- Configuration dictionary
|
||||
dictionary configDict_;
|
||||
|
||||
//- OpenFOAM mesh
|
||||
fvMesh* meshPtr_;
|
||||
|
||||
|
||||
@ -46,16 +46,23 @@ void Foam::vtkPVFoam::updateInfoFields
|
||||
}
|
||||
|
||||
stringList enabledEntries;
|
||||
// enable 'p' and 'U' on the first call
|
||||
|
||||
if (select->GetNumberOfArrays() == 0 && !meshPtr_)
|
||||
{
|
||||
enabledEntries.setSize(2);
|
||||
enabledEntries[0] = "p";
|
||||
enabledEntries[1] = "U";
|
||||
wordList defaultFields
|
||||
(
|
||||
configDict_.lookupOrDefault("defaultFields", wordList{"p", "U"})
|
||||
);
|
||||
|
||||
enabledEntries.setSize(defaultFields.size());
|
||||
forAll(defaultFields, i)
|
||||
{
|
||||
enabledEntries[i] = defaultFields[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// preserve the enabled selections
|
||||
// Preserve the enabled selections
|
||||
enabledEntries = getSelectedArrayEntries(select);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user