mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
PV3FoamReader reorganization
- vtkPV3Foam get PrintSelf (reduces number of methods)
- move output data member from vtkPV3Foam -> PV3FoamReader
in preparation for rewriting output method
- roughed in code to track mesh/field changes in preparation for rewriting
output method
- progress bar with arbitrary values to give the user something to watch
This commit is contained in:
@ -47,6 +47,8 @@ vtkPV3FoamReader::vtkPV3FoamReader()
|
|||||||
FileName = NULL;
|
FileName = NULL;
|
||||||
foamData_ = NULL;
|
foamData_ = NULL;
|
||||||
|
|
||||||
|
output1_ = NULL;
|
||||||
|
|
||||||
TimeStep = 0;
|
TimeStep = 0;
|
||||||
TimeStepRange[0] = 0;
|
TimeStepRange[0] = 0;
|
||||||
TimeStepRange[1] = 0;
|
TimeStepRange[1] = 0;
|
||||||
@ -61,7 +63,6 @@ vtkPV3FoamReader::vtkPV3FoamReader()
|
|||||||
UpdateGUI = 1;
|
UpdateGUI = 1;
|
||||||
UpdateGUIOld = 1;
|
UpdateGUIOld = 1;
|
||||||
|
|
||||||
|
|
||||||
RegionSelection = vtkDataArraySelection::New();
|
RegionSelection = vtkDataArraySelection::New();
|
||||||
VolFieldSelection = vtkDataArraySelection::New();
|
VolFieldSelection = vtkDataArraySelection::New();
|
||||||
PointFieldSelection = vtkDataArraySelection::New();
|
PointFieldSelection = vtkDataArraySelection::New();
|
||||||
@ -148,38 +149,6 @@ int vtkPV3FoamReader::RequestInformation
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Foam::vtkPV3Foam::debug)
|
|
||||||
{
|
|
||||||
vtkInformation* outputInfo = this->GetOutputPortInformation(0);
|
|
||||||
|
|
||||||
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
|
||||||
(
|
|
||||||
outputInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
|
|
||||||
);
|
|
||||||
|
|
||||||
outputInfo->Print(cout);
|
|
||||||
if (output)
|
|
||||||
{
|
|
||||||
output->Print(cout);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<< "no output\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
this->GetExecutive()->GetOutputInformation(0)->Print(cout);
|
|
||||||
|
|
||||||
int nInfo = outputVector->GetNumberOfInformationObjects();
|
|
||||||
|
|
||||||
cout<< "requestInfo with " << nInfo << " items:\n";
|
|
||||||
|
|
||||||
for (int i = 0; i < nInfo; ++i)
|
|
||||||
{
|
|
||||||
vtkInformation *info = outputVector->GetInformationObject(i);
|
|
||||||
info->Print(cout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
||||||
|
|
||||||
if (!foamData_)
|
if (!foamData_)
|
||||||
@ -189,17 +158,22 @@ int vtkPV3FoamReader::RequestInformation
|
|||||||
(
|
(
|
||||||
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
|
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
|
||||||
);
|
);
|
||||||
foamData_ = new Foam::vtkPV3Foam(FileName, this, output);
|
|
||||||
foamData_->UpdateInformation();
|
if (Foam::vtkPV3Foam::debug)
|
||||||
|
{
|
||||||
|
cout<< "constructed vtkPV3Foam with output: ";
|
||||||
|
output->Print(cout);
|
||||||
|
}
|
||||||
|
|
||||||
|
foamData_ = new Foam::vtkPV3Foam(FileName, this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vtkDebugMacro("RequestInformation: updating information");
|
|
||||||
foamData_->UpdateInformation();
|
foamData_->UpdateInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
int nTimeSteps = 0;
|
int nTimeSteps = 0;
|
||||||
double* timeSteps = foamData_->timeSteps(nTimeSteps);
|
double* timeSteps = foamData_->findTimes(nTimeSteps);
|
||||||
|
|
||||||
outInfo->Set
|
outInfo->Set
|
||||||
(
|
(
|
||||||
@ -402,27 +376,20 @@ void vtkPV3FoamReader::removePatchNamesFromView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPV3FoamReader::PrintSelf
|
void vtkPV3FoamReader::PrintSelf(ostream& os, vtkIndent indent)
|
||||||
(
|
|
||||||
ostream& os,
|
|
||||||
vtkIndent indent
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"PrintSelf");
|
vtkDebugMacro(<<"PrintSelf");
|
||||||
|
|
||||||
this->Superclass::PrintSelf(os,indent);
|
this->Superclass::PrintSelf(os,indent);
|
||||||
os<< indent << "File name: "
|
os<< indent << "File name: "
|
||||||
<< (this->FileName ? this->FileName : "(none)") << "\n";
|
<< (this->FileName ? this->FileName : "(none)") << "\n";
|
||||||
os<< indent << "Number of meshes: " << foamData_->numberOfMeshes() << "\n";
|
|
||||||
os<< indent << "Number of nodes: " << foamData_->numberOfPoints() << "\n";
|
foamData_->PrintSelf(os, indent);
|
||||||
os<< indent << "Number of cells: " << foamData_->numberOfCells() << "\n";
|
|
||||||
os<< indent << "Number of available time steps: " << foamData_->numberOfAvailableTimes()
|
|
||||||
<< endl;
|
|
||||||
os<< indent << "Time step range: "
|
os<< indent << "Time step range: "
|
||||||
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1]
|
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1]
|
||||||
<< endl;
|
<< "\n";
|
||||||
os<< indent << "Time step: " << this->TimeStep << endl;
|
os<< indent << "Time step: " << this->TimeStep << endl;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -478,7 +445,6 @@ void vtkPV3FoamReader::SetRegionArrayStatus(const char* name, int status)
|
|||||||
vtkDataArraySelection* vtkPV3FoamReader::GetVolFieldSelection()
|
vtkDataArraySelection* vtkPV3FoamReader::GetVolFieldSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldSelection");
|
vtkDebugMacro(<<"GetVolFieldSelection");
|
||||||
|
|
||||||
return VolFieldSelection;
|
return VolFieldSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +452,6 @@ vtkDataArraySelection* vtkPV3FoamReader::GetVolFieldSelection()
|
|||||||
int vtkPV3FoamReader::GetNumberOfVolFieldArrays()
|
int vtkPV3FoamReader::GetNumberOfVolFieldArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfVolFieldArrays");
|
vtkDebugMacro(<<"GetNumberOfVolFieldArrays");
|
||||||
|
|
||||||
return VolFieldSelection->GetNumberOfArrays();
|
return VolFieldSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +459,6 @@ int vtkPV3FoamReader::GetNumberOfVolFieldArrays()
|
|||||||
const char* vtkPV3FoamReader::GetVolFieldArrayName(int index)
|
const char* vtkPV3FoamReader::GetVolFieldArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldArrayName");
|
vtkDebugMacro(<<"GetVolFieldArrayName");
|
||||||
|
|
||||||
return VolFieldSelection->GetArrayName(index);
|
return VolFieldSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,7 +466,6 @@ const char* vtkPV3FoamReader::GetVolFieldArrayName(int index)
|
|||||||
int vtkPV3FoamReader::GetVolFieldArrayStatus(const char* name)
|
int vtkPV3FoamReader::GetVolFieldArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldArrayStatus");
|
vtkDebugMacro(<<"GetVolFieldArrayStatus");
|
||||||
|
|
||||||
return VolFieldSelection->ArrayIsEnabled(name);
|
return VolFieldSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +473,6 @@ int vtkPV3FoamReader::GetVolFieldArrayStatus(const char* name)
|
|||||||
void vtkPV3FoamReader::SetVolFieldArrayStatus(const char* name, int status)
|
void vtkPV3FoamReader::SetVolFieldArrayStatus(const char* name, int status)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetVolFieldArrayStatus");
|
vtkDebugMacro(<<"SetVolFieldArrayStatus");
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
VolFieldSelection->EnableArray(name);
|
VolFieldSelection->EnableArray(name);
|
||||||
@ -528,7 +490,6 @@ void vtkPV3FoamReader::SetVolFieldArrayStatus(const char* name, int status)
|
|||||||
vtkDataArraySelection* vtkPV3FoamReader::GetPointFieldSelection()
|
vtkDataArraySelection* vtkPV3FoamReader::GetPointFieldSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPointFieldSelection");
|
vtkDebugMacro(<<"GetPointFieldSelection");
|
||||||
|
|
||||||
return PointFieldSelection;
|
return PointFieldSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,7 +497,6 @@ vtkDataArraySelection* vtkPV3FoamReader::GetPointFieldSelection()
|
|||||||
int vtkPV3FoamReader::GetNumberOfPointFieldArrays()
|
int vtkPV3FoamReader::GetNumberOfPointFieldArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfPointFieldArrays");
|
vtkDebugMacro(<<"GetNumberOfPointFieldArrays");
|
||||||
|
|
||||||
return PointFieldSelection->GetNumberOfArrays();
|
return PointFieldSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +504,6 @@ int vtkPV3FoamReader::GetNumberOfPointFieldArrays()
|
|||||||
const char* vtkPV3FoamReader::GetPointFieldArrayName(int index)
|
const char* vtkPV3FoamReader::GetPointFieldArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPointFieldArrayName");
|
vtkDebugMacro(<<"GetPointFieldArrayName");
|
||||||
|
|
||||||
return PointFieldSelection->GetArrayName(index);
|
return PointFieldSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,7 +511,6 @@ const char* vtkPV3FoamReader::GetPointFieldArrayName(int index)
|
|||||||
int vtkPV3FoamReader::GetPointFieldArrayStatus(const char* name)
|
int vtkPV3FoamReader::GetPointFieldArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetPointFieldArrayStatus");
|
vtkDebugMacro(<<"GetPointFieldArrayStatus");
|
||||||
|
|
||||||
return PointFieldSelection->ArrayIsEnabled(name);
|
return PointFieldSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +518,6 @@ int vtkPV3FoamReader::GetPointFieldArrayStatus(const char* name)
|
|||||||
void vtkPV3FoamReader::SetPointFieldArrayStatus(const char* name, int status)
|
void vtkPV3FoamReader::SetPointFieldArrayStatus(const char* name, int status)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetPointFieldArrayStatus");
|
vtkDebugMacro(<<"SetPointFieldArrayStatus");
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
PointFieldSelection->EnableArray(name);
|
PointFieldSelection->EnableArray(name);
|
||||||
@ -578,7 +535,6 @@ void vtkPV3FoamReader::SetPointFieldArrayStatus(const char* name, int status)
|
|||||||
vtkDataArraySelection* vtkPV3FoamReader::GetLagrangianFieldSelection()
|
vtkDataArraySelection* vtkPV3FoamReader::GetLagrangianFieldSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetLagrangianFieldSelection");
|
vtkDebugMacro(<<"GetLagrangianFieldSelection");
|
||||||
|
|
||||||
return LagrangianFieldSelection;
|
return LagrangianFieldSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,7 +542,6 @@ vtkDataArraySelection* vtkPV3FoamReader::GetLagrangianFieldSelection()
|
|||||||
int vtkPV3FoamReader::GetNumberOfLagrangianFieldArrays()
|
int vtkPV3FoamReader::GetNumberOfLagrangianFieldArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays");
|
vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays");
|
||||||
|
|
||||||
return LagrangianFieldSelection->GetNumberOfArrays();
|
return LagrangianFieldSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,7 +549,6 @@ int vtkPV3FoamReader::GetNumberOfLagrangianFieldArrays()
|
|||||||
const char* vtkPV3FoamReader::GetLagrangianFieldArrayName(int index)
|
const char* vtkPV3FoamReader::GetLagrangianFieldArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetLagrangianFieldArrayName");
|
vtkDebugMacro(<<"GetLagrangianFieldArrayName");
|
||||||
|
|
||||||
return LagrangianFieldSelection->GetArrayName(index);
|
return LagrangianFieldSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +556,6 @@ const char* vtkPV3FoamReader::GetLagrangianFieldArrayName(int index)
|
|||||||
int vtkPV3FoamReader::GetLagrangianFieldArrayStatus(const char* name)
|
int vtkPV3FoamReader::GetLagrangianFieldArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetLagrangianFieldArrayStatus");
|
vtkDebugMacro(<<"GetLagrangianFieldArrayStatus");
|
||||||
|
|
||||||
return LagrangianFieldSelection->ArrayIsEnabled(name);
|
return LagrangianFieldSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,7 +567,6 @@ void vtkPV3FoamReader::SetLagrangianFieldArrayStatus
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetLagrangianFieldArrayStatus");
|
vtkDebugMacro(<<"SetLagrangianFieldArrayStatus");
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
LagrangianFieldSelection->EnableArray(name);
|
LagrangianFieldSelection->EnableArray(name);
|
||||||
@ -642,7 +594,6 @@ void vtkPV3FoamReader::SelectionModifiedCallback
|
|||||||
void vtkPV3FoamReader::SelectionModified()
|
void vtkPV3FoamReader::SelectionModified()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SelectionModified");
|
vtkDebugMacro(<<"SelectionModified");
|
||||||
|
|
||||||
Modified();
|
Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -191,6 +191,9 @@ private:
|
|||||||
vtkDataArraySelection* PointFieldSelection;
|
vtkDataArraySelection* PointFieldSelection;
|
||||||
vtkDataArraySelection* LagrangianFieldSelection;
|
vtkDataArraySelection* LagrangianFieldSelection;
|
||||||
|
|
||||||
|
//- Access to the output port1
|
||||||
|
vtkMultiBlockDataSet* output1_;
|
||||||
|
|
||||||
//BTX
|
//BTX
|
||||||
Foam::vtkPV3Foam* foamData_;
|
Foam::vtkPV3Foam* foamData_;
|
||||||
//ETX
|
//ETX
|
||||||
|
|||||||
@ -198,12 +198,34 @@ bool Foam::vtkPV3Foam::setTime(const double& requestedTime)
|
|||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime.setTime(Times[nearestIndex], nearestIndex);
|
// see what has changed
|
||||||
|
if (timeIndex_ != nearestIndex)
|
||||||
|
{
|
||||||
|
timeIndex_ = nearestIndex;
|
||||||
|
runTime.setTime(Times[nearestIndex], nearestIndex);
|
||||||
|
|
||||||
|
// the fields change each time
|
||||||
|
fieldsChanged_ = true;
|
||||||
|
|
||||||
|
if (meshPtr_)
|
||||||
|
{
|
||||||
|
if (meshPtr_->readUpdate() != polyMesh::UNCHANGED)
|
||||||
|
{
|
||||||
|
meshChanged_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meshChanged_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::setTime() - selected time "
|
Info<< "<end> Foam::vtkPV3Foam::setTime() - selected time "
|
||||||
<< Times[nearestIndex].name() << endl;
|
<< Times[nearestIndex].name() << " index=" << nearestIndex
|
||||||
|
<< " meshChanged=" << meshChanged_
|
||||||
|
<< " fieldsChanged=" << fieldsChanged_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
@ -221,13 +243,26 @@ void Foam::vtkPV3Foam::updateSelectedRegions()
|
|||||||
|
|
||||||
const label nSelect = arraySelection->GetNumberOfArrays();
|
const label nSelect = arraySelection->GetNumberOfArrays();
|
||||||
|
|
||||||
selectedRegions_.setSize(nSelect);
|
if (selectedRegions_.size() != nSelect)
|
||||||
|
{
|
||||||
|
selectedRegions_.setSize(nSelect);
|
||||||
|
selectedRegions_ = 0;
|
||||||
|
meshChanged_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
selectedRegionDatasetIds_.setSize(nSelect);
|
selectedRegionDatasetIds_.setSize(nSelect);
|
||||||
|
|
||||||
// Read the selected patches and add to the region list
|
// Read the selected cell regions, zones, patches and add to region list
|
||||||
forAll (selectedRegions_, regionId)
|
forAll (selectedRegions_, regionId)
|
||||||
{
|
{
|
||||||
selectedRegions_[regionId] = arraySelection->GetArraySetting(regionId);
|
int setting = arraySelection->GetArraySetting(regionId);
|
||||||
|
|
||||||
|
if (selectedRegions_[regionId] != setting)
|
||||||
|
{
|
||||||
|
selectedRegions_[regionId] = setting;
|
||||||
|
meshChanged_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
selectedRegionDatasetIds_[regionId] = -1;
|
selectedRegionDatasetIds_[regionId] = -1;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -421,12 +456,10 @@ void Foam::vtkPV3Foam::setSelectedArrayEntries
|
|||||||
Foam::vtkPV3Foam::vtkPV3Foam
|
Foam::vtkPV3Foam::vtkPV3Foam
|
||||||
(
|
(
|
||||||
const char* const FileName,
|
const char* const FileName,
|
||||||
vtkPV3FoamReader* reader,
|
vtkPV3FoamReader* reader
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
reader_(reader),
|
reader_(reader),
|
||||||
output_(output),
|
|
||||||
dbPtr_(NULL),
|
dbPtr_(NULL),
|
||||||
meshPtr_(NULL),
|
meshPtr_(NULL),
|
||||||
selectInfoVolume_(VOLUME, "unzoned"),
|
selectInfoVolume_(VOLUME, "unzoned"),
|
||||||
@ -439,7 +472,10 @@ Foam::vtkPV3Foam::vtkPV3Foam
|
|||||||
selectInfoFaceSets_(FACESET, "faceSet"),
|
selectInfoFaceSets_(FACESET, "faceSet"),
|
||||||
selectInfoPointSets_(POINTSET, "pointSet"),
|
selectInfoPointSets_(POINTSET, "pointSet"),
|
||||||
patchTextActorsPtrs_(0),
|
patchTextActorsPtrs_(0),
|
||||||
nMesh_(0)
|
nMesh_(0),
|
||||||
|
timeIndex_(-1),
|
||||||
|
meshChanged_(true),
|
||||||
|
fieldsChanged_(true)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -487,17 +523,11 @@ Foam::vtkPV3Foam::vtkPV3Foam
|
|||||||
|
|
||||||
dbPtr_().functionObjects().off();
|
dbPtr_().functionObjects().off();
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
cout<< "constructed with output: ";
|
|
||||||
output_->Print(cout);
|
|
||||||
}
|
|
||||||
|
|
||||||
resetCounters();
|
|
||||||
|
|
||||||
// Set initial cloud name
|
// Set initial cloud name
|
||||||
// TODO - TEMPORARY MEASURE UNTIL CAN PROCESS MULTIPLE CLOUDS
|
// TODO - TEMPORARY MEASURE UNTIL CAN PROCESS MULTIPLE CLOUDS
|
||||||
cloudName_ = "";
|
cloudName_ = "";
|
||||||
|
|
||||||
|
UpdateInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -574,6 +604,11 @@ void Foam::vtkPV3Foam::UpdateInformation()
|
|||||||
selectedEntries
|
selectedEntries
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (meshChanged_)
|
||||||
|
{
|
||||||
|
fieldsChanged_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Update volField array
|
// Update volField array
|
||||||
updateInformationFields<fvPatchField, volMesh>
|
updateInformationFields<fvPatchField, volMesh>
|
||||||
(
|
(
|
||||||
@ -609,22 +644,23 @@ void Foam::vtkPV3Foam::Update
|
|||||||
output->Print(cout);
|
output->Print(cout);
|
||||||
|
|
||||||
cout<<"Internally:\n";
|
cout<<"Internally:\n";
|
||||||
output_->Print(cout);
|
output->Print(cout);
|
||||||
|
|
||||||
cout<< " has " << output_->GetNumberOfBlocks() << " blocks\n";
|
cout<< " has " << output->GetNumberOfBlocks() << " blocks\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set up region selection(s)
|
// Set up region selection(s)
|
||||||
updateSelectedRegions();
|
updateSelectedRegions();
|
||||||
|
|
||||||
// Update the Foam mesh
|
// Update the Foam mesh
|
||||||
updateFoamMesh();
|
updateFoamMesh();
|
||||||
|
reader_->UpdateProgress(0.2);
|
||||||
|
|
||||||
// Convert meshes
|
// Convert meshes
|
||||||
convertMeshVolume(output);
|
convertMeshVolume(output);
|
||||||
convertMeshLagrangian(output);
|
convertMeshLagrangian(output);
|
||||||
convertMeshPatches(output);
|
convertMeshPatches(output);
|
||||||
|
reader_->UpdateProgress(0.4);
|
||||||
|
|
||||||
if (reader_->GetIncludeZones())
|
if (reader_->GetIncludeZones())
|
||||||
{
|
{
|
||||||
@ -639,11 +675,13 @@ void Foam::vtkPV3Foam::Update
|
|||||||
convertMeshFaceSets(output);
|
convertMeshFaceSets(output);
|
||||||
convertMeshPointSets(output);
|
convertMeshPointSets(output);
|
||||||
}
|
}
|
||||||
|
reader_->UpdateProgress(0.8);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
updateVolFields(output);
|
updateVolFields(output);
|
||||||
updatePointFields(output);
|
updatePointFields(output);
|
||||||
updateLagrangianFields(output);
|
updateLagrangianFields(output);
|
||||||
|
reader_->UpdateProgress(1.0);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -670,16 +708,18 @@ void Foam::vtkPV3Foam::Update
|
|||||||
// traverse blocks:
|
// traverse blocks:
|
||||||
cout<< "nBlocks = " << output->GetNumberOfBlocks() << "\n";
|
cout<< "nBlocks = " << output->GetNumberOfBlocks() << "\n";
|
||||||
cout<< "done Update\n";
|
cout<< "done Update\n";
|
||||||
output_->Print(cout);
|
output->Print(cout);
|
||||||
cout<< " has " << output_->GetNumberOfBlocks() << " blocks\n";
|
cout<< " has " << output->GetNumberOfBlocks() << " blocks\n";
|
||||||
output_->GetInformation()->Print(cout);
|
output->GetInformation()->Print(cout);
|
||||||
|
|
||||||
cout<<"ShouldIReleaseData :" << output_->ShouldIReleaseData() << "\n";
|
cout<<"ShouldIReleaseData :" << output->ShouldIReleaseData() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meshChanged_ = fieldsChanged_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
|
double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
|
||||||
{
|
{
|
||||||
int nTimes = 0;
|
int nTimes = 0;
|
||||||
double* tsteps = NULL;
|
double* tsteps = NULL;
|
||||||
@ -687,10 +727,10 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
|
|||||||
if (dbPtr_.valid())
|
if (dbPtr_.valid())
|
||||||
{
|
{
|
||||||
Time& runTime = dbPtr_();
|
Time& runTime = dbPtr_();
|
||||||
instantList times = runTime.times();
|
instantList timeLst = runTime.times();
|
||||||
|
|
||||||
// always skip "constant" time, unless there are no other times
|
// always skip "constant" time, unless there are no other times
|
||||||
nTimes = times.size();
|
nTimes = timeLst.size();
|
||||||
label timeI = 0;
|
label timeI = 0;
|
||||||
|
|
||||||
if (nTimes > 1)
|
if (nTimes > 1)
|
||||||
@ -704,7 +744,7 @@ double* Foam::vtkPV3Foam::timeSteps(int& nTimeSteps)
|
|||||||
tsteps = new double[nTimes];
|
tsteps = new double[nTimes];
|
||||||
for (label stepI = 0; stepI < nTimes; ++stepI, ++timeI)
|
for (label stepI = 0; stepI < nTimes; ++stepI, ++timeI)
|
||||||
{
|
{
|
||||||
tsteps[stepI] = times[timeI].value();
|
tsteps[stepI] = timeLst[timeI].value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -924,48 +964,17 @@ void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Foam::vtkPV3Foam::numberOfAvailableTimes() const
|
void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const
|
||||||
{
|
{
|
||||||
if (dbPtr_.valid())
|
os << indent << "Number of meshes: " << nMesh_ << "\n";
|
||||||
{
|
os << indent << "Number of nodes: "
|
||||||
return dbPtr_().times().size();
|
<< (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n";
|
||||||
}
|
|
||||||
else
|
os << indent << "Number of cells: "
|
||||||
{
|
<< (meshPtr_ ? meshPtr_->nCells() : 0) << "\n";
|
||||||
return 0;
|
|
||||||
}
|
os << indent << "Number of available time steps: "
|
||||||
|
<< (dbPtr_.valid() ? dbPtr_().times().size() : 0) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Foam::vtkPV3Foam::numberOfPoints()
|
|
||||||
{
|
|
||||||
if (meshPtr_)
|
|
||||||
{
|
|
||||||
return meshPtr_->nPoints();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Foam::vtkPV3Foam::numberOfCells()
|
|
||||||
{
|
|
||||||
if (meshPtr_)
|
|
||||||
{
|
|
||||||
return meshPtr_->nCells();
|
|
||||||
}
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Foam::vtkPV3Foam::numberOfMeshes() const
|
|
||||||
{
|
|
||||||
return nMesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -69,13 +69,14 @@ SourceFiles
|
|||||||
|
|
||||||
class vtkDataArraySelection;
|
class vtkDataArraySelection;
|
||||||
class vtkDataSet;
|
class vtkDataSet;
|
||||||
class vtkMultiBlockDataSet;
|
|
||||||
class vtkPoints;
|
class vtkPoints;
|
||||||
class vtkPV3FoamReader;
|
class vtkPV3FoamReader;
|
||||||
class vtkRenderer;
|
class vtkRenderer;
|
||||||
class vtkTextActor;
|
class vtkTextActor;
|
||||||
|
class vtkMultiBlockDataSet;
|
||||||
class vtkPolyData;
|
class vtkPolyData;
|
||||||
class vtkUnstructuredGrid;
|
class vtkUnstructuredGrid;
|
||||||
|
class vtkIndent;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -195,9 +196,6 @@ private:
|
|||||||
//- Access to the controlling vtkPV3FoamReader
|
//- Access to the controlling vtkPV3FoamReader
|
||||||
vtkPV3FoamReader* reader_;
|
vtkPV3FoamReader* reader_;
|
||||||
|
|
||||||
//- Access to the output block
|
|
||||||
vtkMultiBlockDataSet* output_;
|
|
||||||
|
|
||||||
//- Foam time control
|
//- Foam time control
|
||||||
autoPtr<Time> dbPtr_;
|
autoPtr<Time> dbPtr_;
|
||||||
|
|
||||||
@ -231,12 +229,12 @@ private:
|
|||||||
labelList superCells_;
|
labelList superCells_;
|
||||||
|
|
||||||
//- Label of original cell for decomposed cells
|
//- Label of original cell for decomposed cells
|
||||||
// - cell zone meshes
|
// - cellZone meshes
|
||||||
List<labelList> superCellZonesCells_;
|
List<labelList> zoneSuperCells_;
|
||||||
|
|
||||||
//- Label of original cell for decomposed cells
|
//- Label of original cell for decomposed cells
|
||||||
// - cell set meshes
|
// - cellSet meshes
|
||||||
List<labelList> superCellSetCells_;
|
List<labelList> csetSuperCells_;
|
||||||
|
|
||||||
//- List of patch names
|
//- List of patch names
|
||||||
List<vtkTextActor*> patchTextActorsPtrs_;
|
List<vtkTextActor*> patchTextActorsPtrs_;
|
||||||
@ -252,6 +250,15 @@ private:
|
|||||||
// TODO - currently only set up to process ONE cloud
|
// TODO - currently only set up to process ONE cloud
|
||||||
word cloudName_;
|
word cloudName_;
|
||||||
|
|
||||||
|
//- The time index
|
||||||
|
int timeIndex_;
|
||||||
|
|
||||||
|
//- Track changes in mesh geometry
|
||||||
|
bool meshChanged_;
|
||||||
|
|
||||||
|
//- Track changes in fields
|
||||||
|
bool fieldsChanged_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -610,8 +617,7 @@ public:
|
|||||||
vtkPV3Foam
|
vtkPV3Foam
|
||||||
(
|
(
|
||||||
const char* const FileName,
|
const char* const FileName,
|
||||||
vtkPV3FoamReader* reader,
|
vtkPV3FoamReader* reader
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -622,13 +628,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Update
|
||||||
void UpdateInformation();
|
void UpdateInformation();
|
||||||
|
|
||||||
void Update(vtkMultiBlockDataSet* output);
|
void Update(vtkMultiBlockDataSet* output);
|
||||||
|
|
||||||
//- allocate and return a list of selected times
|
//- Allocate and return a list of selected times
|
||||||
// returns the count via the parameter
|
// returns the count via the parameter
|
||||||
double* timeSteps(int& nTimeSteps);
|
double* findTimes(int& nTimeSteps);
|
||||||
|
|
||||||
//- Add patch names to the display
|
//- Add patch names to the display
|
||||||
void addPatchNames(vtkRenderer* renderer);
|
void addPatchNames(vtkRenderer* renderer);
|
||||||
@ -643,14 +650,8 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the total number of available timesets
|
//- Debug information
|
||||||
int numberOfAvailableTimes() const;
|
void PrintSelf(ostream&, vtkIndent) const;
|
||||||
|
|
||||||
int numberOfCells();
|
|
||||||
|
|
||||||
int numberOfPoints();
|
|
||||||
|
|
||||||
int numberOfMeshes() const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -258,14 +258,14 @@ void Foam::vtkPV3Foam::convertMeshCellZones
|
|||||||
(
|
(
|
||||||
subsetter.subMesh(),
|
subsetter.subMesh(),
|
||||||
vtkmesh,
|
vtkmesh,
|
||||||
superCellZonesCells_[datasetId]
|
zoneSuperCells_[datasetId]
|
||||||
);
|
);
|
||||||
|
|
||||||
// renumber - superCells must contain global cell ids
|
// renumber - superCells must contain global cell ids
|
||||||
inplaceRenumber
|
inplaceRenumber
|
||||||
(
|
(
|
||||||
subsetter.cellMap(),
|
subsetter.cellMap(),
|
||||||
superCellZonesCells_[datasetId]
|
zoneSuperCells_[datasetId]
|
||||||
);
|
);
|
||||||
|
|
||||||
AddToBlock
|
AddToBlock
|
||||||
@ -337,14 +337,14 @@ void Foam::vtkPV3Foam::convertMeshCellSets
|
|||||||
(
|
(
|
||||||
subsetter.subMesh(),
|
subsetter.subMesh(),
|
||||||
vtkmesh,
|
vtkmesh,
|
||||||
superCellSetCells_[datasetId]
|
csetSuperCells_[datasetId]
|
||||||
);
|
);
|
||||||
|
|
||||||
// renumber - superCells must contain global cell ids
|
// renumber - superCells must contain global cell ids
|
||||||
inplaceRenumber
|
inplaceRenumber
|
||||||
(
|
(
|
||||||
subsetter.cellMap(),
|
subsetter.cellMap(),
|
||||||
superCellSetCells_[datasetId]
|
csetSuperCells_[datasetId]
|
||||||
);
|
);
|
||||||
|
|
||||||
AddToBlock
|
AddToBlock
|
||||||
|
|||||||
@ -173,8 +173,7 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
convertPatchFaceField
|
convertPatchFaceField
|
||||||
(
|
(
|
||||||
tf.name(),
|
tf.name(),
|
||||||
fvPatchField<Type>(p, tf)
|
fvPatchField<Type>(p, tf).patchInternalField()(),
|
||||||
.patchInternalField()(),
|
|
||||||
output,
|
output,
|
||||||
selectInfoPatches_,
|
selectInfoPatches_,
|
||||||
selectedRegionDatasetIds_[regionId]
|
selectedRegionDatasetIds_[regionId]
|
||||||
@ -236,7 +235,7 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output, selectInfoCellZones_, datasetId,
|
output, selectInfoCellZones_, datasetId,
|
||||||
superCellZonesCells_[datasetId]
|
zoneSuperCells_[datasetId]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +272,7 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output, selectInfoCellSets_, datasetId,
|
output, selectInfoCellSets_, datasetId,
|
||||||
superCellSetCells_[datasetId]
|
csetSuperCells_[datasetId]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -72,6 +72,8 @@ void Foam::vtkPV3Foam::updateFoamMesh()
|
|||||||
dbPtr_()
|
dbPtr_()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
meshChanged_ = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,6 +36,10 @@ License
|
|||||||
#include "entry.H"
|
#include "entry.H"
|
||||||
#include "vtkPV3FoamReader.h"
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
|
// local headers
|
||||||
|
#include "vtkPV3FoamAddToSelection.H"
|
||||||
|
#include "vtkPV3FoamUpdateInformationFields.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
|
|
||||||
@ -75,10 +79,43 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType)
|
||||||
|
{
|
||||||
|
wordList zoneNames;
|
||||||
|
|
||||||
|
// mesh not loaded - read from file
|
||||||
|
IOobject ioObj
|
||||||
|
(
|
||||||
|
zoneType,
|
||||||
|
dbPtr_().findInstance
|
||||||
|
(
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
zoneType,
|
||||||
|
IOobject::READ_IF_PRESENT
|
||||||
|
),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
dbPtr_(),
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ioObj.headerOk())
|
||||||
|
{
|
||||||
|
zonesEntries zones(ioObj);
|
||||||
|
|
||||||
|
zoneNames.setSize(zones.size());
|
||||||
|
forAll (zones, zoneI)
|
||||||
|
{
|
||||||
|
zoneNames[zoneI] = zones[zoneI].keyword();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return zoneNames;
|
||||||
|
}
|
||||||
|
|
||||||
#include "vtkPV3FoamAddToSelection.H"
|
|
||||||
#include "vtkPV3FoamUpdateInformationFields.H"
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateInformationInternalMesh()
|
void Foam::vtkPV3Foam::updateInformationInternalMesh()
|
||||||
{
|
{
|
||||||
@ -222,42 +259,6 @@ void Foam::vtkPV3Foam::updateInformationPatches()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType)
|
|
||||||
{
|
|
||||||
wordList zoneNames;
|
|
||||||
|
|
||||||
// mesh not loaded - read from file
|
|
||||||
IOobject ioObj
|
|
||||||
(
|
|
||||||
zoneType,
|
|
||||||
dbPtr_().findInstance
|
|
||||||
(
|
|
||||||
polyMesh::meshSubDir,
|
|
||||||
zoneType,
|
|
||||||
IOobject::READ_IF_PRESENT
|
|
||||||
),
|
|
||||||
polyMesh::meshSubDir,
|
|
||||||
dbPtr_(),
|
|
||||||
IOobject::READ_IF_PRESENT,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (ioObj.headerOk())
|
|
||||||
{
|
|
||||||
zonesEntries zones(ioObj);
|
|
||||||
|
|
||||||
zoneNames.setSize(zones.size());
|
|
||||||
forAll (zones, zoneI)
|
|
||||||
{
|
|
||||||
zoneNames[zoneI] = zones[zoneI].keyword();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return zoneNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateInformationZones()
|
void Foam::vtkPV3Foam::updateInformationZones()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -288,7 +289,7 @@ void Foam::vtkPV3Foam::updateInformationZones()
|
|||||||
arraySelection->AddArray((zoneNames[zoneI] + " - cellZone").c_str());
|
arraySelection->AddArray((zoneNames[zoneI] + " - cellZone").c_str());
|
||||||
}
|
}
|
||||||
selectInfoCellZones_ += zoneNames.size();
|
selectInfoCellZones_ += zoneNames.size();
|
||||||
superCellZonesCells_.setSize(selectInfoCellZones_.size());
|
zoneSuperCells_.setSize(selectInfoCellZones_.size());
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -366,7 +367,7 @@ void Foam::vtkPV3Foam::updateInformationSets()
|
|||||||
objects,
|
objects,
|
||||||
" - cellSet"
|
" - cellSet"
|
||||||
);
|
);
|
||||||
superCellSetCells_.setSize(selectInfoCellSets_.size());
|
csetSuperCells_.setSize(selectInfoCellSets_.size());
|
||||||
|
|
||||||
selectInfoFaceSets_ = arraySelection->GetNumberOfArrays();
|
selectInfoFaceSets_ = arraySelection->GetNumberOfArrays();
|
||||||
selectInfoFaceSets_ += addToSelection<faceSet>
|
selectInfoFaceSets_ += addToSelection<faceSet>
|
||||||
@ -465,4 +466,7 @@ void Foam::vtkPV3Foam::updateInformationLagrangianFields()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user