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,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -105,8 +106,9 @@ int main(int argc, char *argv[])
|
||||
"foamDataToFluentDict",
|
||||
runTime.system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
@ -115,44 +117,21 @@ int main(int argc, char *argv[])
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
|
||||
// volScalarField
|
||||
for (const word& fieldName : objects.sortedNames<volScalarField>())
|
||||
{
|
||||
// Lookup field from dictionary and convert field
|
||||
label unitNumber;
|
||||
if
|
||||
(
|
||||
foamDataToFluentDict.readIfPresent(fieldName, unitNumber)
|
||||
&& unitNumber > 0
|
||||
)
|
||||
{
|
||||
// Read field
|
||||
volScalarField field(*(objects[fieldName]), mesh);
|
||||
readFieldsAndWriteFluent<volScalarField>
|
||||
(
|
||||
foamDataToFluentDict,
|
||||
objects,
|
||||
mesh,
|
||||
fluentDataFile
|
||||
);
|
||||
|
||||
Info<< " Converting field " << fieldName << nl;
|
||||
writeFluentField(field, unitNumber, fluentDataFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// volVectorField
|
||||
for (const word& fieldName : objects.sortedNames<volVectorField>())
|
||||
{
|
||||
// Lookup field from dictionary and convert field
|
||||
label unitNumber;
|
||||
if
|
||||
(
|
||||
foamDataToFluentDict.readIfPresent(fieldName, unitNumber)
|
||||
&& unitNumber > 0
|
||||
)
|
||||
{
|
||||
// Read field
|
||||
volVectorField field(*(objects[fieldName]), mesh);
|
||||
|
||||
Info<< " Converting field " << fieldName << nl;
|
||||
writeFluentField(field, unitNumber, fluentDataFile);
|
||||
}
|
||||
}
|
||||
readFieldsAndWriteFluent<volVectorField>
|
||||
(
|
||||
foamDataToFluentDict,
|
||||
objects,
|
||||
mesh,
|
||||
fluentDataFile
|
||||
);
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user