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

View File

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

View File

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

View File

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

View File

@ -65,7 +65,7 @@ void Foam::fieldsDistributor::readFields
typedef GeometricField<Type, PatchField, GeoMesh> GeoField;
// 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
fields.resize(fieldObjects.size());
@ -86,7 +86,7 @@ void Foam::fieldsDistributor::readFields
)
{
// 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
fields.resize(fieldObjects.size());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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