mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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
This commit is contained in:
@ -1,191 +1,189 @@
|
|||||||
<ServerManagerConfiguration>
|
<ServerManagerConfiguration>
|
||||||
<ProxyGroup name="sources">
|
<ProxyGroup name="sources">
|
||||||
<SourceProxy
|
<SourceProxy
|
||||||
|
name="PV3FoamReader"
|
||||||
|
class="vtkPV3FoamReader">
|
||||||
|
|
||||||
name="PV3FoamReader"
|
<!-- File name - compulsory -->
|
||||||
class="vtkPV3FoamReader">
|
<StringVectorProperty
|
||||||
|
name="FileName"
|
||||||
|
command="SetFileName"
|
||||||
|
number_of_elements="1"
|
||||||
|
animateable="0">
|
||||||
|
<FileListDomain name="files"/>
|
||||||
|
<Documentation>
|
||||||
|
Specifies the filename for the OpenFOAM Reader
|
||||||
|
</Documentation>
|
||||||
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- File name - compulsory -->
|
<!-- Time info sent to animation controls (top of window) -->
|
||||||
<StringVectorProperty
|
<DoubleVectorProperty
|
||||||
name="FileName"
|
name="TimestepValues"
|
||||||
command="SetFileName"
|
information_only="1">
|
||||||
number_of_elements="1">
|
<TimeStepsInformationHelper/>
|
||||||
<FileListDomain
|
<Documentation>
|
||||||
name="files"/>
|
Available timestep values
|
||||||
</StringVectorProperty>
|
</Documentation>
|
||||||
|
</DoubleVectorProperty>
|
||||||
|
|
||||||
<!-- Time info sent to animation controls (top of window) -->
|
<DoubleVectorProperty
|
||||||
|
name="TimeRange"
|
||||||
|
information_only="1">
|
||||||
|
<TimeRangeInformationHelper/>
|
||||||
|
</DoubleVectorProperty>
|
||||||
|
|
||||||
<DoubleVectorProperty
|
<!-- Available Region array -->
|
||||||
name="TimestepValues"
|
<StringVectorProperty
|
||||||
information_only="1">
|
name="RegionArrayInfo"
|
||||||
<TimeStepsInformationHelper/>
|
information_only="1">
|
||||||
<Documentation>
|
<ArraySelectionInformationHelper attribute_name="Region"/>
|
||||||
Available timestep values.
|
</StringVectorProperty>
|
||||||
</Documentation>
|
<StringVectorProperty
|
||||||
</DoubleVectorProperty>
|
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>
|
||||||
|
|
||||||
<DoubleVectorProperty
|
<!-- Available volFields array -->
|
||||||
name="TimeRange"
|
<StringVectorProperty
|
||||||
information_only="1">
|
name="VolFieldArrayInfo"
|
||||||
<TimeRangeInformationHelper/>
|
information_only="1">
|
||||||
</DoubleVectorProperty>
|
<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>
|
||||||
|
|
||||||
<!-- ExtrapolateWalls check box -->
|
<!-- Available Lagrangian fields array -->
|
||||||
<IntVectorProperty
|
<StringVectorProperty
|
||||||
name="ExtrapolateWalls"
|
name="LagrangianFieldArrayInfo"
|
||||||
command="SetExtrapolateWalls"
|
information_only="1">
|
||||||
number_of_elements="1"
|
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
|
||||||
default_values="0">
|
</StringVectorProperty>
|
||||||
<BooleanDomain
|
<StringVectorProperty
|
||||||
name="bool"/>
|
name="LagrangianFieldStatus"
|
||||||
</IntVectorProperty>
|
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>
|
||||||
|
|
||||||
<!-- Include sets check box -->
|
<!-- Available pointFields array -->
|
||||||
<IntVectorProperty
|
<StringVectorProperty
|
||||||
name="IncludeSets"
|
name="PointFieldArrayInfo"
|
||||||
command="SetIncludeSets"
|
information_only="1">
|
||||||
number_of_elements="1"
|
<ArraySelectionInformationHelper attribute_name="PointField"/>
|
||||||
default_values="0">
|
</StringVectorProperty>
|
||||||
<BooleanDomain
|
<StringVectorProperty
|
||||||
name="bool"/>
|
name="PointFieldStatus"
|
||||||
</IntVectorProperty>
|
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>
|
||||||
|
|
||||||
<!-- Include zones check box -->
|
<!-- Extrapolate Walls check-box -->
|
||||||
<IntVectorProperty
|
<IntVectorProperty
|
||||||
name="IncludeZones"
|
name="ExtrapolateWalls"
|
||||||
command="SetIncludeZones"
|
command="SetExtrapolateWalls"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
default_values="0">
|
default_values="0"
|
||||||
<BooleanDomain
|
animateable="0">
|
||||||
name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Show patch names check box -->
|
<!-- Include Sets check-box -->
|
||||||
<IntVectorProperty
|
<IntVectorProperty
|
||||||
name="ShowPatchNames"
|
name="IncludeSets"
|
||||||
command="SetShowPatchNames"
|
command="SetIncludeSets"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
default_values="0">
|
default_values="0"
|
||||||
<BooleanDomain name="bool"/>
|
animateable="0">
|
||||||
</IntVectorProperty>
|
<BooleanDomain name="bool"/>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Available regions array -->
|
<!-- Include Zones check-box -->
|
||||||
<StringVectorProperty
|
<IntVectorProperty
|
||||||
name="RegionArrayInfo"
|
name="IncludeZones"
|
||||||
information_only="1">
|
command="SetIncludeZones"
|
||||||
<ArraySelectionInformationHelper
|
number_of_elements="1"
|
||||||
attribute_name="Region"/>
|
default_values="0"
|
||||||
</StringVectorProperty>
|
animateable="0">
|
||||||
<StringVectorProperty
|
<BooleanDomain name="bool"/>
|
||||||
name="RegionStatus"
|
</IntVectorProperty>
|
||||||
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 -->
|
<!-- Show Patch Names check-box -->
|
||||||
<StringVectorProperty
|
<IntVectorProperty
|
||||||
name="VolFieldArrayInfo"
|
name="ShowPatchNames"
|
||||||
information_only="1">
|
command="SetShowPatchNames"
|
||||||
<ArraySelectionInformationHelper
|
number_of_elements="1"
|
||||||
attribute_name="VolField"/>
|
default_values="0"
|
||||||
</StringVectorProperty>
|
animateable="0">
|
||||||
<StringVectorProperty
|
<BooleanDomain name="bool"/>
|
||||||
name="VolFieldStatus"
|
</IntVectorProperty>
|
||||||
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 -->
|
<!-- Cache Mesh check-box -->
|
||||||
<StringVectorProperty
|
<IntVectorProperty
|
||||||
name="PointFieldArrayInfo"
|
name="CacheMesh"
|
||||||
information_only="1">
|
command="SetCacheMesh"
|
||||||
<ArraySelectionInformationHelper
|
number_of_elements="1"
|
||||||
attribute_name="PointField"/>
|
default_values="1"
|
||||||
</StringVectorProperty>
|
animateable="0">
|
||||||
<StringVectorProperty
|
<BooleanDomain name="bool"/>
|
||||||
name="PointFieldStatus"
|
</IntVectorProperty>
|
||||||
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 -->
|
<!-- Update GUI check box -->
|
||||||
<StringVectorProperty
|
<IntVectorProperty
|
||||||
name="LagrangianFieldArrayInfo"
|
name="UpdateGUI"
|
||||||
information_only="1">
|
command="SetUpdateGUI"
|
||||||
<ArraySelectionInformationHelper
|
number_of_elements="1"
|
||||||
attribute_name="LagrangianField"/>
|
default_values="0"
|
||||||
</StringVectorProperty>
|
animateable="0">
|
||||||
<StringVectorProperty
|
<BooleanDomain name="bool"/>
|
||||||
name="LagrangianFieldStatus"
|
</IntVectorProperty>
|
||||||
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 -->
|
</SourceProxy>
|
||||||
<IntVectorProperty
|
</ProxyGroup>
|
||||||
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>
|
|
||||||
</ServerManagerConfiguration>
|
</ServerManagerConfiguration>
|
||||||
|
|||||||
@ -59,11 +59,10 @@ vtkPV3FoamReader::vtkPV3FoamReader()
|
|||||||
this->GetExecutive()->SetOutputData(1, lagrangian);
|
this->GetExecutive()->SetOutputData(1, lagrangian);
|
||||||
lagrangian->Delete();
|
lagrangian->Delete();
|
||||||
|
|
||||||
TimeStep = 0;
|
|
||||||
TimeStepRange[0] = 0;
|
TimeStepRange[0] = 0;
|
||||||
TimeStepRange[1] = 0;
|
TimeStepRange[1] = 0;
|
||||||
|
|
||||||
CacheMesh = 0;
|
CacheMesh = 1;
|
||||||
|
|
||||||
ExtrapolateWalls = 0;
|
ExtrapolateWalls = 0;
|
||||||
IncludeSets = 0;
|
IncludeSets = 0;
|
||||||
@ -181,7 +180,7 @@ int vtkPV3FoamReader::RequestInformation
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foamData_->UpdateInformation();
|
foamData_->updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
int nTimeSteps = 0;
|
int nTimeSteps = 0;
|
||||||
@ -349,6 +348,15 @@ int vtkPV3FoamReader::RequestData
|
|||||||
|
|
||||||
foamData_->Update(output, lagrangianOutput);
|
foamData_->Update(output, lagrangianOutput);
|
||||||
|
|
||||||
|
if (ShowPatchNames)
|
||||||
|
{
|
||||||
|
addPatchNamesToView();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
removePatchNamesFromView();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -408,7 +416,13 @@ void vtkPV3FoamReader::PrintSelf(ostream& os, vtkIndent indent)
|
|||||||
os<< indent << "Time step range: "
|
os<< indent << "Time step range: "
|
||||||
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1]
|
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1]
|
||||||
<< "\n";
|
<< "\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)
|
void vtkPV3FoamReader::SetRegionArrayStatus(const char* name, int status)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetRegionArrayStatus");
|
vtkDebugMacro(<<"SetRegionArrayStatus");
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
RegionSelection->EnableArray(name);
|
RegionSelection->EnableArray(name);
|
||||||
|
|||||||
@ -21,20 +21,16 @@
|
|||||||
#ifndef __vtkPV3FoamReader_h
|
#ifndef __vtkPV3FoamReader_h
|
||||||
#define __vtkPV3FoamReader_h
|
#define __vtkPV3FoamReader_h
|
||||||
|
|
||||||
#include "vtkMultiBlockDataSetAlgorithm.h"
|
|
||||||
|
|
||||||
// Foam forward declarations
|
// Foam forward declarations
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
class vtkPV3Foam;
|
class vtkPV3Foam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VTK includes
|
||||||
|
#include "vtkMultiBlockDataSetAlgorithm.h"
|
||||||
|
|
||||||
// VTK forward declarations
|
// VTK forward declarations
|
||||||
class vtkUnstructuredGrid;
|
|
||||||
class vtkPoints;
|
|
||||||
class vtkIntArray;
|
|
||||||
class vtkFloatArray;
|
|
||||||
class vtkDoubleArray;
|
|
||||||
class vtkDataArraySelection;
|
class vtkDataArraySelection;
|
||||||
class vtkCallbackCommand;
|
class vtkCallbackCommand;
|
||||||
|
|
||||||
@ -44,41 +40,31 @@ class VTK_IO_EXPORT vtkPV3FoamReader
|
|||||||
public vtkMultiBlockDataSetAlgorithm
|
public vtkMultiBlockDataSetAlgorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
vtkTypeRevisionMacro(vtkPV3FoamReader,vtkMultiBlockDataSetAlgorithm);
|
||||||
|
void PrintSelf(ostream&, vtkIndent);
|
||||||
|
|
||||||
static vtkPV3FoamReader* New();
|
static vtkPV3FoamReader* New();
|
||||||
|
|
||||||
vtkTypeRevisionMacro
|
// Description:
|
||||||
(
|
// Get the current timestep and the timestep range.
|
||||||
vtkPV3FoamReader,
|
vtkGetVector2Macro(TimeStepRange, int);
|
||||||
vtkMultiBlockDataSetAlgorithm
|
|
||||||
);
|
|
||||||
|
|
||||||
void PrintSelf
|
|
||||||
(
|
|
||||||
ostream& os,
|
|
||||||
vtkIndent indent
|
|
||||||
);
|
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Set/Get the filename.
|
// Set/Get the filename.
|
||||||
vtkSetStringMacro(FileName);
|
vtkSetStringMacro(FileName);
|
||||||
vtkGetStringMacro(FileName);
|
vtkGetStringMacro(FileName);
|
||||||
|
|
||||||
// Time control
|
// Description:
|
||||||
// Set/Get the timestep and the timestep range
|
|
||||||
vtkSetMacro(TimeStep, int);
|
|
||||||
vtkGetMacro(TimeStep, int);
|
|
||||||
vtkSetVector2Macro(TimeStepRange, int);
|
|
||||||
vtkGetVector2Macro(TimeStepRange, int);
|
|
||||||
|
|
||||||
// GUI update control
|
// GUI update control
|
||||||
vtkSetMacro(UpdateGUI, int);
|
vtkSetMacro(UpdateGUI, int);
|
||||||
vtkGetMacro(UpdateGUI, int);
|
vtkGetMacro(UpdateGUI, int);
|
||||||
|
|
||||||
|
// Description:
|
||||||
// FOAM mesh caching control
|
// FOAM mesh caching control
|
||||||
vtkSetMacro(CacheMesh, int);
|
vtkSetMacro(CacheMesh, int);
|
||||||
vtkGetMacro(CacheMesh, int);
|
vtkGetMacro(CacheMesh, int);
|
||||||
|
|
||||||
|
// Description:
|
||||||
// FOAM extrapolate internal values onto the walls
|
// FOAM extrapolate internal values onto the walls
|
||||||
vtkSetMacro(ExtrapolateWalls, int);
|
vtkSetMacro(ExtrapolateWalls, int);
|
||||||
vtkGetMacro(ExtrapolateWalls, int);
|
vtkGetMacro(ExtrapolateWalls, int);
|
||||||
@ -87,42 +73,53 @@ public:
|
|||||||
vtkSetMacro(IncludeSets, int);
|
vtkSetMacro(IncludeSets, int);
|
||||||
vtkGetMacro(IncludeSets, int);
|
vtkGetMacro(IncludeSets, int);
|
||||||
|
|
||||||
|
// Description:
|
||||||
// FOAM read zones control
|
// FOAM read zones control
|
||||||
vtkSetMacro(IncludeZones, int);
|
vtkSetMacro(IncludeZones, int);
|
||||||
vtkGetMacro(IncludeZones, int);
|
vtkGetMacro(IncludeZones, int);
|
||||||
|
|
||||||
|
// Description:
|
||||||
// FOAM display patch names control
|
// FOAM display patch names control
|
||||||
vtkSetMacro(ShowPatchNames, int);
|
vtkSetMacro(ShowPatchNames, int);
|
||||||
vtkGetMacro(ShowPatchNames, int);
|
vtkGetMacro(ShowPatchNames, int);
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Get the current timestep
|
||||||
|
int GetTimeStep();
|
||||||
|
|
||||||
|
// Description:
|
||||||
// Region selection list control
|
// Region selection list control
|
||||||
vtkDataArraySelection* GetRegionSelection();
|
vtkDataArraySelection* GetRegionSelection();
|
||||||
int GetNumberOfRegionArrays();
|
int GetNumberOfRegionArrays();
|
||||||
const char* GetRegionArrayName(int index);
|
int GetRegionArrayStatus(const char* name);
|
||||||
int GetRegionArrayStatus(const char* name);
|
|
||||||
void SetRegionArrayStatus(const char* name, int status);
|
void SetRegionArrayStatus(const char* name, int status);
|
||||||
|
const char* GetRegionArrayName(int index);
|
||||||
|
|
||||||
|
// Description:
|
||||||
// volField selection list control
|
// volField selection list control
|
||||||
vtkDataArraySelection* GetVolFieldSelection();
|
vtkDataArraySelection* GetVolFieldSelection();
|
||||||
int GetNumberOfVolFieldArrays();
|
int GetNumberOfVolFieldArrays();
|
||||||
const char* GetVolFieldArrayName(int index);
|
int GetVolFieldArrayStatus(const char* name);
|
||||||
int GetVolFieldArrayStatus(const char* name);
|
|
||||||
void SetVolFieldArrayStatus(const char* name, int status);
|
void SetVolFieldArrayStatus(const char* name, int status);
|
||||||
|
const char* GetVolFieldArrayName(int index);
|
||||||
|
|
||||||
|
// Description:
|
||||||
// pointField selection list control
|
// pointField selection list control
|
||||||
vtkDataArraySelection* GetPointFieldSelection();
|
vtkDataArraySelection* GetPointFieldSelection();
|
||||||
int GetNumberOfPointFieldArrays();
|
int GetNumberOfPointFieldArrays();
|
||||||
int GetPointFieldArrayStatus(const char* name);
|
int GetPointFieldArrayStatus(const char* name);
|
||||||
void SetPointFieldArrayStatus(const char* name, int status);
|
void SetPointFieldArrayStatus(const char* name, int status);
|
||||||
const char* GetPointFieldArrayName(int index);
|
const char* GetPointFieldArrayName(int index);
|
||||||
|
|
||||||
|
// Description:
|
||||||
// lagrangianField selection list control
|
// lagrangianField selection list control
|
||||||
vtkDataArraySelection* GetLagrangianFieldSelection();
|
vtkDataArraySelection* GetLagrangianFieldSelection();
|
||||||
int GetNumberOfLagrangianFieldArrays();
|
int GetNumberOfLagrangianFieldArrays();
|
||||||
int GetLagrangianFieldArrayStatus(const char* name);
|
int GetLagrangianFieldArrayStatus(const char* name);
|
||||||
void SetLagrangianFieldArrayStatus(const char* name, int status);
|
void SetLagrangianFieldArrayStatus(const char* name, int status);
|
||||||
const char* GetLagrangianFieldArrayName(int index);
|
const char* GetLagrangianFieldArrayName(int index);
|
||||||
|
|
||||||
|
// Description:
|
||||||
// Callback registered with the SelectionObserver
|
// Callback registered with the SelectionObserver
|
||||||
// for all the selection lists
|
// for all the selection lists
|
||||||
static void SelectionModifiedCallback
|
static void SelectionModifiedCallback
|
||||||
@ -138,18 +135,13 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
vtkPV3FoamReader();
|
vtkPV3FoamReader();
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
~vtkPV3FoamReader();
|
~vtkPV3FoamReader();
|
||||||
|
|
||||||
char* FileName;
|
//- Return information about mesh, times, etc without loading anything
|
||||||
|
|
||||||
virtual int RequestData
|
|
||||||
(
|
|
||||||
vtkInformation*,
|
|
||||||
vtkInformationVector**,
|
|
||||||
vtkInformationVector*
|
|
||||||
);
|
|
||||||
|
|
||||||
virtual int RequestInformation
|
virtual int RequestInformation
|
||||||
(
|
(
|
||||||
vtkInformation*,
|
vtkInformation*,
|
||||||
@ -157,16 +149,30 @@ protected:
|
|||||||
vtkInformationVector*
|
vtkInformationVector*
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- 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*);
|
virtual int FillOutputPortInformation(int, vtkInformation*);
|
||||||
|
|
||||||
// The observer to modify this object when the array selections
|
// The observer to modify this object when array selections are modified
|
||||||
// are modified
|
|
||||||
vtkCallbackCommand* SelectionObserver;
|
vtkCallbackCommand* SelectionObserver;
|
||||||
|
|
||||||
|
char* FileName;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
vtkPV3FoamReader(const vtkPV3FoamReader&); // Not implemented.
|
//- Disallow default bitwise copy construct
|
||||||
void operator=(const vtkPV3FoamReader&); // Not implemented.
|
vtkPV3FoamReader(const vtkPV3FoamReader&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const vtkPV3FoamReader&);
|
||||||
|
|
||||||
//- Add patch names to the view
|
//- Add patch names to the view
|
||||||
void addPatchNamesToView();
|
void addPatchNamesToView();
|
||||||
@ -174,9 +180,7 @@ private:
|
|||||||
//- Remove patch names from the view
|
//- Remove patch names from the view
|
||||||
void removePatchNamesFromView();
|
void removePatchNamesFromView();
|
||||||
|
|
||||||
int TimeStep;
|
|
||||||
int TimeStepRange[2];
|
int TimeStepRange[2];
|
||||||
|
|
||||||
int CacheMesh;
|
int CacheMesh;
|
||||||
|
|
||||||
int ExtrapolateWalls;
|
int ExtrapolateWalls;
|
||||||
@ -184,7 +188,7 @@ private:
|
|||||||
int IncludeZones;
|
int IncludeZones;
|
||||||
int ShowPatchNames;
|
int ShowPatchNames;
|
||||||
|
|
||||||
//- Dummy variable/switch for provoking a reader update
|
//- Dummy variable/switch for invoke a reader update
|
||||||
int UpdateGUI;
|
int UpdateGUI;
|
||||||
|
|
||||||
vtkDataArraySelection* RegionSelection;
|
vtkDataArraySelection* RegionSelection;
|
||||||
@ -192,7 +196,7 @@ private:
|
|||||||
vtkDataArraySelection* PointFieldSelection;
|
vtkDataArraySelection* PointFieldSelection;
|
||||||
vtkDataArraySelection* LagrangianFieldSelection;
|
vtkDataArraySelection* LagrangianFieldSelection;
|
||||||
|
|
||||||
//- Cached data for output port0
|
//- Cached data for output port0 (experimental!)
|
||||||
vtkMultiBlockDataSet* output0_;
|
vtkMultiBlockDataSet* output0_;
|
||||||
|
|
||||||
//BTX
|
//BTX
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
vtkPV3Foam.C
|
vtkPV3Foam.C
|
||||||
vtkPV3FoamAddVolumeMesh.C
|
vtkPV3FoamFields.C
|
||||||
vtkPV3FoamAddLagrangianMesh.C
|
vtkPV3FoamMesh.C
|
||||||
vtkPV3FoamAddPatchMesh.C
|
vtkPV3FoamMeshLagrangian.C
|
||||||
vtkPV3FoamAddZoneMesh.C
|
vtkPV3FoamMeshPatch.C
|
||||||
vtkPV3FoamAddSetMesh.C
|
vtkPV3FoamMeshSet.C
|
||||||
vtkPV3FoamUpdateInformation.C
|
vtkPV3FoamMeshVolume.C
|
||||||
vtkPV3FoamConvertMesh.C
|
vtkPV3FoamMeshZone.C
|
||||||
vtkPV3FoamConvertFields.C
|
vtkPV3FoamUpdateInfo.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libvtkPV3Foam
|
LIB = $(FOAM_LIBBIN)/libvtkPV3Foam
|
||||||
|
|||||||
@ -25,13 +25,12 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
// Foam includes
|
// Foam includes
|
||||||
#include "Time.H"
|
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "IOobjectList.H"
|
#include "Time.H"
|
||||||
#include "patchZones.H"
|
#include "patchZones.H"
|
||||||
#include "vtkPV3FoamReader.h"
|
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
@ -54,8 +53,7 @@ defineTypeNameAndDebug(Foam::vtkPV3Foam, 0);
|
|||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "vtkPV3FoamAddToSelection.H"
|
#include "vtkPV3FoamAddToSelection.H"
|
||||||
#include "vtkPV3FoamUpdateInformationFields.H"
|
#include "vtkPV3FoamUpdateInfoFields.H"
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::AddToBlock
|
void Foam::vtkPV3Foam::AddToBlock
|
||||||
(
|
(
|
||||||
@ -161,19 +159,19 @@ Foam::label Foam::vtkPV3Foam::GetNumberOfDataSets
|
|||||||
void Foam::vtkPV3Foam::resetCounters()
|
void Foam::vtkPV3Foam::resetCounters()
|
||||||
{
|
{
|
||||||
// Reset region ids and sizes
|
// Reset region ids and sizes
|
||||||
selectInfoVolume_.reset();
|
regionInfoVolume_.reset();
|
||||||
selectInfoPatches_.reset();
|
regionInfoPatches_.reset();
|
||||||
selectInfoLagrangian_.reset();
|
regionInfoLagrangian_.reset();
|
||||||
selectInfoCellZones_.reset();
|
regionInfoCellZones_.reset();
|
||||||
selectInfoFaceZones_.reset();
|
regionInfoFaceZones_.reset();
|
||||||
selectInfoPointZones_.reset();
|
regionInfoPointZones_.reset();
|
||||||
selectInfoCellSets_.reset();
|
regionInfoCellSets_.reset();
|
||||||
selectInfoFaceSets_.reset();
|
regionInfoFaceSets_.reset();
|
||||||
selectInfoPointSets_.reset();
|
regionInfoPointSets_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::vtkPV3Foam::setTime(const double& requestedTime)
|
int Foam::vtkPV3Foam::setTime(const double& requestedTime)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -186,17 +184,12 @@ bool Foam::vtkPV3Foam::setTime(const double& requestedTime)
|
|||||||
// Get times list
|
// Get times list
|
||||||
instantList Times = runTime.times();
|
instantList Times = runTime.times();
|
||||||
|
|
||||||
bool found = false;
|
int foundIndex = Time::findClosestTimeIndex(Times, requestedTime);
|
||||||
int nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
|
int nearestIndex = foundIndex;
|
||||||
|
|
||||||
if (nearestIndex == -1)
|
if (foundIndex < 0)
|
||||||
{
|
{
|
||||||
nearestIndex = 0;
|
nearestIndex = 0;
|
||||||
found = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// see what has changed
|
// see what has changed
|
||||||
@ -213,16 +206,17 @@ bool Foam::vtkPV3Foam::setTime(const double& requestedTime)
|
|||||||
if (meshPtr_->readUpdate() != polyMesh::UNCHANGED)
|
if (meshPtr_->readUpdate() != polyMesh::UNCHANGED)
|
||||||
{
|
{
|
||||||
meshChanged_ = true;
|
meshChanged_ = true;
|
||||||
reader_->UpdateProgress(0.05);
|
|
||||||
|
|
||||||
// patches, zones etc might have changed
|
|
||||||
UpdateInformation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
meshChanged_ = true;
|
meshChanged_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reader_->UpdateProgress(0.05);
|
||||||
|
|
||||||
|
// this seems to be needed for catching Lagrangian fields
|
||||||
|
updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -233,91 +227,109 @@ bool Foam::vtkPV3Foam::setTime(const double& requestedTime)
|
|||||||
<< " fieldsChanged=" << fieldsChanged_ << endl;
|
<< " fieldsChanged=" << fieldsChanged_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return foundIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateSelectedRegions()
|
void Foam::vtkPV3Foam::updateRegionStatus()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateSelectedRegions" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::updateRegionStatus" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
const label nSelect = regionSelection->GetNumberOfArrays();
|
||||||
const label nSelect = arraySelection->GetNumberOfArrays();
|
if (regionStatus_.size() != nSelect)
|
||||||
|
|
||||||
if (selectedRegions_.size() != nSelect)
|
|
||||||
{
|
{
|
||||||
selectedRegions_.setSize(nSelect);
|
regionStatus_.setSize(nSelect);
|
||||||
selectedRegions_ = 0;
|
regionStatus_ = false;
|
||||||
meshChanged_ = true;
|
meshChanged_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedRegionDatasetIds_.setSize(nSelect);
|
// this needs fixing if we wish to re-use the datasets
|
||||||
|
regionDataset_.setSize(nSelect);
|
||||||
|
regionDataset_ = -1;
|
||||||
|
|
||||||
// Read the selected cell regions, zones, patches and add to region list
|
// Read the selected cell regions, zones, patches and add to region list
|
||||||
forAll (selectedRegions_, regionId)
|
forAll(regionStatus_, regionId)
|
||||||
{
|
{
|
||||||
int setting = arraySelection->GetArraySetting(regionId);
|
int setting = regionSelection->GetArraySetting(regionId);
|
||||||
|
|
||||||
if (selectedRegions_[regionId] != setting)
|
if (regionStatus_[regionId] != setting)
|
||||||
{
|
{
|
||||||
selectedRegions_[regionId] = setting;
|
regionStatus_[regionId] = setting;
|
||||||
meshChanged_ = true;
|
meshChanged_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedRegionDatasetIds_[regionId] = -1;
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< " region[" << regionId << "] = "
|
Info<< " region[" << regionId << "] = "
|
||||||
<< selectedRegions_[regionId]
|
<< regionStatus_[regionId]
|
||||||
<< " : " << arraySelection->GetArrayName(regionId) << endl;
|
<< " : " << regionSelection->GetArrayName(regionId) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateSelectedRegions" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateRegionStatus" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Foam::wordHashSet Foam::vtkPV3Foam::getSelected
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int nElem = select->GetNumberOfArrays();
|
||||||
|
wordHashSet selections(2*nElem);
|
||||||
|
|
||||||
|
for (int elemI=0; elemI < nElem; ++elemI)
|
||||||
|
{
|
||||||
|
if (select->GetArraySetting(elemI))
|
||||||
|
{
|
||||||
|
word name(getFirstWord(select->GetArrayName(elemI)));
|
||||||
|
selections.insert(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selections;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
vtkDataArraySelection* select,
|
||||||
const bool firstWord
|
const bool firstWord
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
stringList selections(arraySelection->GetNumberOfArrays());
|
stringList selections(select->GetNumberOfArrays());
|
||||||
label nElem = 0;
|
label nElem = 0;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "available(";
|
Info<< "available(";
|
||||||
forAll (selections, elemI)
|
forAll(selections, elemI)
|
||||||
{
|
{
|
||||||
Info<< " \"" << arraySelection->GetArrayName(elemI) << "\"";
|
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
||||||
}
|
}
|
||||||
Info<< " )\n"
|
Info<< " )\n"
|
||||||
<< "selected(";
|
<< "selected(";
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll (selections, elemI)
|
forAll(selections, elemI)
|
||||||
{
|
{
|
||||||
if (arraySelection->GetArraySetting(elemI))
|
if (select->GetArraySetting(elemI))
|
||||||
{
|
{
|
||||||
if (firstWord)
|
if (firstWord)
|
||||||
{
|
{
|
||||||
selections[nElem] = getFirstWord
|
selections[nElem] = getFirstWord
|
||||||
(
|
(
|
||||||
arraySelection->GetArrayName(elemI)
|
select->GetArrayName(elemI)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
selections[nElem] = arraySelection->GetArrayName(elemI);
|
selections[nElem] = select->GetArrayName(elemI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -341,7 +353,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
|||||||
|
|
||||||
Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
vtkDataArraySelection* select,
|
||||||
const selectionInfo& selector,
|
const selectionInfo& selector,
|
||||||
const bool firstWord
|
const bool firstWord
|
||||||
)
|
)
|
||||||
@ -359,7 +371,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
|||||||
++elemI
|
++elemI
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< " \"" << arraySelection->GetArrayName(elemI) << "\"";
|
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< " )\n"
|
Info<< " )\n"
|
||||||
@ -373,18 +385,18 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
|||||||
++elemI
|
++elemI
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (arraySelection->GetArraySetting(elemI))
|
if (select->GetArraySetting(elemI))
|
||||||
{
|
{
|
||||||
if (firstWord)
|
if (firstWord)
|
||||||
{
|
{
|
||||||
selections[nElem] = getFirstWord
|
selections[nElem] = getFirstWord
|
||||||
(
|
(
|
||||||
arraySelection->GetArrayName(elemI)
|
select->GetArrayName(elemI)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
selections[nElem] = arraySelection->GetArrayName(elemI);
|
selections[nElem] = select->GetArrayName(elemI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -408,7 +420,7 @@ Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
|||||||
|
|
||||||
void Foam::vtkPV3Foam::setSelectedArrayEntries
|
void Foam::vtkPV3Foam::setSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
vtkDataArraySelection* select,
|
||||||
const stringList& selections
|
const stringList& selections
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -416,13 +428,13 @@ void Foam::vtkPV3Foam::setSelectedArrayEntries
|
|||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::setSelectedArrayEntries" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::setSelectedArrayEntries" << endl;
|
||||||
}
|
}
|
||||||
const label nEntries = arraySelection->GetNumberOfArrays();
|
const label nEntries = select->GetNumberOfArrays();
|
||||||
|
|
||||||
// Reset all current entries to 'not selected'
|
// Reset all current entries to 'not selected'
|
||||||
arraySelection->DisableAllArrays();
|
select->DisableAllArrays();
|
||||||
|
|
||||||
// Loop through entries, setting values from selectedEntries
|
// Loop through entries, setting values from selectedEntries
|
||||||
forAll (selections, elemI)
|
forAll(selections, elemI)
|
||||||
{
|
{
|
||||||
if (debug > 1)
|
if (debug > 1)
|
||||||
{
|
{
|
||||||
@ -432,7 +444,7 @@ void Foam::vtkPV3Foam::setSelectedArrayEntries
|
|||||||
|
|
||||||
for (label i=0; i<nEntries; i++)
|
for (label i=0; i<nEntries; i++)
|
||||||
{
|
{
|
||||||
string arrayName = arraySelection->GetArrayName(i);
|
string arrayName = select->GetArrayName(i);
|
||||||
|
|
||||||
if (arrayName == selections[elemI])
|
if (arrayName == selections[elemI])
|
||||||
{
|
{
|
||||||
@ -443,7 +455,7 @@ void Foam::vtkPV3Foam::setSelectedArrayEntries
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
arraySelection->EnableArray(arrayName.c_str());
|
select->EnableArray(arrayName.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,20 +478,19 @@ Foam::vtkPV3Foam::vtkPV3Foam
|
|||||||
reader_(reader),
|
reader_(reader),
|
||||||
dbPtr_(NULL),
|
dbPtr_(NULL),
|
||||||
meshPtr_(NULL),
|
meshPtr_(NULL),
|
||||||
selectInfoVolume_("unzoned"),
|
|
||||||
selectInfoPatches_("patches"),
|
|
||||||
selectInfoLagrangian_("lagrangian"),
|
|
||||||
selectInfoCellZones_("cellZone"),
|
|
||||||
selectInfoFaceZones_("faceZone"),
|
|
||||||
selectInfoPointZones_("pointZone"),
|
|
||||||
selectInfoCellSets_("cellSet"),
|
|
||||||
selectInfoFaceSets_("faceSet"),
|
|
||||||
selectInfoPointSets_("pointSet"),
|
|
||||||
patchTextActorsPtrs_(0),
|
|
||||||
nMesh_(0),
|
nMesh_(0),
|
||||||
timeIndex_(-1),
|
timeIndex_(-1),
|
||||||
meshChanged_(true),
|
meshChanged_(true),
|
||||||
fieldsChanged_(true)
|
fieldsChanged_(true),
|
||||||
|
regionInfoVolume_("unzoned"),
|
||||||
|
regionInfoPatches_("patches"),
|
||||||
|
regionInfoLagrangian_("lagrangian"),
|
||||||
|
regionInfoCellZones_("cellZone"),
|
||||||
|
regionInfoFaceZones_("faceZone"),
|
||||||
|
regionInfoPointZones_("pointZone"),
|
||||||
|
regionInfoCellSets_("cellSet"),
|
||||||
|
regionInfoFaceSets_("faceSet"),
|
||||||
|
regionInfoPointSets_("pointSet")
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -528,11 +539,7 @@ Foam::vtkPV3Foam::vtkPV3Foam
|
|||||||
|
|
||||||
dbPtr_().functionObjects().off();
|
dbPtr_().functionObjects().off();
|
||||||
|
|
||||||
// Set initial cloud name
|
updateInfo();
|
||||||
// TODO - TEMPORARY MEASURE UNTIL CAN PROCESS MULTIPLE CLOUDS
|
|
||||||
cloudName_ = "";
|
|
||||||
|
|
||||||
UpdateInformation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -551,22 +558,22 @@ Foam::vtkPV3Foam::~vtkPV3Foam()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::UpdateInformation()
|
void Foam::vtkPV3Foam::updateInfo()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::UpdateInformation"
|
Info<< "<beg> Foam::vtkPV3Foam::updateInfo"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] TimeStep="
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] timeIndex="
|
||||||
<< reader_->GetTimeStep() << endl;
|
<< timeIndex_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
resetCounters();
|
resetCounters();
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
stringList selectedEntries;
|
stringList selectedEntries;
|
||||||
// enable 'internalMesh' on the first call
|
// enable 'internalMesh' on the first call
|
||||||
if (arraySelection->GetNumberOfArrays() == 0 && !meshPtr_)
|
if (regionSelection->GetNumberOfArrays() == 0 && !meshPtr_)
|
||||||
{
|
{
|
||||||
selectedEntries.setSize(1);
|
selectedEntries.setSize(1);
|
||||||
selectedEntries[0] = "internalMesh";
|
selectedEntries[0] = "internalMesh";
|
||||||
@ -576,33 +583,25 @@ void Foam::vtkPV3Foam::UpdateInformation()
|
|||||||
// preserve the enabled selections
|
// preserve the enabled selections
|
||||||
selectedEntries = getSelectedArrayEntries
|
selectedEntries = getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
arraySelection,
|
regionSelection,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear current region list/array
|
// Clear current region list/array
|
||||||
arraySelection->RemoveAllArrays();
|
regionSelection->RemoveAllArrays();
|
||||||
|
|
||||||
// Update region array
|
// Update region array - add Lagrangian at the bottom
|
||||||
updateInformationInternalMesh();
|
updateInfoInternalMesh();
|
||||||
updateInformationLagrangian();
|
updateInfoPatches();
|
||||||
updateInformationPatches();
|
updateInfoSets();
|
||||||
|
updateInfoZones();
|
||||||
if (reader_->GetIncludeSets())
|
updateInfoLagrangian();
|
||||||
{
|
|
||||||
updateInformationSets();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reader_->GetIncludeZones())
|
|
||||||
{
|
|
||||||
updateInformationZones();
|
|
||||||
}
|
|
||||||
|
|
||||||
// restore the enabled selections
|
// restore the enabled selections
|
||||||
setSelectedArrayEntries
|
setSelectedArrayEntries
|
||||||
(
|
(
|
||||||
arraySelection,
|
regionSelection,
|
||||||
selectedEntries
|
selectedEntries
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -611,24 +610,20 @@ void Foam::vtkPV3Foam::UpdateInformation()
|
|||||||
fieldsChanged_ = true;
|
fieldsChanged_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update volField array
|
// Update volume, point and lagrangian fields
|
||||||
updateInformationFields<fvPatchField, volMesh>
|
updateInfoFields<fvPatchField, volMesh>
|
||||||
(
|
(
|
||||||
reader_->GetVolFieldSelection()
|
reader_->GetVolFieldSelection()
|
||||||
);
|
);
|
||||||
|
updateInfoFields<pointPatchField, pointMesh>
|
||||||
// Update pointField array
|
|
||||||
updateInformationFields<pointPatchField, pointMesh>
|
|
||||||
(
|
(
|
||||||
reader_->GetPointFieldSelection()
|
reader_->GetPointFieldSelection()
|
||||||
);
|
);
|
||||||
|
updateInfoLagrangianFields();
|
||||||
// Update lagrangian field array
|
|
||||||
updateInformationLagrangianFields();
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::UpdateInformation" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfo" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -702,7 +697,7 @@ void Foam::vtkPV3Foam::Update
|
|||||||
reader_->UpdateProgress(0.1);
|
reader_->UpdateProgress(0.1);
|
||||||
|
|
||||||
// Set up region selection(s)
|
// Set up region selection(s)
|
||||||
updateSelectedRegions();
|
updateRegionStatus();
|
||||||
|
|
||||||
// Update the Foam mesh
|
// Update the Foam mesh
|
||||||
updateFoamMesh();
|
updateFoamMesh();
|
||||||
@ -793,29 +788,25 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
|
|||||||
// Remove any patch names previously added to the renderer
|
// Remove any patch names previously added to the renderer
|
||||||
removePatchNames(renderer);
|
removePatchNames(renderer);
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addPatchNames" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the display patches, strip off any suffix
|
// get the display patches, strip off any suffix
|
||||||
const stringList selectedPatches = getSelectedArrayEntries
|
const stringList selectedPatches = getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
reader_->GetRegionSelection(),
|
reader_->GetRegionSelection(),
|
||||||
selectInfoPatches_,
|
regionInfoPatches_,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<<"... add patches: " << selectedPatches << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!selectedPatches.size())
|
if (!selectedPatches.size())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::addPatchNames" << nl
|
||||||
|
<<"... add patches: " << selectedPatches << endl;
|
||||||
|
}
|
||||||
|
|
||||||
const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh();
|
const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh();
|
||||||
|
|
||||||
// Find the total number of zones
|
// Find the total number of zones
|
||||||
@ -977,11 +968,6 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
|
|||||||
|
|
||||||
void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer)
|
void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer)
|
||||||
{
|
{
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "removePatchNames()" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(patchTextActorsPtrs_, patchI)
|
forAll(patchTextActorsPtrs_, patchI)
|
||||||
{
|
{
|
||||||
renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]);
|
renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]);
|
||||||
|
|||||||
@ -32,23 +32,22 @@ SourceFiles
|
|||||||
vtkPV3Foam.C
|
vtkPV3Foam.C
|
||||||
vtkPV3Foam.H
|
vtkPV3Foam.H
|
||||||
vtkPV3FoamI.H
|
vtkPV3FoamI.H
|
||||||
vtkPV3FoamAddLagrangianMesh.C
|
vtkPV3FoamFields.C
|
||||||
vtkPV3FoamAddPatchMesh.C
|
vtkPV3FoamMesh.C
|
||||||
vtkPV3FoamAddSetMesh.C
|
vtkPV3FoamMeshLagrangian.C
|
||||||
|
vtkPV3FoamMeshPatch.C
|
||||||
|
vtkPV3FoamMeshSet.C
|
||||||
|
vtkPV3FoamMeshVolume.C
|
||||||
|
vtkPV3FoamMeshZone.C
|
||||||
|
vtkPV3FoamFaceField.H
|
||||||
|
vtkPV3FoamLagrangianFields.H
|
||||||
|
vtkPV3FoamPatchField.H
|
||||||
|
vtkPV3FoamPointFields.H
|
||||||
|
vtkPV3FoamPoints.H
|
||||||
|
vtkPV3FoamUpdateInfo.C
|
||||||
|
vtkPV3FoamUpdateInfoFields.H
|
||||||
|
vtkPV3FoamVolFields.H
|
||||||
vtkPV3FoamAddToSelection.H
|
vtkPV3FoamAddToSelection.H
|
||||||
vtkPV3FoamAddVolumeMesh.C
|
|
||||||
vtkPV3FoamAddZoneMesh.C
|
|
||||||
vtkPV3FoamConvertFields.C
|
|
||||||
vtkPV3FoamConvertFaceField.H
|
|
||||||
vtkPV3FoamConvertLagrangianFields.H
|
|
||||||
vtkPV3FoamConvertMesh.C
|
|
||||||
vtkPV3FoamConvertPatchFaceField.H
|
|
||||||
vtkPV3FoamConvertPatchPointField.H
|
|
||||||
vtkPV3FoamConvertPointFields.H
|
|
||||||
vtkPV3FoamConvertVolFields.H
|
|
||||||
vtkPV3FoamInsertNextPoint.H
|
|
||||||
vtkPV3FoamUpdateInformation.C
|
|
||||||
vtkPV3FoamUpdateInformationFields.H
|
|
||||||
|
|
||||||
// Needed by VTK:
|
// Needed by VTK:
|
||||||
vtkDataArrayTemplateImplicit.txx
|
vtkDataArrayTemplateImplicit.txx
|
||||||
@ -104,9 +103,55 @@ class List;
|
|||||||
|
|
||||||
class vtkPV3Foam
|
class vtkPV3Foam
|
||||||
{
|
{
|
||||||
public:
|
// Private data
|
||||||
|
|
||||||
// Public data
|
//- Access to the controlling vtkPV3FoamReader
|
||||||
|
vtkPV3FoamReader* reader_;
|
||||||
|
|
||||||
|
//- Foam time control
|
||||||
|
autoPtr<Time> dbPtr_;
|
||||||
|
|
||||||
|
//- Foam mesh
|
||||||
|
fvMesh* meshPtr_;
|
||||||
|
|
||||||
|
//- Number of meshes
|
||||||
|
// TODO - for info only - only set up to process ONE mesh
|
||||||
|
int nMesh_;
|
||||||
|
|
||||||
|
//- The time index
|
||||||
|
int timeIndex_;
|
||||||
|
|
||||||
|
//- Track changes in mesh geometry
|
||||||
|
bool meshChanged_;
|
||||||
|
|
||||||
|
//- Track changes in fields
|
||||||
|
bool fieldsChanged_;
|
||||||
|
|
||||||
|
//- Cell-centre labels used as additional points for decomposed cells
|
||||||
|
labelList addPointCellLabels_;
|
||||||
|
|
||||||
|
//- Label of original cell for decomposed cells (internal mesh)
|
||||||
|
labelList superCells_;
|
||||||
|
|
||||||
|
//- Label of original cell for decomposed cells (cellZone meshes)
|
||||||
|
List<labelList> zoneSuperCells_;
|
||||||
|
|
||||||
|
//- Label of original cell for decomposed cells (cellSet meshes)
|
||||||
|
List<labelList> csetSuperCells_;
|
||||||
|
|
||||||
|
//- List of patch names
|
||||||
|
List<vtkTextActor*> patchTextActorsPtrs_;
|
||||||
|
|
||||||
|
|
||||||
|
//- Selected geometrical pieces
|
||||||
|
// [0] = internal mesh, patches, zones, sets, lagrangian
|
||||||
|
boolList regionStatus_;
|
||||||
|
|
||||||
|
//- Selected regions indices in each respective block
|
||||||
|
labelList regionDataset_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private classes
|
||||||
|
|
||||||
//- bookkeeping for the GUI checklists and the multi-block organization
|
//- bookkeeping for the GUI checklists and the multi-block organization
|
||||||
class selectionInfo
|
class selectionInfo
|
||||||
@ -177,87 +222,20 @@ public:
|
|||||||
{
|
{
|
||||||
size_ += n;
|
size_ += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream& os, const selectionInfo& s)
|
|
||||||
{
|
|
||||||
os << "selector: " << s.name_
|
|
||||||
<< " (block " << s.block_ << ") "
|
|
||||||
<< " = " << s.start_ << " + " << s.size_;
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Access to the controlling vtkPV3FoamReader
|
|
||||||
vtkPV3FoamReader* reader_;
|
|
||||||
|
|
||||||
//- Foam time control
|
|
||||||
autoPtr<Time> dbPtr_;
|
|
||||||
|
|
||||||
//- Foam mesh
|
|
||||||
fvMesh* meshPtr_;
|
|
||||||
|
|
||||||
//- First instance and size of various regions
|
//- First instance and size of various regions
|
||||||
selectionInfo selectInfoVolume_;
|
selectionInfo regionInfoVolume_;
|
||||||
selectionInfo selectInfoPatches_;
|
selectionInfo regionInfoPatches_;
|
||||||
selectionInfo selectInfoLagrangian_;
|
selectionInfo regionInfoLagrangian_;
|
||||||
selectionInfo selectInfoCellZones_;
|
selectionInfo regionInfoCellZones_;
|
||||||
selectionInfo selectInfoFaceZones_;
|
selectionInfo regionInfoFaceZones_;
|
||||||
selectionInfo selectInfoPointZones_;
|
selectionInfo regionInfoPointZones_;
|
||||||
selectionInfo selectInfoCellSets_;
|
selectionInfo regionInfoCellSets_;
|
||||||
selectionInfo selectInfoFaceSets_;
|
selectionInfo regionInfoFaceSets_;
|
||||||
selectionInfo selectInfoPointSets_;
|
selectionInfo regionInfoPointSets_;
|
||||||
|
|
||||||
//- Selected regions
|
|
||||||
// [0] = internal mesh, then lagrangian, patches, zones, sets
|
|
||||||
boolList selectedRegions_;
|
|
||||||
|
|
||||||
//- Selected regions indices in each respective block
|
|
||||||
labelList selectedRegionDatasetIds_;
|
|
||||||
|
|
||||||
//- Labels of cell-centres used as additional points when decomposing
|
|
||||||
// polyhedra
|
|
||||||
labelList addPointCellLabels_;
|
|
||||||
|
|
||||||
//- Label of original cell for decomposed cells
|
|
||||||
// - internal mesh
|
|
||||||
labelList superCells_;
|
|
||||||
|
|
||||||
//- Label of original cell for decomposed cells
|
|
||||||
// - cellZone meshes
|
|
||||||
List<labelList> zoneSuperCells_;
|
|
||||||
|
|
||||||
//- Label of original cell for decomposed cells
|
|
||||||
// - cellSet meshes
|
|
||||||
List<labelList> csetSuperCells_;
|
|
||||||
|
|
||||||
//- List of patch names
|
|
||||||
List<vtkTextActor*> patchTextActorsPtrs_;
|
|
||||||
|
|
||||||
|
|
||||||
// Dataset sizes
|
|
||||||
|
|
||||||
//- Number of meshes
|
|
||||||
// TODO - for info only - only set up to process ONE mesh
|
|
||||||
int nMesh_;
|
|
||||||
|
|
||||||
//- Cloud name to be processed
|
|
||||||
// TODO - currently only set up to process ONE cloud
|
|
||||||
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
|
||||||
@ -296,44 +274,41 @@ private:
|
|||||||
// Update information helper functions
|
// Update information helper functions
|
||||||
|
|
||||||
//- Update the regions selected in the GUI
|
//- Update the regions selected in the GUI
|
||||||
void updateSelectedRegions();
|
void updateRegionStatus();
|
||||||
|
|
||||||
//- Internal mesh info
|
//- Internal mesh info
|
||||||
void updateInformationInternalMesh();
|
void updateInfoInternalMesh();
|
||||||
|
|
||||||
//- Lagrangian info
|
//- Lagrangian info
|
||||||
void updateInformationLagrangian();
|
void updateInfoLagrangian();
|
||||||
|
|
||||||
//- Patch info
|
//- Patch info
|
||||||
void updateInformationPatches();
|
void updateInfoPatches();
|
||||||
|
|
||||||
//- Set info
|
//- Set info
|
||||||
void updateInformationSets();
|
void updateInfoSets();
|
||||||
|
|
||||||
|
//- Zone info
|
||||||
|
void updateInfoZones();
|
||||||
|
|
||||||
//- Read zone names for zoneType from file
|
//- Read zone names for zoneType from file
|
||||||
wordList readZoneNames(const word& zoneType);
|
wordList readZoneNames(const word& zoneType);
|
||||||
|
|
||||||
//- Zone info
|
|
||||||
void updateInformationZones();
|
|
||||||
|
|
||||||
//- Add to paraview array selection
|
//- Add to paraview array selection
|
||||||
template<class Type>
|
template<class Type>
|
||||||
label addToSelection
|
label addToSelection
|
||||||
(
|
(
|
||||||
vtkDataArraySelection *arraySelection,
|
vtkDataArraySelection*,
|
||||||
const IOobjectList&,
|
const IOobjectList&,
|
||||||
const string& suffix=string::null
|
const string& suffix=string::null
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Field info
|
//- Field info
|
||||||
template<template<class> class patchType, class meshType>
|
template<template<class> class patchType, class meshType>
|
||||||
void updateInformationFields
|
void updateInfoFields(vtkDataArraySelection*);
|
||||||
(
|
|
||||||
vtkDataArraySelection *fieldSelection
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Lagrangian field info
|
//- Lagrangian field info
|
||||||
void updateInformationLagrangianFields();
|
void updateInfoLagrangianFields();
|
||||||
|
|
||||||
|
|
||||||
// Update helper functions
|
// Update helper functions
|
||||||
@ -384,64 +359,48 @@ private:
|
|||||||
// Add mesh functions
|
// Add mesh functions
|
||||||
|
|
||||||
//- Add internal mesh/cell set meshes
|
//- Add internal mesh/cell set meshes
|
||||||
void addVolumeMesh
|
vtkUnstructuredGrid* volumeVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
vtkUnstructuredGrid*,
|
|
||||||
labelList& superCells
|
labelList& superCells
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Add Lagrangian mesh
|
//- Add Lagrangian mesh
|
||||||
void addLagrangianMesh
|
vtkPolyData* lagrangianVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
vtkPolyData*
|
const word& cloudName
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Add patch mesh
|
//- Add patch mesh
|
||||||
void addPatchMesh
|
vtkPolyData* patchVTKMesh(const polyPatch&);
|
||||||
(
|
|
||||||
const polyPatch&,
|
|
||||||
vtkPolyData*
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Add face zone mesh
|
//- Add face zone mesh
|
||||||
void addFaceZoneMesh
|
vtkPolyData* faceZoneVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
const labelList& faceLabels,
|
const labelList& faceLabels
|
||||||
vtkPolyData*
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Add point zone
|
//- Add point zone
|
||||||
void addPointZoneMesh
|
vtkPolyData* pointZoneVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
const labelList& pointLabels,
|
const labelList& pointLabels
|
||||||
vtkPolyData*
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Add cell set mesh
|
|
||||||
void addCellSetMesh
|
|
||||||
(
|
|
||||||
const fvMesh&,
|
|
||||||
vtkUnstructuredGrid*
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Add face set mesh
|
//- Add face set mesh
|
||||||
void addFaceSetMesh
|
vtkPolyData* faceSetVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
const faceSet&,
|
const faceSet&
|
||||||
vtkPolyData*
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Add point mesh
|
//- Add point mesh
|
||||||
void addPointSetMesh
|
vtkPolyData* pointSetVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
const pointSet&,
|
const pointSet&
|
||||||
vtkPolyData*
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Field conversion functions
|
// Field conversion functions
|
||||||
@ -461,8 +420,8 @@ private:
|
|||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
label addObjectsToSelection
|
label addObjectsToSelection
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* fieldSelection,
|
vtkDataArraySelection*,
|
||||||
const IOobjectList& objects,
|
const IOobjectList&,
|
||||||
const string& suffix=string::null
|
const string& suffix=string::null
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -474,14 +433,13 @@ private:
|
|||||||
void convertVolFields
|
void convertVolFields
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
const volPointInterpolation& pInterp,
|
const volPointInterpolation&,
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch> >&,
|
const PtrList<PrimitivePatchInterpolation<primitivePatch> >&,
|
||||||
const IOobjectList& objects,
|
const IOobjectList&,
|
||||||
vtkDataArraySelection* fieldSelection,
|
|
||||||
vtkMultiBlockDataSet* output
|
vtkMultiBlockDataSet* output
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Volume field - all types except scalar
|
//- Volume field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertVolField
|
void convertVolField
|
||||||
(
|
(
|
||||||
@ -494,7 +452,7 @@ private:
|
|||||||
|
|
||||||
//- Patch field
|
//- Patch field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertPatchFaceField
|
void convertPatchField
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const Field<Type>&,
|
const Field<Type>&,
|
||||||
@ -531,13 +489,12 @@ private:
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void convertLagrangianFields
|
void convertLagrangianFields
|
||||||
(
|
(
|
||||||
const fvMesh&,
|
const IOobjectList&,
|
||||||
const IOobjectList& objects,
|
vtkMultiBlockDataSet* output,
|
||||||
vtkDataArraySelection *fieldSelection,
|
const label datasetNo
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Lagrangian field - all types except scalar
|
//- Lagrangian field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertLagrangianField
|
void convertLagrangianField
|
||||||
(
|
(
|
||||||
@ -551,29 +508,29 @@ private:
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void convertPointFields
|
void convertPointFields
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh&,
|
||||||
const IOobjectList& objects,
|
const pointMesh&,
|
||||||
vtkDataArraySelection *fieldSelection,
|
const IOobjectList&,
|
||||||
vtkMultiBlockDataSet* output
|
vtkMultiBlockDataSet* output
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Point fields - all types except scalar
|
//- Point fields
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertPointField
|
void convertPointField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
const GeometricField<Type, pointPatchField, pointMesh>&,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
const selectionInfo&,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Patch point field - all types except scalar
|
//- Patch point field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertPatchPointField
|
void convertPatchPointField
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const Field<Type>& tf,
|
const Field<Type>&,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
const selectionInfo&,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
@ -585,17 +542,27 @@ private:
|
|||||||
//- Extract up to the first non-word characters
|
//- Extract up to the first non-word characters
|
||||||
inline static word getFirstWord(const char*);
|
inline static word getFirstWord(const char*);
|
||||||
|
|
||||||
|
//- Subset an IOobjectList based on a hashSet
|
||||||
|
static void subsetObjectList
|
||||||
|
(
|
||||||
|
IOobjectList&,
|
||||||
|
const wordHashSet&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Store the current selection(s)
|
||||||
|
static wordHashSet getSelected(vtkDataArraySelection*);
|
||||||
|
|
||||||
//- Store the current selection(s)
|
//- Store the current selection(s)
|
||||||
static stringList getSelectedArrayEntries
|
static stringList getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
vtkDataArraySelection*,
|
||||||
const bool firstWord=false
|
const bool firstWord=false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Store the current selection(s) for a sub-selection
|
//- Store the current selection(s) for a sub-selection
|
||||||
static stringList getSelectedArrayEntries
|
static stringList getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
vtkDataArraySelection*,
|
||||||
const selectionInfo&,
|
const selectionInfo&,
|
||||||
const bool firstWord=false
|
const bool firstWord=false
|
||||||
);
|
);
|
||||||
@ -603,8 +570,8 @@ private:
|
|||||||
//- Set selection(s)
|
//- Set selection(s)
|
||||||
static void setSelectedArrayEntries
|
static void setSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
vtkDataArraySelection*,
|
||||||
const stringList& selectedEntries
|
const stringList&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -640,7 +607,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Update
|
//- Update
|
||||||
void UpdateInformation();
|
void updateInfo();
|
||||||
|
|
||||||
void Update
|
void Update
|
||||||
(
|
(
|
||||||
@ -658,10 +625,15 @@ public:
|
|||||||
//- Remove patch names from the display
|
//- Remove patch names from the display
|
||||||
void removePatchNames(vtkRenderer* renderer);
|
void removePatchNames(vtkRenderer* renderer);
|
||||||
|
|
||||||
//- set the runTime to the requested time
|
//- set the runTime to the requested time, returns the timeIndex
|
||||||
// sets to "constant" on error
|
// sets to "constant" on error and returns -1
|
||||||
bool setTime(const double& requestedTime);
|
int setTime(const double& requestedTime);
|
||||||
|
|
||||||
|
//- The current time index
|
||||||
|
int timeIndex() const
|
||||||
|
{
|
||||||
|
return timeIndex_;
|
||||||
|
}
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#define vtkPV3FoamAddToSelection_H
|
#define vtkPV3FoamAddToSelection_H
|
||||||
|
|
||||||
// FOAM includes
|
// FOAM includes
|
||||||
|
#include "IOobjectList.H"
|
||||||
#include "SortableList.H"
|
#include "SortableList.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
@ -38,7 +39,7 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::label Foam::vtkPV3Foam::addToSelection
|
Foam::label Foam::vtkPV3Foam::addToSelection
|
||||||
(
|
(
|
||||||
vtkDataArraySelection *arraySelection,
|
vtkDataArraySelection *select,
|
||||||
const IOobjectList& objectLst,
|
const IOobjectList& objectLst,
|
||||||
const string& suffix
|
const string& suffix
|
||||||
)
|
)
|
||||||
@ -57,7 +58,7 @@ Foam::label Foam::vtkPV3Foam::addToSelection
|
|||||||
{
|
{
|
||||||
objectNames.sort();
|
objectNames.sort();
|
||||||
|
|
||||||
forAll (objectNames, objI)
|
forAll(objectNames, objI)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -67,14 +68,14 @@ Foam::label Foam::vtkPV3Foam::addToSelection
|
|||||||
|
|
||||||
if (suffix.size())
|
if (suffix.size())
|
||||||
{
|
{
|
||||||
arraySelection->AddArray
|
select->AddArray
|
||||||
(
|
(
|
||||||
(objectNames[objI] + suffix).c_str()
|
(objectNames[objI] + suffix).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
arraySelection->AddArray
|
select->AddArray
|
||||||
(
|
(
|
||||||
objectNames[objI].c_str()
|
objectNames[objI].c_str()
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,233 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
|
||||||
|
|
||||||
// Foam includes
|
|
||||||
#include "IOobjectList.H"
|
|
||||||
#include "vtkPV3FoamReader.h"
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkDataArraySelection.h"
|
|
||||||
#include "vtkPolyData.h"
|
|
||||||
#include "vtkUnstructuredGrid.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "vtkPV3FoamConvertVolFields.H"
|
|
||||||
#include "vtkPV3FoamConvertPointFields.H"
|
|
||||||
#include "vtkPV3FoamConvertLagrangianFields.H"
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertVolFields
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertVolFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Construct interpolation on the raw mesh
|
|
||||||
pointMesh pMesh(mesh);
|
|
||||||
|
|
||||||
// Search for list of objects for this time
|
|
||||||
IOobjectList objects(mesh, dbPtr_().timeName());
|
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetVolFieldSelection();
|
|
||||||
|
|
||||||
// Convert volume fields
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting Foam volume fields" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
volPointInterpolation pInterp(mesh, pMesh);
|
|
||||||
|
|
||||||
PtrList<PrimitivePatchInterpolation<primitivePatch> >
|
|
||||||
ppInterpList(mesh.boundaryMesh().size());
|
|
||||||
|
|
||||||
forAll(ppInterpList, i)
|
|
||||||
{
|
|
||||||
ppInterpList.set
|
|
||||||
(
|
|
||||||
i,
|
|
||||||
new PrimitivePatchInterpolation<primitivePatch>
|
|
||||||
(
|
|
||||||
mesh.boundaryMesh()[i]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
convertVolFields<Foam::scalar>
|
|
||||||
(
|
|
||||||
mesh, pInterp, ppInterpList, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertVolFields<Foam::vector>
|
|
||||||
(
|
|
||||||
mesh, pInterp, ppInterpList, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertVolFields<Foam::sphericalTensor>
|
|
||||||
(
|
|
||||||
mesh, pInterp, ppInterpList, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertVolFields<Foam::symmTensor>
|
|
||||||
(
|
|
||||||
mesh, pInterp, ppInterpList, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertVolFields<Foam::tensor>
|
|
||||||
(
|
|
||||||
mesh, pInterp, ppInterpList, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertVolFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertPointFields
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertPointFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Search for list of objects for this time
|
|
||||||
IOobjectList objects(mesh, dbPtr_().timeName());
|
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetPointFieldSelection();
|
|
||||||
|
|
||||||
convertPointFields<Foam::scalar>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertPointFields<Foam::vector>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertPointFields<Foam::sphericalTensor>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertPointFields<Foam::symmTensor>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertPointFields<Foam::tensor>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertPointFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertLagrangianFields
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertLagrangianFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Search for list of objects for this time
|
|
||||||
//- TODO - currently hard-coded to ONE cloud
|
|
||||||
IOobjectList objects
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
dbPtr_().timeName(),
|
|
||||||
"lagrangian"/cloudName_
|
|
||||||
);
|
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelection =
|
|
||||||
reader_->GetLagrangianFieldSelection();
|
|
||||||
|
|
||||||
// Convert Lagrangian fields
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting Lagrangian fields - "
|
|
||||||
<< selectInfoLagrangian_ << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
convertLagrangianFields<Foam::label>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
|
|
||||||
convertLagrangianFields<Foam::scalar>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertLagrangianFields<Foam::vector>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertLagrangianFields<Foam::sphericalTensor>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertLagrangianFields<Foam::symmTensor>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
convertLagrangianFields<Foam::tensor>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertLagrangianFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,151 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPV3Foam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkPV3FoamConvertLagrangianFields_H
|
|
||||||
#define vtkPV3FoamConvertLagrangianFields_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPV3Foam::convertLagrangianFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkDataArraySelection* fieldSelection,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const selectionInfo& selector = selectInfoLagrangian_;
|
|
||||||
|
|
||||||
IOobjectList fieldObjects
|
|
||||||
(
|
|
||||||
objects.lookupClass
|
|
||||||
(
|
|
||||||
IOField<Type>::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label nFields = fieldSelection->GetNumberOfArrays();
|
|
||||||
for (label i=0; i<nFields; i++)
|
|
||||||
{
|
|
||||||
const word fieldName = fieldSelection->GetArrayName(i);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!fieldSelection->GetArraySetting(i)
|
|
||||||
|| !fieldObjects.found(fieldName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
IOField<Type> iotf
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
"lagrangian"/cloudName_,
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Convert Lagrangian points
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selector.start();
|
|
||||||
regionId < selector.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
convertLagrangianField
|
|
||||||
(
|
|
||||||
iotf, output, selector,
|
|
||||||
selectedRegionDatasetIds_[regionId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPV3Foam::convertLagrangianField
|
|
||||||
(
|
|
||||||
const IOField<Type>& tf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const selectionInfo& selector,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
|
||||||
);
|
|
||||||
|
|
||||||
vtkFloatArray *pointData = vtkFloatArray::New();
|
|
||||||
pointData->SetNumberOfTuples(tf.size());
|
|
||||||
pointData->SetNumberOfComponents(nComp);
|
|
||||||
pointData->Allocate(nComp*tf.size());
|
|
||||||
pointData->SetName(tf.name().c_str());
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting Lagrangian <Type>Field: " << tf.name() << nl
|
|
||||||
<< "tf.size() = " << tf.size() << nl
|
|
||||||
<< "nComp = " << nComp << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
|
|
||||||
forAll(tf, i)
|
|
||||||
{
|
|
||||||
for (direction d=0; d<nComp; d++)
|
|
||||||
{
|
|
||||||
vec[d] = component(tf[i], d);
|
|
||||||
}
|
|
||||||
|
|
||||||
pointData->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkmesh->GetPointData()->AddArray(pointData);
|
|
||||||
pointData->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -27,8 +27,8 @@ InClass
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPV3FoamConvertFaceField_H
|
#ifndef vtkPV3FoamFaceField_H
|
||||||
#define vtkPV3FoamConvertFaceField_H
|
#define vtkPV3FoamFaceField_H
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellData.h"
|
#include "vtkCellData.h"
|
||||||
@ -60,13 +60,24 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
const labelList& faceNeigh = mesh.faceNeighbour();
|
const labelList& faceNeigh = mesh.faceNeighbour();
|
||||||
|
|
||||||
vtkFloatArray *cellData = vtkFloatArray::New();
|
vtkFloatArray *cellData = vtkFloatArray::New();
|
||||||
cellData->SetNumberOfTuples(faceLabels.size());
|
cellData->SetNumberOfTuples( faceLabels.size() );
|
||||||
cellData->SetNumberOfComponents(nComp);
|
cellData->SetNumberOfComponents( nComp );
|
||||||
cellData->Allocate(nComp*faceLabels.size());
|
cellData->Allocate( nComp*faceLabels.size() );
|
||||||
cellData->SetName(tf.name().c_str());
|
cellData->SetName( tf.name().c_str() );
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert convertFaceField: "
|
||||||
|
<< tf.name()
|
||||||
|
<< " size = " << tf.size()
|
||||||
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << faceLabels.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
float vec[nComp];
|
float vec[nComp];
|
||||||
|
|
||||||
|
// for interior faces: average owner/neighbour
|
||||||
|
// for boundary faces: owner
|
||||||
forAll(faceLabels, faceI)
|
forAll(faceLabels, faceI)
|
||||||
{
|
{
|
||||||
const label faceNo = faceLabels[faceI];
|
const label faceNo = faceLabels[faceI];
|
||||||
@ -119,13 +130,24 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
const labelList& faceNeigh = mesh.faceNeighbour();
|
const labelList& faceNeigh = mesh.faceNeighbour();
|
||||||
|
|
||||||
vtkFloatArray *cellData = vtkFloatArray::New();
|
vtkFloatArray *cellData = vtkFloatArray::New();
|
||||||
cellData->SetNumberOfTuples(fSet.size());
|
cellData->SetNumberOfTuples( fSet.size() );
|
||||||
cellData->SetNumberOfComponents(nComp);
|
cellData->SetNumberOfComponents( nComp );
|
||||||
cellData->Allocate(nComp*fSet.size());
|
cellData->Allocate( nComp*fSet.size() );
|
||||||
cellData->SetName(tf.name().c_str());
|
cellData->SetName( tf.name().c_str() );
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert convertFaceField: "
|
||||||
|
<< tf.name()
|
||||||
|
<< " size = " << tf.size()
|
||||||
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << fSet.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
float vec[nComp];
|
float vec[nComp];
|
||||||
|
|
||||||
|
// for interior faces: average owner/neighbour
|
||||||
|
// for boundary faces: owner
|
||||||
label faceI = 0;
|
label faceI = 0;
|
||||||
forAllConstIter(faceSet, fSet, iter)
|
forAllConstIter(faceSet, fSet, iter)
|
||||||
{
|
{
|
||||||
@ -157,7 +179,6 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
cellData->Delete();
|
cellData->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -0,0 +1,332 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
|
// Foam includes
|
||||||
|
#include "IOobjectList.H"
|
||||||
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
|
// VTK includes
|
||||||
|
#include "vtkDataArraySelection.h"
|
||||||
|
#include "vtkPolyData.h"
|
||||||
|
#include "vtkUnstructuredGrid.h"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "vtkPV3FoamVolFields.H"
|
||||||
|
#include "vtkPV3FoamPointFields.H"
|
||||||
|
#include "vtkPV3FoamLagrangianFields.H"
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::subsetObjectList
|
||||||
|
(
|
||||||
|
IOobjectList& objects,
|
||||||
|
const wordHashSet& selected
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// hash all the selected field names
|
||||||
|
if (!selected.size())
|
||||||
|
{
|
||||||
|
objects.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// only keep selected fields
|
||||||
|
forAllIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
if (!selected.found(iter()->name()))
|
||||||
|
{
|
||||||
|
objects.erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertVolFields
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wordHashSet selectedFields = getSelected
|
||||||
|
(
|
||||||
|
reader_->GetVolFieldSelection()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!selectedFields.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
// Get objects (fields) for this time - only keep selected fields
|
||||||
|
IOobjectList objects(mesh, dbPtr_().timeName());
|
||||||
|
subsetObjectList(objects, selectedFields);
|
||||||
|
|
||||||
|
if (!objects.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertVolFields" << nl
|
||||||
|
<< "converting Foam volume fields" << endl;
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
Info<< " " << iter()->name()
|
||||||
|
<< " == " << iter()->objectPath() << nl;
|
||||||
|
}
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct interpolation on the raw mesh
|
||||||
|
pointMesh pMesh(mesh);
|
||||||
|
volPointInterpolation pInterp(mesh, pMesh);
|
||||||
|
|
||||||
|
PtrList<PrimitivePatchInterpolation<primitivePatch> >
|
||||||
|
ppInterpList(mesh.boundaryMesh().size());
|
||||||
|
|
||||||
|
forAll(ppInterpList, i)
|
||||||
|
{
|
||||||
|
ppInterpList.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
new PrimitivePatchInterpolation<primitivePatch>
|
||||||
|
(
|
||||||
|
mesh.boundaryMesh()[i]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
convertVolFields<scalar>
|
||||||
|
(
|
||||||
|
mesh, pInterp, ppInterpList, objects, output
|
||||||
|
);
|
||||||
|
convertVolFields<vector>
|
||||||
|
(
|
||||||
|
mesh, pInterp, ppInterpList, objects, output
|
||||||
|
);
|
||||||
|
convertVolFields<sphericalTensor>
|
||||||
|
(
|
||||||
|
mesh, pInterp, ppInterpList, objects, output
|
||||||
|
);
|
||||||
|
convertVolFields<symmTensor>
|
||||||
|
(
|
||||||
|
mesh, pInterp, ppInterpList, objects, output
|
||||||
|
);
|
||||||
|
convertVolFields<tensor>
|
||||||
|
(
|
||||||
|
mesh, pInterp, ppInterpList, objects, output
|
||||||
|
);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertVolFields" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertPointFields
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wordHashSet selectedFields = getSelected
|
||||||
|
(
|
||||||
|
reader_->GetPointFieldSelection()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!selectedFields.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
// Get objects (fields) for this time - only keep selected fields
|
||||||
|
IOobjectList objects(mesh, dbPtr_().timeName());
|
||||||
|
|
||||||
|
subsetObjectList(objects, selectedFields);
|
||||||
|
|
||||||
|
if (!objects.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertPointFields" << nl
|
||||||
|
<< "converting Foam volume fields" << endl;
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
Info<< " " << iter()->name()
|
||||||
|
<< " == " << iter()->objectPath() << nl;
|
||||||
|
}
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct interpolation on the raw mesh
|
||||||
|
pointMesh pMesh(mesh);
|
||||||
|
|
||||||
|
|
||||||
|
convertPointFields<scalar>
|
||||||
|
(
|
||||||
|
mesh, pMesh, objects, output
|
||||||
|
);
|
||||||
|
convertPointFields<vector>
|
||||||
|
(
|
||||||
|
mesh, pMesh, objects, output
|
||||||
|
);
|
||||||
|
convertPointFields<sphericalTensor>
|
||||||
|
(
|
||||||
|
mesh, pMesh, objects, output
|
||||||
|
);
|
||||||
|
convertPointFields<symmTensor>
|
||||||
|
(
|
||||||
|
mesh, pMesh, objects, output
|
||||||
|
);
|
||||||
|
convertPointFields<tensor>
|
||||||
|
(
|
||||||
|
mesh, pMesh, objects, output
|
||||||
|
);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertPointFields" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertLagrangianFields
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wordHashSet selectedFields = getSelected
|
||||||
|
(
|
||||||
|
reader_->GetLagrangianFieldSelection()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!selectedFields.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
selectionInfo& selector = regionInfoLagrangian_;
|
||||||
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertLagrangianFields" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int regionId = selector.start();
|
||||||
|
regionId < selector.end();
|
||||||
|
++regionId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
|
||||||
|
if (!regionStatus_[regionId] || datasetNo < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
word cloudName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get the Lagrangian fields for this time and this cloud
|
||||||
|
// but only keep selected fields
|
||||||
|
IOobjectList objects
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
dbPtr_().timeName(),
|
||||||
|
"lagrangian"/cloudName
|
||||||
|
);
|
||||||
|
subsetObjectList(objects, selectedFields);
|
||||||
|
|
||||||
|
if (!objects.size())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "converting Foam lagrangian fields" << nl;
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
Info<< " " << iter()->name()
|
||||||
|
<< " == " << iter()->objectPath() << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
convertLagrangianFields<label>
|
||||||
|
(
|
||||||
|
objects, output, datasetNo
|
||||||
|
);
|
||||||
|
convertLagrangianFields<scalar>
|
||||||
|
(
|
||||||
|
objects, output, datasetNo
|
||||||
|
);
|
||||||
|
convertLagrangianFields<vector>
|
||||||
|
(
|
||||||
|
objects, output, datasetNo
|
||||||
|
);
|
||||||
|
convertLagrangianFields<sphericalTensor>
|
||||||
|
(
|
||||||
|
objects, output, datasetNo
|
||||||
|
);
|
||||||
|
convertLagrangianFields<symmTensor>
|
||||||
|
(
|
||||||
|
objects, output, datasetNo
|
||||||
|
);
|
||||||
|
convertLagrangianFields<tensor>
|
||||||
|
(
|
||||||
|
objects, output, datasetNo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertLagrangianFields" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -27,19 +27,42 @@ InClass
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPV3FoamConvertPatchPointField_H
|
#ifndef vtkPV3FoamLagrangianFields_H
|
||||||
#define vtkPV3FoamConvertPatchPointField_H
|
#define vtkPV3FoamLagrangianFields_H
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkPointData.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::vtkPV3Foam::convertPatchPointField
|
void Foam::vtkPV3Foam::convertLagrangianFields
|
||||||
(
|
(
|
||||||
const word& name,
|
const IOobjectList& objects,
|
||||||
const Field<Type>& pptf,
|
vtkMultiBlockDataSet* output,
|
||||||
|
const label datasetNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const selectionInfo& selector = regionInfoLagrangian_;
|
||||||
|
|
||||||
|
// field subset based on type
|
||||||
|
IOobjectList fieldObjects
|
||||||
|
(
|
||||||
|
objects.lookupClass
|
||||||
|
(
|
||||||
|
IOField<Type>::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
forAllIter(IOobjectList, fieldObjects, iter)
|
||||||
|
{
|
||||||
|
IOField<Type> tf(*iter());
|
||||||
|
convertLagrangianField(tf, output, selector, datasetNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertLagrangianField
|
||||||
|
(
|
||||||
|
const IOField<Type>& tf,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo& selector,
|
const selectionInfo& selector,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
@ -53,18 +76,27 @@ void Foam::vtkPV3Foam::convertPatchPointField
|
|||||||
);
|
);
|
||||||
|
|
||||||
vtkFloatArray *pointData = vtkFloatArray::New();
|
vtkFloatArray *pointData = vtkFloatArray::New();
|
||||||
pointData->SetNumberOfTuples(pptf.size());
|
pointData->SetNumberOfTuples( tf.size() );
|
||||||
pointData->SetNumberOfComponents(nComp);
|
pointData->SetNumberOfComponents( nComp );
|
||||||
pointData->Allocate(nComp*pptf.size());
|
pointData->Allocate( nComp*tf.size() );
|
||||||
pointData->SetName(name.c_str());
|
pointData->SetName( tf.name().c_str() );
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert LagrangianField: "
|
||||||
|
<< tf.name()
|
||||||
|
<< " size = " << tf.size()
|
||||||
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << tf.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
float vec[nComp];
|
float vec[nComp];
|
||||||
|
forAll(tf, i)
|
||||||
forAll(pptf, i)
|
|
||||||
{
|
{
|
||||||
|
const Type& t = tf[i];
|
||||||
for (direction d=0; d<nComp; d++)
|
for (direction d=0; d<nComp; d++)
|
||||||
{
|
{
|
||||||
vec[d] = component(pptf[i], d);
|
vec[d] = component(t, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointData->InsertTuple(i, vec);
|
pointData->InsertTuple(i, vec);
|
||||||
@ -56,13 +56,14 @@ void Foam::vtkPV3Foam::convertMeshVolume
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoVolume_;
|
selectionInfo& selector = regionInfoVolume_;
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
// Create the internal mesh and add as dataset 0
|
// Create the internalMesh
|
||||||
|
// TODO: multiple regions
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selector.start();
|
int regionId = selector.start();
|
||||||
@ -70,34 +71,33 @@ void Foam::vtkPV3Foam::convertMeshVolume
|
|||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!selectedRegions_[regionId])
|
if (!regionStatus_[regionId])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// word selectName = getFirstWord
|
|
||||||
// (
|
|
||||||
// arraySelection->GetArrayName(regionId)
|
|
||||||
// );
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK internalMesh" << endl;
|
Info<< "Creating VTK internalMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label datasetId = 0;
|
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
superCells_
|
||||||
|
);
|
||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
if (vtkmesh)
|
||||||
addVolumeMesh(mesh, vtkmesh, superCells_);
|
{
|
||||||
|
AddToBlock(output, selector, datasetNo, vtkmesh, "internalMesh");
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
AddToBlock(output, selector, datasetId, vtkmesh, "internalMesh");
|
regionDataset_[regionId] = datasetNo++;
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
}
|
||||||
vtkmesh->Delete();
|
|
||||||
|
|
||||||
created = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created)
|
// was anything added?
|
||||||
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
@ -123,13 +123,14 @@ void Foam::vtkPV3Foam::convertMeshLagrangian
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoLagrangian_;
|
selectionInfo& selector = regionInfoLagrangian_;
|
||||||
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
// Create a single Lagrangian mesh and add as dataset 0
|
// Create Lagrangian meshes
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selector.start();
|
int regionId = selector.start();
|
||||||
@ -137,29 +138,28 @@ void Foam::vtkPV3Foam::convertMeshLagrangian
|
|||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!selectedRegions_[regionId])
|
if (!regionStatus_[regionId])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
word cloudName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = lagrangianVTKMesh(mesh, cloudName);
|
||||||
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK Lagrangian mesh" << endl;
|
AddToBlock(output, selector, datasetNo, vtkmesh, cloudName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
regionDataset_[regionId] = datasetNo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label datasetId = 0;
|
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
addLagrangianMesh(mesh, vtkmesh);
|
|
||||||
|
|
||||||
AddToBlock(output, selector, datasetId, vtkmesh, cloudName_);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
|
|
||||||
created = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created)
|
// was anything added?
|
||||||
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
@ -185,18 +185,17 @@ void Foam::vtkPV3Foam::convertMeshPatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoPatches_;
|
selectionInfo& selector = regionInfoPatches_;
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
if (selector.size())
|
if (selector.size())
|
||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Create the patches and add as dataset ...
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selector.start();
|
int regionId = selector.start();
|
||||||
@ -204,52 +203,41 @@ void Foam::vtkPV3Foam::convertMeshPatches
|
|||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!selectedRegions_[regionId])
|
word patchName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
|
label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!regionStatus_[regionId] || patchId < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelection->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
const label patchId = patches.findPatchID(selectName);
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK mesh for patch: " << selectName
|
Info<< "Creating VTK mesh for patch: " << patchName
|
||||||
<< " region index: " << regionId << endl;
|
<< " patch index: " << patchId << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
vtkPolyData* vtkmesh = patchVTKMesh(patches[patchId]);
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock(output, selector, datasetNo, vtkmesh, patchName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
regionDataset_[regionId] = datasetNo++;
|
||||||
addPatchMesh
|
}
|
||||||
(
|
|
||||||
patches[patchId],
|
|
||||||
vtkmesh
|
|
||||||
);
|
|
||||||
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
selectName + ":patch"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
|
|
||||||
created = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created)
|
// was anything added?
|
||||||
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshPatches" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshPatches" << endl;
|
||||||
@ -271,23 +259,32 @@ void Foam::vtkPV3Foam::convertMeshCellZones
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoCellZones_;
|
selectionInfo& selector = regionInfoCellZones_;
|
||||||
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
// Create the cell zone(s) and add as DataSet(CELLZONE, 0..n)
|
|
||||||
if (selector.size())
|
if (selector.size())
|
||||||
{
|
{
|
||||||
const cellZoneMesh& czMesh = mesh.cellZones();
|
const cellZoneMesh& zMesh = mesh.cellZones();
|
||||||
|
|
||||||
// use the zoneId directly instead of the name
|
for
|
||||||
for (int zoneI=0; zoneI < selector.size(); ++zoneI)
|
(
|
||||||
|
int regionId = selector.start();
|
||||||
|
regionId < selector.end();
|
||||||
|
++regionId
|
||||||
|
)
|
||||||
{
|
{
|
||||||
const int regionId = selector.start() + zoneI;
|
word zoneName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
if (!selectedRegions_[regionId])
|
label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (!regionStatus_[regionId] || zoneId < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -295,43 +292,41 @@ void Foam::vtkPV3Foam::convertMeshCellZones
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK mesh for cellZone: "
|
Info<< "Creating VTK mesh for cellZone: "
|
||||||
<< zoneI << endl;
|
<< zoneId << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
fvMeshSubset subsetter(mesh);
|
fvMeshSubset subsetter(mesh);
|
||||||
subsetter.setLargeCellSubset(czMesh[zoneI]);
|
subsetter.setLargeCellSubset(zMesh[zoneId]);
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
|
||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
|
||||||
|
|
||||||
addVolumeMesh
|
|
||||||
(
|
(
|
||||||
subsetter.subMesh(),
|
subsetter.subMesh(),
|
||||||
vtkmesh,
|
zoneSuperCells_[datasetNo]
|
||||||
zoneSuperCells_[datasetId]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// renumber - superCells must contain global cell ids
|
if (vtkmesh)
|
||||||
inplaceRenumber
|
{
|
||||||
(
|
// renumber - superCells must contain global cell ids
|
||||||
subsetter.cellMap(),
|
inplaceRenumber
|
||||||
zoneSuperCells_[datasetId]
|
(
|
||||||
);
|
subsetter.cellMap(),
|
||||||
|
zoneSuperCells_[datasetNo]
|
||||||
|
);
|
||||||
|
|
||||||
AddToBlock
|
AddToBlock
|
||||||
(
|
(
|
||||||
output, selector, datasetId, vtkmesh,
|
output, selector, datasetNo, vtkmesh,
|
||||||
czMesh.names()[zoneI] + ":cellZone"
|
zMesh[zoneId].name() + ":cellZone"
|
||||||
);
|
);
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
vtkmesh->Delete();
|
||||||
vtkmesh->Delete();
|
|
||||||
|
|
||||||
created = true;
|
regionDataset_[regionId] = datasetNo++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created)
|
// was anything added?
|
||||||
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
@ -357,12 +352,12 @@ void Foam::vtkPV3Foam::convertMeshCellSets
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoCellSets_;
|
selectionInfo& selector = regionInfoCellSets_;
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
// Create the cell sets and add as dataset
|
// Create the cell sets and add as dataset
|
||||||
if (selector.size())
|
if (selector.size())
|
||||||
@ -373,57 +368,55 @@ void Foam::vtkPV3Foam::convertMeshCellSets
|
|||||||
regionId < selector.end();
|
regionId < selector.end();
|
||||||
++regionId)
|
++regionId)
|
||||||
{
|
{
|
||||||
if (!selectedRegions_[regionId])
|
if (!regionStatus_[regionId])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
word selectName = getFirstWord
|
word selectedName = getFirstWord
|
||||||
(
|
(
|
||||||
arraySelection->GetArrayName(regionId)
|
regionSelection->GetArrayName(regionId)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK mesh for cellSet: " << selectName
|
Info<< "Creating VTK mesh for cellSet: " << selectedName
|
||||||
<< " region index: " << regionId << endl;
|
<< " region index: " << regionId << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cellSet cSet(mesh, selectName);
|
const cellSet cSet(mesh, selectedName);
|
||||||
fvMeshSubset subsetter(mesh);
|
fvMeshSubset subsetter(mesh);
|
||||||
subsetter.setLargeCellSubset(cSet);
|
subsetter.setLargeCellSubset(cSet);
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
|
||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
|
||||||
|
|
||||||
addVolumeMesh
|
|
||||||
(
|
(
|
||||||
subsetter.subMesh(),
|
subsetter.subMesh(),
|
||||||
vtkmesh,
|
csetSuperCells_[datasetNo]
|
||||||
csetSuperCells_[datasetId]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// renumber - superCells must contain global cell ids
|
if (vtkmesh)
|
||||||
inplaceRenumber
|
{
|
||||||
(
|
// renumber - superCells must contain global cell ids
|
||||||
subsetter.cellMap(),
|
inplaceRenumber
|
||||||
csetSuperCells_[datasetId]
|
(
|
||||||
);
|
subsetter.cellMap(),
|
||||||
|
csetSuperCells_[datasetNo]
|
||||||
|
);
|
||||||
|
|
||||||
AddToBlock
|
AddToBlock
|
||||||
(
|
(
|
||||||
output, selector, datasetId, vtkmesh,
|
output, selector, datasetNo, vtkmesh,
|
||||||
selectName + ":cellSet"
|
selectedName + ":cellSet"
|
||||||
);
|
);
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
vtkmesh->Delete();
|
||||||
vtkmesh->Delete();
|
|
||||||
|
|
||||||
created = true;
|
regionDataset_[regionId] = datasetNo++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created)
|
// was anything added?
|
||||||
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
@ -449,58 +442,65 @@ void Foam::vtkPV3Foam::convertMeshFaceZones
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoFaceZones_;
|
selectionInfo& selector = regionInfoFaceZones_;
|
||||||
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
// Create the cell zone(s) and add as datasets
|
// Create the cell zone(s)
|
||||||
if (selector.size())
|
if (selector.size())
|
||||||
{
|
{
|
||||||
const faceZoneMesh& fzMesh = mesh.faceZones();
|
const faceZoneMesh& zMesh = mesh.faceZones();
|
||||||
|
|
||||||
// use the zoneId directly instead of the name
|
for
|
||||||
for (int zoneI=0; zoneI < selector.size(); ++zoneI)
|
(
|
||||||
|
int regionId = selector.start();
|
||||||
|
regionId < selector.end();
|
||||||
|
++regionId
|
||||||
|
)
|
||||||
{
|
{
|
||||||
const int regionId = selector.start() + zoneI;
|
word zoneName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
if (!selectedRegions_[regionId])
|
const label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (!regionStatus_[regionId] || zoneId < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK mesh for faceZone: "
|
Info<< "Creating VTK mesh for faceZone[" << zoneId
|
||||||
<< zoneI << endl;
|
<< "] " << zoneName << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
vtkPolyData* vtkmesh = faceZoneVTKMesh
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
|
|
||||||
addFaceZoneMesh
|
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
fzMesh[zoneI],
|
zMesh[zoneId]
|
||||||
vtkmesh
|
|
||||||
);
|
);
|
||||||
|
|
||||||
AddToBlock
|
if (vtkmesh)
|
||||||
(
|
{
|
||||||
output, selector, datasetId, vtkmesh,
|
AddToBlock
|
||||||
fzMesh.names()[zoneI] + ":faceZone"
|
(
|
||||||
);
|
output, selector, datasetNo, vtkmesh,
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
zMesh[zoneId].name() + ":faceZone"
|
||||||
vtkmesh->Delete();
|
);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
created = true;
|
regionDataset_[regionId] = datasetNo++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// was anything added?
|
||||||
if (created)
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
@ -526,12 +526,12 @@ void Foam::vtkPV3Foam::convertMeshFaceSets
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoFaceSets_;
|
selectionInfo& selector = regionInfoFaceSets_;
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
// Create the face sets and add as dataset
|
// Create the face sets and add as dataset
|
||||||
if (selector.size())
|
if (selector.size())
|
||||||
@ -543,47 +543,46 @@ void Foam::vtkPV3Foam::convertMeshFaceSets
|
|||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!selectedRegions_[regionId])
|
if (!regionStatus_[regionId])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
word selectName = getFirstWord
|
word selectedName = getFirstWord
|
||||||
(
|
(
|
||||||
arraySelection->GetArrayName(regionId)
|
regionSelection->GetArrayName(regionId)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK mesh for faceSet: " << selectName
|
Info<< "Creating VTK mesh for faceSet: " << selectedName
|
||||||
<< " region index: " << regionId << endl;
|
<< " region index: " << regionId << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const faceSet fSet(mesh, selectName);
|
const faceSet fSet(mesh, selectedName);
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
vtkPolyData* vtkmesh = faceSetVTKMesh
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
addFaceSetMesh
|
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
fSet,
|
fSet
|
||||||
vtkmesh
|
|
||||||
);
|
);
|
||||||
|
|
||||||
AddToBlock
|
if (vtkmesh)
|
||||||
(
|
{
|
||||||
output, selector, datasetId, vtkmesh,
|
AddToBlock
|
||||||
selectName + ":faceSet"
|
(
|
||||||
);
|
output, selector, datasetNo, vtkmesh,
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
selectedName + ":faceSet"
|
||||||
vtkmesh->Delete();
|
);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
created = true;
|
regionDataset_[regionId] = datasetNo++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created)
|
// was anything added?
|
||||||
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
@ -609,62 +608,58 @@ void Foam::vtkPV3Foam::convertMeshPointZones
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoPointZones_;
|
selectionInfo& selector = regionInfoPointZones_;
|
||||||
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
// Create the point sets and add as dataset
|
|
||||||
if (selector.size())
|
if (selector.size())
|
||||||
{
|
{
|
||||||
const pointZoneMesh& pzMesh = mesh.pointZones();
|
const pointZoneMesh& zMesh = mesh.pointZones();
|
||||||
|
|
||||||
// use the zoneId directly instead of the name
|
for
|
||||||
for (int zoneI=0; zoneI < selector.size(); ++zoneI)
|
(
|
||||||
|
int regionId = selector.start();
|
||||||
|
regionId < selector.end();
|
||||||
|
++regionId
|
||||||
|
)
|
||||||
{
|
{
|
||||||
const int regionId = selector.start() + zoneI;
|
word zoneName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
if (!selectedRegions_[regionId])
|
label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (!regionStatus_[regionId] || zoneId < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
vtkPolyData* vtkmesh = pointZoneVTKMesh(mesh, zMesh[zoneId]);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK mesh for pointZone: "
|
AddToBlock
|
||||||
<< zoneI << endl;
|
(
|
||||||
|
output, selector, datasetNo, vtkmesh,
|
||||||
|
zMesh[zoneId].name() + ":pointZone"
|
||||||
|
);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
regionDataset_[regionId] = datasetNo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
|
|
||||||
addPointZoneMesh
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
pzMesh[zoneI],
|
|
||||||
vtkmesh
|
|
||||||
);
|
|
||||||
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
pzMesh.names()[zoneI] + ":pointZone"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
|
|
||||||
created = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created)
|
// was anything added?
|
||||||
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshPointZones" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshPointZones" << endl;
|
||||||
@ -687,14 +682,13 @@ void Foam::vtkPV3Foam::convertMeshPointSets
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
const fvMesh& mesh = *meshPtr_;
|
||||||
selectionInfo& selector = selectInfoPointSets_;
|
selectionInfo& selector = regionInfoPointSets_;
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// set output block and note if anything was added
|
// set output block, restart at dataset 0
|
||||||
selector.block(blockNo);
|
selector.block(blockNo);
|
||||||
bool created = false;
|
label datasetNo = 0;
|
||||||
|
|
||||||
// Create the point sets and add as dataset
|
|
||||||
if (selector.size())
|
if (selector.size())
|
||||||
{
|
{
|
||||||
for
|
for
|
||||||
@ -704,47 +698,41 @@ void Foam::vtkPV3Foam::convertMeshPointSets
|
|||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!selectedRegions_[regionId])
|
if (!regionStatus_[regionId])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
word selectName = getFirstWord
|
word selectedName = getFirstWord
|
||||||
(
|
(
|
||||||
arraySelection->GetArrayName(regionId)
|
regionSelection->GetArrayName(regionId)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "Creating VTK mesh for pointSet: " << selectName
|
Info<< "Creating VTK mesh for pointSet: " << selectedName
|
||||||
<< " region index: " << regionId << endl;
|
<< " region index: " << regionId << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pointSet pSet(mesh, selectName);
|
const pointSet pSet(mesh, selectedName);
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
vtkPolyData* vtkmesh = pointSetVTKMesh(mesh, pSet);
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock
|
||||||
|
(
|
||||||
|
output, selector, datasetNo, vtkmesh,
|
||||||
|
selectedName + ":pointSet"
|
||||||
|
);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
regionDataset_[regionId] = datasetNo++;
|
||||||
addPointSetMesh
|
}
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
pSet,
|
|
||||||
vtkmesh
|
|
||||||
);
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
selectName + ":pointSet"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
|
|
||||||
created = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created)
|
// was anything added?
|
||||||
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
++blockNo;
|
++blockNo;
|
||||||
}
|
}
|
||||||
@ -31,81 +31,68 @@ Description
|
|||||||
// Foam includes
|
// Foam includes
|
||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "passiveParticle.H"
|
|
||||||
#include "vtkPV3FoamInsertNextPoint.H"
|
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
|
#include "passiveParticle.H"
|
||||||
|
#include "vtkPV3FoamPoints.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellArray.h"
|
#include "vtkPoints.h"
|
||||||
#include "vtkPolyData.h"
|
#include "vtkPolyData.h"
|
||||||
#include "vtkUnstructuredGrid.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::addLagrangianMesh
|
vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
vtkPolyData *vtkmesh
|
const word& cloudName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
vtkPolyData* vtkmesh = NULL;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addLagrangianMesh - timePath "
|
Info<< "<beg> Foam::vtkPV3Foam::lagrangianVTKMesh - timePath "
|
||||||
<< mesh.time().timePath()/"lagrangian" << endl;
|
<< mesh.time().timePath()/"lagrangian"/cloudName << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
fileNameList cloudDirs
|
IOobjectList sprayObjs
|
||||||
(
|
(
|
||||||
readDir(mesh.time().timePath()/"lagrangian", fileName::DIRECTORY)
|
mesh,
|
||||||
|
mesh.time().timeName(),
|
||||||
|
"lagrangian"/cloudName
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug && cloudDirs.size())
|
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
||||||
|
if (positionsPtr)
|
||||||
{
|
{
|
||||||
Info<< "... check cloudDirs: " << cloudDirs << endl;
|
Cloud<passiveParticle> parcels(mesh, cloudName, false);
|
||||||
}
|
|
||||||
|
|
||||||
bool foundCloud = false;
|
if (debug)
|
||||||
forAll(cloudDirs, i)
|
|
||||||
{
|
|
||||||
IOobjectList sprayObjs
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
"lagrangian"/cloudDirs[i]
|
|
||||||
);
|
|
||||||
|
|
||||||
IOobject* positionsPtr = sprayObjs.lookup("positions");
|
|
||||||
|
|
||||||
if (positionsPtr && !foundCloud)
|
|
||||||
{
|
{
|
||||||
foundCloud = true;
|
Info<< "cloud with " << parcels.size() << " parcels" << endl;
|
||||||
|
|
||||||
Cloud<passiveParticle> parcels(mesh, cloudDirs[i], false);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "cloud with " << parcels.size() << " parcels" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkPoints* vtkpoints = vtkPoints::New();
|
|
||||||
vtkpoints->Allocate(parcels.size());
|
|
||||||
|
|
||||||
forAllConstIter(Cloud<passiveParticle>, parcels, elmnt)
|
|
||||||
{
|
|
||||||
vtkPV3FoamInsertNextPoint(vtkpoints, elmnt().position());
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkmesh->SetPoints(vtkpoints);
|
|
||||||
vtkpoints->Delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkmesh = vtkPolyData::New();
|
||||||
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
|
vtkpoints->Allocate( parcels.size() );
|
||||||
|
|
||||||
|
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
|
||||||
|
{
|
||||||
|
vtkPV3FoamInsertNextPoint(vtkpoints, iter().position());
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkmesh->SetPoints(vtkpoints);
|
||||||
|
vtkpoints->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::addLagrangianMesh" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::lagrangianVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vtkmesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ Description
|
|||||||
// Foam includes
|
// Foam includes
|
||||||
#include "polyPatch.H"
|
#include "polyPatch.H"
|
||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
#include "vtkPV3FoamInsertNextPoint.H"
|
#include "vtkPV3FoamPoints.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellArray.h"
|
#include "vtkCellArray.h"
|
||||||
@ -40,15 +40,16 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::addPatchMesh
|
vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
|
||||||
(
|
(
|
||||||
const polyPatch& p,
|
const polyPatch& p
|
||||||
vtkPolyData *vtkmesh
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
vtkPolyData* vtkmesh = vtkPolyData::New();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addPatchMesh - " << p.name() << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ void Foam::vtkPV3Foam::addPatchMesh
|
|||||||
const Foam::pointField& points = p.localPoints();
|
const Foam::pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate(points.size());
|
vtkpoints->Allocate( points.size() );
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
|
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
|
||||||
@ -69,14 +70,14 @@ void Foam::vtkPV3Foam::addPatchMesh
|
|||||||
// Add faces as polygons
|
// Add faces as polygons
|
||||||
const faceList& faces = p.localFaces();
|
const faceList& faces = p.localFaces();
|
||||||
|
|
||||||
vtkCellArray * vtkcells = vtkCellArray::New();
|
vtkCellArray* vtkcells = vtkCellArray::New();
|
||||||
vtkcells->Allocate(faces.size());
|
vtkcells->Allocate( faces.size() );
|
||||||
forAll(faces, faceI)
|
forAll(faces, faceI)
|
||||||
{
|
{
|
||||||
const face& f = faces[faceI];
|
const face& f = faces[faceI];
|
||||||
vtkIdType nodeIds[f.size()];
|
vtkIdType nodeIds[f.size()];
|
||||||
|
|
||||||
forAll (f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
nodeIds[fp] = f[fp];
|
nodeIds[fp] = f[fp];
|
||||||
}
|
}
|
||||||
@ -88,9 +89,11 @@ void Foam::vtkPV3Foam::addPatchMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::addPatchMesh - " << p.name() << endl;
|
Info<< "<end> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vtkmesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ Description
|
|||||||
// Foam includes
|
// Foam includes
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
#include "vtkPV3FoamInsertNextPoint.H"
|
#include "vtkPV3FoamPoints.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkPoints.h"
|
#include "vtkPoints.h"
|
||||||
@ -40,16 +40,17 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::addFaceSetMesh
|
vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const faceSet& fSet,
|
const faceSet& fSet
|
||||||
vtkPolyData* vtkmesh
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
vtkPolyData* vtkmesh = vtkPolyData::New();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addFaceSetMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::faceSetVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,13 +66,13 @@ void Foam::vtkPV3Foam::addFaceSetMesh
|
|||||||
primitiveFacePatch p(patchFaces, mesh.points());
|
primitiveFacePatch p(patchFaces, mesh.points());
|
||||||
|
|
||||||
|
|
||||||
// The balance of this routine should be identical to addPatchMesh
|
// The balance of this routine should be identical to patchVTKMesh
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert Foam mesh vertices to VTK
|
||||||
const pointField& points = p.localPoints();
|
const pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate(points.size());
|
vtkpoints->Allocate( points.size() );
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
|
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
|
||||||
@ -83,13 +84,14 @@ void Foam::vtkPV3Foam::addFaceSetMesh
|
|||||||
const faceList& faces = p.localFaces();
|
const faceList& faces = p.localFaces();
|
||||||
|
|
||||||
vtkCellArray* vtkcells = vtkCellArray::New();
|
vtkCellArray* vtkcells = vtkCellArray::New();
|
||||||
vtkcells->Allocate(p.size());
|
vtkcells->Allocate( faces.size() );
|
||||||
|
|
||||||
forAll(faces, faceI)
|
forAll(faces, faceI)
|
||||||
{
|
{
|
||||||
const face& f = faces[faceI];
|
const face& f = faces[faceI];
|
||||||
vtkIdType nodeIds[f.size()];
|
vtkIdType nodeIds[f.size()];
|
||||||
|
|
||||||
forAll (f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
nodeIds[fp] = f[fp];
|
nodeIds[fp] = f[fp];
|
||||||
}
|
}
|
||||||
@ -101,29 +103,32 @@ void Foam::vtkPV3Foam::addFaceSetMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::addFaceSetMesh" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::faceSetVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vtkmesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::addPointSetMesh
|
vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const pointSet& pSet,
|
const pointSet& pSet
|
||||||
vtkPolyData* vtkmesh
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
vtkPolyData* vtkmesh = vtkPolyData::New();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addPointSetMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::pointSetVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
const pointField& meshPoints = mesh.points();
|
const pointField& meshPoints = mesh.points();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate(pSet.size());
|
vtkpoints->Allocate( pSet.size() );
|
||||||
|
|
||||||
forAllConstIter(pointSet, pSet, iter)
|
forAllConstIter(pointSet, pSet, iter)
|
||||||
{
|
{
|
||||||
@ -135,9 +140,12 @@ void Foam::vtkPV3Foam::addPointSetMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::addPointSetMesh" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::pointSetVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vtkmesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -26,35 +26,30 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPV3FoamAddVolumeMesh_H
|
|
||||||
#define vtkPV3FoamAddVolumeMesh_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// Foam includes
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "cellModeller.H"
|
#include "cellModeller.H"
|
||||||
#include "vtkPV3FoamInsertNextPoint.H"
|
#include "vtkPV3FoamPoints.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellArray.h"
|
#include "vtkCellArray.h"
|
||||||
#include "vtkUnstructuredGrid.h"
|
#include "vtkUnstructuredGrid.h"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::addVolumeMesh
|
vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
vtkUnstructuredGrid* vtkmesh,
|
|
||||||
labelList& superCells
|
labelList& superCells
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addVolumeMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::volumeVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,10 +119,10 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<<"mesh.nCells() = " << mesh.nCells() << nl
|
Info<<" mesh nCells = " << mesh.nCells() << nl
|
||||||
<<"mesh.nPoints() = " << mesh.nPoints() << nl
|
<<" nPoints = " << mesh.nPoints() << nl
|
||||||
<<"nAddCells = " << nAddCells << nl
|
<<" nAddCells = " << nAddCells << nl
|
||||||
<<"nAddPoints = " << nAddPoints << endl;
|
<<" nAddPoints = " << nAddPoints << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
superCells.setSize(mesh.nCells() + nAddCells);
|
superCells.setSize(mesh.nCells() + nAddCells);
|
||||||
@ -139,7 +134,7 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert Foam mesh vertices to VTK
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
|
vtkpoints->Allocate( mesh.nPoints() + nAddPoints );
|
||||||
|
|
||||||
const Foam::pointField& points = mesh.points();
|
const Foam::pointField& points = mesh.points();
|
||||||
|
|
||||||
@ -154,21 +149,21 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
Info<< "... converting cells" << endl;
|
Info<< "... converting cells" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->Allocate(mesh.nCells() + nAddCells);
|
vtkmesh->Allocate( mesh.nCells() + nAddCells );
|
||||||
|
|
||||||
// Set counters for additional points and additional cells
|
// Set counters for additional points and additional cells
|
||||||
label api = 0, aci = 0;
|
label addPointI = 0, addCellI = 0;
|
||||||
|
|
||||||
// Create storage for points - needed for mapping from Foam to VTK
|
// Create storage for points - needed for mapping from Foam to VTK
|
||||||
// data types - max 'order' = hex = 8 points
|
// data types - max 'order' = hex = 8 points
|
||||||
vtkIdType nodeIds[8];
|
vtkIdType nodeIds[8];
|
||||||
|
|
||||||
forAll(cellShapes, celli)
|
forAll(cellShapes, cellI)
|
||||||
{
|
{
|
||||||
const cellShape& cellShape = cellShapes[celli];
|
const cellShape& cellShape = cellShapes[cellI];
|
||||||
const cellModel& cellModel = cellShape.model();
|
const cellModel& cellModel = cellShape.model();
|
||||||
|
|
||||||
superCells[aci++] = celli;
|
superCells[addCellI++] = cellI;
|
||||||
|
|
||||||
if (cellModel == tet)
|
if (cellModel == tet)
|
||||||
{
|
{
|
||||||
@ -265,16 +260,16 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
// Polyhedral cell. Decompose into tets + prisms.
|
// Polyhedral cell. Decompose into tets + prisms.
|
||||||
|
|
||||||
// Mapping from additional point to cell
|
// Mapping from additional point to cell
|
||||||
addPointCellLabels_[api] = celli;
|
addPointCellLabels_[addPointI] = cellI;
|
||||||
|
|
||||||
// Insert the new vertex from the cell-centre
|
// Insert the new vertex from the cell-centre
|
||||||
label newVertexLabel = mesh.nPoints() + api;
|
label newVertexLabel = mesh.nPoints() + addPointI;
|
||||||
vtkPV3FoamInsertNextPoint(vtkpoints, mesh.C()[celli]);
|
vtkPV3FoamInsertNextPoint(vtkpoints, mesh.C()[cellI]);
|
||||||
|
|
||||||
// Whether to insert cell in place of original or not.
|
// Whether to insert cell in place of original or not.
|
||||||
bool substituteCell = true;
|
bool substituteCell = true;
|
||||||
|
|
||||||
const labelList& cFaces = mesh.cells()[celli];
|
const labelList& cFaces = mesh.cells()[cellI];
|
||||||
|
|
||||||
forAll(cFaces, cFaceI)
|
forAll(cFaces, cFaceI)
|
||||||
{
|
{
|
||||||
@ -293,13 +288,13 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
|
|
||||||
if (substituteCell)
|
if (substituteCell)
|
||||||
{
|
{
|
||||||
thisCellI = celli;
|
thisCellI = cellI;
|
||||||
substituteCell = false;
|
substituteCell = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thisCellI = mesh.nCells() + aci;
|
thisCellI = mesh.nCells() + addCellI;
|
||||||
superCells[aci++] = celli;
|
superCells[addCellI++] = cellI;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeIds[0] = f[0];
|
nodeIds[0] = f[0];
|
||||||
@ -323,13 +318,13 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
|
|
||||||
if (substituteCell)
|
if (substituteCell)
|
||||||
{
|
{
|
||||||
thisCellI = celli;
|
thisCellI = cellI;
|
||||||
substituteCell = false;
|
substituteCell = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thisCellI = mesh.nCells() + aci;
|
thisCellI = mesh.nCells() + addCellI;
|
||||||
superCells[aci++] = celli;
|
superCells[addCellI++] = cellI;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeIds[0] = f[0];
|
nodeIds[0] = f[0];
|
||||||
@ -345,7 +340,7 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
api++;
|
addPointI++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,14 +349,11 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::addVolumeMesh" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::volumeVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vtkmesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -29,7 +29,7 @@ Description
|
|||||||
#include "vtkPV3Foam.H"
|
#include "vtkPV3Foam.H"
|
||||||
|
|
||||||
// Foam includes
|
// Foam includes
|
||||||
#include "vtkPV3FoamInsertNextPoint.H"
|
#include "vtkPV3FoamPoints.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkPoints.h"
|
#include "vtkPoints.h"
|
||||||
@ -39,20 +39,21 @@ Description
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::addFaceZoneMesh
|
vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const labelList& faceLabels,
|
const labelList& faceLabels
|
||||||
vtkPolyData* vtkmesh
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
vtkPolyData* vtkmesh = vtkPolyData::New();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addFaceZoneMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::faceZoneVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct primitivePatch of faces in fSet.
|
// Construct primitivePatch of faces in faceZone
|
||||||
|
|
||||||
const faceList& meshFaces = mesh.faces();
|
const faceList& meshFaces = mesh.faces();
|
||||||
faceList patchFaces(faceLabels.size());
|
faceList patchFaces(faceLabels.size());
|
||||||
@ -63,31 +64,34 @@ void Foam::vtkPV3Foam::addFaceZoneMesh
|
|||||||
primitiveFacePatch p(patchFaces, mesh.points());
|
primitiveFacePatch p(patchFaces, mesh.points());
|
||||||
|
|
||||||
|
|
||||||
// The balance of this routine should be identical to addPatchMesh
|
// The balance of this routine should be identical to patchVTKMesh
|
||||||
|
|
||||||
// Convert Foam mesh vertices to VTK
|
// Convert Foam mesh vertices to VTK
|
||||||
const pointField& points = p.localPoints();
|
const pointField& points = p.localPoints();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints* vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate(p.size());
|
vtkpoints->Allocate( points.size() );
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
|
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->SetPoints(vtkpoints);
|
vtkmesh->SetPoints(vtkpoints);
|
||||||
vtkpoints->Delete();
|
vtkpoints->Delete();
|
||||||
|
|
||||||
|
|
||||||
// Add faces as polygons
|
// Add faces as polygons
|
||||||
const faceList& faces = p.localFaces();
|
const faceList& faces = p.localFaces();
|
||||||
|
|
||||||
vtkCellArray* vtkcells = vtkCellArray::New();
|
vtkCellArray* vtkcells = vtkCellArray::New();
|
||||||
vtkcells->Allocate(points.size());
|
vtkcells->Allocate( faces.size() );
|
||||||
|
|
||||||
forAll(faces, faceI)
|
forAll(faces, faceI)
|
||||||
{
|
{
|
||||||
const face& f = faces[faceI];
|
const face& f = faces[faceI];
|
||||||
vtkIdType nodeIds[f.size()];
|
vtkIdType nodeIds[f.size()];
|
||||||
|
|
||||||
forAll (f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
nodeIds[fp] = f[fp];
|
nodeIds[fp] = f[fp];
|
||||||
}
|
}
|
||||||
@ -99,30 +103,33 @@ void Foam::vtkPV3Foam::addFaceZoneMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::addFaceZoneMesh" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::faceZoneVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vtkmesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::addPointZoneMesh
|
vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const labelList& pointLabels,
|
const labelList& pointLabels
|
||||||
vtkPolyData* vtkmesh
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
vtkPolyData* vtkmesh = vtkPolyData::New();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addPointZoneMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::pointZoneVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
const pointField& meshPoints = mesh.points();
|
const pointField& meshPoints = mesh.points();
|
||||||
|
|
||||||
vtkPoints *vtkpoints = vtkPoints::New();
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
vtkpoints->Allocate(pointLabels.size());
|
vtkpoints->Allocate( pointLabels.size() );
|
||||||
|
|
||||||
forAll(pointLabels, pointI)
|
forAll(pointLabels, pointI)
|
||||||
{
|
{
|
||||||
@ -134,9 +141,11 @@ void Foam::vtkPV3Foam::addPointZoneMesh
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addPointZoneMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::pointZoneVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vtkmesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -27,19 +27,20 @@ InClass
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPV3FoamConvertPatchFaceField_H
|
#ifndef vtkPV3FoamPatchField_H
|
||||||
#define vtkPV3FoamConvertPatchFaceField_H
|
#define vtkPV3FoamPatchField_H
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkCellData.h"
|
#include "vtkCellData.h"
|
||||||
#include "vtkFloatArray.h"
|
#include "vtkFloatArray.h"
|
||||||
#include "vtkMultiBlockDataSet.h"
|
#include "vtkMultiBlockDataSet.h"
|
||||||
|
#include "vtkPointData.h"
|
||||||
#include "vtkPolyData.h"
|
#include "vtkPolyData.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::vtkPV3Foam::convertPatchFaceField
|
void Foam::vtkPV3Foam::convertPatchField
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const Field<Type>& ptf,
|
const Field<Type>& ptf,
|
||||||
@ -55,14 +56,13 @@ void Foam::vtkPV3Foam::convertPatchFaceField
|
|||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
);
|
);
|
||||||
|
|
||||||
vtkFloatArray *cellData = vtkFloatArray::New();
|
vtkFloatArray* cellData = vtkFloatArray::New();
|
||||||
cellData->SetNumberOfTuples(ptf.size());
|
cellData->SetNumberOfTuples( ptf.size() );
|
||||||
cellData->SetNumberOfComponents(nComp);
|
cellData->SetNumberOfComponents( nComp );
|
||||||
cellData->Allocate(nComp*ptf.size());
|
cellData->Allocate( nComp*ptf.size() );
|
||||||
cellData->SetName(name.c_str());
|
cellData->SetName( name.c_str() );
|
||||||
|
|
||||||
float vec[nComp];
|
float vec[nComp];
|
||||||
|
|
||||||
forAll(ptf, i)
|
forAll(ptf, i)
|
||||||
{
|
{
|
||||||
const Type& t = ptf[i];
|
const Type& t = ptf[i];
|
||||||
@ -79,6 +79,46 @@ void Foam::vtkPV3Foam::convertPatchFaceField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// as above, but with PointData()
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertPatchPointField
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Field<Type>& pptf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const selectionInfo& selector,
|
||||||
|
const label datasetNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
|
);
|
||||||
|
|
||||||
|
vtkFloatArray *pointData = vtkFloatArray::New();
|
||||||
|
pointData->SetNumberOfTuples( pptf.size() );
|
||||||
|
pointData->SetNumberOfComponents( nComp );
|
||||||
|
pointData->Allocate( nComp*pptf.size() );
|
||||||
|
pointData->SetName( name.c_str() );
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
forAll(pptf, i)
|
||||||
|
{
|
||||||
|
const Type& t = pptf[i];
|
||||||
|
for (direction d=0; d<nComp; d++)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
pointData->InsertTuple(i, vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkmesh->GetPointData()->AddArray(pointData);
|
||||||
|
pointData->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -27,8 +27,8 @@ InClass
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPV3FoamConvertPointFields_H
|
#ifndef vtkPV3FoamPointFields_H
|
||||||
#define vtkPV3FoamConvertPointFields_H
|
#define vtkPV3FoamPointFields_H
|
||||||
|
|
||||||
// Foam includes
|
// Foam includes
|
||||||
#include "interpolatePointToCell.H"
|
#include "interpolatePointToCell.H"
|
||||||
@ -39,11 +39,12 @@ template<class Type>
|
|||||||
void Foam::vtkPV3Foam::convertPointFields
|
void Foam::vtkPV3Foam::convertPointFields
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
|
const pointMesh& pMesh,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
vtkDataArraySelection* fieldSelection,
|
|
||||||
vtkMultiBlockDataSet* output
|
vtkMultiBlockDataSet* output
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// field subset based on type
|
||||||
IOobjectList fieldObjects
|
IOobjectList fieldObjects
|
||||||
(
|
(
|
||||||
objects.lookupClass
|
objects.lookupClass
|
||||||
@ -52,20 +53,12 @@ void Foam::vtkPV3Foam::convertPointFields
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
label nFields = fieldSelection->GetNumberOfArrays();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
for (label i=0; i<nFields; i++)
|
forAllIter(IOobjectList, fieldObjects, iter)
|
||||||
{
|
{
|
||||||
const word fieldName = fieldSelection->GetArrayName(i);
|
word fieldName = iter()->name();
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!fieldSelection->GetArraySetting(i)
|
|
||||||
|| !fieldObjects.found(fieldName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -73,17 +66,9 @@ void Foam::vtkPV3Foam::convertPointFields
|
|||||||
<< fieldName << endl;
|
<< fieldName << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
pointMesh pMesh(mesh);
|
|
||||||
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh> ptf
|
GeometricField<Type, pointPatchField, pointMesh> ptf
|
||||||
(
|
(
|
||||||
IOobject
|
*iter(),
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
pMesh
|
pMesh
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -93,14 +78,14 @@ void Foam::vtkPV3Foam::convertPointFields
|
|||||||
//
|
//
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selectInfoVolume_.start();
|
int regionId = regionInfoVolume_.start();
|
||||||
regionId < selectInfoVolume_.end();
|
regionId < regionInfoVolume_.end();
|
||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label datasetId = selectedRegionDatasetIds_[regionId];
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
|
||||||
if (!selectedRegions_[regionId] || datasetId < 0)
|
if (!regionStatus_[regionId] || datasetNo < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -110,36 +95,42 @@ void Foam::vtkPV3Foam::convertPointFields
|
|||||||
ptf,
|
ptf,
|
||||||
GeometricField<Type, fvPatchField, volMesh>::null(),
|
GeometricField<Type, fvPatchField, volMesh>::null(),
|
||||||
output,
|
output,
|
||||||
selectInfoVolume_,
|
regionInfoVolume_,
|
||||||
datasetId
|
datasetNo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert patches - if activated
|
// Convert patches - if activated
|
||||||
//
|
//
|
||||||
label regionId = selectInfoPatches_.start();
|
for
|
||||||
forAll (patches, patchI)
|
(
|
||||||
|
int regionId = regionInfoPatches_.start();
|
||||||
|
regionId < regionInfoPatches_.end();
|
||||||
|
++regionId
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (patches[patchI].size())
|
word patchName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
const label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!regionStatus_[regionId] || datasetNo < 0 || patchId < 0)
|
||||||
{
|
{
|
||||||
const label datasetId = selectedRegionDatasetIds_[regionId];
|
continue;
|
||||||
|
|
||||||
if (selectedRegions_[regionId] && datasetId >= 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
ptf.boundaryField()[patchI].patchInternalField()(),
|
|
||||||
output,
|
|
||||||
selectInfoPatches_,
|
|
||||||
datasetId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
regionId++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
convertPatchPointField
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
ptf.boundaryField()[patchId].patchInternalField()(),
|
||||||
|
output,
|
||||||
|
regionInfoPatches_,
|
||||||
|
datasetNo
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,37 +148,48 @@ void Foam::vtkPV3Foam::convertPointField
|
|||||||
{
|
{
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
vtkUnstructuredGrid* internalMesh = vtkUnstructuredGrid::SafeDownCast
|
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::SafeDownCast
|
||||||
(
|
(
|
||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
);
|
);
|
||||||
|
|
||||||
vtkFloatArray *pointData = vtkFloatArray::New();
|
vtkFloatArray *pointData = vtkFloatArray::New();
|
||||||
pointData->SetNumberOfTuples(ptf.size() + addPointCellLabels_.size());
|
pointData->SetNumberOfTuples( ptf.size() + addPointCellLabels_.size() );
|
||||||
pointData->SetNumberOfComponents(nComp);
|
pointData->SetNumberOfComponents( nComp );
|
||||||
pointData->Allocate(nComp*ptf.size());
|
pointData->Allocate( nComp*(ptf.size() + addPointCellLabels_.size()) );
|
||||||
pointData->SetName(tf.name().c_str());
|
pointData->SetName( tf.name().c_str() );
|
||||||
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert convertPointField: "
|
||||||
|
<< tf.name()
|
||||||
|
<< " size = " << ptf.size()
|
||||||
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << (ptf.size() + addPointCellLabels_.size())
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
float vec[nComp];
|
float vec[nComp];
|
||||||
|
|
||||||
forAll(ptf, i)
|
forAll(ptf, i)
|
||||||
{
|
{
|
||||||
|
const Type& t = ptf[i];
|
||||||
for (direction d=0; d<nComp; d++)
|
for (direction d=0; d<nComp; d++)
|
||||||
{
|
{
|
||||||
vec[d] = component(ptf[i], d);
|
vec[d] = component(t, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointData->InsertTuple(i, vec);
|
pointData->InsertTuple(i, vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// continue insertion from here
|
||||||
label i = ptf.size();
|
label i = ptf.size();
|
||||||
|
|
||||||
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
|
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
|
||||||
{
|
{
|
||||||
forAll(addPointCellLabels_, api)
|
forAll(addPointCellLabels_, api)
|
||||||
{
|
{
|
||||||
Type t = tf[addPointCellLabels_[api]];
|
const Type& t = tf[addPointCellLabels_[api]];
|
||||||
|
|
||||||
for (direction d=0; d<nComp; d++)
|
for (direction d=0; d<nComp; d++)
|
||||||
{
|
{
|
||||||
vec[d] = component(t, d);
|
vec[d] = component(t, d);
|
||||||
@ -211,11 +213,10 @@ void Foam::vtkPV3Foam::convertPointField
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internalMesh->GetPointData()->AddArray(pointData);
|
vtkmesh->GetPointData()->AddArray(pointData);
|
||||||
pointData->Delete();
|
pointData->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -27,8 +27,8 @@ InClass
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPV3FoamInsertNextPoint_H
|
#ifndef vtkPV3FoamPoints_H
|
||||||
#define vtkPV3FoamInsertNextPoint_H
|
#define vtkPV3FoamPoints_H
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkPoints.h"
|
#include "vtkPoints.h"
|
||||||
@ -44,6 +44,34 @@ inline void vtkPV3FoamInsertNextPoint
|
|||||||
points->InsertNextPoint(p.x(), p.y(), p.z());
|
points->InsertNextPoint(p.x(), p.y(), p.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// this should be faster, but didn't get it working ...
|
||||||
|
inline void vtkPV3FoamSetPoint
|
||||||
|
(
|
||||||
|
vtkPoints *points,
|
||||||
|
const Foam::label id,
|
||||||
|
const Foam::point& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
points->SetPoint(id, p.x(), p.y(), p.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Convert Foam mesh vertices to VTK
|
||||||
|
inline vtkPoints* vtkPV3FoamVTKPoints(const Foam::pointField& points)
|
||||||
|
{
|
||||||
|
vtkPoints *vtkpoints = vtkPoints::New();
|
||||||
|
vtkpoints->SetNumberOfPoints(points.size());
|
||||||
|
forAll(points, i)
|
||||||
|
{
|
||||||
|
const Foam::point& p = points[i];
|
||||||
|
vtkpoints->SetPoint(i, p.x(), p.y(), p.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
return vtkpoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ License
|
|||||||
|
|
||||||
// local headers
|
// local headers
|
||||||
#include "vtkPV3FoamAddToSelection.H"
|
#include "vtkPV3FoamAddToSelection.H"
|
||||||
#include "vtkPV3FoamUpdateInformationFields.H"
|
#include "vtkPV3FoamUpdateInfoFields.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
@ -107,7 +107,7 @@ Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType)
|
|||||||
zonesEntries zones(ioObj);
|
zonesEntries zones(ioObj);
|
||||||
|
|
||||||
zoneNames.setSize(zones.size());
|
zoneNames.setSize(zones.size());
|
||||||
forAll (zones, zoneI)
|
forAll(zones, zoneI)
|
||||||
{
|
{
|
||||||
zoneNames[zoneI] = zones[zoneI].keyword();
|
zoneNames[zoneI] = zones[zoneI].keyword();
|
||||||
}
|
}
|
||||||
@ -117,14 +117,14 @@ Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateInformationInternalMesh()
|
void Foam::vtkPV3Foam::updateInfoInternalMesh()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateInformationInternalMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::updateInfoInternalMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// Determine number of meshes available
|
// Determine number of meshes available
|
||||||
HashTable<const fvMesh*> meshObjects = dbPtr_().lookupClass<const fvMesh>();
|
HashTable<const fvMesh*> meshObjects = dbPtr_().lookupClass<const fvMesh>();
|
||||||
@ -132,100 +132,85 @@ void Foam::vtkPV3Foam::updateInformationInternalMesh()
|
|||||||
|
|
||||||
// Determine regions (internal mesh and patches...)
|
// Determine regions (internal mesh and patches...)
|
||||||
//- Add internal mesh as first entry
|
//- Add internal mesh as first entry
|
||||||
selectInfoVolume_ = arraySelection->GetNumberOfArrays();
|
regionInfoVolume_ = regionSelection->GetNumberOfArrays();
|
||||||
arraySelection->AddArray("internalMesh");
|
regionSelection->AddArray("internalMesh");
|
||||||
selectInfoVolume_ += 1;
|
regionInfoVolume_ += 1;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(regionSelection);
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInformationInternalMesh" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoInternalMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateInformationLagrangian()
|
void Foam::vtkPV3Foam::updateInfoLagrangian()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateInformationLagrangian" << nl
|
Info<< "<beg> Foam::vtkPV3Foam::updateInfoLagrangian" << nl
|
||||||
<< " " << dbPtr_->timePath()/"lagrangian" << endl;
|
<< " " << dbPtr_->timePath()/"lagrangian" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
|
||||||
|
|
||||||
// Search for list of lagrangian objects for this time
|
// Search for list of lagrangian objects for this time
|
||||||
fileNameList cloudDirs
|
fileNameList cloudDirs
|
||||||
(
|
(
|
||||||
readDir(dbPtr_->timePath()/"lagrangian", fileName::DIRECTORY)
|
readDir(dbPtr_->timePath()/"lagrangian", fileName::DIRECTORY)
|
||||||
);
|
);
|
||||||
|
|
||||||
selectInfoLagrangian_ = arraySelection->GetNumberOfArrays();
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
regionInfoLagrangian_ = regionSelection->GetNumberOfArrays();
|
||||||
|
|
||||||
if (cloudDirs.size())
|
int nClouds = 0;
|
||||||
|
forAll(cloudDirs, cloudI)
|
||||||
{
|
{
|
||||||
arraySelection->AddArray("lagrangian");
|
// Add cloud to GUI list
|
||||||
selectInfoLagrangian_ += 1;
|
regionSelection->AddArray
|
||||||
|
(
|
||||||
|
(cloudDirs[cloudI] + " - lagrangian").c_str()
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "... added cloudDirs\n";
|
++nClouds;
|
||||||
|
}
|
||||||
|
|
||||||
if (cloudDirs.size() > 1)
|
regionInfoLagrangian_ += nClouds;
|
||||||
{
|
|
||||||
WarningIn("void Foam::vtkPV3Foam::updateInformationLagrangian()")
|
|
||||||
<< "Multiple lagrangian clouds identified. Currently only able "
|
|
||||||
<< "to process ONE cloud: " << cloudDirs[0]
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
// Set cloud name to first cloud found
|
|
||||||
// TODO - multiple clouds
|
|
||||||
cloudName_ = cloudDirs[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "... no clouds identified in " <<nl
|
|
||||||
<< " " <<dbPtr_->timePath()/"lagrangian" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(regionSelection);
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInformationLagrangian" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoLagrangian" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateInformationPatches()
|
void Foam::vtkPV3Foam::updateInfoPatches()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateInformationPatches"
|
Info<< "<beg> Foam::vtkPV3Foam::updateInfoPatches"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection *arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection *regionSelection = reader_->GetRegionSelection();
|
||||||
selectInfoPatches_ = arraySelection->GetNumberOfArrays();
|
regionInfoPatches_ = regionSelection->GetNumberOfArrays();
|
||||||
|
|
||||||
int nPatches = 0;
|
int nPatches = 0;
|
||||||
|
|
||||||
if (meshPtr_)
|
if (meshPtr_)
|
||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = meshPtr_->boundaryMesh();
|
const polyBoundaryMesh& patches = meshPtr_->boundaryMesh();
|
||||||
forAll (patches, patchI)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
|
|
||||||
if (pp.size())
|
if (pp.size())
|
||||||
{
|
{
|
||||||
// Add patch to GUI region list
|
// Add patch to GUI list
|
||||||
arraySelection->AddArray
|
regionSelection->AddArray
|
||||||
(
|
(
|
||||||
(pp.name() + " - patch").c_str()
|
(pp.name() + " - patch").c_str()
|
||||||
);
|
);
|
||||||
@ -252,7 +237,7 @@ void Foam::vtkPV3Foam::updateInformationPatches()
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Start regions at patches
|
// Start regions at patches
|
||||||
forAll (patchEntries, entryI)
|
forAll(patchEntries, entryI)
|
||||||
{
|
{
|
||||||
label nFaces
|
label nFaces
|
||||||
(
|
(
|
||||||
@ -262,8 +247,8 @@ void Foam::vtkPV3Foam::updateInformationPatches()
|
|||||||
// Valid patch if nFace > 0
|
// Valid patch if nFace > 0
|
||||||
if (nFaces)
|
if (nFaces)
|
||||||
{
|
{
|
||||||
// Add patch to GUI region list
|
// Add patch to GUI list
|
||||||
arraySelection->AddArray
|
regionSelection->AddArray
|
||||||
(
|
(
|
||||||
(patchEntries[entryI].keyword() + " - patch").c_str()
|
(patchEntries[entryI].keyword() + " - patch").c_str()
|
||||||
);
|
);
|
||||||
@ -273,27 +258,32 @@ void Foam::vtkPV3Foam::updateInformationPatches()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInfoPatches_ += nPatches;
|
regionInfoPatches_ += nPatches;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(regionSelection);
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInformationPatches" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoPatches" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateInformationZones()
|
void Foam::vtkPV3Foam::updateInfoZones()
|
||||||
{
|
{
|
||||||
|
if (!reader_->GetIncludeZones())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateInformationZones"
|
Info<< "<beg> Foam::vtkPV3Foam::updateInfoZones"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection *arraySelection = reader_->GetRegionSelection();
|
vtkDataArraySelection *regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
wordList namesLst;
|
wordList namesLst;
|
||||||
|
|
||||||
@ -309,13 +299,13 @@ void Foam::vtkPV3Foam::updateInformationZones()
|
|||||||
namesLst = readZoneNames("cellZones");
|
namesLst = readZoneNames("cellZones");
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInfoCellZones_ = arraySelection->GetNumberOfArrays();
|
regionInfoCellZones_ = regionSelection->GetNumberOfArrays();
|
||||||
forAll (namesLst, elemI)
|
forAll(namesLst, elemI)
|
||||||
{
|
{
|
||||||
arraySelection->AddArray((namesLst[elemI] + " - cellZone").c_str());
|
regionSelection->AddArray((namesLst[elemI] + " - cellZone").c_str());
|
||||||
}
|
}
|
||||||
selectInfoCellZones_ += namesLst.size();
|
regionInfoCellZones_ += namesLst.size();
|
||||||
zoneSuperCells_.setSize(selectInfoCellZones_.size());
|
zoneSuperCells_.setSize(regionInfoCellZones_.size());
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -330,12 +320,15 @@ void Foam::vtkPV3Foam::updateInformationZones()
|
|||||||
namesLst = readZoneNames("faceZones");
|
namesLst = readZoneNames("faceZones");
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInfoFaceZones_ = arraySelection->GetNumberOfArrays();
|
regionInfoFaceZones_ = regionSelection->GetNumberOfArrays();
|
||||||
forAll (namesLst, elemI)
|
forAll(namesLst, elemI)
|
||||||
{
|
{
|
||||||
arraySelection->AddArray((namesLst[elemI] + " - faceZone").c_str());
|
regionSelection->AddArray
|
||||||
|
(
|
||||||
|
(namesLst[elemI] + " - faceZone").c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
selectInfoFaceZones_ += namesLst.size();
|
regionInfoFaceZones_ += namesLst.size();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -350,32 +343,40 @@ void Foam::vtkPV3Foam::updateInformationZones()
|
|||||||
namesLst = readZoneNames("pointZones");
|
namesLst = readZoneNames("pointZones");
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInfoPointZones_ = arraySelection->GetNumberOfArrays();
|
regionInfoPointZones_ = regionSelection->GetNumberOfArrays();
|
||||||
forAll (namesLst, elemI)
|
forAll(namesLst, elemI)
|
||||||
{
|
{
|
||||||
arraySelection->AddArray((namesLst[elemI] + " - pointZone").c_str());
|
regionSelection->AddArray
|
||||||
|
(
|
||||||
|
(namesLst[elemI] + " - pointZone").c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
selectInfoPointZones_ += namesLst.size();
|
regionInfoPointZones_ += namesLst.size();
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(regionSelection);
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInformationZones" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoZones" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateInformationSets()
|
void Foam::vtkPV3Foam::updateInfoSets()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (!reader_->GetIncludeSets())
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateInformationSets" << endl;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection *arraySelection = reader_->GetRegionSelection();
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::updateInfoSets" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkDataArraySelection *regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
// Add names of sets
|
// Add names of sets
|
||||||
IOobjectList objects
|
IOobjectList objects
|
||||||
@ -386,27 +387,27 @@ void Foam::vtkPV3Foam::updateInformationSets()
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
selectInfoCellSets_ = arraySelection->GetNumberOfArrays();
|
regionInfoCellSets_ = regionSelection->GetNumberOfArrays();
|
||||||
selectInfoCellSets_ += addToSelection<cellSet>
|
regionInfoCellSets_ += addToSelection<cellSet>
|
||||||
(
|
(
|
||||||
arraySelection,
|
regionSelection,
|
||||||
objects,
|
objects,
|
||||||
" - cellSet"
|
" - cellSet"
|
||||||
);
|
);
|
||||||
csetSuperCells_.setSize(selectInfoCellSets_.size());
|
csetSuperCells_.setSize(regionInfoCellSets_.size());
|
||||||
|
|
||||||
selectInfoFaceSets_ = arraySelection->GetNumberOfArrays();
|
regionInfoFaceSets_ = regionSelection->GetNumberOfArrays();
|
||||||
selectInfoFaceSets_ += addToSelection<faceSet>
|
regionInfoFaceSets_ += addToSelection<faceSet>
|
||||||
(
|
(
|
||||||
arraySelection,
|
regionSelection,
|
||||||
objects,
|
objects,
|
||||||
" - faceSet"
|
" - faceSet"
|
||||||
);
|
);
|
||||||
|
|
||||||
selectInfoPointSets_ = arraySelection->GetNumberOfArrays();
|
regionInfoPointSets_ = regionSelection->GetNumberOfArrays();
|
||||||
selectInfoPointSets_ += addToSelection<pointSet>
|
regionInfoPointSets_ += addToSelection<pointSet>
|
||||||
(
|
(
|
||||||
arraySelection,
|
regionSelection,
|
||||||
objects,
|
objects,
|
||||||
" - pointSet"
|
" - pointSet"
|
||||||
);
|
);
|
||||||
@ -414,82 +415,102 @@ void Foam::vtkPV3Foam::updateInformationSets()
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(regionSelection);
|
||||||
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInformationSets" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoSets" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateInformationLagrangianFields()
|
void Foam::vtkPV3Foam::updateInfoLagrangianFields()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateInformationLagrangianFields"
|
Info<< "<beg> Foam::vtkPV3Foam::updateInfoLagrangianFields"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkDataArraySelection *arraySelection =
|
vtkDataArraySelection *fieldSelection =
|
||||||
reader_->GetLagrangianFieldSelection();
|
reader_->GetLagrangianFieldSelection();
|
||||||
|
|
||||||
|
vtkDataArraySelection *regionSelection =
|
||||||
|
reader_->GetRegionSelection();
|
||||||
|
|
||||||
// preserve the enabled selections
|
// preserve the enabled selections
|
||||||
stringList selectedEntries = getSelectedArrayEntries
|
stringList selectedEntries = getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
arraySelection,
|
fieldSelection,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
arraySelection->RemoveAllArrays();
|
fieldSelection->RemoveAllArrays();
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// TODO - can currently only get fields from ONE cloud
|
||||||
|
//
|
||||||
|
|
||||||
|
const selectionInfo& selector = regionInfoLagrangian_;
|
||||||
|
int regionId = selector.start();
|
||||||
|
|
||||||
|
if (!selector.size() || regionId < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
word cloudName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
// TODO - currently hard-coded to ONE cloud
|
|
||||||
IOobjectList objects
|
IOobjectList objects
|
||||||
(
|
(
|
||||||
dbPtr_(),
|
dbPtr_(),
|
||||||
dbPtr_().timeName(),
|
dbPtr_().timeName(),
|
||||||
"lagrangian"/cloudName_
|
"lagrangian"/cloudName
|
||||||
);
|
);
|
||||||
|
|
||||||
addToSelection<IOField<label> >
|
addToSelection<IOField<label> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
fieldSelection,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<IOField<scalar> >
|
addToSelection<IOField<scalar> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
fieldSelection,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<IOField<vector> >
|
addToSelection<IOField<vector> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
fieldSelection,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<IOField<sphericalTensor> >
|
addToSelection<IOField<sphericalTensor> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
fieldSelection,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<IOField<symmTensor> >
|
addToSelection<IOField<symmTensor> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
fieldSelection,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<IOField<tensor> >
|
addToSelection<IOField<tensor> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
fieldSelection,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
|
|
||||||
// restore the enabled selections
|
// restore the enabled selections
|
||||||
setSelectedArrayEntries
|
setSelectedArrayEntries
|
||||||
(
|
(
|
||||||
arraySelection,
|
fieldSelection,
|
||||||
selectedEntries
|
selectedEntries
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInformationLagrangianFields - "
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoLagrangianFields - "
|
||||||
<< "lagrangian objects.size() = " << objects.size() << endl;
|
<< "lagrangian objects.size() = " << objects.size() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,25 +27,25 @@ InClass
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPV3FoamUpdateInformationFields_H
|
#ifndef vtkPV3FoamUpdateInfoFields_H
|
||||||
#define vtkPV3FoamUpdateInformationFields_H
|
#define vtkPV3FoamUpdateInfoFields_H
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<template<class> class patchType, class meshType>
|
template<template<class> class patchType, class meshType>
|
||||||
void Foam::vtkPV3Foam::updateInformationFields
|
void Foam::vtkPV3Foam::updateInfoFields
|
||||||
(
|
(
|
||||||
vtkDataArraySelection *arraySelection
|
vtkDataArraySelection *select
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateInformationFields" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::updateInfoFields" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
stringList selectedEntries;
|
stringList selectedEntries;
|
||||||
// enable 'p' and 'U' on the first call
|
// enable 'p' and 'U' on the first call
|
||||||
if (arraySelection->GetNumberOfArrays() == 0 && !meshPtr_)
|
if (select->GetNumberOfArrays() == 0 && !meshPtr_)
|
||||||
{
|
{
|
||||||
selectedEntries.setSize(2);
|
selectedEntries.setSize(2);
|
||||||
selectedEntries[0] = "p";
|
selectedEntries[0] = "p";
|
||||||
@ -54,61 +54,55 @@ void Foam::vtkPV3Foam::updateInformationFields
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// preserve the enabled selections
|
// preserve the enabled selections
|
||||||
selectedEntries = getSelectedArrayEntries
|
selectedEntries = getSelectedArrayEntries(select);
|
||||||
(
|
|
||||||
arraySelection
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arraySelection->RemoveAllArrays();
|
select->RemoveAllArrays();
|
||||||
|
|
||||||
// Search for list of objects for this time
|
// Search for list of objects for this time
|
||||||
IOobjectList objects(dbPtr_(), dbPtr_().timeName());
|
IOobjectList objects(dbPtr_(), dbPtr_().timeName());
|
||||||
// Populate the GUI volume/point field arrays
|
|
||||||
|
|
||||||
//- Add volume fields to GUI
|
//- Add volume fields to GUI
|
||||||
addToSelection<GeometricField<scalar, patchType, meshType> >
|
addToSelection<GeometricField<scalar, patchType, meshType> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
select,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<GeometricField<vector, patchType, meshType> >
|
addToSelection<GeometricField<vector, patchType, meshType> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
select,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<GeometricField<sphericalTensor, patchType, meshType> >
|
addToSelection<GeometricField<sphericalTensor, patchType, meshType> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
select,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<GeometricField<symmTensor, patchType, meshType> >
|
addToSelection<GeometricField<symmTensor, patchType, meshType> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
select,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
addToSelection<GeometricField<tensor, patchType, meshType> >
|
addToSelection<GeometricField<tensor, patchType, meshType> >
|
||||||
(
|
(
|
||||||
arraySelection,
|
select,
|
||||||
objects
|
objects
|
||||||
);
|
);
|
||||||
|
|
||||||
// restore the enabled selections
|
// restore the enabled selections
|
||||||
setSelectedArrayEntries
|
setSelectedArrayEntries
|
||||||
(
|
(
|
||||||
arraySelection,
|
select,
|
||||||
selectedEntries
|
selectedEntries
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInformationFields" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoFields" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -27,16 +27,15 @@ InClass
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef vtkPV3FoamConvertVolFields_H
|
#ifndef vtkPV3FoamVolFields_H
|
||||||
#define vtkPV3FoamConvertVolFields_H
|
#define vtkPV3FoamVolFields_H
|
||||||
|
|
||||||
// Foam includes
|
// Foam includes
|
||||||
#include "emptyFvPatchField.H"
|
#include "emptyFvPatchField.H"
|
||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "vtkPV3FoamConvertPatchFaceField.H"
|
#include "vtkPV3FoamFaceField.H"
|
||||||
#include "vtkPV3FoamConvertPatchPointField.H"
|
#include "vtkPV3FoamPatchField.H"
|
||||||
#include "vtkPV3FoamConvertFaceField.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -47,10 +46,10 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
const volPointInterpolation& pInterp,
|
const volPointInterpolation& pInterp,
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
|
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
vtkDataArraySelection *fieldSelection,
|
|
||||||
vtkMultiBlockDataSet* output
|
vtkMultiBlockDataSet* output
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// field subset based on type
|
||||||
IOobjectList fieldObjects
|
IOobjectList fieldObjects
|
||||||
(
|
(
|
||||||
objects.lookupClass
|
objects.lookupClass
|
||||||
@ -59,37 +58,16 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
label nFields = fieldSelection->GetNumberOfArrays();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
vtkDataArraySelection* regionSelection = reader_->GetRegionSelection();
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelector = reader_->GetRegionSelection();
|
forAllIter(IOobjectList, fieldObjects, iter)
|
||||||
|
|
||||||
for (label i=0; i<nFields; i++)
|
|
||||||
{
|
{
|
||||||
const word fieldName = fieldSelection->GetArrayName(i);
|
word fieldName = iter()->name();
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!fieldSelection->GetArraySetting(i)
|
|
||||||
|| !fieldObjects.found(fieldName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting volume field: " << fieldName << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
GeometricField<Type, fvPatchField, volMesh> tf
|
GeometricField<Type, fvPatchField, volMesh> tf
|
||||||
(
|
(
|
||||||
IOobject
|
*iter(),
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -104,14 +82,14 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
//
|
//
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selectInfoVolume_.start();
|
int regionId = regionInfoVolume_.start();
|
||||||
regionId < selectInfoVolume_.end();
|
regionId < regionInfoVolume_.end();
|
||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label datasetId = selectedRegionDatasetIds_[regionId];
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
|
||||||
if (!selectedRegions_[regionId] || datasetId < 0)
|
if (!regionStatus_[regionId] || datasetNo < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -120,8 +98,8 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output,
|
output,
|
||||||
selectInfoVolume_,
|
regionInfoVolume_,
|
||||||
datasetId,
|
datasetNo,
|
||||||
superCells_
|
superCells_
|
||||||
);
|
);
|
||||||
convertPointField
|
convertPointField
|
||||||
@ -129,8 +107,8 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
tptf(),
|
tptf(),
|
||||||
tf,
|
tf,
|
||||||
output,
|
output,
|
||||||
selectInfoVolume_,
|
regionInfoVolume_,
|
||||||
datasetId
|
datasetNo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,29 +117,25 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
//
|
//
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selectInfoPatches_.start();
|
int regionId = regionInfoPatches_.start();
|
||||||
regionId < selectInfoPatches_.end();
|
regionId < regionInfoPatches_.end();
|
||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label datasetId = selectedRegionDatasetIds_[regionId];
|
word patchName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
|
||||||
if (!selectedRegions_[regionId] || datasetId < 0)
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
const label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!regionStatus_[regionId] || datasetNo < 0 || patchId < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
word selectName = getFirstWord
|
const fvPatchField<Type>& ptf = tf.boundaryField()[patchId];
|
||||||
(
|
|
||||||
arraySelector->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
const label patchId = patches.findPatchID(selectName);
|
|
||||||
|
|
||||||
const fvPatchField<Type>& ptf
|
|
||||||
(
|
|
||||||
tf.boundaryField()[patchId]
|
|
||||||
);
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -179,24 +153,24 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
tf.mesh().boundary()
|
tf.mesh().boundary()
|
||||||
);
|
);
|
||||||
|
|
||||||
convertPatchFaceField
|
convertPatchField
|
||||||
(
|
(
|
||||||
tf.name(),
|
tf.name(),
|
||||||
fvPatchField<Type>(p, tf).patchInternalField()(),
|
fvPatchField<Type>(p, tf).patchInternalField()(),
|
||||||
output,
|
output,
|
||||||
selectInfoPatches_,
|
regionInfoPatches_,
|
||||||
datasetId
|
datasetNo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
convertPatchFaceField
|
convertPatchField
|
||||||
(
|
(
|
||||||
tf.name(),
|
tf.name(),
|
||||||
ptf,
|
ptf,
|
||||||
output,
|
output,
|
||||||
selectInfoPatches_,
|
regionInfoPatches_,
|
||||||
datasetId
|
datasetNo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +179,8 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
tf.name(),
|
tf.name(),
|
||||||
ppInterpList[patchId].faceToPointInterpolate(ptf)(),
|
ppInterpList[patchId].faceToPointInterpolate(ptf)(),
|
||||||
output,
|
output,
|
||||||
selectInfoPatches_,
|
regionInfoPatches_,
|
||||||
datasetId
|
datasetNo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,14 +189,14 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
//
|
//
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selectInfoCellZones_.start();
|
int regionId = regionInfoCellZones_.start();
|
||||||
regionId < selectInfoCellZones_.end();
|
regionId < regionInfoCellZones_.end();
|
||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label datasetId = selectedRegionDatasetIds_[regionId];
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
|
||||||
if (!selectedRegions_[regionId] || datasetId < 0)
|
if (!regionStatus_[regionId] || datasetNo < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -230,7 +204,7 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "wish to convert cellzone: "
|
Info<< "wish to convert cellzone: "
|
||||||
<< getFirstWord(arraySelector->GetArrayName(regionId))
|
<< getFirstWord(regionSelection->GetArrayName(regionId))
|
||||||
<< " regionId: " << regionId
|
<< " regionId: " << regionId
|
||||||
<< " volume field: " << fieldName
|
<< " volume field: " << fieldName
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -240,9 +214,9 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output,
|
output,
|
||||||
selectInfoCellZones_,
|
regionInfoCellZones_,
|
||||||
datasetId,
|
datasetNo,
|
||||||
zoneSuperCells_[datasetId]
|
zoneSuperCells_[datasetNo]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,14 +225,14 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
//
|
//
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selectInfoCellSets_.start();
|
int regionId = regionInfoCellSets_.start();
|
||||||
regionId < selectInfoCellSets_.end();
|
regionId < regionInfoCellSets_.end();
|
||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label datasetId = selectedRegionDatasetIds_[regionId];
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
|
||||||
if (!selectedRegions_[regionId] || datasetId < 0)
|
if (!regionStatus_[regionId] || datasetNo < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -266,7 +240,7 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "wish to convert cellset: "
|
Info<< "wish to convert cellset: "
|
||||||
<< getFirstWord(arraySelector->GetArrayName(regionId))
|
<< getFirstWord(regionSelection->GetArrayName(regionId))
|
||||||
<< " regionId: " << regionId
|
<< " regionId: " << regionId
|
||||||
<< " volume field: " << fieldName
|
<< " volume field: " << fieldName
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -276,9 +250,9 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output,
|
output,
|
||||||
selectInfoCellSets_,
|
regionInfoCellSets_,
|
||||||
datasetId,
|
datasetNo,
|
||||||
csetSuperCells_[datasetId]
|
csetSuperCells_[datasetNo]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,14 +261,26 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
//
|
//
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selectInfoFaceZones_.start();
|
int regionId = regionInfoFaceZones_.start();
|
||||||
regionId < selectInfoFaceZones_.end();
|
regionId < regionInfoFaceZones_.end();
|
||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label datasetId = selectedRegionDatasetIds_[regionId];
|
word zoneName = getFirstWord
|
||||||
|
(
|
||||||
|
regionSelection->GetArrayName(regionId)
|
||||||
|
);
|
||||||
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
|
||||||
if (!selectedRegions_[regionId] || datasetId < 0)
|
if (!regionStatus_[regionId] || datasetNo < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceZoneMesh& zMesh = mesh.faceZones();
|
||||||
|
const label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (zoneId < 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -302,23 +288,20 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "wish to convert facezone: "
|
Info<< "wish to convert facezone: "
|
||||||
<< getFirstWord(arraySelector->GetArrayName(regionId))
|
<< zoneName
|
||||||
<< " regionId: " << regionId
|
<< " regionId: " << regionId
|
||||||
<< " volume field: " << fieldName
|
<< " volume field: " << fieldName
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const faceZoneMesh& fzMesh = mesh.faceZones();
|
|
||||||
const label zoneI = regionId - selectInfoFaceZones_.start();
|
|
||||||
|
|
||||||
convertFaceField
|
convertFaceField
|
||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output,
|
output,
|
||||||
selectInfoFaceZones_,
|
regionInfoFaceZones_,
|
||||||
datasetId,
|
datasetNo,
|
||||||
mesh,
|
mesh,
|
||||||
fzMesh[zoneI]
|
zMesh[zoneId]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,21 +310,20 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
//
|
//
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int regionId = selectInfoFaceSets_.start();
|
int regionId = regionInfoFaceSets_.start();
|
||||||
regionId < selectInfoFaceSets_.end();
|
regionId < regionInfoFaceSets_.end();
|
||||||
++regionId
|
++regionId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label datasetId = selectedRegionDatasetIds_[regionId];
|
const label datasetNo = regionDataset_[regionId];
|
||||||
|
if (!regionStatus_[regionId] || datasetNo < 0)
|
||||||
if (!selectedRegions_[regionId] || datasetId < 0)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
word selectName = getFirstWord
|
word selectName = getFirstWord
|
||||||
(
|
(
|
||||||
arraySelector->GetArrayName(regionId)
|
regionSelection->GetArrayName(regionId)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -354,13 +336,12 @@ void Foam::vtkPV3Foam::convertVolFields
|
|||||||
|
|
||||||
const faceSet fSet(mesh, selectName);
|
const faceSet fSet(mesh, selectName);
|
||||||
|
|
||||||
|
|
||||||
convertFaceField
|
convertFaceField
|
||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output,
|
output,
|
||||||
selectInfoFaceSets_,
|
regionInfoFaceSets_,
|
||||||
datasetId,
|
datasetNo,
|
||||||
mesh,
|
mesh,
|
||||||
fSet
|
fSet
|
||||||
);
|
);
|
||||||
@ -387,30 +368,30 @@ void Foam::vtkPV3Foam::convertVolField
|
|||||||
);
|
);
|
||||||
|
|
||||||
vtkFloatArray* celldata = vtkFloatArray::New();
|
vtkFloatArray* celldata = vtkFloatArray::New();
|
||||||
celldata->SetNumberOfTuples(superCells.size());
|
celldata->SetNumberOfTuples( superCells.size() );
|
||||||
celldata->SetNumberOfComponents(nComp);
|
celldata->SetNumberOfComponents( nComp );
|
||||||
celldata->Allocate(nComp*superCells.size());
|
celldata->Allocate( nComp*superCells.size() );
|
||||||
celldata->SetName(tf.name().c_str());
|
celldata->SetName( tf.name().c_str() );
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "converting vol<Type>Field: " << tf.name() << nl
|
Info<< "convert volField: "
|
||||||
<< "field size = " << tf.size() << nl
|
<< tf.name()
|
||||||
<< "nTuples = " << superCells.size() << nl
|
<< " size = " << tf.size()
|
||||||
<< "nComp = " << nComp << endl;
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << superCells.size() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
float vec[nComp];
|
float vec[nComp];
|
||||||
|
forAll(superCells, i)
|
||||||
forAll(superCells, scI)
|
|
||||||
{
|
{
|
||||||
const Type& t = tf[superCells[scI]];
|
const Type& t = tf[superCells[i]];
|
||||||
for (direction d=0; d<nComp; d++)
|
for (direction d=0; d<nComp; d++)
|
||||||
{
|
{
|
||||||
vec[d] = component(t, d);
|
vec[d] = component(t, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
celldata->InsertTuple(scI, vec);
|
celldata->InsertTuple(i, vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->GetCellData()->AddArray(celldata);
|
vtkmesh->GetCellData()->AddArray(celldata);
|
||||||
Reference in New Issue
Block a user