ENH: binField: remove an unused field

- skip the reduce operation for serial mode
- fix typos
This commit is contained in:
Kutalmis Bercin
2025-09-23 21:02:54 +01:00
parent b30d42c391
commit d39b8a5c94
3 changed files with 13 additions and 13 deletions

View File

@ -197,7 +197,7 @@ void Foam::binModels::singleDirectionUniformBin::apply()
{ {
WarningInFunction WarningInFunction
<< "Unable to find field " << fieldNames_[i] << "Unable to find field " << fieldNames_[i]
<< ". Avaliable objects are " << ". Available objects are "
<< mesh_.objectRegistry::sortedToc() << mesh_.objectRegistry::sortedToc()
<< endl; << endl;
} }

View File

@ -73,7 +73,7 @@ void Foam::binModels::singleDirectionUniformBin::writeFileHeader
if (decomposePatchValues_) if (decomposePatchValues_)
{ {
writeTabbed(os, writeComponents<Type>("normal" + ibin)); writeTabbed(os, writeComponents<Type>("normal" + ibin));
writeTabbed(os, writeComponents<Type>("tangenial" + ibin)); writeTabbed(os, writeComponents<Type>("tangential" + ibin));
} }
else else
{ {
@ -171,8 +171,6 @@ bool Foam::binModels::singleDirectionUniformBin::processField
const auto& pts = pp.faceCentres(); const auto& pts = pp.faceCentres();
const scalarField dd(pp.faceCentres() & binDir_);
forAll(pts, facei) forAll(pts, facei)
{ {
const label bini = whichBin(pts[facei] & binDir_); const label bini = whichBin(pts[facei] & binDir_);
@ -189,9 +187,12 @@ bool Foam::binModels::singleDirectionUniformBin::processField
} }
} }
for (auto& binList : data) if (Pstream::parRun())
{ {
reduce(binList, sumOp<List<Type>>()); for (auto& binList : data)
{
reduce(binList, sumOp<List<Type>>());
}
} }
if (writeToFile()) if (writeToFile())

View File

@ -121,11 +121,7 @@ bool Foam::binModels::uniformBin::processField(const label fieldi)
nField += 1; nField += 1;
} }
List<List<Type>> data(nField); List<List<Type>> data(nField, List<Type>(nBin_, Zero));
for (auto& binList : data)
{
binList.resize(nBin_, Zero);
}
for (const label zonei : cellZoneIDs_) for (const label zonei : cellZoneIDs_)
{ {
@ -165,9 +161,12 @@ bool Foam::binModels::uniformBin::processField(const label fieldi)
} }
} }
for (auto& binList : data) if (Pstream::parRun())
{ {
reduce(binList, sumOp<List<Type>>()); for (auto& binList : data)
{
reduce(binList, sumOp<List<Type>>());
}
} }
if (writeToFile()) if (writeToFile())