mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: reduce number of small methods in paraview reader
- improves the overview of the code
This commit is contained in:
@ -47,7 +47,7 @@ License
|
|||||||
// STL includes
|
// STL includes
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#undef EXPERIMENTAL_TIME_CACHING
|
#undef VTKPVFOAM_DUALPORT
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -62,10 +62,8 @@ vtkPVFoamReader::vtkPVFoamReader()
|
|||||||
vtkDebugMacro(<<"Constructor");
|
vtkDebugMacro(<<"Constructor");
|
||||||
|
|
||||||
SetNumberOfInputPorts(0);
|
SetNumberOfInputPorts(0);
|
||||||
|
|
||||||
FileName = nullptr;
|
FileName = nullptr;
|
||||||
backend_ = nullptr;
|
backend_ = nullptr;
|
||||||
output0_ = nullptr;
|
|
||||||
|
|
||||||
#ifdef VTKPVFOAM_DUALPORT
|
#ifdef VTKPVFOAM_DUALPORT
|
||||||
// Add second output for the Lagrangian
|
// Add second output for the Lagrangian
|
||||||
@ -84,7 +82,7 @@ vtkPVFoamReader::vtkPVFoamReader()
|
|||||||
|
|
||||||
CacheMesh = true;
|
CacheMesh = true;
|
||||||
|
|
||||||
SkipZeroTime = false;
|
SkipZeroTime = true;
|
||||||
ExtrapolatePatches = false;
|
ExtrapolatePatches = false;
|
||||||
UseVTKPolyhedron = false;
|
UseVTKPolyhedron = false;
|
||||||
IncludeSets = false;
|
IncludeSets = false;
|
||||||
@ -152,12 +150,6 @@ vtkPVFoamReader::~vtkPVFoamReader()
|
|||||||
delete[] FileName;
|
delete[] FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output0_)
|
|
||||||
{
|
|
||||||
output0_->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PartSelection->RemoveAllObservers();
|
PartSelection->RemoveAllObservers();
|
||||||
VolFieldSelection->RemoveAllObservers();
|
VolFieldSelection->RemoveAllObservers();
|
||||||
PointFieldSelection->RemoveAllObservers();
|
PointFieldSelection->RemoveAllObservers();
|
||||||
@ -258,7 +250,7 @@ int vtkPVFoamReader::RequestInformation
|
|||||||
<<"time-range " << times.front() << ':' << times.back() << "\n"
|
<<"time-range " << times.front() << ':' << times.back() << "\n"
|
||||||
<<"times " << times.size() << "(";
|
<<"times " << times.size() << "(";
|
||||||
|
|
||||||
for (const double& val : times)
|
for (auto val : times)
|
||||||
{
|
{
|
||||||
cout<< ' ' << val;
|
cout<< ' ' << val;
|
||||||
}
|
}
|
||||||
@ -294,12 +286,12 @@ int vtkPVFoamReader::RequestData
|
|||||||
|
|
||||||
if (!FileName)
|
if (!FileName)
|
||||||
{
|
{
|
||||||
vtkErrorMacro("FileName has to be specified!");
|
vtkErrorMacro("FileName must be specified!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!backend_)
|
if (!backend_)
|
||||||
{
|
{
|
||||||
// catch some previous error
|
// Catch some previous error
|
||||||
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -365,76 +357,23 @@ int vtkPVFoamReader::RequestData
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Foam::vtkPVFoam::debug)
|
|
||||||
{
|
|
||||||
cout<< "update output with "
|
|
||||||
<< output->GetNumberOfBlocks() << " blocks\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_TIME_CACHING
|
|
||||||
bool needsUpdate = false;
|
|
||||||
|
|
||||||
if (!output0_)
|
|
||||||
{
|
|
||||||
output0_ = vtkMultiBlockDataSet::New();
|
|
||||||
needsUpdate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This experimental bit of code seems to work for the geometry,
|
|
||||||
// but trashes the fields and still triggers the GeometryFilter
|
|
||||||
if (needsUpdate)
|
|
||||||
{
|
|
||||||
backend_->Update(output);
|
|
||||||
output0_->ShallowCopy(output);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
output->ShallowCopy(output0_);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Foam::vtkPVFoam::debug)
|
|
||||||
{
|
|
||||||
if (needsUpdate)
|
|
||||||
{
|
|
||||||
cout<< "full UPDATE ---------\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<< "cached UPDATE ---------\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
cout<< "UPDATED output: ";
|
|
||||||
output->Print(cout);
|
|
||||||
|
|
||||||
cout<< "UPDATED output0_: ";
|
|
||||||
output0_->Print(cout);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifdef VTKPVFOAM_DUALPORT
|
#ifdef VTKPVFOAM_DUALPORT
|
||||||
backend_->Update
|
vtkMultiBlockDataSet* output1 = vtkMultiBlockDataSet::SafeDownCast
|
||||||
(
|
(
|
||||||
output,
|
outputVector->GetInformationObject(1)->Get
|
||||||
vtkMultiBlockDataSet::SafeDownCast
|
|
||||||
(
|
(
|
||||||
outputVector->GetInformationObject(1)->Get
|
vtkMultiBlockDataSet::DATA_OBJECT()
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet::DATA_OBJECT()
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
backend_->Update(output, output1);
|
||||||
#else
|
#else
|
||||||
backend_->Update(output, output);
|
backend_->Update(output, nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
updatePatchNamesView(ShowPatchNames);
|
updatePatchNamesView(ShowPatchNames);
|
||||||
|
|
||||||
#endif
|
backend_->UpdateFinalize();
|
||||||
|
|
||||||
// Do any cleanup on the OpenFOAM side
|
|
||||||
backend_->CleanUp();
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -251,9 +251,6 @@ private:
|
|||||||
vtkDataArraySelection* PointFieldSelection;
|
vtkDataArraySelection* PointFieldSelection;
|
||||||
vtkDataArraySelection* LagrangianFieldSelection;
|
vtkDataArraySelection* LagrangianFieldSelection;
|
||||||
|
|
||||||
//- Cached data for output port0 (experimental!)
|
|
||||||
vtkMultiBlockDataSet* output0_;
|
|
||||||
|
|
||||||
//- Backend portion of the reader
|
//- Backend portion of the reader
|
||||||
Foam::vtkPVFoam* backend_;
|
Foam::vtkPVFoam* backend_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -39,6 +39,9 @@ License
|
|||||||
#include "vtkTextProperty.h"
|
#include "vtkTextProperty.h"
|
||||||
#include "vtkSmartPointer.h"
|
#include "vtkSmartPointer.h"
|
||||||
|
|
||||||
|
// Templates (only needed here)
|
||||||
|
#include "vtkPVFoamUpdateTemplates.C"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -100,31 +103,6 @@ void Foam::vtkPVFoam::resetCounters()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::reduceMemory()
|
|
||||||
{
|
|
||||||
forAll(regionVtus_, i)
|
|
||||||
{
|
|
||||||
regionVtus_[i].clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(zoneVtus_, i)
|
|
||||||
{
|
|
||||||
zoneVtus_[i].clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(csetVtus_, i)
|
|
||||||
{
|
|
||||||
csetVtus_[i].clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reader_->GetCacheMesh())
|
|
||||||
{
|
|
||||||
delete meshPtr_;
|
|
||||||
meshPtr_ = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
|
int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
|
||||||
{
|
{
|
||||||
Time& runTime = dbPtr_();
|
Time& runTime = dbPtr_();
|
||||||
@ -201,52 +179,6 @@ int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::updateMeshPartsStatus()
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> updateMeshPartsStatus" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkDataArraySelection* selection = reader_->GetPartSelection();
|
|
||||||
label nElem = selection->GetNumberOfArrays();
|
|
||||||
|
|
||||||
if (partStatus_.size() != nElem)
|
|
||||||
{
|
|
||||||
partStatus_.setSize(nElem);
|
|
||||||
partStatus_ = false;
|
|
||||||
meshChanged_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this needs fixing if we wish to re-use the datasets
|
|
||||||
partDataset_.setSize(nElem);
|
|
||||||
partDataset_ = -1;
|
|
||||||
|
|
||||||
// Read the selected mesh parts (zones, patches ...) and add to list
|
|
||||||
forAll(partStatus_, partId)
|
|
||||||
{
|
|
||||||
const int setting = selection->GetArraySetting(partId);
|
|
||||||
|
|
||||||
if (partStatus_[partId] != setting)
|
|
||||||
{
|
|
||||||
partStatus_[partId] = setting;
|
|
||||||
meshChanged_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug > 1)
|
|
||||||
{
|
|
||||||
Info<< " part[" << partId << "] = "
|
|
||||||
<< partStatus_[partId]
|
|
||||||
<< " : " << selection->GetArrayName(partId) << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> updateMeshPartsStatus" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::vtkPVFoam::getPartName(const int partId)
|
Foam::word Foam::vtkPVFoam::getPartName(const int partId)
|
||||||
{
|
{
|
||||||
return getFoamName(reader_->GetPartArrayName(partId));
|
return getFoamName(reader_->GetPartArrayName(partId));
|
||||||
@ -270,7 +202,7 @@ Foam::vtkPVFoam::vtkPVFoam
|
|||||||
meshChanged_(true),
|
meshChanged_(true),
|
||||||
fieldsChanged_(true),
|
fieldsChanged_(true),
|
||||||
rangeVolume_("unzoned"),
|
rangeVolume_("unzoned"),
|
||||||
rangePatches_("patches"),
|
rangePatches_("patch"),
|
||||||
rangeLagrangian_("lagrangian"),
|
rangeLagrangian_("lagrangian"),
|
||||||
rangeCellZones_("cellZone"),
|
rangeCellZones_("cellZone"),
|
||||||
rangeFaceZones_("faceZone"),
|
rangeFaceZones_("faceZone"),
|
||||||
@ -433,7 +365,18 @@ void Foam::vtkPVFoam::updateInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update volume, point and lagrangian fields
|
// Update volume, point and lagrangian fields
|
||||||
updateInfoFields();
|
updateInfoFields<fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
reader_->GetVolFieldSelection()
|
||||||
|
);
|
||||||
|
updateInfoFields<pointPatchField, pointMesh>
|
||||||
|
(
|
||||||
|
reader_->GetPointFieldSelection()
|
||||||
|
);
|
||||||
|
updateInfoLagrangianFields
|
||||||
|
(
|
||||||
|
reader_->GetLagrangianFieldSelection()
|
||||||
|
);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -442,84 +385,121 @@ void Foam::vtkPVFoam::updateInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::updateFoamMesh()
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> updateFoamMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reader_->GetCacheMesh())
|
|
||||||
{
|
|
||||||
delete meshPtr_;
|
|
||||||
meshPtr_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check to see if the OpenFOAM mesh has been created
|
|
||||||
if (!meshPtr_)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating OpenFOAM mesh for region " << meshRegion_
|
|
||||||
<< " at time=" << dbPtr_().timeName()
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
meshPtr_ = new fvMesh
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
meshRegion_,
|
|
||||||
dbPtr_().timeName(),
|
|
||||||
dbPtr_(),
|
|
||||||
IOobject::MUST_READ
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
meshChanged_ = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Using existing OpenFOAM mesh" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> updateFoamMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::Update
|
void Foam::vtkPVFoam::Update
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
vtkMultiBlockDataSet* lagrangianOutput
|
vtkMultiBlockDataSet* outputLagrangian
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
cout<< "<beg> Foam::vtkPVFoam::Update - output with "
|
cout<< "<beg> Foam::vtkPVFoam::Update\n";
|
||||||
<< output->GetNumberOfBlocks() << " and "
|
|
||||||
<< lagrangianOutput->GetNumberOfBlocks() << " blocks\n";
|
|
||||||
output->Print(cout);
|
output->Print(cout);
|
||||||
lagrangianOutput->Print(cout);
|
if (outputLagrangian) outputLagrangian->Print(cout);
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
reader_->UpdateProgress(0.1);
|
reader_->UpdateProgress(0.1);
|
||||||
|
|
||||||
// Set up mesh parts selection(s)
|
// Set up mesh parts selection(s)
|
||||||
updateMeshPartsStatus();
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> updateMeshPartsStatus" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkDataArraySelection* selection = reader_->GetPartSelection();
|
||||||
|
label nElem = selection->GetNumberOfArrays();
|
||||||
|
|
||||||
|
if (partStatus_.size() != nElem)
|
||||||
|
{
|
||||||
|
partStatus_.setSize(nElem);
|
||||||
|
partStatus_ = false;
|
||||||
|
meshChanged_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this needs fixing if we wish to re-use the datasets
|
||||||
|
partDataset_.setSize(nElem);
|
||||||
|
partDataset_ = -1;
|
||||||
|
|
||||||
|
// Read the selected mesh parts (zones, patches ...) and add to list
|
||||||
|
forAll(partStatus_, partId)
|
||||||
|
{
|
||||||
|
const int setting = selection->GetArraySetting(partId);
|
||||||
|
|
||||||
|
if (partStatus_[partId] != setting)
|
||||||
|
{
|
||||||
|
partStatus_[partId] = setting;
|
||||||
|
meshChanged_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug > 1)
|
||||||
|
{
|
||||||
|
Info<< " part[" << partId << "] = "
|
||||||
|
<< partStatus_[partId]
|
||||||
|
<< " : " << selection->GetArrayName(partId) << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> updateMeshPartsStatus" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reader_->UpdateProgress(0.15);
|
reader_->UpdateProgress(0.15);
|
||||||
|
|
||||||
// Update the OpenFOAM mesh
|
// Update the OpenFOAM mesh
|
||||||
updateFoamMesh();
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> updateFoamMesh" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!reader_->GetCacheMesh())
|
||||||
|
{
|
||||||
|
delete meshPtr_;
|
||||||
|
meshPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check to see if the OpenFOAM mesh has been created
|
||||||
|
if (!meshPtr_)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Creating OpenFOAM mesh for region " << meshRegion_
|
||||||
|
<< " at time=" << dbPtr_().timeName()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
meshPtr_ = new fvMesh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
meshRegion_,
|
||||||
|
dbPtr_().timeName(),
|
||||||
|
dbPtr_(),
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
meshChanged_ = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Using existing OpenFOAM mesh" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> updateFoamMesh" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reader_->UpdateProgress(0.4);
|
reader_->UpdateProgress(0.4);
|
||||||
|
|
||||||
// Convert meshes - start port0 at block=0
|
// Convert meshes - start port0 at block=0
|
||||||
@ -545,18 +525,24 @@ void Foam::vtkPVFoam::Update
|
|||||||
reader_->UpdateProgress(0.7);
|
reader_->UpdateProgress(0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VTKPVFOAM_DUALPORT
|
if (outputLagrangian)
|
||||||
// restart port1 at block=0
|
{
|
||||||
blockNo = 0;
|
// Lagrangian dual port - restart port1 at block=0
|
||||||
#endif
|
blockNo = 0;
|
||||||
convertMeshLagrangian(lagrangianOutput, blockNo);
|
convertMeshLagrangian(outputLagrangian, blockNo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
convertMeshLagrangian(output, blockNo);
|
||||||
|
}
|
||||||
|
|
||||||
reader_->UpdateProgress(0.8);
|
reader_->UpdateProgress(0.8);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
convertVolFields(output);
|
convertVolFields(output);
|
||||||
convertPointFields(output);
|
convertPointFields(output);
|
||||||
convertLagrangianFields(lagrangianOutput);
|
convertLagrangianFields(outputLagrangian ? outputLagrangian : output);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "done reader part" << nl << endl;
|
Info<< "done reader part" << nl << endl;
|
||||||
@ -564,13 +550,31 @@ void Foam::vtkPVFoam::Update
|
|||||||
reader_->UpdateProgress(0.95);
|
reader_->UpdateProgress(0.95);
|
||||||
|
|
||||||
meshChanged_ = fieldsChanged_ = false;
|
meshChanged_ = fieldsChanged_ = false;
|
||||||
|
|
||||||
|
// Standard memory cleanup
|
||||||
|
forAll(regionVtus_, i)
|
||||||
|
{
|
||||||
|
regionVtus_[i].clear();
|
||||||
|
}
|
||||||
|
forAll(zoneVtus_, i)
|
||||||
|
{
|
||||||
|
zoneVtus_[i].clear();
|
||||||
|
}
|
||||||
|
forAll(csetVtus_, i)
|
||||||
|
{
|
||||||
|
csetVtus_[i].clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::CleanUp()
|
void Foam::vtkPVFoam::UpdateFinalize()
|
||||||
{
|
{
|
||||||
// reclaim some memory
|
if (!reader_->GetCacheMesh())
|
||||||
reduceMemory();
|
{
|
||||||
|
delete meshPtr_;
|
||||||
|
meshPtr_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
reader_->UpdateProgress(1.0);
|
reader_->UpdateProgress(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,6 @@ SourceFiles
|
|||||||
#include "volPointInterpolation.H"
|
#include "volPointInterpolation.H"
|
||||||
#include "foamPvCore.H"
|
#include "foamPvCore.H"
|
||||||
|
|
||||||
#undef VTKPVFOAM_DUALPORT
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
||||||
|
|
||||||
class vtkDataArraySelection;
|
class vtkDataArraySelection;
|
||||||
@ -231,9 +229,6 @@ class vtkPVFoam
|
|||||||
|
|
||||||
// Update information helper functions
|
// Update information helper functions
|
||||||
|
|
||||||
//- Update the mesh parts selected in the GUI
|
|
||||||
void updateMeshPartsStatus();
|
|
||||||
|
|
||||||
//- Internal mesh info
|
//- Internal mesh info
|
||||||
void updateInfoInternalMesh(vtkDataArraySelection*);
|
void updateInfoInternalMesh(vtkDataArraySelection*);
|
||||||
|
|
||||||
@ -259,9 +254,6 @@ class vtkPVFoam
|
|||||||
const ZoneMesh<ZoneType, polyMesh>& zmesh
|
const ZoneMesh<ZoneType, polyMesh>& zmesh
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Field (volume, point, lagrangian) info
|
|
||||||
void updateInfoFields();
|
|
||||||
|
|
||||||
//- Field info
|
//- Field info
|
||||||
template<template<class> class patchType, class meshType>
|
template<template<class> class patchType, class meshType>
|
||||||
void updateInfoFields
|
void updateInfoFields
|
||||||
@ -273,15 +265,6 @@ class vtkPVFoam
|
|||||||
void updateInfoLagrangianFields(vtkDataArraySelection* select);
|
void updateInfoLagrangianFields(vtkDataArraySelection* select);
|
||||||
|
|
||||||
|
|
||||||
// Update helper functions
|
|
||||||
|
|
||||||
//- OpenFOAM mesh
|
|
||||||
void updateFoamMesh();
|
|
||||||
|
|
||||||
//- Reduce memory footprint after conversion
|
|
||||||
void reduceMemory();
|
|
||||||
|
|
||||||
|
|
||||||
// Mesh conversion functions
|
// Mesh conversion functions
|
||||||
|
|
||||||
//- Convert volume mesh
|
//- Convert volume mesh
|
||||||
@ -506,19 +489,19 @@ public:
|
|||||||
void Update
|
void Update
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
vtkMultiBlockDataSet* lagrangianOutput
|
vtkMultiBlockDataSet* outputLagrangian
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Clean any storage
|
//- Final part of Update(), after any last minute rendering.
|
||||||
void CleanUp();
|
void UpdateFinalize();
|
||||||
|
|
||||||
|
//- Add/remove patch names to/from the view
|
||||||
|
void renderPatchNames(vtkRenderer* renderer, const bool show);
|
||||||
|
|
||||||
//- Return a list of selected times.
|
//- Return a list of selected times.
|
||||||
// Use STL container since these values are used by the plugin
|
// Use STL container since these values are used by the plugin
|
||||||
std::vector<double> findTimes(const bool skipZero = false) const;
|
std::vector<double> findTimes(const bool skipZero = false) const;
|
||||||
|
|
||||||
//- Add/remove patch names to/from the view
|
|
||||||
void renderPatchNames(vtkRenderer*, const bool show);
|
|
||||||
|
|
||||||
//- Set the runTime to the first plausible request time,
|
//- Set the runTime to the first plausible request time,
|
||||||
// returns the timeIndex
|
// returns the timeIndex
|
||||||
// sets to "constant" on error
|
// sets to "constant" on error
|
||||||
|
|||||||
@ -39,10 +39,6 @@ License
|
|||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
|
|
||||||
// Templates (only needed here)
|
|
||||||
#include "vtkPVFoamUpdateTemplates.C"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Private Classes * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Private Classes * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -580,23 +576,6 @@ void Foam::vtkPVFoam::updateInfoSets
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::updateInfoFields()
|
|
||||||
{
|
|
||||||
updateInfoFields<fvPatchField, volMesh>
|
|
||||||
(
|
|
||||||
reader_->GetVolFieldSelection()
|
|
||||||
);
|
|
||||||
updateInfoFields<pointPatchField, pointMesh>
|
|
||||||
(
|
|
||||||
reader_->GetPointFieldSelection()
|
|
||||||
);
|
|
||||||
updateInfoLagrangianFields
|
|
||||||
(
|
|
||||||
reader_->GetLagrangianFieldSelection()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::updateInfoLagrangianFields
|
void Foam::vtkPVFoam::updateInfoLagrangianFields
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select
|
vtkDataArraySelection* select
|
||||||
|
|||||||
@ -165,20 +165,19 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
|
|
||||||
if (!FileName)
|
if (!FileName)
|
||||||
{
|
{
|
||||||
vtkErrorMacro("FileName has to be specified!");
|
vtkErrorMacro("FileName must be specified!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Catch previous error
|
|
||||||
if (!backend_)
|
if (!backend_)
|
||||||
{
|
{
|
||||||
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
// Catch some previous error
|
||||||
|
vtkErrorMacro("Reader failed - perhaps no blockMesh?");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Foam::vtkPVblockMesh::debug)
|
if (Foam::vtkPVblockMesh::debug)
|
||||||
{
|
{
|
||||||
cout<<"REQUEST_DATA:\n";
|
cout<<"RequestData:\n";
|
||||||
outputVector->GetInformationObject(0)->Print(cout);
|
outputVector->GetInformationObject(0)->Print(cout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,19 +189,12 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Foam::vtkPVblockMesh::debug)
|
|
||||||
{
|
|
||||||
cout<< "update output with "
|
|
||||||
<< output->GetNumberOfBlocks() << " blocks\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
backend_->Update(output);
|
backend_->Update(output);
|
||||||
|
|
||||||
updatePatchNamesView(ShowPatchNames);
|
updatePatchNamesView(ShowPatchNames);
|
||||||
updatePointNumbersView(ShowPointNumbers);
|
updatePointNumbersView(ShowPointNumbers);
|
||||||
|
|
||||||
// Do any cleanup on the OpenFOAM side
|
backend_->UpdateFinalize();
|
||||||
backend_->CleanUp();
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -430,7 +430,7 @@ void Foam::vtkPVblockMesh::Update
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::CleanUp()
|
void Foam::vtkPVblockMesh::UpdateFinalize()
|
||||||
{
|
{
|
||||||
reader_->UpdateProgress(1.0);
|
reader_->UpdateProgress(1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -177,14 +177,15 @@ public:
|
|||||||
|
|
||||||
void Update(vtkMultiBlockDataSet* output);
|
void Update(vtkMultiBlockDataSet* output);
|
||||||
|
|
||||||
//- Clean any storage
|
//- Final part of Update(), after any last minute rendering.
|
||||||
void CleanUp();
|
void UpdateFinalize();
|
||||||
|
|
||||||
//- Add/remove patch names to/from the view
|
//- Add/remove patch names to/from the view
|
||||||
void renderPatchNames(vtkRenderer*, const bool show);
|
void renderPatchNames(vtkRenderer* renderer, const bool show);
|
||||||
|
|
||||||
//- Add/remove point numbers to/from the view
|
//- Add/remove point numbers to/from the view
|
||||||
void renderPointNumbers(vtkRenderer*, const bool show);
|
void renderPointNumbers(vtkRenderer* renderer, const bool show);
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user