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:
@ -756,7 +756,10 @@ void Foam::functionObjects::forces::calcForcesMoments()
|
||||
const volScalarField rho(this->rho());
|
||||
const volScalarField mu(this->mu());
|
||||
|
||||
const auto models = obr_.lookupClass<porosityModel>();
|
||||
const UPtrList<const porosityModel> models
|
||||
(
|
||||
obr_.csorted<porosityModel>()
|
||||
);
|
||||
|
||||
if (models.empty())
|
||||
{
|
||||
@ -766,10 +769,10 @@ void Foam::functionObjects::forces::calcForcesMoments()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
forAllConstIters(models, iter)
|
||||
for (const porosityModel& mdl : models)
|
||||
{
|
||||
// Non-const access required if mesh is changing
|
||||
auto& pm = const_cast<porosityModel&>(*iter());
|
||||
auto& pm = const_cast<porosityModel&>(mdl);
|
||||
|
||||
const vectorField fPTot(pm.force(U, rho, mu));
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ const Foam::volVectorField& Foam::functionObjects::propellerInfo::U() const
|
||||
FatalErrorInFunction
|
||||
<< "Unable to find velocity field " << UName_
|
||||
<< " . Available vector fields are: "
|
||||
<< mesh_.names<volVectorField>()
|
||||
<< flatOutput(mesh_.sortedNames<volVectorField>())
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user