Commit ac46f28a authored by Mark Olesen's avatar Mark Olesen

ENH: for-range, forAllIters() ... in applications/utilities

- reduced clutter when iterating over containers
parent 4b7ace55
......@@ -118,7 +118,7 @@ Foam::label Foam::foamPvCore::addToSelection
if (iter.found())
{
return addToArray(select, prefix, iter.object().sortedToc());
return addToArray(select, prefix, iter.val().sortedToc());
}
return 0;
......@@ -137,7 +137,7 @@ Foam::label Foam::foamPvCore::addToSelection
if (iter.found())
{
return addToArray(select, iter.object().sortedToc(), suffix);
return addToArray(select, iter.val().sortedToc(), suffix);
}
return 0;
......
......@@ -144,9 +144,9 @@ bool Foam::vtkPVFoam::addOutputBlock
const word shortName = getFoamName(longName);
auto iter = cache.find(longName);
if (iter.found() && iter.object().dataset)
if (iter.found() && iter.val().dataset)
{
auto dataset = iter.object().dataset;
auto dataset = iter.val().dataset;
if (singleDataset)
{
......@@ -540,13 +540,13 @@ void Foam::vtkPVFoam::Update
// Eliminate cached values that would be unreliable
forAllIters(cachedVtp_, iter)
{
iter.object().clearGeom();
iter.object().clear();
iter.val().clearGeom();
iter.val().clear();
}
forAllIters(cachedVtu_, iter)
{
iter.object().clearGeom();
iter.object().clear();
iter.val().clearGeom();
iter.val().clear();
}
}
else if (oldDecomp != decomposePoly_)
......@@ -554,8 +554,8 @@ void Foam::vtkPVFoam::Update
// poly-decompose changed - dispose of cached values
forAllIters(cachedVtu_, iter)
{
iter.object().clearGeom();
iter.object().clear();
iter.val().clearGeom();
iter.val().clear();
}
}
}
......
......@@ -91,13 +91,13 @@ void Foam::vtkPVFoam::convertVolField
const auto& longName = selectedPartIds_[partId];
auto iter = cachedVtp_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk geometry
continue;
}
foamVtpData& vtpData = iter.object();
foamVtpData& vtpData = iter.val();
auto dataset = vtpData.dataset;
const labelUList& patchIds = vtpData.additionalIds();
......@@ -195,13 +195,13 @@ void Foam::vtkPVFoam::convertVolField
const word zoneName = getFoamName(longName);
auto iter = cachedVtp_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk geometry
continue;
}
foamVtpData& vtpData = iter.object();
foamVtpData& vtpData = iter.val();
auto dataset = vtpData.dataset;
const faceZoneMesh& zMesh = mesh.faceZones();
......@@ -236,12 +236,12 @@ void Foam::vtkPVFoam::convertVolField
const word selectName = getFoamName(longName);
auto iter = cachedVtp_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk geometry
continue;
}
foamVtpData& vtpData = iter.object();
foamVtpData& vtpData = iter.val();
auto dataset = vtpData.dataset;
vtkSmartPointer<vtkFloatArray> cdata = convertFaceFieldToVTK
......@@ -270,7 +270,7 @@ void Foam::vtkPVFoam::convertVolFields
forAllConstIters(objects, iter)
{
// Restrict to GeometricField<Type, ...>
const auto& ioobj = *(iter.object());
const auto& ioobj = *(iter.val());
if (ioobj.headerClassName() == FieldType::typeName)
{
......@@ -320,7 +320,7 @@ void Foam::vtkPVFoam::convertDimFields
forAllConstIters(objects, iter)
{
// Restrict to DimensionedField<Type, ...>
const auto& ioobj = *(iter.object());
const auto& ioobj = *(iter.val());
if (ioobj.headerClassName() != FieldType::typeName)
{
......@@ -404,13 +404,13 @@ void Foam::vtkPVFoam::convertVolFieldBlock
const auto& longName = selectedPartIds_[partId];
auto iter = cachedVtu_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk geometry
continue;
}
foamVtuData& vtuData = iter.object();
foamVtuData& vtuData = iter.val();
auto dataset = vtuData.dataset;
vtkSmartPointer<vtkFloatArray> cdata = convertVolFieldToVTK
......@@ -459,7 +459,7 @@ void Foam::vtkPVFoam::convertAreaFields
forAllConstIters(objects, iter)
{
// Restrict to GeometricField<Type, ...>
const auto& ioobj = *(iter.object());
const auto& ioobj = *(iter.val());
if (ioobj.headerClassName() == FieldType::typeName)
{
......@@ -478,14 +478,14 @@ void Foam::vtkPVFoam::convertAreaFields
const auto& longName = selectedPartIds_[partId];
auto iter = cachedVtp_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk
// geometry
continue;
}
foamVtpData& vtpData = iter.object();
foamVtpData& vtpData = iter.val();
auto dataset = vtpData.dataset;
vtkSmartPointer<vtkFloatArray> cdata = convertFieldToVTK
......@@ -535,7 +535,7 @@ void Foam::vtkPVFoam::convertPointFields
forAllConstIters(objects, iter)
{
// Restrict to this GeometricField<Type, ...>
const auto& ioobj = *(iter.object());
const auto& ioobj = *(iter.val());
const word& fieldName = ioobj.name();
if (ioobj.headerClassName() != FieldType::typeName)
......@@ -568,13 +568,13 @@ void Foam::vtkPVFoam::convertPointFields
const auto& longName = selectedPartIds_[partId];
auto iter = cachedVtp_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk geometry
continue;
}
foamVtpData& vtpData = iter.object();
foamVtpData& vtpData = iter.val();
auto dataset = vtpData.dataset;
const labelUList& patchIds = vtpData.additionalIds();
......@@ -605,13 +605,13 @@ void Foam::vtkPVFoam::convertPointFields
const word zoneName = getFoamName(longName);
auto iter = cachedVtp_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk geometry
continue;
}
foamVtpData& vtpData = iter.object();
foamVtpData& vtpData = iter.val();
auto dataset = vtpData.dataset;
const label zoneId = mesh.faceZones().findZoneID(zoneName);
......@@ -673,13 +673,13 @@ void Foam::vtkPVFoam::convertPointFieldBlock
const auto& longName = selectedPartIds_[partId];
auto iter = cachedVtu_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk geometry
continue;
}
foamVtuData& vtuData = iter.object();
foamVtuData& vtuData = iter.val();
auto dataset = vtuData.dataset;
vtkSmartPointer<vtkFloatArray> pdata = convertPointField
......@@ -794,7 +794,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
forAllConstIters(objects, iter)
{
// Restrict to IOField<Type>
const auto& ioobj = *(iter.object());
const auto& ioobj = *(iter.val());
if (ioobj.headerClassName() == IOField<Type>::typeName)
{
......
......@@ -255,12 +255,12 @@ void Foam::vtkPVFoam::convertLagrangianFields()
const word cloudName = getFoamName(longName);
auto iter = cachedVtp_.find(longName);
if (!iter.found() || !iter.object().dataset)
if (!iter.found() || !iter.val().dataset)
{
// Should not happen, but for safety require a vtk geometry
continue;
}
auto dataset = iter.object().dataset;
auto dataset = iter.val().dataset;
// Get the Lagrangian fields for this time and this cloud
// but only keep selected fields
......
......@@ -80,9 +80,9 @@ vtkSmartPointer<vtkPolyData> Foam::vtkPVFoam::lagrangianVTKMesh
vtkpoints->SetNumberOfPoints(parcels.size());
vtkIdType particleId = 0;
forAllConstIters(parcels, iter)
for (const passiveParticle& p : parcels)
{
vtkpoints->SetPoint(particleId, iter().position().v_);
vtkpoints->SetPoint(particleId, p.position().v_);
++particleId;
}
......
......@@ -276,7 +276,7 @@ void Foam::vtkPVFoam::updateInfoPatches
forAllConstIters(groups, iter)
{
const auto& groupName = iter.key();
const auto& patchIDs = iter.object();
const auto& patchIDs = iter.val();
label nFaces = 0;
for (auto patchId : patchIDs)
......@@ -392,7 +392,7 @@ void Foam::vtkPVFoam::updateInfoPatches
forAllConstIters(groups, iter)
{
const auto& groupName = iter.key();
const auto& patchIDs = iter.object();
const auto& patchIDs = iter.val();
const string dpyName = "group/" + groupName;
displayNames.append(dpyName);
......@@ -715,7 +715,7 @@ void Foam::vtkPVFoam::updateInfoLagrangianFields
forAllConstIters(localFields, iter)
{
fields(iter.key()) |= iter.object();
fields(iter.key()) |= iter.val();
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment