Commit 3db5f133 authored by Mark Olesen's avatar Mark Olesen

PV3FoamReader improvements

  - various GUI properties are now animateable="0"
    (meaning they no longer show up on the time-line)
  - move reader switches to the bottom of the GUI
  - move Lagrangian fields above pointFields for better visibility
  - basic support for multiple clouds
  - filter fields based on selection before looping over all the geometry bits
  - mesh conversion functions now return VTK mesh types for easier handling
  - faceZones mesh conversion had points/faces allocation reversed
  - updateInfo with every call to setTime() that changes the timeIndex
    This seems to be the only way to notice Lagrangian fields
  - restore displaying patchnames that got forgotten in the last commit
  - misc reorganization
parent cf9019f8
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy
name="PV3FoamReader"
class="vtkPV3FoamReader">
<!-- File name - compulsory -->
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1">
<FileListDomain
name="files"/>
</StringVectorProperty>
<!-- Time info sent to animation controls (top of window) -->
<DoubleVectorProperty
name="TimestepValues"
information_only="1">
<TimeStepsInformationHelper/>
<Documentation>
Available timestep values.
</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty
name="TimeRange"
information_only="1">
<TimeRangeInformationHelper/>
</DoubleVectorProperty>
<!-- ExtrapolateWalls check box -->
<IntVectorProperty
name="ExtrapolateWalls"
command="SetExtrapolateWalls"
number_of_elements="1"
default_values="0">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
<!-- Include sets check box -->
<IntVectorProperty
name="IncludeSets"
command="SetIncludeSets"
number_of_elements="1"
default_values="0">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
<!-- Include zones check box -->
<IntVectorProperty
name="IncludeZones"
command="SetIncludeZones"
number_of_elements="1"
default_values="0">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
<!-- Show patch names check box -->
<IntVectorProperty
name="ShowPatchNames"
command="SetShowPatchNames"
number_of_elements="1"
default_values="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Available regions array -->
<StringVectorProperty
name="RegionArrayInfo"
information_only="1">
<ArraySelectionInformationHelper
attribute_name="Region"/>
</StringVectorProperty>
<StringVectorProperty
name="RegionStatus"
command="SetRegionArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="RegionArrayInfo">
<ArraySelectionDomain
name="array_list">
<RequiredProperties>
<Property name="RegionArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available volFields array -->
<StringVectorProperty
name="VolFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper
attribute_name="VolField"/>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldStatus"
command="SetVolFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="VolFieldArrayInfo">
<ArraySelectionDomain
name="array_list">
<RequiredProperties>
<Property name="VolFieldArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available pointFields array -->
<StringVectorProperty
name="PointFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper
attribute_name="PointField"/>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldStatus"
command="SetPointFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointFieldArrayInfo">
<ArraySelectionDomain
name="array_list">
<RequiredProperties>
<Property name="PointFieldArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available Lagrangian fields array -->
<StringVectorProperty
name="LagrangianFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper
attribute_name="LagrangianField"/>
</StringVectorProperty>
<StringVectorProperty
name="LagrangianFieldStatus"
command="SetLagrangianFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="LagrangianFieldArrayInfo">
<ArraySelectionDomain
name="array_list">
<RequiredProperties>
<Property name="LagrangianFieldArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Cache mesh check box -->
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
<!-- Update GUI check box -->
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
default_values="0">
<BooleanDomain
name="bool"/>
</IntVectorProperty>
</SourceProxy>
</ProxyGroup>
<ProxyGroup name="sources">
<SourceProxy
name="PV3FoamReader"
class="vtkPV3FoamReader">
<!-- File name - compulsory -->
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1"
animateable="0">
<FileListDomain name="files"/>
<Documentation>
Specifies the filename for the OpenFOAM Reader
</Documentation>
</StringVectorProperty>
<!-- Time info sent to animation controls (top of window) -->
<DoubleVectorProperty
name="TimestepValues"
information_only="1">
<TimeStepsInformationHelper/>
<Documentation>
Available timestep values
</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty
name="TimeRange"
information_only="1">
<TimeRangeInformationHelper/>
</DoubleVectorProperty>
<!-- Available Region array -->
<StringVectorProperty
name="RegionArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Region"/>
</StringVectorProperty>
<StringVectorProperty
name="RegionStatus"
label="Mesh Parts"
command="SetRegionArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="RegionArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="RegionArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available volFields array -->
<StringVectorProperty
name="VolFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="VolField"/>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldStatus"
label="Volume Fields"
command="SetVolFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="VolFieldArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="VolFieldArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available Lagrangian fields array -->
<StringVectorProperty
name="LagrangianFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
</StringVectorProperty>
<StringVectorProperty
name="LagrangianFieldStatus"
label="Lagrangian Fields"
command="SetLagrangianFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="LagrangianFieldArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="LagrangianFieldArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available pointFields array -->
<StringVectorProperty
name="PointFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="PointField"/>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldStatus"
label="Point Fields"
command="SetPointFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointFieldArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PointFieldArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Extrapolate Walls check-box -->
<IntVectorProperty
name="ExtrapolateWalls"
command="SetExtrapolateWalls"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Include Sets check-box -->
<IntVectorProperty
name="IncludeSets"
command="SetIncludeSets"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Include Zones check-box -->
<IntVectorProperty
name="IncludeZones"
command="SetIncludeZones"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Show Patch Names check-box -->
<IntVectorProperty
name="ShowPatchNames"
command="SetShowPatchNames"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Cache Mesh check-box -->
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Update GUI check box -->
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
......@@ -59,11 +59,10 @@ vtkPV3FoamReader::vtkPV3FoamReader()
this->GetExecutive()->SetOutputData(1, lagrangian);
lagrangian->Delete();
TimeStep = 0;
TimeStepRange[0] = 0;
TimeStepRange[1] = 0;
CacheMesh = 0;
CacheMesh = 1;
ExtrapolateWalls = 0;
IncludeSets = 0;
......@@ -181,7 +180,7 @@ int vtkPV3FoamReader::RequestInformation
}
else
{
foamData_->UpdateInformation();
foamData_->updateInfo();
}
int nTimeSteps = 0;
......@@ -349,6 +348,15 @@ int vtkPV3FoamReader::RequestData
foamData_->Update(output, lagrangianOutput);
if (ShowPatchNames)
{
addPatchNamesToView();
}
else
{
removePatchNamesFromView();
}
#endif
return 1;
......@@ -408,7 +416,13 @@ void vtkPV3FoamReader::PrintSelf(ostream& os, vtkIndent indent)
os<< indent << "Time step range: "
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1]
<< "\n";
os<< indent << "Time step: " << this->TimeStep << endl;
os<< indent << "Time step: " << this->GetTimeStep() << endl;
}
int vtkPV3FoamReader::GetTimeStep()
{
return foamData_ ? foamData_->timeIndex() : -1;
}
......@@ -446,7 +460,6 @@ int vtkPV3FoamReader::GetRegionArrayStatus(const char* name)
void vtkPV3FoamReader::SetRegionArrayStatus(const char* name, int status)
{
vtkDebugMacro(<<"SetRegionArrayStatus");
if (status)
{
RegionSelection->EnableArray(name);
......
......@@ -21,20 +21,16 @@
#ifndef __vtkPV3FoamReader_h
#define __vtkPV3FoamReader_h
#include "vtkMultiBlockDataSetAlgorithm.h"
// Foam forward declarations
namespace Foam
{
class vtkPV3Foam;
}
// VTK includes
#include "vtkMultiBlockDataSetAlgorithm.h"
// VTK forward declarations
class vtkUnstructuredGrid;
class vtkPoints;
class vtkIntArray;
class vtkFloatArray;
class vtkDoubleArray;
class vtkDataArraySelection;
class vtkCallbackCommand;
......@@ -44,41 +40,31 @@ class VTK_IO_EXPORT vtkPV3FoamReader
public vtkMultiBlockDataSetAlgorithm
{
public:
vtkTypeRevisionMacro(vtkPV3FoamReader,vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream&, vtkIndent);
static vtkPV3FoamReader* New();
vtkTypeRevisionMacro
(
vtkPV3FoamReader,
vtkMultiBlockDataSetAlgorithm
);
void PrintSelf
(
ostream& os,
vtkIndent indent
);
// Description:
// Get the current timestep and the timestep range.
vtkGetVector2Macro(TimeStepRange, int);
// Description:
// Set/Get the filename.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
// Time control
// Set/Get the timestep and the timestep range
vtkSetMacro(TimeStep, int);
vtkGetMacro(TimeStep, int);
vtkSetVector2Macro(TimeStepRange, int);
vtkGetVector2Macro(TimeStepRange, int);
// Description:
// GUI update control
vtkSetMacro(UpdateGUI, int);
vtkGetMacro(UpdateGUI, int);
// Description:
// FOAM mesh caching control
vtkSetMacro(CacheMesh, int);
vtkGetMacro(CacheMesh, int);
// Description:
// FOAM extrapolate internal values onto the walls
vtkSetMacro(ExtrapolateWalls, int);
vtkGetMacro(ExtrapolateWalls, int);
......@@ -87,42 +73,53 @@ public:
vtkSetMacro(IncludeSets, int);
vtkGetMacro(IncludeSets, int);
// Description:
// FOAM read zones control
vtkSetMacro(IncludeZones, int);
vtkGetMacro(IncludeZones, int);
// Description:
// FOAM display patch names control
vtkSetMacro(ShowPatchNames, int);
vtkGetMacro(ShowPatchNames, int);
// Description:
// Get the current timestep
int GetTimeStep();
// Description:
// Region selection list control
vtkDataArraySelection* GetRegionSelection();
int GetNumberOfRegionArrays();
const char* GetRegionArrayName(int index);
int GetRegionArrayStatus(const char* name);
int GetNumberOfRegionArrays();
int GetRegionArrayStatus(const char* name);
void SetRegionArrayStatus(const char* name, int status);
const char* GetRegionArrayName(int index);
// Description:
// volField selection list control
vtkDataArraySelection* GetVolFieldSelection();
int GetNumberOfVolFieldArrays();
const char* GetVolFieldArrayName(int index);
int GetVolFieldArrayStatus(const char* name);
int GetNumberOfVolFieldArrays();
int GetVolFieldArrayStatus(const char* name);
void SetVolFieldArrayStatus(const char* name, int status);
const char* GetVolFieldArrayName(int index);
// Description:
// pointField selection list control
vtkDataArraySelection* GetPointFieldSelection();
int GetNumberOfPointFieldArrays();
int GetPointFieldArrayStatus(const char* name);
int GetNumberOfPointFieldArrays();
int GetPointFieldArrayStatus(const char* name);
void SetPointFieldArrayStatus(const char* name, int status);
const char* GetPointFieldArrayName(int index);
// Description:
// lagrangianField selection list control
vtkDataArraySelection* GetLagrangianFieldSelection();
int GetNumberOfLagrangianFieldArrays();
int GetLagrangianFieldArrayStatus(const char* name);
int GetNumberOfLagrangianFieldArrays();
int GetLagrangianFieldArrayStatus(const char* name);
void SetLagrangianFieldArrayStatus(const char* name, int status);
const char* GetLagrangianFieldArrayName(int index);
// Description:
// Callback registered with the SelectionObserver
// for all the selection lists
static void SelectionModifiedCallback
......@@ -138,35 +135,44 @@ public:
protected:
//- Construct null
vtkPV3FoamReader();
~vtkPV3FoamReader();
char* FileName;
//- Destructor
~vtkPV3FoamReader();
virtual int RequestData
//- Return information about mesh, times, etc without loading anything
virtual int RequestInformation
(
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*
);
virtual int RequestInformation
//- Get the mesh/fields for a particular time
//- Destructor
virtual int RequestData
(
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*
);
//- Fill in additional port information
virtual int FillOutputPortInformation(int, vtkInformation*);
// The observer to modify this object when the array selections
// are modified
// The observer to modify this object when array selections are modified
vtkCallbackCommand* SelectionObserver;
char* FileName;
private:
vtkPV3FoamReader(const vtkPV3FoamReader&); // Not implemented.
void operator=(const vtkPV3FoamReader&