COMP: use csorted() instead of sorted()

This commit is contained in:
Mark Olesen
2023-07-17 16:04:40 +02:00
parent 129b738136
commit 5397c9ac04
16 changed files with 65 additions and 66 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd. Copyright (C) 2017-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -158,7 +158,7 @@ void printSets(Ostream& os, const IOobjectList& objects)
{ {
label n = 0; label n = 0;
for (const IOobject& io : objects.sorted<SetType>()) for (const IOobject& io : objects.csorted<SetType>())
{ {
SetType set(io); SetType set(io);
if (!n++) os << SetType::typeName << "s:" << nl; if (!n++) os << SetType::typeName << "s:" << nl;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -105,7 +105,7 @@ int main(int argc, char *argv[])
<< endl; << endl;
for (const IOobject& io : objects.sorted<pointSet>()) for (const IOobject& io : objects.csorted<pointSet>())
{ {
// Not in memory. Load it. // Not in memory. Load it.
pointSet set(io); pointSet set(io);
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
wordHashSet slaveCellSets; wordHashSet slaveCellSets;
for (const IOobject& io : objects.sorted<faceSet>()) for (const IOobject& io : objects.csorted<faceSet>())
{ {
// Not in memory. Load it. // Not in memory. Load it.
faceSet set(io); faceSet set(io);
@ -259,7 +259,7 @@ int main(int argc, char *argv[])
for (const IOobject& io : objects.sorted<cellSet>()) for (const IOobject& io : objects.csorted<cellSet>())
{ {
if (!slaveCellSets.found(io.name())) if (!slaveCellSets.found(io.name()))
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -653,7 +653,7 @@ int main(int argc, char *argv[])
const labelList& cellMap = const labelList& cellMap =
procMeshes.cellProcAddressing()[proci]; procMeshes.cellProcAddressing()[proci];
for (const IOobject& io : objects.sorted<cellSet>()) for (const IOobject& io : objects.csorted<cellSet>())
{ {
// Load cellSet // Load cellSet
const cellSet procSet(io); const cellSet procSet(io);
@ -684,7 +684,7 @@ int main(int argc, char *argv[])
const labelList& faceMap = const labelList& faceMap =
procMeshes.faceProcAddressing()[proci]; procMeshes.faceProcAddressing()[proci];
for (const IOobject& io : objects.sorted<faceSet>()) for (const IOobject& io : objects.csorted<faceSet>())
{ {
// Load faceSet // Load faceSet
const faceSet procSet(io); const faceSet procSet(io);
@ -714,7 +714,7 @@ int main(int argc, char *argv[])
const labelList& pointMap = const labelList& pointMap =
procMeshes.pointProcAddressing()[proci]; procMeshes.pointProcAddressing()[proci];
for (const IOobject& io : objects.sorted<pointSet>()) for (const IOobject& io : objects.csorted<pointSet>())
{ {
// Load pointSet // Load pointSet
const pointSet procSet(io); const pointSet procSet(io);

View File

@ -185,11 +185,11 @@ Foam::label Foam::parPointFieldDistributor::distributePointFields
{ {
typedef GeometricField<Type, pointPatchField, pointMesh> fieldType; typedef GeometricField<Type, pointPatchField, pointMesh> fieldType;
UPtrList<const IOobject> fieldObjects const UPtrList<const IOobject> fieldObjects
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
); );
label nFields = 0; label nFields = 0;

View File

@ -65,7 +65,7 @@ void Foam::fieldsDistributor::readFields
typedef GeometricField<Type, PatchField, GeoMesh> GeoField; typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
// GeoField fields - sorted for consistent order on all processors // GeoField fields - sorted for consistent order on all processors
UPtrList<const IOobject> fieldObjects(objects.sorted<GeoField>()); const UPtrList<const IOobject> fieldObjects(objects.csorted<GeoField>());
// Construct the fields // Construct the fields
fields.resize(fieldObjects.size()); fields.resize(fieldObjects.size());
@ -86,7 +86,7 @@ void Foam::fieldsDistributor::readFields
) )
{ {
// GeoField fields - sorted for consistent order on all processors // GeoField fields - sorted for consistent order on all processors
UPtrList<const IOobject> fieldObjects(objects.sorted<GeoField>()); const UPtrList<const IOobject> fieldObjects(objects.csorted<GeoField>());
// Construct the fields // Construct the fields
fields.resize(fieldObjects.size()); fields.resize(fieldObjects.size());

View File

@ -310,8 +310,8 @@ Foam::label Foam::faMeshDistributor::distributeAreaFields
const IOobject& io : const IOobject& io :
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
) )
{ {
@ -368,8 +368,8 @@ Foam::label Foam::faMeshDistributor::distributeEdgeFields
const IOobject& io : const IOobject& io :
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
) )
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd. Copyright (C) 2015-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -236,7 +236,7 @@ void Foam::functionObjects::forceCoeffs::writeIntegratedDataFileHeader
writeHeader(os, ""); writeHeader(os, "");
writeCommented(os, "Time"); writeCommented(os, "Time");
for (const auto& iter : coeffs_.sorted()) for (const auto& iter : coeffs_.csorted())
{ {
const auto& coeff = iter.val(); const auto& coeff = iter.val();
@ -255,7 +255,7 @@ void Foam::functionObjects::forceCoeffs::writeIntegratedDataFile()
writeCurrentTime(os); writeCurrentTime(os);
for (const auto& iter : coeffs_.sorted()) for (const auto& iter : coeffs_.csorted())
{ {
const auto& coeff = iter.val(); const auto& coeff = iter.val();
@ -359,16 +359,16 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
for (const word& key : coeffs) for (const word& key : coeffs)
{ {
auto coeffIter = coeffs_.find(key); auto iter = coeffs_.find(key);
if (!coeffIter.good()) if (!iter.good())
{ {
FatalIOErrorInFunction(dict) FatalIOErrorInFunction(dict)
<< "Unknown coefficient type " << key << "Unknown coefficient type " << key
<< " . Valid entries are : " << coeffs_.sortedToc() << " . Valid entries are : " << coeffs_.sortedToc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
auto& coeff = coeffIter.val(); auto& coeff = iter.val();
coeff.active_ = true; coeff.active_ = true;
Info<< " - " << coeff << nl; Info<< " - " << coeff << nl;
} }
@ -412,7 +412,7 @@ bool Foam::functionObjects::forceCoeffs::execute()
}; };
// Always setting all results // Always setting all results
for (const auto& iter : coeffs_.sorted()) for (const auto& iter : coeffs_.csorted())
{ {
const word& coeffName = iter.key(); const word& coeffName = iter.key();
const auto& coeff = iter.val(); const auto& coeff = iter.val();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,7 +46,7 @@ Foam::label Foam::functionObjects::ensightWrite::writeVolFieldsImpl
for for
( (
const GeoField& origField const GeoField& origField
: baseMesh.sorted<GeoField>(candidateNames) : baseMesh.csorted<GeoField>(candidateNames)
) )
{ {
const word& fieldName = origField.name(); const word& fieldName = origField.name();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -43,7 +43,7 @@ Foam::label Foam::functionObjects::vtkWrite::writeVolFieldsImpl
for for
( (
const GeoField& origField const GeoField& origField
: baseMesh.sorted<GeoField>(candidateNames) : baseMesh.csorted<GeoField>(candidateNames)
) )
{ {
bool ok = false; bool ok = false;
@ -110,7 +110,7 @@ Foam::label Foam::functionObjects::vtkWrite::writeVolFieldsImpl
for for
( (
const GeoField& origField const GeoField& origField
: baseMesh.sorted<GeoField>(candidateNames) : baseMesh.csorted<GeoField>(candidateNames)
) )
{ {
bool ok = false; bool ok = false;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd. Copyright (C) 2021-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -114,14 +114,13 @@ void Foam::KinematicSurfaceFilm<CloudType>::initFilmModels()
// Set up area films // Set up area films
if (areaFilms_.empty()) if (areaFilms_.empty())
{ {
UPtrList<const areaFilm> models for
( (
mesh.time().objectRegistry::template sorted<areaFilm>() const areaFilm& regionFa
); : mesh.time().objectRegistry::template csorted<areaFilm>()
)
for (const auto& model : models)
{ {
areaFilms_.append(const_cast<areaFilm*>(&model)); areaFilms_.push_back(const_cast<areaFilm*>(&regionFa));
} }
} }
} }

View File

@ -288,7 +288,7 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackCloudType& cloud)
for for
( (
const areaFilm& regionFa const areaFilm& regionFa
: mesh.time().objectRegistry::template sorted<areaFilm>() : mesh.time().objectRegistry::template csorted<areaFilm>()
) )
{ {
if (regionFa.active()) if (regionFa.active())

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd. Copyright (C) 2022-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -40,9 +40,9 @@ void Foam::lagrangianFieldDecomposer::readFields
) )
{ {
// List of lagrangian field objects // List of lagrangian field objects
UPtrList<const IOobject> fieldObjects const UPtrList<const IOobject> fieldObjects
( (
lagrangianObjects.sorted<IOField<Type>>() lagrangianObjects.csorted<IOField<Type>>()
); );
auto& cloudFields = auto& cloudFields =
@ -66,12 +66,12 @@ void Foam::lagrangianFieldDecomposer::readFieldFields
// List of lagrangian field objects // List of lagrangian field objects
UPtrList<const IOobject> fieldObjects UPtrList<const IOobject> fieldObjects
( (
lagrangianObjects.sorted<IOField<Field<Type>>>() lagrangianObjects.cobjects<IOField<Field<Type>>>()
); );
fieldObjects.push_back fieldObjects.push_back
( (
lagrangianObjects.sorted<CompactIOField<Field<Type>, Type>>() lagrangianObjects.cobjects<CompactIOField<Field<Type>, Type>>()
); );
Foam::sort(fieldObjects, nameOp<IOobject>()); Foam::sort(fieldObjects, nameOp<IOobject>());

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2016-2017 Wikki Ltd
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -697,8 +697,8 @@ Foam::label Foam::faFieldReconstructor::reconstructAreaFields
( (
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
); );
} }
@ -717,8 +717,8 @@ Foam::label Foam::faFieldReconstructor::reconstructEdgeFields
( (
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
); );
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -707,8 +707,8 @@ Foam::label Foam::fvFieldReconstructor::reconstructInternalFields
( (
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
); );
} }
@ -727,8 +727,8 @@ Foam::label Foam::fvFieldReconstructor::reconstructVolumeFields
( (
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
); );
} }
@ -747,8 +747,8 @@ Foam::label Foam::fvFieldReconstructor::reconstructSurfaceFields
( (
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
); );
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -199,8 +199,8 @@ Foam::label Foam::lagrangianReconstructor::reconstructFields
cloudName, cloudName,
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
); );
} }
@ -221,13 +221,13 @@ Foam::label Foam::lagrangianReconstructor::reconstructFieldFields
if (selectedFields.empty()) if (selectedFields.empty())
{ {
fieldObjects.append(objects.sorted<fieldType>()); fieldObjects.push_back(objects.csorted<fieldType>());
fieldObjects.append(objects.sorted<fieldTypeB>()); fieldObjects.push_back(objects.csorted<fieldTypeB>());
} }
else else
{ {
fieldObjects.append(objects.sorted<fieldType>(selectedFields)); fieldObjects.push_back(objects.csorted<fieldType>(selectedFields));
fieldObjects.append(objects.sorted<fieldTypeB>(selectedFields)); fieldObjects.push_back(objects.csorted<fieldTypeB>(selectedFields));
} }
Foam::sort(fieldObjects, nameOp<IOobject>()); Foam::sort(fieldObjects, nameOp<IOobject>());

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -212,8 +212,8 @@ Foam::label Foam::pointFieldReconstructor::reconstructPointFields
( (
( (
selectedFields.empty() selectedFields.empty()
? objects.sorted<fieldType>() ? objects.csorted<fieldType>()
: objects.sorted<fieldType>(selectedFields) : objects.csorted<fieldType>(selectedFields)
) )
); );
} }