mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use labelRange and range-based-for in paraview readers
- also use updated forAll* macros
This commit is contained in:
@ -146,7 +146,7 @@ vtkPVFoamReader::~vtkPVFoamReader()
|
||||
|
||||
if (FileName)
|
||||
{
|
||||
delete [] FileName;
|
||||
delete[] FileName;
|
||||
}
|
||||
|
||||
if (output0_)
|
||||
@ -525,13 +525,11 @@ void vtkPVFoamReader::updatePatchNamesView(const bool show)
|
||||
}
|
||||
|
||||
// Get all the pqRenderView instances
|
||||
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
||||
|
||||
for (int viewI=0; viewI < renderViews.size(); ++viewI)
|
||||
for (auto view : smModel->findItems<pqRenderView*>())
|
||||
{
|
||||
backend_->renderPatchNames
|
||||
(
|
||||
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
||||
view->getRenderViewProxy()->GetRenderer(),
|
||||
show
|
||||
);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Foam
|
||||
|
||||
vtkTextActor* Foam::vtkPVFoam::createTextActor
|
||||
(
|
||||
const string& s,
|
||||
const std::string& s,
|
||||
const point& pt
|
||||
)
|
||||
{
|
||||
@ -79,15 +79,15 @@ vtkTextActor* Foam::vtkPVFoam::createTextActor
|
||||
void Foam::vtkPVFoam::resetCounters()
|
||||
{
|
||||
// Reset array range information (ids and sizes)
|
||||
arrayRangeVolume_.reset();
|
||||
arrayRangePatches_.reset();
|
||||
arrayRangeLagrangian_.reset();
|
||||
arrayRangeCellZones_.reset();
|
||||
arrayRangeFaceZones_.reset();
|
||||
arrayRangePointZones_.reset();
|
||||
arrayRangeCellSets_.reset();
|
||||
arrayRangeFaceSets_.reset();
|
||||
arrayRangePointSets_.reset();
|
||||
rangeVolume_.reset();
|
||||
rangePatches_.reset();
|
||||
rangeLagrangian_.reset();
|
||||
rangeCellZones_.reset();
|
||||
rangeFaceZones_.reset();
|
||||
rangePointZones_.reset();
|
||||
rangeCellSets_.reset();
|
||||
rangeFaceSets_.reset();
|
||||
rangePointSets_.reset();
|
||||
}
|
||||
|
||||
|
||||
@ -260,15 +260,15 @@ Foam::vtkPVFoam::vtkPVFoam
|
||||
timeIndex_(-1),
|
||||
meshChanged_(true),
|
||||
fieldsChanged_(true),
|
||||
arrayRangeVolume_("unzoned"),
|
||||
arrayRangePatches_("patches"),
|
||||
arrayRangeLagrangian_("lagrangian"),
|
||||
arrayRangeCellZones_("cellZone"),
|
||||
arrayRangeFaceZones_("faceZone"),
|
||||
arrayRangePointZones_("pointZone"),
|
||||
arrayRangeCellSets_("cellSet"),
|
||||
arrayRangeFaceSets_("faceSet"),
|
||||
arrayRangePointSets_("pointSet")
|
||||
rangeVolume_("unzoned"),
|
||||
rangePatches_("patches"),
|
||||
rangeLagrangian_("lagrangian"),
|
||||
rangeCellZones_("cellZone"),
|
||||
rangeFaceZones_("faceZone"),
|
||||
rangePointZones_("pointZone"),
|
||||
rangeCellSets_("cellSet"),
|
||||
rangeFaceSets_("faceSet"),
|
||||
rangePointSets_("pointSet")
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -653,7 +653,7 @@ void Foam::vtkPVFoam::renderPatchNames
|
||||
hashedWordList selectedPatches = getSelected
|
||||
(
|
||||
reader_->GetPartSelection(),
|
||||
arrayRangePatches_
|
||||
rangePatches_
|
||||
);
|
||||
|
||||
if (selectedPatches.empty())
|
||||
|
||||
@ -35,7 +35,6 @@ SourceFiles
|
||||
vtkPVFoamMeshVolume.C
|
||||
vtkPVFoamTemplates.C
|
||||
vtkPVFoamUpdateInfo.C
|
||||
vtkPVFoamUtils.C
|
||||
vtkPVFoamFieldTemplates.C
|
||||
vtkPVFoamUpdateTemplates.C
|
||||
|
||||
@ -197,15 +196,15 @@ class vtkPVFoam
|
||||
|
||||
//- First instance and size of various mesh parts
|
||||
// used to index into partStatus_ and partDataset_
|
||||
arrayRange arrayRangeVolume_;
|
||||
arrayRange arrayRangePatches_;
|
||||
arrayRange arrayRangeLagrangian_;
|
||||
arrayRange arrayRangeCellZones_;
|
||||
arrayRange arrayRangeFaceZones_;
|
||||
arrayRange arrayRangePointZones_;
|
||||
arrayRange arrayRangeCellSets_;
|
||||
arrayRange arrayRangeFaceSets_;
|
||||
arrayRange arrayRangePointSets_;
|
||||
arrayRange rangeVolume_;
|
||||
arrayRange rangePatches_;
|
||||
arrayRange rangeLagrangian_;
|
||||
arrayRange rangeCellZones_;
|
||||
arrayRange rangeFaceZones_;
|
||||
arrayRange rangePointZones_;
|
||||
arrayRange rangeCellSets_;
|
||||
arrayRange rangeFaceSets_;
|
||||
arrayRange rangePointSets_;
|
||||
|
||||
//- Decomposed cells information (mesh regions)
|
||||
// TODO: regions
|
||||
@ -224,7 +223,11 @@ class vtkPVFoam
|
||||
// Private Member Functions
|
||||
|
||||
//- Create a text actor
|
||||
static vtkTextActor* createTextActor(const string& s, const point& pt);
|
||||
static vtkTextActor* createTextActor
|
||||
(
|
||||
const std::string& s,
|
||||
const point& pt
|
||||
);
|
||||
|
||||
//- Reset data counters
|
||||
void resetCounters();
|
||||
|
||||
@ -83,7 +83,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
fld,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeVolume_,
|
||||
rangeVolume_,
|
||||
regionPolyDecomp_
|
||||
);
|
||||
|
||||
@ -93,7 +93,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
fld,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeCellZones_,
|
||||
rangeCellZones_,
|
||||
zonePolyDecomp_
|
||||
);
|
||||
|
||||
@ -103,7 +103,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
fld,
|
||||
ptfPtr,
|
||||
output,
|
||||
arrayRangeCellSets_,
|
||||
rangeCellSets_,
|
||||
csetPolyDecomp_
|
||||
);
|
||||
|
||||
@ -111,12 +111,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
//
|
||||
// Convert patches - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangePatches_.start();
|
||||
partId < arrayRangePatches_.end();
|
||||
++partId
|
||||
)
|
||||
for (auto partId : rangePatches_)
|
||||
{
|
||||
const word patchName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
@ -129,7 +124,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
|
||||
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||
(
|
||||
output, arrayRangePatches_, datasetNo
|
||||
output, rangePatches_, datasetNo
|
||||
);
|
||||
|
||||
if (!vtkmesh)
|
||||
@ -195,12 +190,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
//
|
||||
// Convert face zones - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangeFaceZones_.start();
|
||||
partId < arrayRangeFaceZones_.end();
|
||||
++partId
|
||||
)
|
||||
for (auto partId : rangeFaceZones_)
|
||||
{
|
||||
const word zoneName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
@ -220,7 +210,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
|
||||
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||
(
|
||||
output, arrayRangeFaceZones_, datasetNo
|
||||
output, rangeFaceZones_, datasetNo
|
||||
);
|
||||
|
||||
if (vtkmesh)
|
||||
@ -241,12 +231,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
//
|
||||
// Convert face sets - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangeFaceSets_.start();
|
||||
partId < arrayRangeFaceSets_.end();
|
||||
++partId
|
||||
)
|
||||
for (auto partId : rangeFaceSets_)
|
||||
{
|
||||
const word selectName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
@ -258,7 +243,7 @@ void Foam::vtkPVFoam::convertVolField
|
||||
|
||||
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||
(
|
||||
output, arrayRangeFaceSets_, datasetNo
|
||||
output, rangeFaceSets_, datasetNo
|
||||
);
|
||||
|
||||
if (!vtkmesh)
|
||||
@ -291,7 +276,7 @@ void Foam::vtkPVFoam::convertVolFields
|
||||
vtkMultiBlockDataSet* output
|
||||
)
|
||||
{
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
forAllConstIters(objects, iter)
|
||||
{
|
||||
// restrict to GeometricField<Type, ...>
|
||||
if
|
||||
@ -327,7 +312,7 @@ void Foam::vtkPVFoam::convertDimFields
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
forAllConstIters(objects, iter)
|
||||
{
|
||||
// restrict to DimensionedField<Type, ...>
|
||||
if
|
||||
@ -387,7 +372,7 @@ void Foam::vtkPVFoam::convertVolFieldBlock
|
||||
const List<polyDecomp>& decompLst
|
||||
)
|
||||
{
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
const label datasetNo = partDataset_[partId];
|
||||
|
||||
@ -437,7 +422,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
const polyMesh& mesh = pMesh.mesh();
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
forAllConstIters(objects, iter)
|
||||
{
|
||||
const word& fieldName = iter()->name();
|
||||
// restrict to this GeometricField<Type, ...>
|
||||
@ -463,7 +448,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
(
|
||||
pfld,
|
||||
output,
|
||||
arrayRangeVolume_,
|
||||
rangeVolume_,
|
||||
regionPolyDecomp_
|
||||
);
|
||||
|
||||
@ -472,7 +457,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
(
|
||||
pfld,
|
||||
output,
|
||||
arrayRangeCellZones_,
|
||||
rangeCellZones_,
|
||||
zonePolyDecomp_
|
||||
);
|
||||
|
||||
@ -481,7 +466,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
(
|
||||
pfld,
|
||||
output,
|
||||
arrayRangeCellSets_,
|
||||
rangeCellSets_,
|
||||
csetPolyDecomp_
|
||||
);
|
||||
|
||||
@ -489,12 +474,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
//
|
||||
// Convert patches - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangePatches_.start();
|
||||
partId < arrayRangePatches_.end();
|
||||
++partId
|
||||
)
|
||||
for (auto partId : rangePatches_)
|
||||
{
|
||||
const word patchName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
@ -507,7 +487,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
|
||||
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||
(
|
||||
output, arrayRangePatches_, datasetNo
|
||||
output, rangePatches_, datasetNo
|
||||
);
|
||||
|
||||
if (vtkmesh)
|
||||
@ -526,12 +506,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
//
|
||||
// Convert faceZones - if activated
|
||||
//
|
||||
for
|
||||
(
|
||||
int partId = arrayRangeFaceZones_.start();
|
||||
partId < arrayRangeFaceZones_.end();
|
||||
++partId
|
||||
)
|
||||
for (auto partId : rangeFaceZones_)
|
||||
{
|
||||
const word zoneName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
@ -544,7 +519,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
|
||||
vtkPolyData* vtkmesh = getDataFromBlock<vtkPolyData>
|
||||
(
|
||||
output, arrayRangeFaceZones_, datasetNo
|
||||
output, rangeFaceZones_, datasetNo
|
||||
);
|
||||
|
||||
if (vtkmesh)
|
||||
@ -575,31 +550,31 @@ void Foam::vtkPVFoam::convertPointFieldBlock
|
||||
const List<polyDecomp>& decompLst
|
||||
)
|
||||
{
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
{
|
||||
const label datasetNo = partDataset_[partId];
|
||||
for (auto partId : range)
|
||||
{
|
||||
const label datasetNo = partDataset_[partId];
|
||||
|
||||
if (!partStatus_[partId])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!partStatus_[partId])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
vtkUnstructuredGrid* vtkmesh = getDataFromBlock<vtkUnstructuredGrid>
|
||||
(
|
||||
output, range, datasetNo
|
||||
);
|
||||
vtkUnstructuredGrid* vtkmesh = getDataFromBlock<vtkUnstructuredGrid>
|
||||
(
|
||||
output, range, datasetNo
|
||||
);
|
||||
|
||||
if (vtkmesh)
|
||||
{
|
||||
convertPointField
|
||||
(
|
||||
vtkmesh,
|
||||
pfld,
|
||||
GeometricField<Type, fvPatchField, volMesh>::null(),
|
||||
decompLst[datasetNo]
|
||||
);
|
||||
}
|
||||
}
|
||||
if (vtkmesh)
|
||||
{
|
||||
convertPointField
|
||||
(
|
||||
vtkmesh,
|
||||
pfld,
|
||||
GeometricField<Type, fvPatchField, volMesh>::null(),
|
||||
decompLst[datasetNo]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -731,9 +706,9 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
||||
const label datasetNo
|
||||
)
|
||||
{
|
||||
const arrayRange& range = arrayRangeLagrangian_;
|
||||
const arrayRange& range = rangeLagrangian_;
|
||||
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
forAllConstIters(objects, iter)
|
||||
{
|
||||
// restrict to this IOField<Type>
|
||||
if (iter()->headerClassName() == IOField<Type>::typeName)
|
||||
|
||||
@ -52,7 +52,7 @@ void Foam::vtkPVFoam::pruneObjectList
|
||||
}
|
||||
|
||||
// only retain specified fields
|
||||
forAllIter(IOobjectList, objects, iter)
|
||||
forAllIters(objects, iter)
|
||||
{
|
||||
if (!retain.found(iter()->name()))
|
||||
{
|
||||
@ -93,7 +93,7 @@ void Foam::vtkPVFoam::convertVolFields
|
||||
if (debug)
|
||||
{
|
||||
Info<< "<beg> convert volume fields" << endl;
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
forAllConstIters(objects, iter)
|
||||
{
|
||||
Info<< " " << iter()->name()
|
||||
<< " == " << iter()->objectPath() << endl;
|
||||
@ -175,7 +175,7 @@ void Foam::vtkPVFoam::convertPointFields
|
||||
if (debug)
|
||||
{
|
||||
Info<< "<beg> convert volume -> point fields" << endl;
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
forAllConstIters(objects, iter)
|
||||
{
|
||||
Info<< " " << iter()->name()
|
||||
<< " == " << iter()->objectPath() << endl;
|
||||
@ -205,7 +205,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
||||
vtkMultiBlockDataSet* output
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeLagrangian_;
|
||||
arrayRange& range = rangeLagrangian_;
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
|
||||
hashedWordList selectedFields = getSelected
|
||||
@ -224,7 +224,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
||||
printMemory();
|
||||
}
|
||||
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
const word cloudName = getPartName(partId);
|
||||
const label datasetNo = partDataset_[partId];
|
||||
@ -253,7 +253,7 @@ void Foam::vtkPVFoam::convertLagrangianFields
|
||||
if (debug)
|
||||
{
|
||||
Info<< "converting OpenFOAM lagrangian fields" << endl;
|
||||
forAllConstIter(IOobjectList, objects, iter)
|
||||
forAllConstIters(objects, iter)
|
||||
{
|
||||
Info<< " " << iter()->name()
|
||||
<< " == " << iter()->objectPath() << endl;
|
||||
|
||||
@ -47,7 +47,7 @@ void Foam::vtkPVFoam::convertMeshVolume
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeVolume_;
|
||||
arrayRange& range = rangeVolume_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -63,7 +63,7 @@ void Foam::vtkPVFoam::convertMeshVolume
|
||||
|
||||
// Convert the internalMesh
|
||||
// this looks like more than one part, but it isn't
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
const word partName = "internalMesh";
|
||||
|
||||
@ -107,7 +107,7 @@ void Foam::vtkPVFoam::convertMeshLagrangian
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeLagrangian_;
|
||||
arrayRange& range = rangeLagrangian_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -118,7 +118,7 @@ void Foam::vtkPVFoam::convertMeshLagrangian
|
||||
printMemory();
|
||||
}
|
||||
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
const word cloudName = getPartName(partId);
|
||||
|
||||
@ -158,7 +158,7 @@ void Foam::vtkPVFoam::convertMeshPatches
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangePatches_;
|
||||
arrayRange& range = rangePatches_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -170,7 +170,7 @@ void Foam::vtkPVFoam::convertMeshPatches
|
||||
printMemory();
|
||||
}
|
||||
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
if (!partStatus_[partId])
|
||||
{
|
||||
@ -197,15 +197,15 @@ void Foam::vtkPVFoam::convertMeshPatches
|
||||
{
|
||||
// Patch group. Collect patch faces.
|
||||
label sz = 0;
|
||||
forAllConstIter(labelHashSet, patchIds, iter)
|
||||
for (auto id : patchIds)
|
||||
{
|
||||
sz += patches[iter.key()].size();
|
||||
sz += patches[id].size();
|
||||
}
|
||||
labelList faceLabels(sz);
|
||||
sz = 0;
|
||||
forAllConstIter(labelHashSet, patchIds, iter)
|
||||
for (auto id : patchIds)
|
||||
{
|
||||
const polyPatch& pp = patches[iter.key()];
|
||||
const auto& pp = patches[id];
|
||||
forAll(pp, i)
|
||||
{
|
||||
faceLabels[sz++] = pp.start()+i;
|
||||
@ -254,7 +254,7 @@ void Foam::vtkPVFoam::convertMeshCellZones
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeCellZones_;
|
||||
arrayRange& range = rangeCellZones_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -274,7 +274,7 @@ void Foam::vtkPVFoam::convertMeshCellZones
|
||||
}
|
||||
|
||||
const cellZoneMesh& zMesh = mesh.cellZones();
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
const word zoneName = getPartName(partId);
|
||||
const label zoneId = zMesh.findZoneID(zoneName);
|
||||
@ -343,7 +343,7 @@ void Foam::vtkPVFoam::convertMeshCellSets
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeCellSets_;
|
||||
arrayRange& range = rangeCellSets_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -357,7 +357,7 @@ void Foam::vtkPVFoam::convertMeshCellSets
|
||||
printMemory();
|
||||
}
|
||||
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
const word partName = getPartName(partId);
|
||||
|
||||
@ -425,7 +425,7 @@ void Foam::vtkPVFoam::convertMeshFaceZones
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeFaceZones_;
|
||||
arrayRange& range = rangeFaceZones_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -442,7 +442,7 @@ void Foam::vtkPVFoam::convertMeshFaceZones
|
||||
}
|
||||
|
||||
const faceZoneMesh& zMesh = mesh.faceZones();
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
const word zoneName = getPartName(partId);
|
||||
const label zoneId = zMesh.findZoneID(zoneName);
|
||||
@ -489,7 +489,7 @@ void Foam::vtkPVFoam::convertMeshFaceSets
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeFaceSets_;
|
||||
arrayRange& range = rangeFaceSets_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -500,7 +500,7 @@ void Foam::vtkPVFoam::convertMeshFaceSets
|
||||
printMemory();
|
||||
}
|
||||
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
const word partName = getPartName(partId);
|
||||
|
||||
@ -560,7 +560,7 @@ void Foam::vtkPVFoam::convertMeshPointZones
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangePointZones_;
|
||||
arrayRange& range = rangePointZones_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -574,10 +574,10 @@ void Foam::vtkPVFoam::convertMeshPointZones
|
||||
if (range.size())
|
||||
{
|
||||
const pointZoneMesh& zMesh = mesh.pointZones();
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
word zoneName = getPartName(partId);
|
||||
label zoneId = zMesh.findZoneID(zoneName);
|
||||
const word zoneName = getPartName(partId);
|
||||
const label zoneId = zMesh.findZoneID(zoneName);
|
||||
|
||||
if (!partStatus_[partId] || zoneId < 0)
|
||||
{
|
||||
@ -630,7 +630,7 @@ void Foam::vtkPVFoam::convertMeshPointSets
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangePointSets_;
|
||||
arrayRange& range = rangePointSets_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
const fvMesh& mesh = *meshPtr_;
|
||||
@ -641,9 +641,9 @@ void Foam::vtkPVFoam::convertMeshPointSets
|
||||
printMemory();
|
||||
}
|
||||
|
||||
for (int partId = range.start(); partId < range.end(); ++partId)
|
||||
for (auto partId : range)
|
||||
{
|
||||
word partName = getPartName(partId);
|
||||
const word partName = getPartName(partId);
|
||||
|
||||
if (!partStatus_[partId])
|
||||
{
|
||||
@ -661,7 +661,7 @@ void Foam::vtkPVFoam::convertMeshPointSets
|
||||
vtkpoints->Allocate(pSet.size());
|
||||
|
||||
const pointField& meshPoints = mesh.points();
|
||||
forAllConstIter(pointSet, pSet, iter)
|
||||
forAllConstIters(pSet, iter)
|
||||
{
|
||||
vtkpoints->InsertNextPoint(meshPoints[iter.key()].v_);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
|
||||
vtkcells->Allocate(parcels.size());
|
||||
|
||||
vtkIdType particleId = 0;
|
||||
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
|
||||
forAllConstIters(parcels, iter)
|
||||
{
|
||||
vtkpoints->InsertNextPoint(iter().position().v_);
|
||||
|
||||
|
||||
@ -89,11 +89,11 @@ Foam::wordList Foam::vtkPVFoam::getZoneNames
|
||||
wordList names(zmesh.size());
|
||||
label nZone = 0;
|
||||
|
||||
forAll(zmesh, zoneI)
|
||||
forAll(zmesh, zonei)
|
||||
{
|
||||
if (!zmesh[zoneI].empty())
|
||||
if (!zmesh[zonei].empty())
|
||||
{
|
||||
names[nZone++] = zmesh[zoneI].name();
|
||||
names[nZone++] = zmesh[zonei].name();
|
||||
}
|
||||
}
|
||||
names.setSize(nZone);
|
||||
@ -128,9 +128,9 @@ Foam::wordList Foam::vtkPVFoam::getZoneNames(const word& zoneType) const
|
||||
zonesEntries zones(ioObj);
|
||||
|
||||
names.setSize(zones.size());
|
||||
forAll(zones, zoneI)
|
||||
forAll(zones, zonei)
|
||||
{
|
||||
names[zoneI] = zones[zoneI].keyword();
|
||||
names[zonei] = zones[zonei].keyword();
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,12 +150,8 @@ void Foam::vtkPVFoam::updateInfoInternalMesh
|
||||
|
||||
// Determine mesh parts (internalMesh, patches...)
|
||||
//- Add internal mesh as first entry
|
||||
arrayRangeVolume_.reset(arraySelection->GetNumberOfArrays());
|
||||
arraySelection->AddArray
|
||||
(
|
||||
"internalMesh"
|
||||
);
|
||||
arrayRangeVolume_ += 1;
|
||||
rangeVolume_.reset(arraySelection->GetNumberOfArrays(), 1);
|
||||
arraySelection->AddArray("internalMesh");
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -190,20 +186,16 @@ void Foam::vtkPVFoam::updateInfoLagrangian
|
||||
readDir(dbPtr_->timePath()/lagrangianPrefix, fileName::DIRECTORY)
|
||||
);
|
||||
|
||||
arrayRangeLagrangian_.reset(arraySelection->GetNumberOfArrays());
|
||||
|
||||
int nClouds = 0;
|
||||
forAll(cloudDirs, cloudI)
|
||||
rangeLagrangian_.reset(arraySelection->GetNumberOfArrays());
|
||||
forAll(cloudDirs, cloudi)
|
||||
{
|
||||
// Add cloud to GUI list
|
||||
arraySelection->AddArray
|
||||
(
|
||||
(cloudDirs[cloudI] + " - lagrangian").c_str()
|
||||
(cloudDirs[cloudi] + " - lagrangian").c_str()
|
||||
);
|
||||
|
||||
++nClouds;
|
||||
++rangeLagrangian_;
|
||||
}
|
||||
arrayRangeLagrangian_ += nClouds;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -224,53 +216,54 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||
}
|
||||
|
||||
|
||||
HashSet<string> enabledEntriesSet(enabledEntries);
|
||||
|
||||
arrayRangePatches_.reset(arraySelection->GetNumberOfArrays());
|
||||
rangePatches_.reset(arraySelection->GetNumberOfArrays());
|
||||
|
||||
int nPatches = 0;
|
||||
if (meshPtr_)
|
||||
{
|
||||
const polyBoundaryMesh& patches = meshPtr_->boundaryMesh();
|
||||
const HashTable<labelList>& groups = patches.groupPatchIDs();
|
||||
const wordList allPatchNames = patches.names();
|
||||
|
||||
// Add patch groups
|
||||
// ~~~~~~~~~~~~~~~~
|
||||
// Add (non-zero) patch groups to the list of mesh parts
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
forAllConstIters(groups, iter)
|
||||
{
|
||||
const word& groupName = iter.key();
|
||||
const labelList& patchIDs = iter.object();
|
||||
const auto& groupName = iter.key();
|
||||
const auto& patchIDs = iter.object();
|
||||
|
||||
label nFaces = 0;
|
||||
forAll(patchIDs, i)
|
||||
for (auto patchId : patchIDs)
|
||||
{
|
||||
nFaces += patches[patchIDs[i]].size();
|
||||
nFaces += patches[patchId].size();
|
||||
}
|
||||
|
||||
if (!nFaces)
|
||||
{
|
||||
// Skip if group has no faces
|
||||
continue;
|
||||
}
|
||||
|
||||
// Valid patch if nFace > 0 - add patch to GUI list
|
||||
if (nFaces)
|
||||
const string dpyName = groupName + " - group";
|
||||
arraySelection->AddArray(dpyName.c_str());
|
||||
++rangePatches_;
|
||||
|
||||
if (enabledEntriesSet.found(dpyName))
|
||||
{
|
||||
string vtkGrpName = groupName + " - group";
|
||||
arraySelection->AddArray(vtkGrpName.c_str());
|
||||
|
||||
++nPatches;
|
||||
|
||||
if (enabledEntriesSet.found(vtkGrpName))
|
||||
if (!reader_->GetShowGroupsOnly())
|
||||
{
|
||||
if (!reader_->GetShowGroupsOnly())
|
||||
enabledEntriesSet.erase(dpyName);
|
||||
for (auto patchId : patchIDs)
|
||||
{
|
||||
enabledEntriesSet.erase(vtkGrpName);
|
||||
forAll(patchIDs, i)
|
||||
const polyPatch& pp = patches[patchId];
|
||||
if (pp.size())
|
||||
{
|
||||
const polyPatch& pp = patches[patchIDs[i]];
|
||||
if (pp.size())
|
||||
{
|
||||
string vtkPatchName = pp.name() + " - patch";
|
||||
enabledEntriesSet.insert(vtkPatchName);
|
||||
}
|
||||
enabledEntriesSet.insert
|
||||
(
|
||||
pp.name() + " - patch"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,8 +271,8 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
}
|
||||
|
||||
|
||||
// Add patches
|
||||
// ~~~~~~~~~~~
|
||||
// Add (non-zero) patches to the list of mesh parts
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (!reader_->GetShowGroupsOnly())
|
||||
{
|
||||
@ -294,8 +287,7 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
(
|
||||
(pp.name() + " - patch").c_str()
|
||||
);
|
||||
|
||||
++nPatches;
|
||||
++rangePatches_;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -325,7 +317,6 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
{
|
||||
polyBoundaryMeshEntries patchEntries(ioObj);
|
||||
|
||||
|
||||
// Read patches and determine sizes
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -344,66 +335,49 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
// Add (non-zero) patch groups to the list of mesh parts
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
HashTable<labelList> groups(patchEntries.size());
|
||||
HashTable<labelHashSet> groups(patchEntries.size());
|
||||
|
||||
forAll(patchEntries, patchi)
|
||||
{
|
||||
const dictionary& patchDict = patchEntries[patchi].dict();
|
||||
|
||||
wordList groupNames;
|
||||
patchDict.readIfPresent("inGroups", groupNames);
|
||||
|
||||
forAll(groupNames, groupI)
|
||||
if
|
||||
(
|
||||
sizes[patchi] // Valid patch if nFace > 0
|
||||
&& patchDict.readIfPresent("inGroups", groupNames)
|
||||
)
|
||||
{
|
||||
HashTable<labelList>::iterator iter = groups.find
|
||||
(
|
||||
groupNames[groupI]
|
||||
);
|
||||
if (iter != groups.end())
|
||||
forAll(groupNames, groupI)
|
||||
{
|
||||
iter().append(patchi);
|
||||
}
|
||||
else
|
||||
{
|
||||
groups.insert(groupNames[groupI], labelList{patchi});
|
||||
groups(groupNames[groupI]).insert(patchi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAllConstIters(groups, iter)
|
||||
{
|
||||
const word& groupName = iter.key();
|
||||
const labelList& patchIDs = iter.object();
|
||||
const auto& groupName = iter.key();
|
||||
const auto& patchIDs = iter.object();
|
||||
|
||||
label nFaces = 0;
|
||||
forAll(patchIDs, i)
|
||||
const string dpyName = groupName + " - group";
|
||||
arraySelection->AddArray(dpyName.c_str());
|
||||
++rangePatches_;
|
||||
|
||||
// Optionally replace with patch name selection
|
||||
if
|
||||
(
|
||||
enabledEntriesSet.found(dpyName)
|
||||
&& !reader_->GetShowGroupsOnly()
|
||||
)
|
||||
{
|
||||
nFaces += sizes[patchIDs[i]];
|
||||
}
|
||||
|
||||
// Valid patch if nFace > 0 - add patch to GUI list
|
||||
if (nFaces)
|
||||
{
|
||||
string vtkGrpName = groupName + " - group";
|
||||
arraySelection->AddArray(vtkGrpName.c_str());
|
||||
|
||||
++nPatches;
|
||||
|
||||
if (enabledEntriesSet.found(vtkGrpName))
|
||||
enabledEntriesSet.erase(dpyName);
|
||||
for (auto patchId : patchIDs)
|
||||
{
|
||||
if (!reader_->GetShowGroupsOnly())
|
||||
{
|
||||
enabledEntriesSet.erase(vtkGrpName);
|
||||
forAll(patchIDs, i)
|
||||
{
|
||||
if (sizes[patchIDs[i]])
|
||||
{
|
||||
string vtkPatchName =
|
||||
names[patchIDs[i]] + " - patch";
|
||||
enabledEntriesSet.insert(vtkPatchName);
|
||||
}
|
||||
}
|
||||
}
|
||||
enabledEntriesSet.insert
|
||||
(
|
||||
names[patchId] + " - patch";
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -423,14 +397,12 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
(
|
||||
(names[patchi] + " - patch").c_str()
|
||||
);
|
||||
|
||||
++nPatches;
|
||||
++rangePatches_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arrayRangePatches_ += nPatches;
|
||||
|
||||
// Update enabled entries in case of group selection
|
||||
enabledEntries = enabledEntriesSet.toc();
|
||||
@ -472,15 +444,15 @@ void Foam::vtkPVFoam::updateInfoZones
|
||||
namesLst = getZoneNames("cellZones");
|
||||
}
|
||||
|
||||
arrayRangeCellZones_.reset(arraySelection->GetNumberOfArrays());
|
||||
rangeCellZones_.reset(arraySelection->GetNumberOfArrays());
|
||||
forAll(namesLst, elemI)
|
||||
{
|
||||
arraySelection->AddArray
|
||||
(
|
||||
(namesLst[elemI] + " - cellZone").c_str()
|
||||
);
|
||||
++rangeCellZones_;
|
||||
}
|
||||
arrayRangeCellZones_ += namesLst.size();
|
||||
|
||||
|
||||
//
|
||||
@ -495,15 +467,15 @@ void Foam::vtkPVFoam::updateInfoZones
|
||||
namesLst = getZoneNames("faceZones");
|
||||
}
|
||||
|
||||
arrayRangeFaceZones_.reset(arraySelection->GetNumberOfArrays());
|
||||
rangeFaceZones_.reset(arraySelection->GetNumberOfArrays());
|
||||
forAll(namesLst, elemI)
|
||||
{
|
||||
arraySelection->AddArray
|
||||
(
|
||||
(namesLst[elemI] + " - faceZone").c_str()
|
||||
);
|
||||
++rangeFaceZones_;
|
||||
}
|
||||
arrayRangeFaceZones_ += namesLst.size();
|
||||
|
||||
|
||||
//
|
||||
@ -518,15 +490,15 @@ void Foam::vtkPVFoam::updateInfoZones
|
||||
namesLst = getZoneNames("pointZones");
|
||||
}
|
||||
|
||||
arrayRangePointZones_.reset(arraySelection->GetNumberOfArrays());
|
||||
rangePointZones_.reset(arraySelection->GetNumberOfArrays());
|
||||
forAll(namesLst, elemI)
|
||||
{
|
||||
arraySelection->AddArray
|
||||
(
|
||||
(namesLst[elemI] + " - pointZone").c_str()
|
||||
);
|
||||
++rangePointZones_;
|
||||
}
|
||||
arrayRangePointZones_ += namesLst.size();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -577,24 +549,24 @@ void Foam::vtkPVFoam::updateInfoSets
|
||||
}
|
||||
|
||||
|
||||
arrayRangeCellSets_.reset(arraySelection->GetNumberOfArrays());
|
||||
arrayRangeCellSets_ += addToSelection<cellSet>
|
||||
rangeCellSets_.reset(arraySelection->GetNumberOfArrays());
|
||||
rangeCellSets_ += addToSelection<cellSet>
|
||||
(
|
||||
arraySelection,
|
||||
objects,
|
||||
" - cellSet"
|
||||
);
|
||||
|
||||
arrayRangeFaceSets_.reset(arraySelection->GetNumberOfArrays());
|
||||
arrayRangeFaceSets_ += addToSelection<faceSet>
|
||||
rangeFaceSets_.reset(arraySelection->GetNumberOfArrays());
|
||||
rangeFaceSets_ += addToSelection<faceSet>
|
||||
(
|
||||
arraySelection,
|
||||
objects,
|
||||
" - faceSet"
|
||||
);
|
||||
|
||||
arrayRangePointSets_.reset(arraySelection->GetNumberOfArrays());
|
||||
arrayRangePointSets_ += addToSelection<pointSet>
|
||||
rangePointSets_.reset(arraySelection->GetNumberOfArrays());
|
||||
rangePointSets_ += addToSelection<pointSet>
|
||||
(
|
||||
arraySelection,
|
||||
objects,
|
||||
@ -643,7 +615,7 @@ void Foam::vtkPVFoam::updateInfoLagrangianFields
|
||||
// have to decide if the second set of fields get mixed in
|
||||
// or dealt with separately
|
||||
|
||||
const arrayRange& range = arrayRangeLagrangian_;
|
||||
const arrayRange& range = rangeLagrangian_;
|
||||
if (range.empty())
|
||||
{
|
||||
return;
|
||||
|
||||
@ -106,7 +106,7 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
||||
|
||||
if (FileName)
|
||||
{
|
||||
delete [] FileName;
|
||||
delete[] FileName;
|
||||
}
|
||||
|
||||
BlockSelection->RemoveAllObservers();
|
||||
@ -263,12 +263,11 @@ void vtkPVblockMeshReader::updatePatchNamesView(const bool show)
|
||||
}
|
||||
|
||||
// Get all the pqRenderView instances
|
||||
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
||||
for (int viewI=0; viewI<renderViews.size(); ++viewI)
|
||||
for (auto view : smModel->findItems<pqRenderView*>())
|
||||
{
|
||||
backend_->renderPatchNames
|
||||
(
|
||||
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
||||
view->getRenderViewProxy()->GetRenderer(),
|
||||
show
|
||||
);
|
||||
}
|
||||
@ -295,12 +294,11 @@ void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
||||
}
|
||||
|
||||
// Get all the pqRenderView instances
|
||||
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
||||
for (int viewI=0; viewI<renderViews.size(); ++viewI)
|
||||
for (auto view : smModel->findItems<pqRenderView*>())
|
||||
{
|
||||
backend_->renderPointNumbers
|
||||
(
|
||||
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
||||
view->getRenderViewProxy()->GetRenderer(),
|
||||
show
|
||||
);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ namespace Foam
|
||||
|
||||
vtkTextActor* Foam::vtkPVblockMesh::createTextActor
|
||||
(
|
||||
const string& s,
|
||||
const std::string& s,
|
||||
const point& pt
|
||||
)
|
||||
{
|
||||
@ -81,9 +81,9 @@ vtkTextActor* Foam::vtkPVblockMesh::createTextActor
|
||||
void Foam::vtkPVblockMesh::resetCounters()
|
||||
{
|
||||
// Reset mesh part ids and sizes
|
||||
arrayRangeBlocks_.reset();
|
||||
arrayRangeEdges_.reset();
|
||||
arrayRangeCorners_.reset();
|
||||
rangeBlocks_.reset();
|
||||
rangeEdges_.reset();
|
||||
rangeCorners_.reset();
|
||||
}
|
||||
|
||||
|
||||
@ -92,15 +92,13 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
|
||||
vtkDataArraySelection* select
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeBlocks_;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "<beg> updateInfoBlocks"
|
||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||
}
|
||||
|
||||
range.reset(select->GetNumberOfArrays());
|
||||
rangeBlocks_.reset(select->GetNumberOfArrays());
|
||||
|
||||
const blockMesh& blkMesh = *meshPtr_;
|
||||
|
||||
@ -122,10 +120,9 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
|
||||
|
||||
// Add "blockId" or "blockId - zoneName" to GUI list
|
||||
select->AddArray(ostr.str().c_str());
|
||||
++rangeBlocks_;
|
||||
}
|
||||
|
||||
range += nBlocks;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "<end> updateInfoBlocks" << endl;
|
||||
@ -138,15 +135,13 @@ void Foam::vtkPVblockMesh::updateInfoEdges
|
||||
vtkDataArraySelection* select
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeEdges_;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "<beg> updateInfoEdges"
|
||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||
}
|
||||
|
||||
range.reset(select->GetNumberOfArrays());
|
||||
rangeEdges_.reset(select->GetNumberOfArrays());
|
||||
|
||||
const blockMesh& blkMesh = *meshPtr_;
|
||||
const blockEdgeList& edges = blkMesh.edges();
|
||||
@ -161,10 +156,9 @@ void Foam::vtkPVblockMesh::updateInfoEdges
|
||||
|
||||
// Add "beg:end - type" to GUI list
|
||||
select->AddArray(ostr.str().c_str());
|
||||
++rangeEdges_;
|
||||
}
|
||||
|
||||
range += edges.size();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "<end> updateInfoEdges" << endl;
|
||||
@ -185,9 +179,9 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
|
||||
meshPtr_(nullptr),
|
||||
meshRegion_(polyMesh::defaultRegion),
|
||||
meshDir_(polyMesh::meshSubDir),
|
||||
arrayRangeBlocks_("block"),
|
||||
arrayRangeEdges_("edges"),
|
||||
arrayRangeCorners_("corners")
|
||||
rangeBlocks_("block"),
|
||||
rangeEdges_("edges"),
|
||||
rangeCorners_("corners")
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -101,13 +101,13 @@ class vtkPVblockMesh
|
||||
|
||||
//- First instance and size of bleckMesh blocks
|
||||
// used to index into blockStatus_
|
||||
arrayRange arrayRangeBlocks_;
|
||||
arrayRange rangeBlocks_;
|
||||
|
||||
//- First instance and size of CurvedEdges (only partially used)
|
||||
arrayRange arrayRangeEdges_;
|
||||
arrayRange rangeEdges_;
|
||||
|
||||
//- First instance and size of block corners (only partially used)
|
||||
arrayRange arrayRangeCorners_;
|
||||
arrayRange rangeCorners_;
|
||||
|
||||
//- List of patch names for rendering to window
|
||||
List<vtkTextActor*> patchTextActorsPtrs_;
|
||||
@ -119,7 +119,11 @@ class vtkPVblockMesh
|
||||
// Private Member Functions
|
||||
|
||||
//- Create a text actor
|
||||
static vtkTextActor* createTextActor(const string& s, const point& pt);
|
||||
static vtkTextActor* createTextActor
|
||||
(
|
||||
const std::string& s,
|
||||
const point& pt
|
||||
);
|
||||
|
||||
//- Reset data counters
|
||||
void resetCounters();
|
||||
|
||||
@ -68,7 +68,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
|
||||
)
|
||||
{
|
||||
vtkDataArraySelection* selection = reader_->GetBlockSelection();
|
||||
arrayRange& range = arrayRangeBlocks_;
|
||||
arrayRange& range = rangeBlocks_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
|
||||
@ -85,11 +85,12 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
|
||||
|
||||
for
|
||||
(
|
||||
int partId = range.start();
|
||||
partId < range.end();
|
||||
++partId, ++blockI
|
||||
auto iter = range.cbegin();
|
||||
iter != range.cend();
|
||||
++iter, ++blockI
|
||||
)
|
||||
{
|
||||
const auto partId = *iter;
|
||||
if (!blockStatus_[partId])
|
||||
{
|
||||
continue;
|
||||
@ -135,7 +136,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
|
||||
);
|
||||
|
||||
vtkmesh->Delete();
|
||||
datasetNo++;
|
||||
++datasetNo;
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +160,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges
|
||||
)
|
||||
{
|
||||
vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
|
||||
arrayRange& range = arrayRangeEdges_;
|
||||
arrayRange& range = rangeEdges_;
|
||||
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
@ -172,11 +173,12 @@ void Foam::vtkPVblockMesh::convertMeshEdges
|
||||
|
||||
for
|
||||
(
|
||||
int partId = range.start();
|
||||
partId < range.end();
|
||||
++partId, ++edgeI
|
||||
auto iter = range.cbegin();
|
||||
iter != range.cend();
|
||||
++iter, ++edgeI
|
||||
)
|
||||
{
|
||||
const auto partId = *iter;
|
||||
if (!edgeStatus_[partId])
|
||||
{
|
||||
continue;
|
||||
@ -271,7 +273,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
|
||||
int& blockNo
|
||||
)
|
||||
{
|
||||
arrayRange& range = arrayRangeCorners_;
|
||||
arrayRange& range = rangeCorners_;
|
||||
range.block(blockNo); // set output block
|
||||
label datasetNo = 0; // restart at dataset 0
|
||||
|
||||
@ -315,12 +317,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
|
||||
addToBlock(output, vtkmesh, range, datasetNo, range.name());
|
||||
vtkmesh->Delete();
|
||||
|
||||
datasetNo++;
|
||||
}
|
||||
|
||||
// anything added?
|
||||
if (datasetNo)
|
||||
{
|
||||
++datasetNo;
|
||||
++blockNo;
|
||||
}
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@ Foam::hashedWordList Foam::foamPvCore::getSelected
|
||||
const int n = select->GetNumberOfArrays();
|
||||
DynamicList<word> selected(n);
|
||||
|
||||
for (int i = selector.start(); i < selector.end(); ++i)
|
||||
for (auto i : selector)
|
||||
{
|
||||
if (select->GetArraySetting(i))
|
||||
{
|
||||
@ -240,7 +240,7 @@ Foam::stringList Foam::foamPvCore::getSelectedArrayEntries
|
||||
stringList selections(selector.size());
|
||||
label nElem = 0;
|
||||
|
||||
for (int i = selector.start(); i < selector.end(); ++i)
|
||||
for (auto i : selector)
|
||||
{
|
||||
if (select->GetArraySetting(i))
|
||||
{
|
||||
@ -252,7 +252,7 @@ Foam::stringList Foam::foamPvCore::getSelectedArrayEntries
|
||||
if (debug > 1)
|
||||
{
|
||||
Info<< "available(";
|
||||
for (int i = selector.start(); i < selector.end(); ++i)
|
||||
for (auto i : selector)
|
||||
{
|
||||
Info<< " \"" << select->GetArrayName(i) << "\"";
|
||||
}
|
||||
@ -324,4 +324,5 @@ void Foam::foamPvCore::printMemory()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
#include "wordList.H"
|
||||
#include "Hash.H"
|
||||
#include "hashedWordList.H"
|
||||
#include "labelRange.H"
|
||||
|
||||
#include "vtkPoints.h"
|
||||
|
||||
@ -69,21 +70,20 @@ public:
|
||||
//- Bookkeeping for GUI checklists and multi-block organization
|
||||
// Works like a SubList selection.
|
||||
class arrayRange
|
||||
:
|
||||
public labelRange
|
||||
{
|
||||
const char *name_;
|
||||
int block_;
|
||||
int start_;
|
||||
int size_;
|
||||
|
||||
public:
|
||||
|
||||
//- Construct with given name for the specified block
|
||||
arrayRange(const char *name, const int blockNo=0)
|
||||
arrayRange(const char *name, int blockNo=0)
|
||||
:
|
||||
labelRange(),
|
||||
name_(name),
|
||||
block_(blockNo),
|
||||
start_(0),
|
||||
size_(0)
|
||||
block_(blockNo)
|
||||
{}
|
||||
|
||||
//- Return the block holding these datasets
|
||||
@ -106,47 +106,21 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- The array start index
|
||||
int start() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
//- The array end index
|
||||
int end() const
|
||||
{
|
||||
return start_ + size_;
|
||||
}
|
||||
|
||||
//- The sub-list size
|
||||
int size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
//- True if the sub-list is empty
|
||||
bool empty() const
|
||||
{
|
||||
return !size_;
|
||||
}
|
||||
//- Reset the start/size directly
|
||||
using labelRange::reset;
|
||||
|
||||
//- Reset the size to zero and optionally assign a new start
|
||||
void reset(const int startAt = 0)
|
||||
void reset(label startAt = 0)
|
||||
{
|
||||
start_ = startAt;
|
||||
size_ = 0;
|
||||
clear();
|
||||
setStart(startAt);
|
||||
}
|
||||
|
||||
//- Assign new start and reset the size
|
||||
void operator=(const int i)
|
||||
{
|
||||
reset(i);
|
||||
}
|
||||
|
||||
//- Increment the size
|
||||
void operator+=(const int n)
|
||||
void operator+=(label n)
|
||||
{
|
||||
size_ += n;
|
||||
setSize(size() + n);
|
||||
}
|
||||
|
||||
}; // End class arrayRange
|
||||
@ -206,7 +180,7 @@ public:
|
||||
(
|
||||
vtkDataArraySelection* select,
|
||||
const IOobjectList& objects,
|
||||
const string& suffix = string::null
|
||||
const std::string& suffix = string::null
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ Foam::label Foam::foamPvCore::addToSelection
|
||||
(
|
||||
vtkDataArraySelection *select,
|
||||
const IOobjectList& objects,
|
||||
const string& suffix
|
||||
const std::string& suffix
|
||||
)
|
||||
{
|
||||
const wordList names = objects.sortedNames(Type::typeName);
|
||||
|
||||
Reference in New Issue
Block a user