Commit 23444fb9 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: more consistency for down-casting

parent 024d158c
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -80,8 +80,7 @@ static QAbstractButton* setButtonProperties
setWidgetProperties(b, prop);
b->setText(prop->GetXMLLabel());
vtkSMIntVectorProperty* intProp =
vtkSMIntVectorProperty::SafeDownCast(prop);
auto* intProp = vtkSMIntVectorProperty::SafeDownCast(prop);
// Initial checked state for integer (bool) properties
if (intProp)
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -184,7 +184,7 @@ int vtkPVblockMeshReader::RequestData
outputVector->GetInformationObject(0)->Print(cout);
}
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
auto* output = vtkMultiBlockDataSet::SafeDownCast
(
outputVector->GetInformationObject(0)->Get
(
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -96,9 +96,7 @@ queryFieldSummary
if (dataset)
{
vtkDataArray* array;
array = vtkDataArray::SafeDownCast
auto* array = vtkDataArray::SafeDownCast
(
dataset->GetCellData()->GetAbstractArray(fieldName.c_str())
);
......@@ -150,7 +148,7 @@ queryFieldSummary
iter->GoToNextItem()
)
{
vtkDataSet* dataset = vtkDataSet::SafeDownCast
auto* dataset = vtkDataSet::SafeDownCast
(
iter->GetCurrentDataObject()
);
......@@ -222,7 +220,7 @@ queryFieldAssociation
iter->GoToNextItem()
)
{
vtkDataSet* dataset = vtkDataSet::SafeDownCast
auto* dataset = vtkDataSet::SafeDownCast
(
iter->GetCurrentDataObject()
);
......@@ -245,7 +243,7 @@ void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::addMagField
return;
}
vtkDataArray* input = vtkDataArray::SafeDownCast
auto* input = vtkDataArray::SafeDownCast
(
fieldData->GetAbstractArray(fieldName.c_str())
);
......@@ -257,7 +255,7 @@ void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::addMagField
const word magFieldName = "mag(" + fieldName + ")";
vtkDataArray* output = vtkDataArray::SafeDownCast
auto* output = vtkDataArray::SafeDownCast
(
fieldData->GetAbstractArray(magFieldName.c_str())
);
......@@ -348,7 +346,7 @@ void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::addMagField
iter->GoToNextItem()
)
{
vtkDataSet* dataset = vtkDataSet::SafeDownCast
auto* dataset = vtkDataSet::SafeDownCast
(
iter->GetCurrentDataObject()
);
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -79,8 +79,7 @@ void Foam::functionObjects::runTimePostPro::pathline::addLines
vector colour = lineColour_->value(framei);
actor->GetProperty()->SetColor(colour[0], colour[1], colour[2]);
vtkPolyDataMapper* mapper =
vtkPolyDataMapper::SafeDownCast(actor->GetMapper());
auto* mapper = vtkPolyDataMapper::SafeDownCast(actor->GetMapper());
switch (representation_)
{
......
......@@ -35,6 +35,7 @@ License
#include "vtkCaptionActor2D.h"
#include "vtkCubeSource.h"
#include "vtkLightKit.h"
#include "vtkNew.h"
#include "vtkPNGWriter.h"
#include "vtkPolyDataMapper.h"
#include "vtkProperty.h"
......@@ -161,7 +162,7 @@ void Foam::functionObjects::runTimePostPro::scene::setActorVisibility
vtkActorCollection *actors = renderer->GetActors();
for (int i = 0; i < actors->GetNumberOfItems(); ++i)
{
vtkActor *actor = vtkActor::SafeDownCast(actors->GetItemAsObject(i));
auto* actor = vtkActor::SafeDownCast(actors->GetItemAsObject(i));
actor->SetVisibility(visible);
}
}
......@@ -484,7 +485,7 @@ void Foam::functionObjects::runTimePostPro::scene::saveImage
renderWindow->Render();
// Set up off-screen rendering
auto windowToImageFilter = vtkSmartPointer<vtkWindowToImageFilter>::New();
vtkNew<vtkWindowToImageFilter> windowToImageFilter;
windowToImageFilter->SetInput(renderWindow);
......@@ -501,16 +502,14 @@ void Foam::functionObjects::runTimePostPro::scene::saveImage
{
mkDir(fName.path());
auto writer = vtkSmartPointer<vtkPNGWriter>::New();
vtkNew<vtkPNGWriter> writer;
writer->SetFileName(fName.c_str());
writer->SetInputConnection(windowToImageFilter->GetOutputPort());
Info<< " Generating image: " << runTime.relativePath(fName) << endl;
writer->Write();
}
}
// ************************************************************************* //
......@@ -52,6 +52,7 @@ SourceFiles
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Forward Declarations
class vtkDataSet;
class vtkMultiPieceDataSet;
template<class T> class vtkSmartPointer;
......
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