mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use objectRegistry/IOobjectList sorted instead of lookupClass
- in most cases a parallel-consistent order is required. Even when the order is not important, it will generally require fewer allocations to create a UPtrList of entries instead of a HashTable or even a wordList.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -132,20 +132,21 @@ void MapVolFields
|
||||
const fvMesh& meshTarget = static_cast<const fvMesh&>(interp.tgtRegion());
|
||||
|
||||
// Available fields, sorted order
|
||||
const wordList fieldNames =
|
||||
for
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.sortedNames<fieldType>()
|
||||
: objects.sortedNames<fieldType>(selectedFields)
|
||||
);
|
||||
|
||||
for (const word& fieldName : fieldNames)
|
||||
const IOobject& io :
|
||||
(
|
||||
selectedFields.empty()
|
||||
? objects.csorted<fieldType>()
|
||||
: objects.csorted<fieldType>(selectedFields)
|
||||
)
|
||||
)
|
||||
{
|
||||
const fieldType fieldSource(*(objects[fieldName]), meshSource, false);
|
||||
const fieldType fieldSource(io, meshSource, false);
|
||||
|
||||
IOobject targetIO
|
||||
(
|
||||
fieldName,
|
||||
io.name(),
|
||||
meshTarget.time().timeName(),
|
||||
meshTarget,
|
||||
IOobject::MUST_READ
|
||||
@ -154,7 +155,7 @@ void MapVolFields
|
||||
if (targetIO.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
Info<< " interpolating onto existing field "
|
||||
<< fieldName << endl;
|
||||
<< targetIO.name() << endl;
|
||||
|
||||
fieldType fieldTarget(targetIO, meshTarget, false);
|
||||
|
||||
@ -167,7 +168,7 @@ void MapVolFields
|
||||
else
|
||||
{
|
||||
Info<< " creating new field "
|
||||
<< fieldName << endl;
|
||||
<< targetIO.name() << endl;
|
||||
|
||||
targetIO.readOpt(IOobject::NO_READ);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user