ENH: foamToVTK improvements for (-no-internal, -no-boundary)

- skip loading of fields with -no-internal, -no-boundary

- suppress reporting fields with -no-internal, -no-boundary

- cache loaded volume field for reuse with point interpolation.
  Trade off some memory overhead against reading twice.

  NOTE: this issue will not be evident with foamToEnsight since there
  it only handles cell data *or* point data (not both), so a field is
  only ever loaded/processed once.
This commit is contained in:
Mark Olesen
2023-01-30 22:43:55 +01:00
parent 72bfaa2be9
commit 8ee7595a77
13 changed files with 251 additions and 417 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,10 +35,11 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_readFields_H
#define Foam_readFields_H
#ifndef FoamToVTK_readFields_H
#define FoamToVTK_readFields_H
#include "fvMeshSubsetProxy.H"
#include "objectRegistry.H"
#include "IOobjectList.H"
#include "PtrList.H"
@ -63,7 +64,8 @@ tmp<GeoField> getField
(
const IOobject* io,
const fvMeshSubsetProxy& proxy,
const bool syncPar
const bool syncPar,
objectRegistry* cache = nullptr
);
@ -78,14 +80,17 @@ tmp<GeoField> getField
);
//- Get the named field from the objects and subset it, or return nullptr
//- Return the named field from the optional cache (if found),
//- or get it from the objects and subset it (add to cache).
//- Return nullptr if nothing worked.
template<class GeoField>
tmp<GeoField> getField
(
const fvMeshSubsetProxy& proxy,
const IOobjectList& objects,
const word& fieldName,
const bool syncPar
const bool syncPar,
objectRegistry* cache = nullptr
);