mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: allow modifiable access to IOobject local(), as per instance()
ENH: simplify code by using fieldTypes::is_xxx() tests
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -857,16 +857,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
if
|
||||
(
|
||||
obj.isHeaderClass<volScalarField>()
|
||||
|| obj.isHeaderClass<volVectorField>()
|
||||
|| obj.isHeaderClass<volSphericalTensorField>()
|
||||
|| obj.isHeaderClass<volTensorField>()
|
||||
|| obj.isHeaderClass<volSymmTensorField>()
|
||||
|| obj.isHeaderClass<surfaceScalarField>()
|
||||
|| obj.isHeaderClass<surfaceVectorField>()
|
||||
|| obj.isHeaderClass<surfaceSphericalTensorField>()
|
||||
|| obj.isHeaderClass<surfaceSymmTensorField>()
|
||||
|| obj.isHeaderClass<surfaceTensorField>()
|
||||
Foam::fieldTypes::is_volume(obj.headerClassName())
|
||||
|| Foam::fieldTypes::is_surface(obj.headerClassName())
|
||||
)
|
||||
{
|
||||
objects.add(objPtr);
|
||||
|
||||
@ -86,7 +86,7 @@ void constructVolFields(fvMesh& mesh, const vtkUnstructuredReader& reader)
|
||||
);
|
||||
auto& fld = tfld.ref();
|
||||
fld.instance() = mesh.time().timeName();
|
||||
fld.writeOpt() = IOobject::AUTO_WRITE;
|
||||
fld.writeOpt(IOobject::AUTO_WRITE);
|
||||
|
||||
// Fill cell values
|
||||
fld.internalFieldRef().field() =
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -383,29 +383,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
if
|
||||
(
|
||||
io.isHeaderClass<volScalarField>()
|
||||
|| io.isHeaderClass<volVectorField>()
|
||||
|| io.isHeaderClass<volSphericalTensorField>()
|
||||
|| io.isHeaderClass<volSymmTensorField>()
|
||||
|| io.isHeaderClass<volTensorField>()
|
||||
|
||||
|| io.isHeaderClass<surfaceScalarField>()
|
||||
|| io.isHeaderClass<surfaceVectorField>()
|
||||
|| io.isHeaderClass<surfaceSphericalTensorField>()
|
||||
|| io.isHeaderClass<surfaceSymmTensorField>()
|
||||
|| io.isHeaderClass<surfaceTensorField>()
|
||||
|
||||
|| io.isHeaderClass<pointScalarField>()
|
||||
|| io.isHeaderClass<pointVectorField>()
|
||||
|| io.isHeaderClass<pointSphericalTensorField>()
|
||||
|| io.isHeaderClass<pointSymmTensorField>()
|
||||
|| io.isHeaderClass<pointTensorField>()
|
||||
|
||||
|| io.isHeaderClass<volScalarField::Internal>()
|
||||
|| io.isHeaderClass<volVectorField::Internal>()
|
||||
|| io.isHeaderClass<volSphericalTensorField::Internal>()
|
||||
|| io.isHeaderClass<volSymmTensorField::Internal>()
|
||||
|| io.isHeaderClass<volTensorField::Internal>()
|
||||
Foam::fieldTypes::is_volume(io.headerClassName())
|
||||
|| Foam::fieldTypes::is_internal(io.headerClassName())
|
||||
|| Foam::fieldTypes::is_surface(io.headerClassName())
|
||||
|| Foam::fieldTypes::is_point(io.headerClassName())
|
||||
)
|
||||
{
|
||||
Info<< " Reading " << io.headerClassName()
|
||||
|
||||
@ -57,14 +57,7 @@ forAll(meshes, regioni)
|
||||
if (!doPointValues)
|
||||
{
|
||||
// Prune point fields if disabled
|
||||
objects.filterClasses
|
||||
(
|
||||
[](const word& clsName)
|
||||
{
|
||||
return fieldTypes::point.found(clsName);
|
||||
},
|
||||
true // prune
|
||||
);
|
||||
objects.filterClasses(Foam::fieldTypes::is_point, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -28,8 +28,7 @@ if (doFiniteArea)
|
||||
|
||||
autoPtr<faMesh> faMeshPtr;
|
||||
|
||||
const label nAreaFields =
|
||||
faObjects.count(stringListOps::foundOp<word>(fieldTypes::area));
|
||||
const label nAreaFields = faObjects.count(Foam::fieldTypes::is_area);
|
||||
|
||||
if (nAreaFields || withMeshIds)
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -53,10 +53,7 @@ if (doLagrangian)
|
||||
}
|
||||
|
||||
// Limited to basic IOField types
|
||||
cloudObjs.filterClasses
|
||||
(
|
||||
stringListOps::foundOp<word>(fieldTypes::basic)
|
||||
);
|
||||
cloudObjs.filterClasses(Foam::fieldTypes::is_basic);
|
||||
|
||||
// Are there cloud fields (globally)?
|
||||
if (returnReduceAnd(cloudObjs.empty()))
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -23,10 +23,7 @@ Description
|
||||
{
|
||||
using reportFields = foamToVtkReportFields;
|
||||
|
||||
const label nVolFields =
|
||||
(
|
||||
objects.count(stringListOps::foundOp<word>(fieldTypes::volume))
|
||||
);
|
||||
const label nVolFields = objects.count(Foam::fieldTypes::is_volume);
|
||||
|
||||
reportFields::volume(Info, objects);
|
||||
|
||||
|
||||
@ -24,21 +24,21 @@ Description
|
||||
const label nVolFields =
|
||||
(
|
||||
(doInternal || doBoundary)
|
||||
? objects.count(stringListOps::foundOp<word>(fieldTypes::volume))
|
||||
? objects.count(Foam::fieldTypes::is_volume)
|
||||
: 0
|
||||
);
|
||||
|
||||
const label nDimFields =
|
||||
(
|
||||
(doInternal || doBoundary)
|
||||
? objects.count(stringListOps::foundOp<word>(fieldTypes::internal))
|
||||
? objects.count(Foam::fieldTypes::is_internal)
|
||||
: 0
|
||||
);
|
||||
|
||||
label nPointFields =
|
||||
(
|
||||
doPointValues
|
||||
? objects.count(stringListOps::foundOp<word>(fieldTypes::point))
|
||||
? objects.count(Foam::fieldTypes::is_point)
|
||||
: 0
|
||||
);
|
||||
|
||||
|
||||
@ -803,14 +803,7 @@ int main(int argc, char *argv[])
|
||||
if (!doPointValues)
|
||||
{
|
||||
// Prune point fields if disabled
|
||||
objects.filterClasses
|
||||
(
|
||||
[](const word& clsName)
|
||||
{
|
||||
return fieldTypes::point.found(clsName);
|
||||
},
|
||||
true // prune
|
||||
);
|
||||
objects.filterClasses(Foam::fieldTypes::is_point, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -104,16 +104,7 @@ IOobjectList preFilterFields
|
||||
|
||||
const IOobject& io = *(iter.val());
|
||||
|
||||
if
|
||||
(
|
||||
//OR: fieldTypes::basic.found(io.headerClassName())
|
||||
io.isHeaderClass<IOField<label>>()
|
||||
|| io.isHeaderClass<IOField<scalar>>()
|
||||
|| io.isHeaderClass<IOField<vector>>()
|
||||
|| io.isHeaderClass<IOField<sphericalTensor>>()
|
||||
|| io.isHeaderClass<IOField<symmTensor>>()
|
||||
|| io.isHeaderClass<IOField<tensor>>()
|
||||
)
|
||||
if (Foam::fieldTypes::is_basic(io.headerClassName()))
|
||||
{
|
||||
// Transfer from cloudObjects -> filteredObjects
|
||||
filteredObjects.add(cloudObjects.remove(fldName));
|
||||
|
||||
@ -647,10 +647,10 @@ void Foam::PDRarrays::addBlockage
|
||||
|
||||
const word patchName = word::validate(identifier.substr(0, spc));
|
||||
|
||||
patchNum = ListOps::find
|
||||
patchNum = ListOps::find_if
|
||||
(
|
||||
patches,
|
||||
[=](const PDRpatchDef& p){ return patchName == p.patchName; },
|
||||
[&](const PDRpatchDef& p){ return patchName == p.patchName; },
|
||||
1 // skip 0 (blocked face)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user