mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy2/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -1,191 +1,211 @@
|
|||||||
<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 -->
|
<!-- Send discrete time info to the animation panel -->
|
||||||
<StringVectorProperty
|
<DoubleVectorProperty
|
||||||
name="FileName"
|
name="TimestepValues"
|
||||||
command="SetFileName"
|
repeatable="1"
|
||||||
number_of_elements="1">
|
information_only="1">
|
||||||
<FileListDomain
|
<TimeStepsInformationHelper/>
|
||||||
name="files"/>
|
<Documentation>
|
||||||
</StringVectorProperty>
|
Available timestep values.
|
||||||
|
</Documentation>
|
||||||
|
</DoubleVectorProperty>
|
||||||
|
|
||||||
<!-- Time info sent to animation controls (top of window) -->
|
<!-- Send continuous time info to the animation panel -->
|
||||||
|
<DoubleVectorProperty
|
||||||
|
name="TimeRange"
|
||||||
|
information_only="1">
|
||||||
|
<TimeRangeInformationHelper/>
|
||||||
|
</DoubleVectorProperty>
|
||||||
|
|
||||||
<DoubleVectorProperty
|
<!-- Available Parts (volume, patches, lagrangian) array -->
|
||||||
name="TimestepValues"
|
<StringVectorProperty
|
||||||
information_only="1">
|
name="PartArrayInfo"
|
||||||
<TimeStepsInformationHelper/>
|
information_only="1">
|
||||||
<Documentation>
|
<ArraySelectionInformationHelper attribute_name="Part"/>
|
||||||
Available timestep values.
|
</StringVectorProperty>
|
||||||
</Documentation>
|
<StringVectorProperty
|
||||||
</DoubleVectorProperty>
|
name="PartStatus"
|
||||||
|
label="Mesh Parts"
|
||||||
|
command="SetPartArrayStatus"
|
||||||
|
number_of_elements="0"
|
||||||
|
repeat_command="1"
|
||||||
|
number_of_elements_per_command="2"
|
||||||
|
element_types="2 0"
|
||||||
|
information_property="PartArrayInfo"
|
||||||
|
animateable="0">
|
||||||
|
<ArraySelectionDomain name="array_list">
|
||||||
|
<RequiredProperties>
|
||||||
|
<Property name="PartArrayInfo" 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>
|
<Documentation>
|
||||||
|
Extrapolate internalField to wall and empty patches
|
||||||
|
</Documentation>
|
||||||
|
</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>
|
<Documentation>
|
||||||
|
Searches the polyMesh/sets/ directory
|
||||||
|
</Documentation>
|
||||||
|
<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
|
<Documentation>
|
||||||
name="RegionStatus"
|
ZoneMesh information is used to find {cell,face,point}Zones.
|
||||||
command="SetRegionArrayStatus"
|
The polyMesh/ directory is only checked on startup.
|
||||||
number_of_elements="0"
|
</Documentation>
|
||||||
repeat_command="1"
|
<BooleanDomain name="bool"/>
|
||||||
number_of_elements_per_command="2"
|
</IntVectorProperty>
|
||||||
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"
|
<Documentation>
|
||||||
command="SetVolFieldArrayStatus"
|
Show patch names in render window.
|
||||||
number_of_elements="0"
|
</Documentation>
|
||||||
repeat_command="1"
|
</IntVectorProperty>
|
||||||
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"
|
<Documentation>
|
||||||
command="SetPointFieldArrayStatus"
|
Cache the fvMesh in memory.
|
||||||
number_of_elements="0"
|
</Documentation>
|
||||||
repeat_command="1"
|
</IntVectorProperty>
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="PointFieldArrayInfo">
|
|
||||||
<ArraySelectionDomain
|
|
||||||
name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="PointFieldArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<!-- Available Lagrangian fields array -->
|
|
||||||
<StringVectorProperty
|
|
||||||
name="LagrangianFieldArrayInfo"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper
|
|
||||||
attribute_name="LagrangianField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="LagrangianFieldStatus"
|
|
||||||
command="SetLagrangianFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="LagrangianFieldArrayInfo">
|
|
||||||
<ArraySelectionDomain
|
|
||||||
name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="LagrangianFieldArrayInfo"
|
|
||||||
function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<!-- Cache mesh check box -->
|
<!-- Update GUI check box -->
|
||||||
<IntVectorProperty
|
<IntVectorProperty
|
||||||
name="CacheMesh"
|
name="UpdateGUI"
|
||||||
command="SetCacheMesh"
|
command="SetUpdateGUI"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
default_values="1">
|
default_values="0"
|
||||||
<BooleanDomain
|
animateable="0">
|
||||||
name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
</IntVectorProperty>
|
<Documentation>
|
||||||
|
A simple way cause a reader GUI modification.
|
||||||
|
</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Update GUI check box -->
|
</SourceProxy>
|
||||||
<IntVectorProperty
|
</ProxyGroup>
|
||||||
name="UpdateGUI"
|
|
||||||
command="SetUpdateGUI"
|
|
||||||
number_of_elements="1"
|
|
||||||
default_values="0">
|
|
||||||
<BooleanDomain
|
|
||||||
name="bool"/>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
</SourceProxy>
|
|
||||||
</ProxyGroup>
|
|
||||||
</ServerManagerConfiguration>
|
</ServerManagerConfiguration>
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.5$");
|
vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.5$");
|
||||||
vtkStandardNewMacro(vtkPV3FoamReader);
|
vtkStandardNewMacro(vtkPV3FoamReader);
|
||||||
|
|
||||||
|
#undef EXPERIMENTAL_TIME_CACHING
|
||||||
|
|
||||||
vtkPV3FoamReader::vtkPV3FoamReader()
|
vtkPV3FoamReader::vtkPV3FoamReader()
|
||||||
{
|
{
|
||||||
@ -47,23 +48,30 @@ vtkPV3FoamReader::vtkPV3FoamReader()
|
|||||||
FileName = NULL;
|
FileName = NULL;
|
||||||
foamData_ = NULL;
|
foamData_ = NULL;
|
||||||
|
|
||||||
output1_ = NULL;
|
output0_ = NULL;
|
||||||
|
|
||||||
|
// Add second output for the Lagrangian
|
||||||
|
this->SetNumberOfOutputPorts(2);
|
||||||
|
vtkMultiBlockDataSet *lagrangian;
|
||||||
|
lagrangian = vtkMultiBlockDataSet::New();
|
||||||
|
lagrangian->ReleaseData();
|
||||||
|
|
||||||
|
this->GetExecutive()->SetOutputData(1, lagrangian);
|
||||||
|
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;
|
||||||
IncludeZones = 0;
|
IncludeZones = 0;
|
||||||
ShowPatchNames = 0;
|
ShowPatchNames = 0;
|
||||||
|
|
||||||
UpdateGUI = 1;
|
UpdateGUI = 0;
|
||||||
UpdateGUIOld = 1;
|
|
||||||
|
|
||||||
RegionSelection = vtkDataArraySelection::New();
|
PartSelection = vtkDataArraySelection::New();
|
||||||
VolFieldSelection = vtkDataArraySelection::New();
|
VolFieldSelection = vtkDataArraySelection::New();
|
||||||
PointFieldSelection = vtkDataArraySelection::New();
|
PointFieldSelection = vtkDataArraySelection::New();
|
||||||
LagrangianFieldSelection = vtkDataArraySelection::New();
|
LagrangianFieldSelection = vtkDataArraySelection::New();
|
||||||
@ -77,7 +85,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
|
|||||||
);
|
);
|
||||||
SelectionObserver->SetClientData(this);
|
SelectionObserver->SetClientData(this);
|
||||||
|
|
||||||
RegionSelection->AddObserver
|
PartSelection->AddObserver
|
||||||
(
|
(
|
||||||
vtkCommand::ModifiedEvent,
|
vtkCommand::ModifiedEvent,
|
||||||
this->SelectionObserver
|
this->SelectionObserver
|
||||||
@ -114,14 +122,20 @@ vtkPV3FoamReader::~vtkPV3FoamReader()
|
|||||||
delete [] FileName;
|
delete [] FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionSelection->RemoveObserver(this->SelectionObserver);
|
if (output0_)
|
||||||
|
{
|
||||||
|
output0_->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PartSelection->RemoveObserver(this->SelectionObserver);
|
||||||
VolFieldSelection->RemoveObserver(this->SelectionObserver);
|
VolFieldSelection->RemoveObserver(this->SelectionObserver);
|
||||||
PointFieldSelection->RemoveObserver(this->SelectionObserver);
|
PointFieldSelection->RemoveObserver(this->SelectionObserver);
|
||||||
LagrangianFieldSelection->RemoveObserver(this->SelectionObserver);
|
LagrangianFieldSelection->RemoveObserver(this->SelectionObserver);
|
||||||
|
|
||||||
SelectionObserver->Delete();
|
SelectionObserver->Delete();
|
||||||
|
|
||||||
RegionSelection->Delete();
|
PartSelection->Delete();
|
||||||
VolFieldSelection->Delete();
|
VolFieldSelection->Delete();
|
||||||
PointFieldSelection->Delete();
|
PointFieldSelection->Delete();
|
||||||
LagrangianFieldSelection->Delete();
|
LagrangianFieldSelection->Delete();
|
||||||
@ -149,38 +163,40 @@ int vtkPV3FoamReader::RequestInformation
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
int nInfo = outputVector->GetNumberOfInformationObjects();
|
||||||
|
|
||||||
|
if (Foam::vtkPV3Foam::debug)
|
||||||
|
{
|
||||||
|
cout<<"RequestInformation with " << nInfo << " item(s)\n";
|
||||||
|
for (int infoI = 0; infoI < nInfo; ++infoI)
|
||||||
|
{
|
||||||
|
outputVector->GetInformationObject(infoI)->Print(cout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!foamData_)
|
if (!foamData_)
|
||||||
{
|
{
|
||||||
vtkDebugMacro("RequestInformation: creating foamData_");
|
|
||||||
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
|
||||||
(
|
|
||||||
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
|
|
||||||
);
|
|
||||||
|
|
||||||
if (Foam::vtkPV3Foam::debug)
|
|
||||||
{
|
|
||||||
cout<< "constructed vtkPV3Foam with output: ";
|
|
||||||
output->Print(cout);
|
|
||||||
}
|
|
||||||
|
|
||||||
foamData_ = new Foam::vtkPV3Foam(FileName, this);
|
foamData_ = new Foam::vtkPV3Foam(FileName, this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foamData_->UpdateInformation();
|
foamData_->updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
int nTimeSteps = 0;
|
int nTimeSteps = 0;
|
||||||
double* timeSteps = foamData_->findTimes(nTimeSteps);
|
double* timeSteps = foamData_->findTimes(nTimeSteps);
|
||||||
|
|
||||||
outInfo->Set
|
|
||||||
(
|
// set identical time steps for all ports
|
||||||
vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
|
for (int infoI = 0; infoI < nInfo; ++infoI)
|
||||||
timeSteps,
|
{
|
||||||
nTimeSteps
|
outputVector->GetInformationObject(infoI)->Set
|
||||||
);
|
(
|
||||||
|
vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
|
||||||
|
timeSteps,
|
||||||
|
nTimeSteps
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
double timeRange[2];
|
double timeRange[2];
|
||||||
if (nTimeSteps)
|
if (nTimeSteps)
|
||||||
@ -190,21 +206,25 @@ int vtkPV3FoamReader::RequestInformation
|
|||||||
|
|
||||||
if (Foam::vtkPV3Foam::debug > 1)
|
if (Foam::vtkPV3Foam::debug > 1)
|
||||||
{
|
{
|
||||||
cout<<"nTimeSteps " << nTimeSteps << "\n";
|
cout<<"nTimeSteps " << nTimeSteps << "\n"
|
||||||
cout<<"timeRange " << timeRange[0] << " to " << timeRange[1] << "\n";
|
<<"timeRange " << timeRange[0] << " to " << timeRange[1]
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
for (int i = 0; i < nTimeSteps; ++i)
|
for (int timeI = 0; timeI < nTimeSteps; ++timeI)
|
||||||
{
|
{
|
||||||
cout<< "step[" << i << "] = " << timeSteps[i] << "\n";
|
cout<< "step[" << timeI << "] = " << timeSteps[timeI] << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outInfo->Set
|
for (int infoI = 0; infoI < nInfo; ++infoI)
|
||||||
(
|
{
|
||||||
vtkStreamingDemandDrivenPipeline::TIME_RANGE(),
|
outputVector->GetInformationObject(infoI)->Set
|
||||||
timeRange,
|
(
|
||||||
2
|
vtkStreamingDemandDrivenPipeline::TIME_RANGE(),
|
||||||
);
|
timeRange,
|
||||||
|
2
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete timeSteps;
|
delete timeSteps;
|
||||||
@ -229,75 +249,41 @@ int vtkPV3FoamReader::RequestData
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nInfo = outputVector->GetNumberOfInformationObjects();
|
||||||
|
|
||||||
if (Foam::vtkPV3Foam::debug)
|
if (Foam::vtkPV3Foam::debug)
|
||||||
{
|
{
|
||||||
int nInfo = outputVector->GetNumberOfInformationObjects();
|
cout<<"RequestData with " << nInfo << " item(s)\n";
|
||||||
cout<<"requestData with " << nInfo << " items\n";
|
for (int infoI = 0; infoI < nInfo; ++infoI)
|
||||||
|
|
||||||
for (int i = 0; i < nInfo; ++i)
|
|
||||||
{
|
{
|
||||||
vtkInformation *info = outputVector->GetInformationObject(i);
|
outputVector->GetInformationObject(infoI)->Print(cout);
|
||||||
info->Print(cout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkInformation* outInfo = outputVector->GetInformationObject(0);
|
// take port0 as the lead for other outputs
|
||||||
|
vtkInformation *outInfo = outputVector->GetInformationObject(0);
|
||||||
|
|
||||||
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
||||||
(
|
(
|
||||||
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
|
outInfo->Get
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet::DATA_OBJECT()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Foam::vtkPV3Foam::debug)
|
|
||||||
{
|
|
||||||
vtkInformation* outputInfo = this->GetOutputPortInformation(0);
|
|
||||||
outputInfo->Print(cout);
|
|
||||||
|
|
||||||
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
vtkMultiBlockDataSet* lagrangianOutput = vtkMultiBlockDataSet::SafeDownCast
|
||||||
|
(
|
||||||
|
outputVector->GetInformationObject(1)->Get
|
||||||
(
|
(
|
||||||
outputInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
|
vtkMultiBlockDataSet::DATA_OBJECT()
|
||||||
);
|
)
|
||||||
if (output)
|
);
|
||||||
{
|
|
||||||
output->Print(cout);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<< "no output\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkInformation* execInfo = this->GetExecutive()->GetOutputInformation(0);
|
|
||||||
execInfo->Print(cout);
|
|
||||||
|
|
||||||
outInfo->Print(cout);
|
|
||||||
|
|
||||||
vtkMultiBlockDataSet* dobj = vtkMultiBlockDataSet::SafeDownCast
|
|
||||||
(
|
|
||||||
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT())
|
|
||||||
);
|
|
||||||
if (dobj)
|
|
||||||
{
|
|
||||||
dobj->Print(cout);
|
|
||||||
|
|
||||||
vtkInformation* dobjInfo = dobj->GetInformation();
|
|
||||||
dobjInfo->Print(cout);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<< "no data_object\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()))
|
if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()))
|
||||||
{
|
{
|
||||||
if (Foam::vtkPV3Foam::debug)
|
|
||||||
{
|
|
||||||
cout<<"Has UPDATE_TIME_STEPS\n";
|
|
||||||
cout<<"output->GetNumberOfBlocks() = "
|
|
||||||
<< output->GetNumberOfBlocks() << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the requested time step.
|
// Get the requested time step.
|
||||||
// We only supprt requests of a single time step
|
// We only support requests for a single time step
|
||||||
int nRequestedTimeSteps = outInfo->Length
|
int nRequestedTimeSteps = outInfo->Length
|
||||||
(
|
(
|
||||||
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
|
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
|
||||||
@ -313,24 +299,65 @@ int vtkPV3FoamReader::RequestData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if
|
if (Foam::vtkPV3Foam::debug)
|
||||||
(
|
{
|
||||||
(UpdateGUIOld == GetUpdateGUI())
|
cout<< "update output with "
|
||||||
|| (output->GetNumberOfBlocks() == 0)
|
<< output->GetNumberOfBlocks() << " blocks\n";
|
||||||
)
|
}
|
||||||
|
|
||||||
|
#ifdef EXPERIMENTAL_TIME_CACHING
|
||||||
|
bool needsUpdate = false;
|
||||||
|
|
||||||
|
if (!output0_)
|
||||||
|
{
|
||||||
|
output0_ = vtkMultiBlockDataSet::New();
|
||||||
|
needsUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This experimental bit of code seems to work for the geometry,
|
||||||
|
// but trashes the fields and still triggers the GeometryFilter
|
||||||
|
if (needsUpdate)
|
||||||
{
|
{
|
||||||
foamData_->Update(output);
|
foamData_->Update(output);
|
||||||
|
output0_->ShallowCopy(output);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output->ShallowCopy(output0_);
|
||||||
|
}
|
||||||
|
|
||||||
if (ShowPatchNames == 1)
|
if (Foam::vtkPV3Foam::debug)
|
||||||
|
{
|
||||||
|
if (needsUpdate)
|
||||||
{
|
{
|
||||||
addPatchNamesToView();
|
cout<< "full UPDATE ---------\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
removePatchNamesFromView();
|
cout<< "cached UPDATE ---------\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cout<< "UPDATED output: ";
|
||||||
|
output->Print(cout);
|
||||||
|
|
||||||
|
cout<< "UPDATED output0_: ";
|
||||||
|
output0_->Print(cout);
|
||||||
}
|
}
|
||||||
UpdateGUIOld = GetUpdateGUI();
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
foamData_->Update(output, lagrangianOutput);
|
||||||
|
|
||||||
|
if (ShowPatchNames)
|
||||||
|
{
|
||||||
|
addPatchNamesToView();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
removePatchNamesFromView();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -389,52 +416,57 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Region selection list control
|
// Parts selection list control
|
||||||
|
|
||||||
vtkDataArraySelection* vtkPV3FoamReader::GetRegionSelection()
|
vtkDataArraySelection* vtkPV3FoamReader::GetPartSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetRegionSelection");
|
vtkDebugMacro(<<"GetPartSelection");
|
||||||
return RegionSelection;
|
return PartSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPV3FoamReader::GetNumberOfRegionArrays()
|
int vtkPV3FoamReader::GetNumberOfPartArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfRegionArrays");
|
vtkDebugMacro(<<"GetNumberOfPartArrays");
|
||||||
return RegionSelection->GetNumberOfArrays();
|
return PartSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPV3FoamReader::GetRegionArrayName(int index)
|
const char* vtkPV3FoamReader::GetPartArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetRegionArrayName");
|
vtkDebugMacro(<<"GetPartArrayName");
|
||||||
return RegionSelection->GetArrayName(index);
|
return PartSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPV3FoamReader::GetRegionArrayStatus(const char* name)
|
int vtkPV3FoamReader::GetPartArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetRegionArrayStatus");
|
vtkDebugMacro(<<"GetPartArrayStatus");
|
||||||
return RegionSelection->ArrayIsEnabled(name);
|
return PartSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPV3FoamReader::SetRegionArrayStatus(const char* name, int status)
|
void vtkPV3FoamReader::SetPartArrayStatus(const char* name, int status)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetRegionArrayStatus");
|
vtkDebugMacro(<<"SetPartArrayStatus");
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
RegionSelection->EnableArray(name);
|
PartSelection->EnableArray(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RegionSelection->DisableArray(name);
|
PartSelection->DisableArray(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,4 +629,19 @@ void vtkPV3FoamReader::SelectionModified()
|
|||||||
Modified();
|
Modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int vtkPV3FoamReader::FillOutputPortInformation
|
||||||
|
(
|
||||||
|
int port,
|
||||||
|
vtkInformation* info
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (port == 0)
|
||||||
|
{
|
||||||
|
return this->Superclass::FillOutputPortInformation(port, info);
|
||||||
|
}
|
||||||
|
info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
// Region selection list control
|
// Description:
|
||||||
vtkDataArraySelection* GetRegionSelection();
|
// Get the current timestep
|
||||||
int GetNumberOfRegionArrays();
|
int GetTimeStep();
|
||||||
const char* GetRegionArrayName(int index);
|
|
||||||
int GetRegionArrayStatus(const char* name);
|
|
||||||
void SetRegionArrayStatus(const char* name, int status);
|
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Parts selection list control
|
||||||
|
vtkDataArraySelection* GetPartSelection();
|
||||||
|
int GetNumberOfPartArrays();
|
||||||
|
int GetPartArrayStatus(const char* name);
|
||||||
|
void SetPartArrayStatus(const char* name, int status);
|
||||||
|
const char* GetPartArrayName(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,15 +149,30 @@ protected:
|
|||||||
vtkInformationVector*
|
vtkInformationVector*
|
||||||
);
|
);
|
||||||
|
|
||||||
// The observer to modify this object when the array selections
|
//- Get the mesh/fields for a particular time
|
||||||
// are modified
|
//- Destructor
|
||||||
|
virtual int RequestData
|
||||||
|
(
|
||||||
|
vtkInformation*,
|
||||||
|
vtkInformationVector**,
|
||||||
|
vtkInformationVector*
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Fill in additional port information
|
||||||
|
virtual int FillOutputPortInformation(int, vtkInformation*);
|
||||||
|
|
||||||
|
// The observer to modify this object when array selections 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();
|
||||||
@ -173,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;
|
||||||
@ -183,16 +188,16 @@ private:
|
|||||||
int IncludeZones;
|
int IncludeZones;
|
||||||
int ShowPatchNames;
|
int ShowPatchNames;
|
||||||
|
|
||||||
|
//- Dummy variable/switch for invoke a reader update
|
||||||
int UpdateGUI;
|
int UpdateGUI;
|
||||||
int UpdateGUIOld;
|
|
||||||
|
|
||||||
vtkDataArraySelection* RegionSelection;
|
vtkDataArraySelection* PartSelection;
|
||||||
vtkDataArraySelection* VolFieldSelection;
|
vtkDataArraySelection* VolFieldSelection;
|
||||||
vtkDataArraySelection* PointFieldSelection;
|
vtkDataArraySelection* PointFieldSelection;
|
||||||
vtkDataArraySelection* LagrangianFieldSelection;
|
vtkDataArraySelection* LagrangianFieldSelection;
|
||||||
|
|
||||||
//- Access to the output port1
|
//- Cached data for output port0 (experimental!)
|
||||||
vtkMultiBlockDataSet* output1_;
|
vtkMultiBlockDataSet* output0_;
|
||||||
|
|
||||||
//BTX
|
//BTX
|
||||||
Foam::vtkPV3Foam* foamData_;
|
Foam::vtkPV3Foam* foamData_;
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
vtkPV3Foam.C
|
vtkPV3Foam.C
|
||||||
vtkPV3FoamAddVolumeMesh.C
|
vtkPV3FoamFields.C
|
||||||
vtkPV3FoamAddLagrangianMesh.C
|
vtkPV3FoamMesh.C
|
||||||
vtkPV3FoamAddPatchMesh.C
|
vtkPV3FoamMeshLagrangian.C
|
||||||
vtkPV3FoamAddZoneMesh.C
|
vtkPV3FoamMeshPatch.C
|
||||||
vtkPV3FoamAddSetMesh.C
|
vtkPV3FoamMeshSet.C
|
||||||
vtkPV3FoamUpdate.C
|
vtkPV3FoamMeshVolume.C
|
||||||
vtkPV3FoamUpdateInformation.C
|
vtkPV3FoamMeshZone.C
|
||||||
vtkPV3FoamConvertMesh.C
|
vtkPV3FoamUpdateInfo.C
|
||||||
|
vtkPV3FoamUtilities.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libvtkPV3Foam
|
LIB = $(FOAM_LIBBIN)/libvtkPV3Foam
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -32,23 +32,23 @@ 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
|
||||||
|
vtkPV3FoamUtilities.C
|
||||||
|
vtkPV3FoamVolFields.H
|
||||||
vtkPV3FoamAddToSelection.H
|
vtkPV3FoamAddToSelection.H
|
||||||
vtkPV3FoamAddVolumeMesh.C
|
|
||||||
vtkPV3FoamAddZoneMesh.C
|
|
||||||
vtkPV3FoamConvertFaceField.H
|
|
||||||
vtkPV3FoamConvertLagrangianFields.H
|
|
||||||
vtkPV3FoamConvertMesh.C
|
|
||||||
vtkPV3FoamConvertPatchFaceField.H
|
|
||||||
vtkPV3FoamConvertPatchPointField.H
|
|
||||||
vtkPV3FoamConvertPointFields.H
|
|
||||||
vtkPV3FoamConvertVolFields.H
|
|
||||||
vtkPV3FoamInsertNextPoint.H
|
|
||||||
vtkPV3FoamUpdate.C
|
|
||||||
vtkPV3FoamUpdateInformation.C
|
|
||||||
vtkPV3FoamUpdateInformationFields.H
|
|
||||||
|
|
||||||
// Needed by VTK:
|
// Needed by VTK:
|
||||||
vtkDataArrayTemplateImplicit.txx
|
vtkDataArrayTemplateImplicit.txx
|
||||||
@ -104,24 +104,22 @@ class List;
|
|||||||
|
|
||||||
class vtkPV3Foam
|
class vtkPV3Foam
|
||||||
{
|
{
|
||||||
public:
|
// Private classes
|
||||||
|
|
||||||
// Public data
|
//- Bookkeeping for GUI checklists and the multi-block organization
|
||||||
|
class partInfo
|
||||||
//- bookkeeping for the GUI checklists and the multi-block organization
|
|
||||||
class selectionInfo
|
|
||||||
{
|
{
|
||||||
int block_;
|
|
||||||
const char *name_;
|
const char *name_;
|
||||||
|
int block_;
|
||||||
int start_;
|
int start_;
|
||||||
int size_;
|
int size_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
selectionInfo(const int blockNo, const char *name)
|
partInfo(const char *name, const int blockNo=0)
|
||||||
:
|
:
|
||||||
block_(blockNo),
|
|
||||||
name_(name),
|
name_(name),
|
||||||
|
block_(blockNo),
|
||||||
start_(-1),
|
start_(-1),
|
||||||
size_(0)
|
size_(0)
|
||||||
{}
|
{}
|
||||||
@ -132,6 +130,13 @@ public:
|
|||||||
return block_;
|
return block_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int block(int blockNo)
|
||||||
|
{
|
||||||
|
int prev = block_;
|
||||||
|
block_ = blockNo;
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
|
||||||
const char* name() const
|
const char* name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
@ -172,26 +177,67 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//- bookkeeping for polyhedral cell decomposition
|
||||||
private:
|
// hide in extra pointMap (cellSet/cellZone) for now
|
||||||
|
class polyDecomp
|
||||||
// Private data
|
|
||||||
|
|
||||||
//BTX
|
|
||||||
//- Indices for datasets in vtkMultiBlockDataSet
|
|
||||||
enum
|
|
||||||
{
|
{
|
||||||
VOLUME = 0, // internal mesh
|
labelList superCells_;
|
||||||
PATCHES = 1, // patches
|
labelList addPointCellLabels_;
|
||||||
LAGRANGIAN = 2,
|
labelList pointMap_;
|
||||||
CELLZONE = 3,
|
|
||||||
FACEZONE = 4,
|
public:
|
||||||
POINTZONE = 5,
|
|
||||||
CELLSET = 6,
|
polyDecomp()
|
||||||
FACESET = 7,
|
{}
|
||||||
POINTSET = 8
|
|
||||||
|
//- Label of original cell for decomposed cells
|
||||||
|
labelList& superCells()
|
||||||
|
{
|
||||||
|
return superCells_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Label of original cell for decomposed cells
|
||||||
|
const labelList& superCells() const
|
||||||
|
{
|
||||||
|
return superCells_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Cell-centre labels for additional points of decomposed cells
|
||||||
|
labelList& addPointCellLabels()
|
||||||
|
{
|
||||||
|
return addPointCellLabels_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Cell-centre labels for additional points of decomposed cells
|
||||||
|
const labelList& addPointCellLabels() const
|
||||||
|
{
|
||||||
|
return addPointCellLabels_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Point labels for subsetted meshes
|
||||||
|
labelList& pointMap()
|
||||||
|
{
|
||||||
|
return pointMap_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Point labels for subsetted meshes
|
||||||
|
const labelList& pointMap() const
|
||||||
|
{
|
||||||
|
return pointMap_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Clear
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
superCells_.clear();
|
||||||
|
addPointCellLabels_.clear();
|
||||||
|
pointMap_.clear();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
//ETX
|
|
||||||
|
|
||||||
|
// Private Data
|
||||||
|
|
||||||
//- Access to the controlling vtkPV3FoamReader
|
//- Access to the controlling vtkPV3FoamReader
|
||||||
vtkPV3FoamReader* reader_;
|
vtkPV3FoamReader* reader_;
|
||||||
@ -202,64 +248,51 @@ private:
|
|||||||
//- Foam mesh
|
//- Foam mesh
|
||||||
fvMesh* meshPtr_;
|
fvMesh* meshPtr_;
|
||||||
|
|
||||||
//- First instance and size of various regions
|
//- Number of meshes
|
||||||
selectionInfo selectInfoVolume_;
|
// TODO - for info only - only set up to process ONE mesh
|
||||||
selectionInfo selectInfoPatches_;
|
int nMesh_;
|
||||||
selectionInfo selectInfoLagrangian_;
|
|
||||||
selectionInfo selectInfoCellZones_;
|
|
||||||
selectionInfo selectInfoFaceZones_;
|
|
||||||
selectionInfo selectInfoPointZones_;
|
|
||||||
selectionInfo selectInfoCellSets_;
|
|
||||||
selectionInfo selectInfoFaceSets_;
|
|
||||||
selectionInfo selectInfoPointSets_;
|
|
||||||
|
|
||||||
//- Selected regions
|
//- The time index
|
||||||
// [0] = internal mesh, then lagrangian, patches, zones, sets
|
int timeIndex_;
|
||||||
boolList selectedRegions_;
|
|
||||||
|
|
||||||
//- Selected regions indices in each respective block
|
//- Track changes in mesh geometry
|
||||||
labelList selectedRegionDatasetIds_;
|
bool meshChanged_;
|
||||||
|
|
||||||
//- Labels of cell-centres used as additional points when decomposing
|
//- Track changes in fields
|
||||||
// polyhedra
|
bool fieldsChanged_;
|
||||||
labelList addPointCellLabels_;
|
|
||||||
|
|
||||||
//- Label of original cell for decomposed cells
|
//- Selected geometrical parts (internalMesh, patches, ...)
|
||||||
// - internal mesh
|
boolList partStatus_;
|
||||||
labelList superCells_;
|
|
||||||
|
|
||||||
//- Label of original cell for decomposed cells
|
//- Datasets corresponding to selected geometrical pieces
|
||||||
// - cellZone meshes
|
// a negative number indicates that no vtkmesh exists for this piece
|
||||||
List<labelList> zoneSuperCells_;
|
labelList partDataset_;
|
||||||
|
|
||||||
//- Label of original cell for decomposed cells
|
//- First instance and size of various mesh parts
|
||||||
// - cellSet meshes
|
// used to index into partStatus_ and partDataset_
|
||||||
List<labelList> csetSuperCells_;
|
partInfo partInfoVolume_;
|
||||||
|
partInfo partInfoPatches_;
|
||||||
|
partInfo partInfoLagrangian_;
|
||||||
|
partInfo partInfoCellZones_;
|
||||||
|
partInfo partInfoFaceZones_;
|
||||||
|
partInfo partInfoPointZones_;
|
||||||
|
partInfo partInfoCellSets_;
|
||||||
|
partInfo partInfoFaceSets_;
|
||||||
|
partInfo partInfoPointSets_;
|
||||||
|
|
||||||
//- List of patch names
|
//- Decomposed cells information (mesh regions)
|
||||||
|
// TODO: regions
|
||||||
|
List<polyDecomp> regionPolyDecomp_;
|
||||||
|
|
||||||
|
//- Decomposed cells information (cellZone meshes)
|
||||||
|
List<polyDecomp> zonePolyDecomp_;
|
||||||
|
|
||||||
|
//- Decomposed cells information (cellSet meshes)
|
||||||
|
List<polyDecomp> csetPolyDecomp_;
|
||||||
|
|
||||||
|
//- List of patch names for rendering to window
|
||||||
List<vtkTextActor*> patchTextActorsPtrs_;
|
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
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
// Convenience method use to convert the readers from VTK 5
|
||||||
@ -267,10 +300,10 @@ private:
|
|||||||
static void AddToBlock
|
static void AddToBlock
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
|
||||||
const label datasetNo,
|
|
||||||
vtkDataSet* dataset,
|
vtkDataSet* dataset,
|
||||||
const string& blockName = string::null
|
const partInfo&,
|
||||||
|
const label datasetNo,
|
||||||
|
const string& datasetName
|
||||||
);
|
);
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
// Convenience method use to convert the readers from VTK 5
|
||||||
@ -278,7 +311,7 @@ private:
|
|||||||
static vtkDataSet* GetDataSetFromBlock
|
static vtkDataSet* GetDataSetFromBlock
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
const partInfo&,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -287,7 +320,7 @@ private:
|
|||||||
static label GetNumberOfDataSets
|
static label GetNumberOfDataSets
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&
|
const partInfo&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Reset data counters
|
//- Reset data counters
|
||||||
@ -295,45 +328,42 @@ private:
|
|||||||
|
|
||||||
// Update information helper functions
|
// Update information helper functions
|
||||||
|
|
||||||
//- Update the regions selected in the GUI
|
//- Update the mesh parts selected in the GUI
|
||||||
void updateSelectedRegions();
|
void updateMeshPartsStatus();
|
||||||
|
|
||||||
//- 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
|
//- Add objects of Type to paraview array selection
|
||||||
void updateInformationZones();
|
|
||||||
|
|
||||||
//- 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 = ""
|
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
|
||||||
@ -341,118 +371,112 @@ private:
|
|||||||
//- Foam mesh
|
//- Foam mesh
|
||||||
void updateFoamMesh();
|
void updateFoamMesh();
|
||||||
|
|
||||||
|
//- Reduce memory footprint after conversion
|
||||||
|
void reduceMemory();
|
||||||
|
|
||||||
//- Volume fields
|
//- Volume fields
|
||||||
void updateVolFields(vtkMultiBlockDataSet* output);
|
void updateVolFields(vtkMultiBlockDataSet*);
|
||||||
|
|
||||||
//- Point fields
|
//- Point fields
|
||||||
void updatePointFields(vtkMultiBlockDataSet* output);
|
void updatePointFields(vtkMultiBlockDataSet*);
|
||||||
|
|
||||||
//- Lagrangian fields
|
//- Lagrangian fields
|
||||||
void updateLagrangianFields(vtkMultiBlockDataSet* output);
|
void updateLagrangianFields(vtkMultiBlockDataSet*);
|
||||||
|
|
||||||
|
|
||||||
// Mesh conversion functions
|
// Mesh conversion functions
|
||||||
|
|
||||||
//- Volume mesh
|
//- Volume mesh
|
||||||
void convertMeshVolume(vtkMultiBlockDataSet* output);
|
void convertMeshVolume(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- Lagrangian mesh
|
//- Lagrangian mesh
|
||||||
void convertMeshLagrangian(vtkMultiBlockDataSet* output);
|
void convertMeshLagrangian(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- Patch meshes
|
//- Patch meshes
|
||||||
void convertMeshPatches(vtkMultiBlockDataSet* output);
|
void convertMeshPatches(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- Cell zone meshes
|
//- Cell zone meshes
|
||||||
void convertMeshCellZones(vtkMultiBlockDataSet* output);
|
void convertMeshCellZones(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- Face zone meshes
|
//- Face zone meshes
|
||||||
void convertMeshFaceZones(vtkMultiBlockDataSet* output);
|
void convertMeshFaceZones(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- Point zone meshes
|
//- Point zone meshes
|
||||||
void convertMeshPointZones(vtkMultiBlockDataSet* output);
|
void convertMeshPointZones(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- Cell set meshes
|
//- Cell set meshes
|
||||||
void convertMeshCellSets(vtkMultiBlockDataSet* output);
|
void convertMeshCellSets(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- Face set meshes
|
//- Face set meshes
|
||||||
void convertMeshFaceSets(vtkMultiBlockDataSet* output);
|
void convertMeshFaceSets(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- Point set meshes
|
//- Point set meshes
|
||||||
void convertMeshPointSets(vtkMultiBlockDataSet* output);
|
void convertMeshPointSets(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
|
|
||||||
// Add mesh functions
|
// Add mesh functions
|
||||||
|
|
||||||
//- Add internal mesh/cell set meshes
|
//- Add internal mesh/cell set meshes
|
||||||
void addVolumeMesh
|
vtkUnstructuredGrid* volumeVTKMesh(const fvMesh&, polyDecomp&);
|
||||||
(
|
|
||||||
const fvMesh&,
|
|
||||||
vtkUnstructuredGrid*,
|
|
||||||
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
|
||||||
|
|
||||||
|
//- Convert volume fields
|
||||||
|
void convertVolFields(vtkMultiBlockDataSet*);
|
||||||
|
|
||||||
|
//- Convert point fields
|
||||||
|
void convertPointFields(vtkMultiBlockDataSet*);
|
||||||
|
|
||||||
|
//- Convert Lagrangian fields
|
||||||
|
void convertLagrangianFields(vtkMultiBlockDataSet*);
|
||||||
|
|
||||||
|
|
||||||
//- Add the fields in the selected time directory to the selection
|
//- Add the fields in the selected time directory to the selection
|
||||||
// lists
|
// lists
|
||||||
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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -463,32 +487,42 @@ 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 - all selected parts
|
||||||
|
template<class Type>
|
||||||
|
void convertVolFieldBlock
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>&,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
|
const List<polyDecomp>& decompLst
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Volume field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertVolField
|
void convertVolField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
const partInfo&,
|
||||||
const label datasetNo,
|
const label datasetNo,
|
||||||
labelList& superCells
|
const polyDecomp&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- 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>&,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
const partInfo&,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -498,7 +532,7 @@ private:
|
|||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
const partInfo&,
|
||||||
const label datasetNo,
|
const label datasetNo,
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
const labelList& faceLabels
|
const labelList& faceLabels
|
||||||
@ -510,7 +544,7 @@ private:
|
|||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
const partInfo&,
|
||||||
const label datasetNo,
|
const label datasetNo,
|
||||||
const fvMesh&,
|
const fvMesh&,
|
||||||
const faceSet&
|
const faceSet&
|
||||||
@ -520,19 +554,18 @@ 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
|
||||||
(
|
(
|
||||||
const IOField<Type>&,
|
const IOField<Type>&,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo&,
|
const partInfo&,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -540,31 +573,42 @@ 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 field - all selected parts
|
||||||
|
template<class Type>
|
||||||
|
void convertPointFieldBlock
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>&,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
|
const List<polyDecomp>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- 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 partInfo&,
|
||||||
const label datasetNo
|
const label datasetNo,
|
||||||
|
const polyDecomp&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- 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 partInfo&,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -574,28 +618,43 @@ 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*);
|
||||||
|
|
||||||
//- Store the current selection(s)
|
//- Only keep what is listed in hashSet
|
||||||
static stringList getSelectedArrayEntries
|
static void pruneObjectList
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
IOobjectList&,
|
||||||
const bool firstWord = false
|
const wordHashSet&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Store the current selection(s) for a sub-selection
|
//- Retrieve the current selections
|
||||||
|
static wordHashSet getSelected(vtkDataArraySelection*);
|
||||||
|
|
||||||
|
//- Retrieve a sub-list of the current selections
|
||||||
|
static wordHashSet getSelected
|
||||||
|
(
|
||||||
|
vtkDataArraySelection*,
|
||||||
|
const partInfo&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Retrieve the current selections
|
||||||
|
static stringList getSelectedArrayEntries(vtkDataArraySelection*);
|
||||||
|
|
||||||
|
//- Retrieve a sub-list of the current selections
|
||||||
static stringList getSelectedArrayEntries
|
static stringList getSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
vtkDataArraySelection*,
|
||||||
const selectionInfo&,
|
const partInfo&
|
||||||
const bool firstWord = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Set selection(s)
|
//- Set selection(s)
|
||||||
static void setSelectedArrayEntries
|
static void setSelectedArrayEntries
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection,
|
vtkDataArraySelection*,
|
||||||
const stringList& selectedEntries
|
const stringList&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Get the first word from the mesh parts selection
|
||||||
|
word getPartName(int);
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkPV3Foam(const vtkPV3Foam&);
|
vtkPV3Foam(const vtkPV3Foam&);
|
||||||
@ -629,9 +688,13 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Update
|
//- Update
|
||||||
void UpdateInformation();
|
void updateInfo();
|
||||||
|
|
||||||
void Update(vtkMultiBlockDataSet* output);
|
void Update
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
vtkMultiBlockDataSet* lagrangianOutput
|
||||||
|
);
|
||||||
|
|
||||||
//- Allocate and return a list of selected times
|
//- Allocate and return a list of selected times
|
||||||
// returns the count via the parameter
|
// returns the count via the parameter
|
||||||
@ -643,10 +706,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,51 +39,26 @@ 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
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOobjectList objects(objectLst.lookupClass(Type::typeName));
|
SortableList<word> names(objectLst.names(Type::typeName));
|
||||||
|
|
||||||
SortableList<word> objectNames(objects.size());
|
forAll(names, nameI)
|
||||||
|
|
||||||
label count = 0;
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
|
||||||
{
|
{
|
||||||
objectNames[count++] = iter()->name();
|
if (suffix.size())
|
||||||
}
|
|
||||||
|
|
||||||
if (count)
|
|
||||||
{
|
|
||||||
objectNames.sort();
|
|
||||||
|
|
||||||
forAll (objectNames, objI)
|
|
||||||
{
|
{
|
||||||
if (debug)
|
select->AddArray((names[nameI] + suffix).c_str());
|
||||||
{
|
}
|
||||||
Info<<" addToSelection<" << Type::typeName << "> to GUI "
|
else
|
||||||
<< ":" << objectNames[objI] << endl;
|
{
|
||||||
}
|
select->AddArray(names[nameI].c_str());
|
||||||
|
|
||||||
if (suffix.size())
|
|
||||||
{
|
|
||||||
arraySelection->AddArray
|
|
||||||
(
|
|
||||||
(objectNames[objI] + suffix).c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
arraySelection->AddArray
|
|
||||||
(
|
|
||||||
objectNames[objI].c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return names.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,139 +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_;
|
|
||||||
const label datasetId = 0;
|
|
||||||
|
|
||||||
if (!selector.size())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IOobjectList fieldObjects
|
|
||||||
(
|
|
||||||
objects.lookupClass
|
|
||||||
(
|
|
||||||
IOField<Type>::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label nFields = fieldSelection->GetNumberOfArrays();
|
|
||||||
|
|
||||||
for (label i=0; i<nFields; i++)
|
|
||||||
{
|
|
||||||
if (fieldSelection->GetArraySetting(i))
|
|
||||||
{
|
|
||||||
const word fieldName = fieldSelection->GetArrayName(i);
|
|
||||||
|
|
||||||
if (fieldObjects.found(fieldName))
|
|
||||||
{
|
|
||||||
IOField<Type> iotf
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
"lagrangian"/cloudName_,
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
convertLagrangianField(iotf, output, selector, datasetId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,649 +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 "cellSet.H"
|
|
||||||
#include "faceSet.H"
|
|
||||||
#include "pointSet.H"
|
|
||||||
#include "fvMeshSubset.H"
|
|
||||||
#include "vtkPV3FoamReader.h"
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkDataArraySelection.h"
|
|
||||||
#include "vtkMultiBlockDataSet.h"
|
|
||||||
#include "vtkPolyData.h"
|
|
||||||
#include "vtkUnstructuredGrid.h"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshVolume
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshVolume" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoVolume_;
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Create the internal mesh and add as dataset 0
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selector.start();
|
|
||||||
regionId < selector.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// word selectName = getFirstWord
|
|
||||||
// (
|
|
||||||
// arraySelection->GetArrayName(regionId)
|
|
||||||
// );
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK internalMesh" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label datasetId = 0;
|
|
||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
|
||||||
addVolumeMesh(mesh, vtkmesh, superCells_);
|
|
||||||
|
|
||||||
AddToBlock(output, selector, datasetId, vtkmesh, "internalMesh");
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshVolume" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshLagrangian
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshLagrangian" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoLagrangian_;
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Create the Lagrangian mesh and add as dataset 0
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selector.start();
|
|
||||||
regionId < selector.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK Lagrangian mesh" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label datasetId = 0;
|
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
addLagrangianMesh(mesh, vtkmesh);
|
|
||||||
|
|
||||||
AddToBlock(output, selector, datasetId, vtkmesh, cloudName_);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
}
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshLagrangian" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshPatches
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPatches" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoPatches_;
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
|
||||||
|
|
||||||
if (selector.size())
|
|
||||||
{
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
// Create the patches and add as dataset ...
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selector.start();
|
|
||||||
regionId < selector.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelection->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
const label patchId = patches.findPatchID(selectName);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK mesh for patch: " << selectName
|
|
||||||
<< " region index: " << regionId << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
addPatchMesh
|
|
||||||
(
|
|
||||||
patches[patchId],
|
|
||||||
vtkmesh
|
|
||||||
);
|
|
||||||
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
selectName + ":patch"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshPatches" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshCellZones
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshCellZones" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoCellZones_;
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Create the cell zone(s) and add as DataSet(CELLZONE, 0..n)
|
|
||||||
if (selector.size())
|
|
||||||
{
|
|
||||||
const cellZoneMesh& czMesh = mesh.cellZones();
|
|
||||||
|
|
||||||
// use the zoneId directly instead of the name
|
|
||||||
for (int zoneI=0; zoneI < selector.size(); ++zoneI)
|
|
||||||
{
|
|
||||||
const int regionId = selector.start() + zoneI;
|
|
||||||
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK mesh for cellZone: "
|
|
||||||
<< zoneI << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
fvMeshSubset subsetter(mesh);
|
|
||||||
subsetter.setLargeCellSubset(czMesh[zoneI]);
|
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
|
||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
|
||||||
|
|
||||||
addVolumeMesh
|
|
||||||
(
|
|
||||||
subsetter.subMesh(),
|
|
||||||
vtkmesh,
|
|
||||||
zoneSuperCells_[datasetId]
|
|
||||||
);
|
|
||||||
|
|
||||||
// renumber - superCells must contain global cell ids
|
|
||||||
inplaceRenumber
|
|
||||||
(
|
|
||||||
subsetter.cellMap(),
|
|
||||||
zoneSuperCells_[datasetId]
|
|
||||||
);
|
|
||||||
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
czMesh.names()[zoneI] + ":cellZone"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshCellZones" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshCellSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshCellSets" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoCellSets_;
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
|
||||||
|
|
||||||
// Create the cell sets and add as dataset
|
|
||||||
if (selector.size())
|
|
||||||
{
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selector.start();
|
|
||||||
regionId < selector.end();
|
|
||||||
++regionId)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelection->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK mesh for cellSet: " << selectName
|
|
||||||
<< " region index: " << regionId << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cellSet cSet(mesh, selectName);
|
|
||||||
fvMeshSubset subsetter(mesh);
|
|
||||||
subsetter.setLargeCellSubset(cSet);
|
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
|
||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
|
||||||
|
|
||||||
addVolumeMesh
|
|
||||||
(
|
|
||||||
subsetter.subMesh(),
|
|
||||||
vtkmesh,
|
|
||||||
csetSuperCells_[datasetId]
|
|
||||||
);
|
|
||||||
|
|
||||||
// renumber - superCells must contain global cell ids
|
|
||||||
inplaceRenumber
|
|
||||||
(
|
|
||||||
subsetter.cellMap(),
|
|
||||||
csetSuperCells_[datasetId]
|
|
||||||
);
|
|
||||||
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
selectName + ":cellSet"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshCellSets" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshFaceZones
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshFaceZones" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoFaceZones_;
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Create the cell zone(s) and add as datasets
|
|
||||||
if (selector.size())
|
|
||||||
{
|
|
||||||
const faceZoneMesh& fzMesh = mesh.faceZones();
|
|
||||||
|
|
||||||
// use the zoneId directly instead of the name
|
|
||||||
for (int zoneI=0; zoneI < selector.size(); ++zoneI)
|
|
||||||
{
|
|
||||||
const int regionId = selector.start() + zoneI;
|
|
||||||
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK mesh for faceZone: "
|
|
||||||
<< zoneI << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
|
|
||||||
addFaceZoneMesh
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
fzMesh[zoneI],
|
|
||||||
vtkmesh
|
|
||||||
);
|
|
||||||
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
fzMesh.names()[zoneI] + ":faceZone"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshFaceZones" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshFaceSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshFaceSets" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoFaceSets_;
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
|
||||||
|
|
||||||
// Create the face sets and add as dataset
|
|
||||||
if (selector.size())
|
|
||||||
{
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selector.start();
|
|
||||||
regionId < selector.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelection->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK mesh for faceSet: " << selectName
|
|
||||||
<< " region index: " << regionId << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const faceSet fSet(mesh, selectName);
|
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
addFaceSetMesh
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
fSet,
|
|
||||||
vtkmesh
|
|
||||||
);
|
|
||||||
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
selectName + ":faceSet"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshFaceSets" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshPointZones
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPointZones" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoPointZones_;
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
// Create the point sets and add as dataset
|
|
||||||
if (selector.size())
|
|
||||||
{
|
|
||||||
const pointZoneMesh& pzMesh = mesh.pointZones();
|
|
||||||
|
|
||||||
// use the zoneId directly instead of the name
|
|
||||||
for (int zoneI=0; zoneI < selector.size(); ++zoneI)
|
|
||||||
{
|
|
||||||
const int regionId = selector.start() + zoneI;
|
|
||||||
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK mesh for pointZone: "
|
|
||||||
<< zoneI << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshPointZones" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::convertMeshPointSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPointSets" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectionInfo& selector = selectInfoPointSets_;
|
|
||||||
vtkDataArraySelection* arraySelection = reader_->GetRegionSelection();
|
|
||||||
|
|
||||||
// Create the point sets and add as dataset
|
|
||||||
if (selector.size())
|
|
||||||
{
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selector.start();
|
|
||||||
regionId < selector.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelection->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating VTK mesh for pointSet: " << selectName
|
|
||||||
<< " region index: " << regionId << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pointSet pSet(mesh, selectName);
|
|
||||||
|
|
||||||
const label datasetId = GetNumberOfDataSets(output, selector);
|
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::New();
|
|
||||||
addPointSetMesh
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
pSet,
|
|
||||||
vtkmesh
|
|
||||||
);
|
|
||||||
AddToBlock
|
|
||||||
(
|
|
||||||
output, selector, datasetId, vtkmesh,
|
|
||||||
selectName + ":pointSet"
|
|
||||||
);
|
|
||||||
selectedRegionDatasetIds_[regionId] = datasetId;
|
|
||||||
vtkmesh->Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::convertMeshPointSets" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,211 +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 vtkPV3FoamConvertPointFields_H
|
|
||||||
#define vtkPV3FoamConvertPointFields_H
|
|
||||||
|
|
||||||
// Foam includes
|
|
||||||
#include "interpolatePointToCell.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPV3Foam::convertPointFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkDataArraySelection* fieldSelection,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IOobjectList fieldObjects
|
|
||||||
(
|
|
||||||
objects.lookupClass
|
|
||||||
(
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh>::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label nSelectedFields = fieldSelection->GetNumberOfArrays();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
for (label i=0; i<nSelectedFields; i++)
|
|
||||||
{
|
|
||||||
if (fieldSelection->GetArraySetting(i))
|
|
||||||
{
|
|
||||||
word fieldName = fieldSelection->GetArrayName(i);
|
|
||||||
|
|
||||||
if (fieldObjects.found(fieldName))
|
|
||||||
{
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Foam::vtkPV3Foam::convertPointFields : " << fieldName
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
pointMesh pMesh(mesh);
|
|
||||||
|
|
||||||
GeometricField<Type, pointPatchField, pointMesh> ptf
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
pMesh
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convert internal mesh
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selectInfoVolume_.start();
|
|
||||||
regionId < selectInfoVolume_.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
convertPointField
|
|
||||||
(
|
|
||||||
ptf,
|
|
||||||
GeometricField<Type, fvPatchField, volMesh>::null(),
|
|
||||||
output,
|
|
||||||
selectInfoVolume_,
|
|
||||||
selectedRegionDatasetIds_[regionId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Convert patches
|
|
||||||
label regionId = selectInfoPatches_.start();
|
|
||||||
forAll (patches, patchI)
|
|
||||||
{
|
|
||||||
if (patches[patchI].size())
|
|
||||||
{
|
|
||||||
if (selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
ptf.boundaryField()[patchI]
|
|
||||||
.patchInternalField()(),
|
|
||||||
output,
|
|
||||||
selectInfoPatches_,
|
|
||||||
selectedRegionDatasetIds_[regionId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
regionId++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPV3Foam::convertPointField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const selectionInfo& selector,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
|
|
||||||
vtkUnstructuredGrid* internalMesh = vtkUnstructuredGrid::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
|
||||||
);
|
|
||||||
|
|
||||||
vtkFloatArray *pointData = vtkFloatArray::New();
|
|
||||||
pointData->SetNumberOfTuples(ptf.size() + addPointCellLabels_.size());
|
|
||||||
pointData->SetNumberOfComponents(nComp);
|
|
||||||
pointData->Allocate(nComp*ptf.size());
|
|
||||||
pointData->SetName(tf.name().c_str());
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
|
|
||||||
forAll(ptf, i)
|
|
||||||
{
|
|
||||||
for (direction d=0; d<nComp; d++)
|
|
||||||
{
|
|
||||||
vec[d] = component(ptf[i], d);
|
|
||||||
}
|
|
||||||
|
|
||||||
pointData->InsertTuple(i, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
label i = ptf.size();
|
|
||||||
|
|
||||||
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
|
|
||||||
{
|
|
||||||
forAll(addPointCellLabels_, api)
|
|
||||||
{
|
|
||||||
Type t = tf[addPointCellLabels_[api]];
|
|
||||||
|
|
||||||
for (direction d=0; d<nComp; d++)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
pointData->InsertTuple(i++, vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(addPointCellLabels_, api)
|
|
||||||
{
|
|
||||||
Type t = interpolatePointToCell(ptf, addPointCellLabels_[api]);
|
|
||||||
|
|
||||||
for (direction d=0; d<nComp; d++)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
pointData->InsertTuple(i++, vec);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internalMesh->GetPointData()->AddArray(pointData);
|
|
||||||
pointData->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,416 +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 vtkPV3FoamConvertVolFields_H
|
|
||||||
#define vtkPV3FoamConvertVolFields_H
|
|
||||||
|
|
||||||
// Foam includes
|
|
||||||
#include "emptyFvPatchField.H"
|
|
||||||
#include "wallPolyPatch.H"
|
|
||||||
#include "faceSet.H"
|
|
||||||
#include "vtkPV3FoamConvertPatchFaceField.H"
|
|
||||||
#include "vtkPV3FoamConvertPatchPointField.H"
|
|
||||||
#include "vtkPV3FoamConvertFaceField.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPV3Foam::convertVolFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const volPointInterpolation& pInterp,
|
|
||||||
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
vtkDataArraySelection *fieldSelection,
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IOobjectList fieldObjects
|
|
||||||
(
|
|
||||||
objects.lookupClass
|
|
||||||
(
|
|
||||||
GeometricField<Type, fvPatchField, volMesh>::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label nFields = fieldSelection->GetNumberOfArrays();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
vtkDataArraySelection* arraySelector = reader_->GetRegionSelection();
|
|
||||||
|
|
||||||
for (label i=0; i<nFields; i++)
|
|
||||||
{
|
|
||||||
const word fieldName = fieldSelection->GetArrayName(i);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!fieldSelection->GetArraySetting(i)
|
|
||||||
|| !fieldObjects.found(fieldName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting Foam volume field: " << fieldName
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
GeometricField<Type, fvPatchField, volMesh> tf
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
tmp<GeometricField<Type, pointPatchField, pointMesh> > tptf
|
|
||||||
(
|
|
||||||
pInterp.interpolate(tf)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convert internal mesh
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selectInfoVolume_.start();
|
|
||||||
regionId < selectInfoVolume_.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
convertVolField
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
output,
|
|
||||||
selectInfoVolume_,
|
|
||||||
selectedRegionDatasetIds_[regionId],
|
|
||||||
superCells_
|
|
||||||
);
|
|
||||||
convertPointField
|
|
||||||
(
|
|
||||||
tptf(),
|
|
||||||
tf,
|
|
||||||
output,
|
|
||||||
selectInfoVolume_,
|
|
||||||
selectedRegionDatasetIds_[regionId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Convert patches
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selectInfoPatches_.start();
|
|
||||||
regionId < selectInfoPatches_.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelector->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
const label patchId = patches.findPatchID(selectName);
|
|
||||||
|
|
||||||
const fvPatchField<Type>& ptf
|
|
||||||
(
|
|
||||||
tf.boundaryField()[patchId]
|
|
||||||
);
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
isType<emptyFvPatchField<Type> >(ptf)
|
|
||||||
||
|
|
||||||
(
|
|
||||||
typeid(patches[patchId]) == typeid(wallPolyPatch)
|
|
||||||
&& reader_->GetExtrapolateWalls()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
fvPatch p
|
|
||||||
(
|
|
||||||
ptf.patch().patch(),
|
|
||||||
tf.mesh().boundary()
|
|
||||||
);
|
|
||||||
|
|
||||||
convertPatchFaceField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
fvPatchField<Type>(p, tf).patchInternalField()(),
|
|
||||||
output,
|
|
||||||
selectInfoPatches_,
|
|
||||||
selectedRegionDatasetIds_[regionId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
convertPatchFaceField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
ptf,
|
|
||||||
output,
|
|
||||||
selectInfoPatches_,
|
|
||||||
selectedRegionDatasetIds_[regionId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
convertPatchPointField
|
|
||||||
(
|
|
||||||
tf.name(),
|
|
||||||
ppInterpList[patchId].faceToPointInterpolate(ptf)(),
|
|
||||||
output,
|
|
||||||
selectInfoPatches_,
|
|
||||||
selectedRegionDatasetIds_[regionId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert cell zones
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selectInfoCellZones_.start();
|
|
||||||
regionId < selectInfoCellZones_.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelector->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "wish to convert cellzone: " << selectName
|
|
||||||
<< " regionId: " << regionId
|
|
||||||
<< " volume field: " << fieldName
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label datasetId =
|
|
||||||
selectedRegionDatasetIds_[regionId];
|
|
||||||
|
|
||||||
convertVolField
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
output, selectInfoCellZones_, datasetId,
|
|
||||||
zoneSuperCells_[datasetId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert cell sets
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selectInfoCellSets_.start();
|
|
||||||
regionId < selectInfoCellSets_.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelector->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "wish to convert cellset: " << selectName
|
|
||||||
<< " regionId: " << regionId
|
|
||||||
<< " volume field: " << fieldName
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const label datasetId =
|
|
||||||
selectedRegionDatasetIds_[regionId];
|
|
||||||
|
|
||||||
convertVolField
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
output, selectInfoCellSets_, datasetId,
|
|
||||||
csetSuperCells_[datasetId]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert face zones
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selectInfoFaceZones_.start();
|
|
||||||
regionId < selectInfoFaceZones_.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelector->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "wish to convert facezone: " << selectName
|
|
||||||
<< " regionId: " << regionId
|
|
||||||
<< " volume field: " << fieldName
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const faceZoneMesh& fzMesh = mesh.faceZones();
|
|
||||||
const label zoneI = regionId - selectInfoFaceZones_.start();
|
|
||||||
|
|
||||||
const label datasetId =
|
|
||||||
selectedRegionDatasetIds_[regionId];
|
|
||||||
|
|
||||||
convertFaceField
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
output, selectInfoFaceZones_, datasetId,
|
|
||||||
mesh,
|
|
||||||
fzMesh[zoneI]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert face sets
|
|
||||||
for
|
|
||||||
(
|
|
||||||
int regionId = selectInfoFaceSets_.start();
|
|
||||||
regionId < selectInfoFaceSets_.end();
|
|
||||||
++regionId
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!selectedRegions_[regionId])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
word selectName = getFirstWord
|
|
||||||
(
|
|
||||||
arraySelector->GetArrayName(regionId)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "wish to convert faceset: " << selectName
|
|
||||||
<< " regionId: " << regionId
|
|
||||||
<< " volume field: " << fieldName
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const faceSet fSet(mesh, selectName);
|
|
||||||
|
|
||||||
const label datasetId =
|
|
||||||
selectedRegionDatasetIds_[regionId];
|
|
||||||
|
|
||||||
convertFaceField
|
|
||||||
(
|
|
||||||
tf,
|
|
||||||
output, selectInfoFaceSets_, datasetId,
|
|
||||||
mesh,
|
|
||||||
fSet
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPV3Foam::convertVolField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const selectionInfo& selector,
|
|
||||||
const label datasetNo,
|
|
||||||
labelList& superCells
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
|
|
||||||
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
|
||||||
);
|
|
||||||
|
|
||||||
vtkFloatArray* celldata = vtkFloatArray::New();
|
|
||||||
celldata->SetNumberOfTuples(superCells.size());
|
|
||||||
celldata->SetNumberOfComponents(nComp);
|
|
||||||
celldata->Allocate(nComp*superCells.size());
|
|
||||||
celldata->SetName(tf.name().c_str());
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "converting vol<Type>Field: " << tf.name() << nl
|
|
||||||
<< "field size = " << tf.size() << nl
|
|
||||||
<< "nTuples = " << superCells.size() << nl
|
|
||||||
<< "nComp = " << nComp << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
float vec[nComp];
|
|
||||||
|
|
||||||
forAll(superCells, scI)
|
|
||||||
{
|
|
||||||
const Type& t = tf[superCells[scI]];
|
|
||||||
for (direction d=0; d<nComp; d++)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
celldata->InsertTuple(scI, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkmesh->GetCellData()->AddArray(celldata);
|
|
||||||
celldata->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"
|
||||||
@ -42,31 +42,36 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo& selector,
|
const partInfo& selector,
|
||||||
const label datasetNo,
|
const label datasetNo,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const labelList& faceLabels
|
const labelList& faceLabels
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
|
||||||
);
|
|
||||||
|
|
||||||
const label nInternalFaces = mesh.nInternalFaces();
|
const label nInternalFaces = mesh.nInternalFaces();
|
||||||
const labelList& faceOwner = mesh.faceOwner();
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
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];
|
||||||
@ -91,7 +96,13 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
cellData->InsertTuple(faceI, vec);
|
cellData->InsertTuple(faceI, vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->GetCellData()->AddArray(cellData);
|
|
||||||
|
vtkPolyData::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
|
) ->GetCellData()
|
||||||
|
->AddArray(cellData);
|
||||||
|
|
||||||
cellData->Delete();
|
cellData->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,31 +112,36 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo& selector,
|
const partInfo& selector,
|
||||||
const label datasetNo,
|
const label datasetNo,
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const faceSet& fSet
|
const faceSet& fSet
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
|
||||||
);
|
|
||||||
|
|
||||||
const label nInternalFaces = mesh.nInternalFaces();
|
const label nInternalFaces = mesh.nInternalFaces();
|
||||||
const labelList& faceOwner = mesh.faceOwner();
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
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)
|
||||||
{
|
{
|
||||||
@ -153,11 +169,16 @@ void Foam::vtkPV3Foam::convertFaceField
|
|||||||
++faceI;
|
++faceI;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->GetCellData()->AddArray(cellData);
|
|
||||||
|
vtkPolyData::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
|
) ->GetCellData()
|
||||||
|
->AddArray(cellData);
|
||||||
|
|
||||||
cellData->Delete();
|
cellData->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -0,0 +1,319 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::pruneObjectList
|
||||||
|
(
|
||||||
|
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());
|
||||||
|
pruneObjectList(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());
|
||||||
|
pruneObjectList(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
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoLagrangian_;
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
wordHashSet selectedFields = getSelected
|
||||||
|
(
|
||||||
|
reader_->GetLagrangianFieldSelection()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!selectedFields.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertLagrangianFields" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const word cloudName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || datasetNo < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the Lagrangian fields for this time and this cloud
|
||||||
|
// but only keep selected fields
|
||||||
|
IOobjectList objects
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
dbPtr_().timeName(),
|
||||||
|
"lagrangian"/cloudName
|
||||||
|
);
|
||||||
|
pruneObjectList(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,54 +27,81 @@ 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,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo& selector,
|
const label datasetNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const partInfo& selector = partInfoLagrangian_;
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
// restrict to this IOField<Type>
|
||||||
|
if (iter()->headerClassName() == IOField<Type>::typeName)
|
||||||
|
{
|
||||||
|
IOField<Type> tf(*iter());
|
||||||
|
convertLagrangianField(tf, output, selector, datasetNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertLagrangianField
|
||||||
|
(
|
||||||
|
const IOField<Type>& tf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
|
||||||
);
|
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->GetPointData()->AddArray(pointData);
|
|
||||||
|
vtkPolyData::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
|
) ->GetPointData()
|
||||||
|
->AddArray(pointData);
|
||||||
|
|
||||||
pointData->Delete();
|
pointData->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -0,0 +1,623 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "cellSet.H"
|
||||||
|
#include "faceSet.H"
|
||||||
|
#include "pointSet.H"
|
||||||
|
#include "fvMeshSubset.H"
|
||||||
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
|
// VTK includes
|
||||||
|
#include "vtkDataArraySelection.h"
|
||||||
|
#include "vtkMultiBlockDataSet.h"
|
||||||
|
#include "vtkPolyData.h"
|
||||||
|
#include "vtkUnstructuredGrid.h"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshVolume
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoVolume_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
// resize for decomposed polyhedra
|
||||||
|
regionPolyDecomp_.setSize(selector.size());
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshVolume" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the internalMesh
|
||||||
|
// TODO: multiple mesh regions
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const word partName = "internalMesh";
|
||||||
|
|
||||||
|
if (!partStatus_[partId])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
regionPolyDecomp_[datasetNo]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshVolume" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshLagrangian
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoLagrangian_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshLagrangian" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const word cloudName = getPartName(partId);
|
||||||
|
|
||||||
|
if (!partStatus_[partId])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = lagrangianVTKMesh(mesh, cloudName);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, cloudName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshLagrangian" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshPatches
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoPatches_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPatches" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const word patchName = getPartName(partId);
|
||||||
|
const label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || patchId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Creating VTK mesh for patch[" << patchId <<"] "
|
||||||
|
<< patchName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = patchVTKMesh(patches[patchId]);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, patchName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshPatches" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshCellZones
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoCellZones_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
// resize for decomposed polyhedra
|
||||||
|
zonePolyDecomp_.setSize(selector.size());
|
||||||
|
|
||||||
|
if (!selector.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshCellZones" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
const cellZoneMesh& zMesh = mesh.cellZones();
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const word zoneName = getPartName(partId);
|
||||||
|
const label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || zoneId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Creating VTK mesh for cellZone[" << zoneId << "] "
|
||||||
|
<< zoneName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
fvMeshSubset subsetter(mesh);
|
||||||
|
subsetter.setLargeCellSubset(zMesh[zoneId]);
|
||||||
|
|
||||||
|
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
|
||||||
|
(
|
||||||
|
subsetter.subMesh(),
|
||||||
|
zonePolyDecomp_[datasetNo]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
// superCells + addPointCellLabels must contain global cell ids
|
||||||
|
inplaceRenumber
|
||||||
|
(
|
||||||
|
subsetter.cellMap(),
|
||||||
|
zonePolyDecomp_[datasetNo].superCells()
|
||||||
|
);
|
||||||
|
inplaceRenumber
|
||||||
|
(
|
||||||
|
subsetter.cellMap(),
|
||||||
|
zonePolyDecomp_[datasetNo].addPointCellLabels()
|
||||||
|
);
|
||||||
|
|
||||||
|
// copy pointMap as well, otherwise pointFields fail
|
||||||
|
zonePolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
|
||||||
|
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, zoneName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshCellZones" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshCellSets
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoCellSets_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
// resize for decomposed polyhedra
|
||||||
|
csetPolyDecomp_.setSize(selector.size());
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshCellSets" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const word partName = getPartName(partId);
|
||||||
|
|
||||||
|
if (!partStatus_[partId])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Creating VTK mesh for cellSet=" << partName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cellSet cSet(mesh, partName);
|
||||||
|
fvMeshSubset subsetter(mesh);
|
||||||
|
subsetter.setLargeCellSubset(cSet);
|
||||||
|
|
||||||
|
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
|
||||||
|
(
|
||||||
|
subsetter.subMesh(),
|
||||||
|
csetPolyDecomp_[datasetNo]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
// superCells + addPointCellLabels must contain global cell ids
|
||||||
|
inplaceRenumber
|
||||||
|
(
|
||||||
|
subsetter.cellMap(),
|
||||||
|
csetPolyDecomp_[datasetNo].superCells()
|
||||||
|
);
|
||||||
|
inplaceRenumber
|
||||||
|
(
|
||||||
|
subsetter.cellMap(),
|
||||||
|
csetPolyDecomp_[datasetNo].addPointCellLabels()
|
||||||
|
);
|
||||||
|
|
||||||
|
// copy pointMap as well, otherwise pointFields fail
|
||||||
|
csetPolyDecomp_[datasetNo].pointMap() = subsetter.pointMap();
|
||||||
|
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshCellSets" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshFaceZones
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoFaceZones_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
if (!selector.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshFaceZones" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceZoneMesh& zMesh = mesh.faceZones();
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const word zoneName = getPartName(partId);
|
||||||
|
const label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || zoneId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Creating VTKmesh for faceZone[" << zoneId << "] "
|
||||||
|
<< zoneName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = faceZoneVTKMesh(mesh, zMesh[zoneId]);
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, zoneName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshFaceZones" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshFaceSets
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoFaceSets_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshFaceSets" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const word partName = getPartName(partId);
|
||||||
|
|
||||||
|
if (!partStatus_[partId])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Creating VTK mesh for faceSet=" << partName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceSet fSet(mesh, partName);
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = faceSetVTKMesh(mesh, fSet);
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshFaceSets" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshPointZones
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoPointZones_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPointZones" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
if (selector.size())
|
||||||
|
{
|
||||||
|
const pointZoneMesh& zMesh = mesh.pointZones();
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
word zoneName = getPartName(partId);
|
||||||
|
label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || zoneId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = pointZoneVTKMesh(mesh, zMesh[zoneId]);
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, zoneName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshPointZones" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::convertMeshPointSets
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
int& blockNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
partInfo& selector = partInfoPointSets_;
|
||||||
|
selector.block(blockNo); // set output block
|
||||||
|
label datasetNo = 0; // restart at dataset 0
|
||||||
|
const fvMesh& mesh = *meshPtr_;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPointSets" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
word partName = getPartName(partId);
|
||||||
|
|
||||||
|
if (!partStatus_[partId])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Creating VTK mesh for pointSet=" << partName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pointSet pSet(mesh, partName);
|
||||||
|
|
||||||
|
vtkPolyData* vtkmesh = pointSetVTKMesh(mesh, pSet);
|
||||||
|
if (vtkmesh)
|
||||||
|
{
|
||||||
|
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
|
||||||
|
vtkmesh->Delete();
|
||||||
|
|
||||||
|
partDataset_[partId] = datasetNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// anything added?
|
||||||
|
if (datasetNo)
|
||||||
|
{
|
||||||
|
++blockNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPV3Foam::convertMeshPointSets" << endl;
|
||||||
|
printMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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,
|
polyDecomp& decompInfo
|
||||||
labelList& superCells
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::addVolumeMesh" << endl;
|
Info<< "<beg> Foam::vtkPV3Foam::volumeVTKMesh" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +59,9 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
// Number of additional cells generated by the decomposition of polyhedra
|
// Number of additional cells generated by the decomposition of polyhedra
|
||||||
label nAddCells = 0;
|
label nAddCells = 0;
|
||||||
|
|
||||||
|
labelList& superCells = decompInfo.superCells();
|
||||||
|
labelList& addPointCellLabels = decompInfo.addPointCellLabels();
|
||||||
|
|
||||||
const cellModel& tet = *(cellModeller::lookup("tet"));
|
const cellModel& tet = *(cellModeller::lookup("tet"));
|
||||||
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
const cellModel& pyr = *(cellModeller::lookup("pyr"));
|
||||||
const cellModel& prism = *(cellModeller::lookup("prism"));
|
const cellModel& prism = *(cellModeller::lookup("prism"));
|
||||||
@ -117,17 +115,17 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
|
|
||||||
// Set size of additional point addressing array
|
// Set size of additional point addressing array
|
||||||
// (from added point to original cell)
|
// (from added point to original cell)
|
||||||
addPointCellLabels_.setSize(nAddPoints);
|
addPointCellLabels.setSize(nAddPoints);
|
||||||
|
|
||||||
// Set size of additional cells mapping array
|
// Set size of additional cells mapping array
|
||||||
// (from added cell to original cell)
|
// (from added cell to original cell)
|
||||||
|
|
||||||
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 +137,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 +152,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 +263,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 +291,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 +321,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 +343,7 @@ void Foam::vtkPV3Foam::addVolumeMesh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
api++;
|
addPointI++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,14 +352,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,42 +27,37 @@ 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,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
const selectionInfo& selector,
|
const partInfo& selector,
|
||||||
const label datasetNo
|
const label datasetNo
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
vtkPolyData* vtkmesh = vtkPolyData::SafeDownCast
|
vtkFloatArray* cellData = vtkFloatArray::New();
|
||||||
(
|
cellData->SetNumberOfTuples( ptf.size() );
|
||||||
GetDataSetFromBlock(output, selector, datasetNo)
|
cellData->SetNumberOfComponents( nComp );
|
||||||
);
|
cellData->Allocate( nComp*ptf.size() );
|
||||||
|
cellData->SetName( name.c_str() );
|
||||||
vtkFloatArray *cellData = vtkFloatArray::New();
|
|
||||||
cellData->SetNumberOfTuples(ptf.size());
|
|
||||||
cellData->SetNumberOfComponents(nComp);
|
|
||||||
cellData->Allocate(nComp*ptf.size());
|
|
||||||
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];
|
||||||
@ -70,15 +65,59 @@ void Foam::vtkPV3Foam::convertPatchFaceField
|
|||||||
{
|
{
|
||||||
vec[d] = component(t, d);
|
vec[d] = component(t, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
cellData->InsertTuple(i, vec);
|
cellData->InsertTuple(i, vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkmesh->GetCellData()->AddArray(cellData);
|
vtkPolyData::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
|
) ->GetCellData()
|
||||||
|
->AddArray(cellData);
|
||||||
|
|
||||||
cellData->Delete();
|
cellData->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// as above, but with PointData()
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertPatchPointField
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Field<Type>& pptf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
|
const label datasetNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
|
) ->GetPointData()
|
||||||
|
->AddArray(pointData);
|
||||||
|
|
||||||
|
pointData->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -0,0 +1,277 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 vtkPV3FoamPointFields_H
|
||||||
|
#define vtkPV3FoamPointFields_H
|
||||||
|
|
||||||
|
// Foam includes
|
||||||
|
#include "interpolatePointToCell.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertPointFields
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const pointMesh& pMesh,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
const word& fieldName = iter()->name();
|
||||||
|
// restrict to this GeometricField<Type, ...>
|
||||||
|
if
|
||||||
|
(
|
||||||
|
iter()->headerClassName()
|
||||||
|
!= GeometricField<Type, pointPatchField, pointMesh>::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Foam::vtkPV3Foam::convertPointFields : "
|
||||||
|
<< fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
GeometricField<Type, pointPatchField, pointMesh> ptf
|
||||||
|
(
|
||||||
|
*iter(),
|
||||||
|
pMesh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Convert activated internalMesh regions
|
||||||
|
convertPointFieldBlock
|
||||||
|
(
|
||||||
|
ptf,
|
||||||
|
output,
|
||||||
|
partInfoVolume_,
|
||||||
|
regionPolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert activated cellZones
|
||||||
|
convertPointFieldBlock
|
||||||
|
(
|
||||||
|
ptf,
|
||||||
|
output,
|
||||||
|
partInfoCellZones_,
|
||||||
|
zonePolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert activated cellSets
|
||||||
|
convertPointFieldBlock
|
||||||
|
(
|
||||||
|
ptf,
|
||||||
|
output,
|
||||||
|
partInfoCellSets_,
|
||||||
|
csetPolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert patches - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = partInfoPatches_.start();
|
||||||
|
partId < partInfoPatches_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word patchName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
const label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
convertPatchPointField
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
ptf.boundaryField()[patchId].patchInternalField()(),
|
||||||
|
output,
|
||||||
|
partInfoPatches_,
|
||||||
|
datasetNo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertPointFieldBlock
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
|
const List<polyDecomp>& decompLst
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (datasetNo >= 0 && partStatus_[partId])
|
||||||
|
{
|
||||||
|
convertPointField
|
||||||
|
(
|
||||||
|
ptf,
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>::null(),
|
||||||
|
output,
|
||||||
|
selector,
|
||||||
|
datasetNo,
|
||||||
|
decompLst[datasetNo]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertPointField
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
|
const label datasetNo,
|
||||||
|
const polyDecomp& decomp
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
const labelList& addPointCellLabels = decomp.addPointCellLabels();
|
||||||
|
const labelList& pointMap = decomp.pointMap();
|
||||||
|
|
||||||
|
// use a pointMap or address directly into mesh
|
||||||
|
label nPoints;
|
||||||
|
if (pointMap.size())
|
||||||
|
{
|
||||||
|
nPoints = pointMap.size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nPoints = ptf.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkFloatArray *pointData = vtkFloatArray::New();
|
||||||
|
pointData->SetNumberOfTuples( nPoints + addPointCellLabels.size() );
|
||||||
|
pointData->SetNumberOfComponents( nComp );
|
||||||
|
pointData->Allocate( nComp*(nPoints + addPointCellLabels.size()) );
|
||||||
|
pointData->SetName( tf.name().c_str() );
|
||||||
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert convertPointField: "
|
||||||
|
<< tf.name()
|
||||||
|
<< " size = " << nPoints
|
||||||
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << (nPoints + addPointCellLabels.size())
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
|
||||||
|
if (pointMap.size())
|
||||||
|
{
|
||||||
|
forAll(pointMap, i)
|
||||||
|
{
|
||||||
|
const Type& t = ptf[pointMap[i]];
|
||||||
|
for (direction d=0; d<nComp; d++)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
pointData->InsertTuple(i, vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(ptf, i)
|
||||||
|
{
|
||||||
|
const Type& t = ptf[i];
|
||||||
|
for (direction d=0; d<nComp; d++)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
pointData->InsertTuple(i, vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// continue insertion from here
|
||||||
|
label i = nPoints;
|
||||||
|
|
||||||
|
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
|
||||||
|
{
|
||||||
|
forAll(addPointCellLabels, apI)
|
||||||
|
{
|
||||||
|
const Type& t = tf[addPointCellLabels[apI]];
|
||||||
|
for (direction d=0; d<nComp; d++)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
pointData->InsertTuple(i++, vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(addPointCellLabels, apI)
|
||||||
|
{
|
||||||
|
Type t = interpolatePointToCell(ptf, addPointCellLabels[apI]);
|
||||||
|
for (direction d=0; d<nComp; d++)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
pointData->InsertTuple(i++, vec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkUnstructuredGrid::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
|
) ->GetPointData()
|
||||||
|
->AddArray(pointData);
|
||||||
|
|
||||||
|
pointData->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -1,291 +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::updateFoamMesh()
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateFoamMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reader_->GetCacheMesh())
|
|
||||||
{
|
|
||||||
delete meshPtr_;
|
|
||||||
meshPtr_ = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check to see if the FOAM mesh has been created
|
|
||||||
if (!meshPtr_)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Creating Foam mesh" << endl;
|
|
||||||
}
|
|
||||||
meshPtr_ = new fvMesh
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
fvMesh::defaultRegion,
|
|
||||||
dbPtr_().timeName(),
|
|
||||||
dbPtr_()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
meshChanged_ = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "Using existing Foam mesh" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateFoamMesh" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateVolFields
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateVolFields" << 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::label>
|
|
||||||
(
|
|
||||||
mesh, pInterp, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
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::updateVolFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updatePointFields
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updatePointFields" << 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::label>
|
|
||||||
(
|
|
||||||
mesh, objects, arraySelection, output
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
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::updatePointFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPV3Foam::updateLagrangianFields
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPV3Foam::updateLagrangianFields" << 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 Foam Lagrangian fields" << 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::updateLagrangianFields" << endl;
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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,115 +117,100 @@ 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* partSelection = reader_->GetPartSelection();
|
||||||
|
|
||||||
// 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>();
|
||||||
nMesh_ = meshObjects.size();
|
nMesh_ = meshObjects.size();
|
||||||
|
|
||||||
// Determine regions (internal mesh and patches...)
|
// Determine mesh parts (internalMesh, patches...)
|
||||||
//- Add internal mesh as first entry
|
//- Add internal mesh as first entry
|
||||||
selectInfoVolume_ = arraySelection->GetNumberOfArrays();
|
partInfoVolume_ = partSelection->GetNumberOfArrays();
|
||||||
arraySelection->AddArray("internalMesh");
|
partSelection->AddArray("internalMesh");
|
||||||
selectInfoVolume_ += 1;
|
partInfoVolume_ += 1;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(partSelection);
|
||||||
|
|
||||||
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* partSelection = reader_->GetPartSelection();
|
||||||
|
partInfoLagrangian_ = partSelection->GetNumberOfArrays();
|
||||||
|
|
||||||
if (cloudDirs.size())
|
int nClouds = 0;
|
||||||
|
forAll(cloudDirs, cloudI)
|
||||||
{
|
{
|
||||||
arraySelection->AddArray("lagrangian");
|
// Add cloud to GUI list
|
||||||
selectInfoLagrangian_ += 1;
|
partSelection->AddArray
|
||||||
|
(
|
||||||
|
(cloudDirs[cloudI] + " - lagrangian").c_str()
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "... added cloudDirs\n";
|
++nClouds;
|
||||||
|
}
|
||||||
|
|
||||||
if (cloudDirs.size() > 1)
|
partInfoLagrangian_ += 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(partSelection);
|
||||||
|
|
||||||
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* partSelection = reader_->GetPartSelection();
|
||||||
selectInfoPatches_ = arraySelection->GetNumberOfArrays();
|
partInfoPatches_ = partSelection->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
|
partSelection->AddArray
|
||||||
(
|
(
|
||||||
(pp.name() + " - patch").c_str()
|
(pp.name() + " - patch").c_str()
|
||||||
);
|
);
|
||||||
@ -251,8 +236,8 @@ void Foam::vtkPV3Foam::updateInformationPatches()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Start regions at patches
|
// Add (non-zero) patches to the list of mesh parts
|
||||||
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
|
partSelection->AddArray
|
||||||
(
|
(
|
||||||
(patchEntries[entryI].keyword() + " - patch").c_str()
|
(patchEntries[entryI].keyword() + " - patch").c_str()
|
||||||
);
|
);
|
||||||
@ -273,28 +258,32 @@ void Foam::vtkPV3Foam::updateInformationPatches()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInfoPatches_ += nPatches;
|
partInfoPatches_ += nPatches;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(partSelection);
|
||||||
|
|
||||||
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* partSelection = reader_->GetPartSelection();
|
||||||
|
|
||||||
wordList namesLst;
|
wordList namesLst;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -309,13 +298,12 @@ void Foam::vtkPV3Foam::updateInformationZones()
|
|||||||
namesLst = readZoneNames("cellZones");
|
namesLst = readZoneNames("cellZones");
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInfoCellZones_ = arraySelection->GetNumberOfArrays();
|
partInfoCellZones_ = partSelection->GetNumberOfArrays();
|
||||||
forAll (namesLst, elemI)
|
forAll(namesLst, elemI)
|
||||||
{
|
{
|
||||||
arraySelection->AddArray((namesLst[elemI] + " - cellZone").c_str());
|
partSelection->AddArray((namesLst[elemI] + " - cellZone").c_str());
|
||||||
}
|
}
|
||||||
selectInfoCellZones_ += namesLst.size();
|
partInfoCellZones_ += namesLst.size();
|
||||||
zoneSuperCells_.setSize(selectInfoCellZones_.size());
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -330,12 +318,15 @@ void Foam::vtkPV3Foam::updateInformationZones()
|
|||||||
namesLst = readZoneNames("faceZones");
|
namesLst = readZoneNames("faceZones");
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInfoFaceZones_ = arraySelection->GetNumberOfArrays();
|
partInfoFaceZones_ = partSelection->GetNumberOfArrays();
|
||||||
forAll (namesLst, elemI)
|
forAll(namesLst, elemI)
|
||||||
{
|
{
|
||||||
arraySelection->AddArray((namesLst[elemI] + " - faceZone").c_str());
|
partSelection->AddArray
|
||||||
|
(
|
||||||
|
(namesLst[elemI] + " - faceZone").c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
selectInfoFaceZones_ += namesLst.size();
|
partInfoFaceZones_ += namesLst.size();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -350,32 +341,40 @@ void Foam::vtkPV3Foam::updateInformationZones()
|
|||||||
namesLst = readZoneNames("pointZones");
|
namesLst = readZoneNames("pointZones");
|
||||||
}
|
}
|
||||||
|
|
||||||
selectInfoPointZones_ = arraySelection->GetNumberOfArrays();
|
partInfoPointZones_ = partSelection->GetNumberOfArrays();
|
||||||
forAll (namesLst, elemI)
|
forAll(namesLst, elemI)
|
||||||
{
|
{
|
||||||
arraySelection->AddArray((namesLst[elemI] + " - pointZone").c_str());
|
partSelection->AddArray
|
||||||
|
(
|
||||||
|
(namesLst[elemI] + " - pointZone").c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
selectInfoPointZones_ += namesLst.size();
|
partInfoPointZones_ += namesLst.size();
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(partSelection);
|
||||||
|
|
||||||
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* partSelection = reader_->GetPartSelection();
|
||||||
|
|
||||||
// Add names of sets
|
// Add names of sets
|
||||||
IOobjectList objects
|
IOobjectList objects
|
||||||
@ -386,27 +385,26 @@ void Foam::vtkPV3Foam::updateInformationSets()
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
selectInfoCellSets_ = arraySelection->GetNumberOfArrays();
|
partInfoCellSets_ = partSelection->GetNumberOfArrays();
|
||||||
selectInfoCellSets_ += addToSelection<cellSet>
|
partInfoCellSets_ += addToSelection<cellSet>
|
||||||
(
|
(
|
||||||
arraySelection,
|
partSelection,
|
||||||
objects,
|
objects,
|
||||||
" - cellSet"
|
" - cellSet"
|
||||||
);
|
);
|
||||||
csetSuperCells_.setSize(selectInfoCellSets_.size());
|
|
||||||
|
|
||||||
selectInfoFaceSets_ = arraySelection->GetNumberOfArrays();
|
partInfoFaceSets_ = partSelection->GetNumberOfArrays();
|
||||||
selectInfoFaceSets_ += addToSelection<faceSet>
|
partInfoFaceSets_ += addToSelection<faceSet>
|
||||||
(
|
(
|
||||||
arraySelection,
|
partSelection,
|
||||||
objects,
|
objects,
|
||||||
" - faceSet"
|
" - faceSet"
|
||||||
);
|
);
|
||||||
|
|
||||||
selectInfoPointSets_ = arraySelection->GetNumberOfArrays();
|
partInfoPointSets_ = partSelection->GetNumberOfArrays();
|
||||||
selectInfoPointSets_ += addToSelection<pointSet>
|
partInfoPointSets_ += addToSelection<pointSet>
|
||||||
(
|
(
|
||||||
arraySelection,
|
partSelection,
|
||||||
objects,
|
objects,
|
||||||
" - pointSet"
|
" - pointSet"
|
||||||
);
|
);
|
||||||
@ -414,85 +412,92 @@ void Foam::vtkPV3Foam::updateInformationSets()
|
|||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
// just for debug info
|
// just for debug info
|
||||||
getSelectedArrayEntries(arraySelection);
|
getSelectedArrayEntries(partSelection);
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
// preserve the currently selected values
|
// preserve the enabled selections
|
||||||
const stringList selectedEntries = getSelectedArrayEntries
|
stringList enabledEntries = getSelectedArrayEntries(fieldSelection);
|
||||||
(
|
fieldSelection->RemoveAllArrays();
|
||||||
arraySelection
|
|
||||||
);
|
//
|
||||||
arraySelection->RemoveAllArrays();
|
// TODO - currently only get fields from ONE cloud
|
||||||
|
// have to decide if the second set of fields get mixed in
|
||||||
|
// or dealt with separately
|
||||||
|
|
||||||
|
const partInfo& selector = partInfoLagrangian_;
|
||||||
|
int partId = selector.start();
|
||||||
|
|
||||||
|
if (!selector.size() || partId < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
word cloudName = getPartName(partId);
|
||||||
|
|
||||||
// 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 currently enabled values
|
// restore the enabled selections
|
||||||
setSelectedArrayEntries
|
setSelectedArrayEntries(fieldSelection, enabledEntries);
|
||||||
(
|
|
||||||
arraySelection,
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -27,95 +27,78 @@ 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 enabledEntries;
|
||||||
// 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);
|
enabledEntries.setSize(2);
|
||||||
selectedEntries[0] = "p";
|
enabledEntries[0] = "p";
|
||||||
selectedEntries[1] = "U";
|
enabledEntries[1] = "U";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// preserve the currently selected values
|
// preserve the enabled selections
|
||||||
selectedEntries = getSelectedArrayEntries
|
enabledEntries = 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<label, patchType, meshType> >
|
|
||||||
(
|
|
||||||
arraySelection,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
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 currently enabled values
|
// restore the enabled selections
|
||||||
setSelectedArrayEntries
|
setSelectedArrayEntries(select, enabledEntries);
|
||||||
(
|
|
||||||
arraySelection,
|
|
||||||
selectedEntries
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPV3Foam::updateInformationFields" << endl;
|
Info<< "<end> Foam::vtkPV3Foam::updateInfoFields" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,341 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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
|
||||||
|
Misc helper methods and utilities
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "vtkPV3Foam.H"
|
||||||
|
#include "vtkPV3FoamReader.h"
|
||||||
|
|
||||||
|
// Foam includes
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
|
||||||
|
// VTK includes
|
||||||
|
#include "vtkDataArraySelection.h"
|
||||||
|
#include "vtkDataSet.h"
|
||||||
|
#include "vtkMultiBlockDataSet.h"
|
||||||
|
#include "vtkInformation.h"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::AddToBlock
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
vtkDataSet* dataset,
|
||||||
|
const partInfo& selector,
|
||||||
|
const label datasetNo,
|
||||||
|
const string& datasetName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const int blockNo = selector.block();
|
||||||
|
|
||||||
|
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
||||||
|
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
||||||
|
|
||||||
|
if (!block)
|
||||||
|
{
|
||||||
|
if (blockDO)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Foam::vtkPV3Foam::AddToBlock")
|
||||||
|
<< "Block already has a vtkDataSet assigned to it"
|
||||||
|
<< endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
block = vtkMultiBlockDataSet::New();
|
||||||
|
output->SetBlock(blockNo, block);
|
||||||
|
block->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "block[" << blockNo << "] has "
|
||||||
|
<< block->GetNumberOfBlocks()
|
||||||
|
<< " datasets prior to adding set " << datasetNo
|
||||||
|
<< " with name: " << datasetName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
block->SetBlock(datasetNo, dataset);
|
||||||
|
|
||||||
|
// name the block when assigning dataset 0
|
||||||
|
if (datasetNo == 0)
|
||||||
|
{
|
||||||
|
output->GetMetaData(blockNo)->Set
|
||||||
|
(
|
||||||
|
vtkCompositeDataSet::NAME(),
|
||||||
|
selector.name()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (datasetName.size())
|
||||||
|
{
|
||||||
|
block->GetMetaData(datasetNo)->Set
|
||||||
|
(
|
||||||
|
vtkCompositeDataSet::NAME(),
|
||||||
|
datasetName.c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vtkDataSet* Foam::vtkPV3Foam::GetDataSetFromBlock
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
|
const label datasetNo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const int blockNo = selector.block();
|
||||||
|
|
||||||
|
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
||||||
|
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
||||||
|
|
||||||
|
if (block)
|
||||||
|
{
|
||||||
|
return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ununsed at the moment
|
||||||
|
Foam::label Foam::vtkPV3Foam::GetNumberOfDataSets
|
||||||
|
(
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const int blockNo = selector.block();
|
||||||
|
|
||||||
|
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
||||||
|
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
||||||
|
if (block)
|
||||||
|
{
|
||||||
|
return block->GetNumberOfBlocks();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::word Foam::vtkPV3Foam::getPartName(int partId)
|
||||||
|
{
|
||||||
|
return getFirstWord(reader_->GetPartArrayName(partId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
selections.insert(getFirstWord(select->GetArrayName(elemI)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selections;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordHashSet Foam::vtkPV3Foam::getSelected
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select,
|
||||||
|
const partInfo& selector
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int nElem = select->GetNumberOfArrays();
|
||||||
|
wordHashSet selections(2*nElem);
|
||||||
|
|
||||||
|
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
|
||||||
|
{
|
||||||
|
if (select->GetArraySetting(elemI))
|
||||||
|
{
|
||||||
|
selections.insert(getFirstWord(select->GetArrayName(elemI)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return selections;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select
|
||||||
|
)
|
||||||
|
{
|
||||||
|
stringList selections(select->GetNumberOfArrays());
|
||||||
|
label nElem = 0;
|
||||||
|
|
||||||
|
forAll(selections, elemI)
|
||||||
|
{
|
||||||
|
if (select->GetArraySetting(elemI))
|
||||||
|
{
|
||||||
|
selections[nElem++] = select->GetArrayName(elemI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selections.setSize(nElem);
|
||||||
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
label nElem = select->GetNumberOfArrays();
|
||||||
|
Info<< "available(";
|
||||||
|
for (int elemI = 0; elemI < nElem; ++elemI)
|
||||||
|
{
|
||||||
|
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
||||||
|
}
|
||||||
|
Info<< " )\nselected(";
|
||||||
|
|
||||||
|
forAll(selections, elemI)
|
||||||
|
{
|
||||||
|
Info<< " " << selections[elemI];
|
||||||
|
}
|
||||||
|
Info<< " )\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return selections;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select,
|
||||||
|
const partInfo& selector
|
||||||
|
)
|
||||||
|
{
|
||||||
|
stringList selections(selector.size());
|
||||||
|
label nElem = 0;
|
||||||
|
|
||||||
|
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
|
||||||
|
{
|
||||||
|
if (select->GetArraySetting(elemI))
|
||||||
|
{
|
||||||
|
selections[nElem++] = select->GetArrayName(elemI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selections.setSize(nElem);
|
||||||
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "available(";
|
||||||
|
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
|
||||||
|
{
|
||||||
|
Info<< " \"" << select->GetArrayName(elemI) << "\"";
|
||||||
|
}
|
||||||
|
Info<< " )\nselected(";
|
||||||
|
|
||||||
|
forAll(selections, elemI)
|
||||||
|
{
|
||||||
|
Info<< " " << selections[elemI];
|
||||||
|
}
|
||||||
|
Info<< " )\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return selections;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPV3Foam::setSelectedArrayEntries
|
||||||
|
(
|
||||||
|
vtkDataArraySelection* select,
|
||||||
|
const stringList& selections
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const int nElem = select->GetNumberOfArrays();
|
||||||
|
select->DisableAllArrays();
|
||||||
|
|
||||||
|
// Loop through entries, setting values from selectedEntries
|
||||||
|
for (int elemI=0; elemI < nElem; ++elemI)
|
||||||
|
{
|
||||||
|
string arrayName(select->GetArrayName(elemI));
|
||||||
|
|
||||||
|
forAll(selections, elemI)
|
||||||
|
{
|
||||||
|
if (selections[elemI] == arrayName)
|
||||||
|
{
|
||||||
|
select->EnableArray(arrayName.c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// parse these bits of info from /proc/meminfo (Linux)
|
||||||
|
//
|
||||||
|
// MemTotal: 2062660 kB
|
||||||
|
// MemFree: 1124400 kB
|
||||||
|
//
|
||||||
|
// used = MemTotal - MemFree is what the free(1) uses.
|
||||||
|
//
|
||||||
|
void Foam::vtkPV3Foam::printMemory()
|
||||||
|
{
|
||||||
|
const char* meminfo = "/proc/meminfo";
|
||||||
|
|
||||||
|
if (exists(meminfo))
|
||||||
|
{
|
||||||
|
IFstream is(meminfo);
|
||||||
|
label memTotal = 0;
|
||||||
|
label memFree = 0;
|
||||||
|
|
||||||
|
string line;
|
||||||
|
|
||||||
|
while (is.getLine(line).good())
|
||||||
|
{
|
||||||
|
char tag[32];
|
||||||
|
int value;
|
||||||
|
|
||||||
|
if (sscanf(line.c_str(), "%30s %d", tag, &value) == 2)
|
||||||
|
{
|
||||||
|
if (!strcmp(tag, "MemTotal:"))
|
||||||
|
{
|
||||||
|
memTotal = value;
|
||||||
|
}
|
||||||
|
else if (!strcmp(tag, "MemFree:"))
|
||||||
|
{
|
||||||
|
memFree = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << "memUsed: " << (memTotal - memFree) << " kB\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,354 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 vtkPV3FoamVolFields_H
|
||||||
|
#define vtkPV3FoamVolFields_H
|
||||||
|
|
||||||
|
// Foam includes
|
||||||
|
#include "emptyFvPatchField.H"
|
||||||
|
#include "wallPolyPatch.H"
|
||||||
|
#include "faceSet.H"
|
||||||
|
#include "vtkPV3FoamFaceField.H"
|
||||||
|
#include "vtkPV3FoamPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertVolFields
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const volPointInterpolation& pInterp,
|
||||||
|
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
// restrict to GeometricField<Type, ...>
|
||||||
|
if
|
||||||
|
(
|
||||||
|
iter()->headerClassName()
|
||||||
|
!= GeometricField<Type, fvPatchField, volMesh>::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GeometricField<Type, fvPatchField, volMesh> tf
|
||||||
|
(
|
||||||
|
*iter(),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, pointPatchField, pointMesh> > tptf
|
||||||
|
(
|
||||||
|
pInterp.interpolate(tf)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Convert activated internalMesh regions
|
||||||
|
convertVolFieldBlock
|
||||||
|
(
|
||||||
|
tf,
|
||||||
|
tptf(),
|
||||||
|
output,
|
||||||
|
partInfoVolume_,
|
||||||
|
regionPolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert activated cellZones
|
||||||
|
convertVolFieldBlock
|
||||||
|
(
|
||||||
|
tf,
|
||||||
|
tptf(),
|
||||||
|
output,
|
||||||
|
partInfoCellZones_,
|
||||||
|
zonePolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert activated cellSets
|
||||||
|
convertVolFieldBlock
|
||||||
|
(
|
||||||
|
tf,
|
||||||
|
tptf(),
|
||||||
|
output,
|
||||||
|
partInfoCellSets_,
|
||||||
|
csetPolyDecomp_
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert patches - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = partInfoPatches_.start();
|
||||||
|
partId < partInfoPatches_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word patchName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
const label patchId = patches.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvPatchField<Type>& ptf = tf.boundaryField()[patchId];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
isType<emptyFvPatchField<Type> >(ptf)
|
||||||
|
||
|
||||||
|
(
|
||||||
|
typeid(patches[patchId]) == typeid(wallPolyPatch)
|
||||||
|
&& reader_->GetExtrapolateWalls()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fvPatch p(ptf.patch().patch(), tf.mesh().boundary());
|
||||||
|
|
||||||
|
tmp<Field<Type> > tpptf
|
||||||
|
(
|
||||||
|
fvPatchField<Type>(p, tf).patchInternalField()
|
||||||
|
);
|
||||||
|
|
||||||
|
convertPatchField
|
||||||
|
(
|
||||||
|
tf.name(),
|
||||||
|
tpptf(),
|
||||||
|
output,
|
||||||
|
partInfoPatches_,
|
||||||
|
datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
convertPatchPointField
|
||||||
|
(
|
||||||
|
tf.name(),
|
||||||
|
ppInterpList[patchId].faceToPointInterpolate(tpptf)(),
|
||||||
|
output,
|
||||||
|
partInfoPatches_,
|
||||||
|
datasetNo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
convertPatchField
|
||||||
|
(
|
||||||
|
tf.name(),
|
||||||
|
ptf,
|
||||||
|
output,
|
||||||
|
partInfoPatches_,
|
||||||
|
datasetNo
|
||||||
|
);
|
||||||
|
|
||||||
|
convertPatchPointField
|
||||||
|
(
|
||||||
|
tf.name(),
|
||||||
|
ppInterpList[patchId].faceToPointInterpolate(ptf)(),
|
||||||
|
output,
|
||||||
|
partInfoPatches_,
|
||||||
|
datasetNo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert face zones - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = partInfoFaceZones_.start();
|
||||||
|
partId < partInfoFaceZones_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word zoneName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || datasetNo < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceZoneMesh& zMesh = mesh.faceZones();
|
||||||
|
const label zoneId = zMesh.findZoneID(zoneName);
|
||||||
|
|
||||||
|
if (zoneId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
convertFaceField
|
||||||
|
(
|
||||||
|
tf,
|
||||||
|
output,
|
||||||
|
partInfoFaceZones_,
|
||||||
|
datasetNo,
|
||||||
|
mesh,
|
||||||
|
zMesh[zoneId]
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: points
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert face sets - if activated
|
||||||
|
//
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = partInfoFaceSets_.start();
|
||||||
|
partId < partInfoFaceSets_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word selectName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || datasetNo < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceSet fSet(mesh, selectName);
|
||||||
|
|
||||||
|
convertFaceField
|
||||||
|
(
|
||||||
|
tf,
|
||||||
|
output,
|
||||||
|
partInfoFaceSets_,
|
||||||
|
datasetNo,
|
||||||
|
mesh,
|
||||||
|
fSet
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: points
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertVolFieldBlock
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
|
const List<polyDecomp>& decompLst
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (int partId = selector.start(); partId < selector.end(); ++partId)
|
||||||
|
{
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (datasetNo >= 0 && partStatus_[partId])
|
||||||
|
{
|
||||||
|
convertVolField
|
||||||
|
(
|
||||||
|
tf,
|
||||||
|
output,
|
||||||
|
selector,
|
||||||
|
datasetNo,
|
||||||
|
decompLst[datasetNo]
|
||||||
|
);
|
||||||
|
|
||||||
|
convertPointField
|
||||||
|
(
|
||||||
|
ptf,
|
||||||
|
tf,
|
||||||
|
output,
|
||||||
|
selector,
|
||||||
|
datasetNo,
|
||||||
|
decompLst[datasetNo]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPV3Foam::convertVolField
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const partInfo& selector,
|
||||||
|
const label datasetNo,
|
||||||
|
const polyDecomp& decompInfo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
const labelList& superCells = decompInfo.superCells();
|
||||||
|
|
||||||
|
vtkFloatArray* celldata = vtkFloatArray::New();
|
||||||
|
celldata->SetNumberOfTuples( superCells.size() );
|
||||||
|
celldata->SetNumberOfComponents( nComp );
|
||||||
|
celldata->Allocate( nComp*superCells.size() );
|
||||||
|
celldata->SetName( tf.name().c_str() );
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert volField: "
|
||||||
|
<< tf.name()
|
||||||
|
<< " size = " << tf.size()
|
||||||
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << superCells.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
forAll(superCells, i)
|
||||||
|
{
|
||||||
|
const Type& t = tf[superCells[i]];
|
||||||
|
for (direction d=0; d<nComp; d++)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
celldata->InsertTuple(i, vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkUnstructuredGrid::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, selector, datasetNo)
|
||||||
|
) ->GetCellData()
|
||||||
|
->AddArray(celldata);
|
||||||
|
|
||||||
|
celldata->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -570,7 +570,9 @@ public:
|
|||||||
// region and split them.
|
// region and split them.
|
||||||
autoPtr<mapPolyMesh> dupNonManifoldPoints();
|
autoPtr<mapPolyMesh> dupNonManifoldPoints();
|
||||||
|
|
||||||
//- Create baffle for every internal face where ownPatch != -1
|
//- Create baffle for every internal face where ownPatch != -1.
|
||||||
|
// External faces get repatched according to ownPatch (neiPatch
|
||||||
|
// should be -1 for these)
|
||||||
autoPtr<mapPolyMesh> createBaffles
|
autoPtr<mapPolyMesh> createBaffles
|
||||||
(
|
(
|
||||||
const labelList& ownPatch,
|
const labelList& ownPatch,
|
||||||
|
|||||||
@ -233,10 +233,9 @@ void Foam::searchableSphere::findLineAll
|
|||||||
{
|
{
|
||||||
info.setSize(start.size());
|
info.setSize(start.size());
|
||||||
|
|
||||||
pointIndexHit near, far;
|
|
||||||
|
|
||||||
forAll(start, i)
|
forAll(start, i)
|
||||||
{
|
{
|
||||||
|
pointIndexHit near, far;
|
||||||
findLineAll(start[i], end[i], near, far);
|
findLineAll(start[i], end[i], near, far);
|
||||||
|
|
||||||
if (near.hit())
|
if (near.hit())
|
||||||
@ -260,6 +259,10 @@ void Foam::searchableSphere::findLineAll
|
|||||||
info[i].setSize(1);
|
info[i].setSize(1);
|
||||||
info[i][0] = far;
|
info[i][0] = far;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info[i].clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user