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:
@ -68,7 +68,7 @@ void Foam::fieldsDistributor::readFields
|
||||
const UPtrList<const IOobject> fieldObjects(objects.csorted<GeoField>());
|
||||
|
||||
// Construct the fields
|
||||
fields.resize(fieldObjects.size());
|
||||
fields.resize_null(fieldObjects.size());
|
||||
|
||||
forAll(fieldObjects, i)
|
||||
{
|
||||
@ -89,7 +89,7 @@ void Foam::fieldsDistributor::readFields
|
||||
const UPtrList<const IOobject> fieldObjects(objects.csorted<GeoField>());
|
||||
|
||||
// Construct the fields
|
||||
fields.resize(fieldObjects.size());
|
||||
fields.resize_null(fieldObjects.size());
|
||||
|
||||
forAll(fieldObjects, i)
|
||||
{
|
||||
@ -167,18 +167,16 @@ void Foam::fieldsDistributor::readFieldsImpl
|
||||
if (deregister)
|
||||
{
|
||||
// Extra safety - remove all such types
|
||||
HashTable<const GeoField*> other
|
||||
const UPtrList<const GeoField> other
|
||||
(
|
||||
mesh.thisDb().objectRegistry::template lookupClass<GeoField>()
|
||||
mesh.thisDb().objectRegistry::template cobjects<GeoField>()
|
||||
);
|
||||
|
||||
forAllConstIters(other, iter)
|
||||
for (const GeoField& field : other)
|
||||
{
|
||||
GeoField& fld = const_cast<GeoField&>(*iter.val());
|
||||
|
||||
if (!fld.ownedByRegistry())
|
||||
if (!field.ownedByRegistry())
|
||||
{
|
||||
fld.checkOut();
|
||||
const_cast<GeoField&>(field).checkOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user