PVFoamReader: Added support for visualising surfaceFields
To avoid additional clutter in the interface volFields, surfaceFields and pointFields are now selected from a single fields selection box consistent with the single directory with guaranteed unique names in which they are stored. Note that when visualising the "phi" flux fields that these are extensive, the value depends directly on the face area, so unless the mesh is uniform interpolated continuous colour plots are not physical or informative. Based on proposal contributed by Mattijs Janssens
This commit is contained in:
@ -156,7 +156,7 @@
|
|||||||
command="SetIncludeZones"
|
command="SetIncludeZones"
|
||||||
label="Include Zones"
|
label="Include Zones"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
default_values="0"
|
default_values="1"
|
||||||
animateable="0">
|
animateable="0">
|
||||||
<Documentation>
|
<Documentation>
|
||||||
Allow selection of zones
|
Allow selection of zones
|
||||||
@ -206,27 +206,27 @@
|
|||||||
|
|
||||||
<!-- Available Volume Fields array -->
|
<!-- Available Volume Fields array -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
name="VolFieldArrayStatus"
|
name="FieldArrayStatus"
|
||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="VolField"/>
|
<ArraySelectionInformationHelper attribute_name="Field"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
name="VolFieldStatus"
|
name="FieldStatus"
|
||||||
label="Volume Fields"
|
label="Fields"
|
||||||
command="SetVolFieldArrayStatus"
|
command="SetFieldArrayStatus"
|
||||||
number_of_elements="0"
|
number_of_elements="0"
|
||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="VolFieldArrayStatus"
|
information_property="FieldArrayStatus"
|
||||||
animateable="0">
|
animateable="0">
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="VolFieldArrayStatus" function="ArrayList"/>
|
<Property name="FieldArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>
|
||||||
Select volume fields to load
|
Select fields to load
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
@ -256,44 +256,16 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Available pointFields array -->
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PointFieldArrayStatus"
|
|
||||||
information_only="1">
|
|
||||||
<ArraySelectionInformationHelper attribute_name="PointField"/>
|
|
||||||
</StringVectorProperty>
|
|
||||||
<StringVectorProperty
|
|
||||||
name="PointFieldStatus"
|
|
||||||
label="Point Fields"
|
|
||||||
command="SetPointFieldArrayStatus"
|
|
||||||
number_of_elements="0"
|
|
||||||
repeat_command="1"
|
|
||||||
number_of_elements_per_command="2"
|
|
||||||
element_types="2 0"
|
|
||||||
information_property="PointFieldArrayStatus"
|
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
|
||||||
<RequiredProperties>
|
|
||||||
<Property name="PointFieldArrayStatus" function="ArrayList"/>
|
|
||||||
</RequiredProperties>
|
|
||||||
</ArraySelectionDomain>
|
|
||||||
<Documentation>
|
|
||||||
Select point fields to load
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
|
||||||
|
|
||||||
<PropertyGroup label="Selection">
|
<PropertyGroup label="Selection">
|
||||||
<Property name="UiIncludeSets"/>
|
<Property name="UiIncludeSets"/>
|
||||||
<Property name="UiIncludeZones"/>
|
<Property name="UiIncludeZones"/>
|
||||||
<Property name="UiShowGroupsOnly"/>
|
<Property name="UiShowGroupsOnly"/>
|
||||||
<Property name="PartArrayStatus"/>
|
<Property name="PartArrayStatus"/>
|
||||||
<Property name="PartStatus"/>
|
<Property name="PartStatus"/>
|
||||||
<Property name="VolFieldArrayStatus"/>
|
<Property name="FieldArrayStatus"/>
|
||||||
<Property name="VolFieldStatus"/>
|
<Property name="FieldStatus"/>
|
||||||
<Property name="LagrangianFieldArrayStatus"/>
|
<Property name="LagrangianFieldArrayStatus"/>
|
||||||
<Property name="LagrangianFieldStatus"/>
|
<Property name="LagrangianFieldStatus"/>
|
||||||
<Property name="PointFieldArrayStatus"/>
|
|
||||||
<Property name="PointFieldStatus"/>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Hints>
|
<Hints>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -71,14 +71,13 @@ vtkPVFoamReader::vtkPVFoamReader()
|
|||||||
ExtrapolatePatches = 0;
|
ExtrapolatePatches = 0;
|
||||||
UseVTKPolyhedron = 0;
|
UseVTKPolyhedron = 0;
|
||||||
IncludeSets = 0;
|
IncludeSets = 0;
|
||||||
IncludeZones = 0;
|
IncludeZones = 1;
|
||||||
ShowPatchNames = 0;
|
ShowPatchNames = 0;
|
||||||
ShowGroupsOnly = 0;
|
ShowGroupsOnly = 0;
|
||||||
InterpolateVolFields = 1;
|
InterpolateVolFields = 1;
|
||||||
|
|
||||||
PartSelection = vtkDataArraySelection::New();
|
PartSelection = vtkDataArraySelection::New();
|
||||||
VolFieldSelection = vtkDataArraySelection::New();
|
FieldSelection = vtkDataArraySelection::New();
|
||||||
PointFieldSelection = vtkDataArraySelection::New();
|
|
||||||
LagrangianFieldSelection = vtkDataArraySelection::New();
|
LagrangianFieldSelection = vtkDataArraySelection::New();
|
||||||
|
|
||||||
// Setup the selection callback to modify this object when an array
|
// Setup the selection callback to modify this object when an array
|
||||||
@ -95,12 +94,7 @@ vtkPVFoamReader::vtkPVFoamReader()
|
|||||||
vtkCommand::ModifiedEvent,
|
vtkCommand::ModifiedEvent,
|
||||||
this->SelectionObserver
|
this->SelectionObserver
|
||||||
);
|
);
|
||||||
VolFieldSelection->AddObserver
|
FieldSelection->AddObserver
|
||||||
(
|
|
||||||
vtkCommand::ModifiedEvent,
|
|
||||||
this->SelectionObserver
|
|
||||||
);
|
|
||||||
PointFieldSelection->AddObserver
|
|
||||||
(
|
(
|
||||||
vtkCommand::ModifiedEvent,
|
vtkCommand::ModifiedEvent,
|
||||||
this->SelectionObserver
|
this->SelectionObserver
|
||||||
@ -138,15 +132,13 @@ vtkPVFoamReader::~vtkPVFoamReader()
|
|||||||
|
|
||||||
|
|
||||||
PartSelection->RemoveObserver(this->SelectionObserver);
|
PartSelection->RemoveObserver(this->SelectionObserver);
|
||||||
VolFieldSelection->RemoveObserver(this->SelectionObserver);
|
FieldSelection->RemoveObserver(this->SelectionObserver);
|
||||||
PointFieldSelection->RemoveObserver(this->SelectionObserver);
|
|
||||||
LagrangianFieldSelection->RemoveObserver(this->SelectionObserver);
|
LagrangianFieldSelection->RemoveObserver(this->SelectionObserver);
|
||||||
|
|
||||||
SelectionObserver->Delete();
|
SelectionObserver->Delete();
|
||||||
|
|
||||||
PartSelection->Delete();
|
PartSelection->Delete();
|
||||||
VolFieldSelection->Delete();
|
FieldSelection->Delete();
|
||||||
PointFieldSelection->Delete();
|
|
||||||
LagrangianFieldSelection->Delete();
|
LagrangianFieldSelection->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,91 +501,46 @@ void vtkPVFoamReader::SetPartArrayStatus(const char* name, int status)
|
|||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// volField selection list control
|
// Field selection list control
|
||||||
|
|
||||||
vtkDataArraySelection* vtkPVFoamReader::GetVolFieldSelection()
|
vtkDataArraySelection* vtkPVFoamReader::GetFieldSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldSelection");
|
vtkDebugMacro(<<"GetFieldSelection");
|
||||||
return VolFieldSelection;
|
return FieldSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetNumberOfVolFieldArrays()
|
int vtkPVFoamReader::GetNumberOfFieldArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfVolFieldArrays");
|
vtkDebugMacro(<<"GetNumberOfFieldArrays");
|
||||||
return VolFieldSelection->GetNumberOfArrays();
|
return FieldSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVFoamReader::GetVolFieldArrayName(int index)
|
const char* vtkPVFoamReader::GetFieldArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldArrayName");
|
vtkDebugMacro(<<"GetFieldArrayName");
|
||||||
return VolFieldSelection->GetArrayName(index);
|
return FieldSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetVolFieldArrayStatus(const char* name)
|
int vtkPVFoamReader::GetFieldArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetVolFieldArrayStatus");
|
vtkDebugMacro(<<"GetFieldArrayStatus");
|
||||||
return VolFieldSelection->ArrayIsEnabled(name);
|
return FieldSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetVolFieldArrayStatus(const char* name, int status)
|
void vtkPVFoamReader::SetFieldArrayStatus(const char* name, int status)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetVolFieldArrayStatus");
|
vtkDebugMacro(<<"SetFieldArrayStatus");
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
VolFieldSelection->EnableArray(name);
|
FieldSelection->EnableArray(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VolFieldSelection->DisableArray(name);
|
FieldSelection->DisableArray(name);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// pointField selection list control
|
|
||||||
|
|
||||||
vtkDataArraySelection* vtkPVFoamReader::GetPointFieldSelection()
|
|
||||||
{
|
|
||||||
vtkDebugMacro(<<"GetPointFieldSelection");
|
|
||||||
return PointFieldSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetNumberOfPointFieldArrays()
|
|
||||||
{
|
|
||||||
vtkDebugMacro(<<"GetNumberOfPointFieldArrays");
|
|
||||||
return PointFieldSelection->GetNumberOfArrays();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVFoamReader::GetPointFieldArrayName(int index)
|
|
||||||
{
|
|
||||||
vtkDebugMacro(<<"GetPointFieldArrayName");
|
|
||||||
return PointFieldSelection->GetArrayName(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int vtkPVFoamReader::GetPointFieldArrayStatus(const char* name)
|
|
||||||
{
|
|
||||||
vtkDebugMacro(<<"GetPointFieldArrayStatus");
|
|
||||||
return PointFieldSelection->ArrayIsEnabled(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetPointFieldArrayStatus(const char* name, int status)
|
|
||||||
{
|
|
||||||
vtkDebugMacro(<<"SetPointFieldArrayStatus");
|
|
||||||
if (status)
|
|
||||||
{
|
|
||||||
PointFieldSelection->EnableArray(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PointFieldSelection->DisableArray(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,6 @@ class vtkPVFoamReader
|
|||||||
public vtkMultiBlockDataSetAlgorithm
|
public vtkMultiBlockDataSetAlgorithm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
vtkTypeMacro(vtkPVFoamReader, vtkMultiBlockDataSetAlgorithm);
|
vtkTypeMacro(vtkPVFoamReader, vtkMultiBlockDataSetAlgorithm);
|
||||||
void PrintSelf(ostream&, vtkIndent);
|
void PrintSelf(ostream&, vtkIndent);
|
||||||
|
|
||||||
@ -140,20 +139,12 @@ public:
|
|||||||
const char* GetPartArrayName(int index);
|
const char* GetPartArrayName(int index);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// volField selection list control
|
// Field selection list control
|
||||||
virtual vtkDataArraySelection* GetVolFieldSelection();
|
virtual vtkDataArraySelection* GetFieldSelection();
|
||||||
int GetNumberOfVolFieldArrays();
|
int GetNumberOfFieldArrays();
|
||||||
int GetVolFieldArrayStatus(const char* name);
|
int GetFieldArrayStatus(const char* name);
|
||||||
void SetVolFieldArrayStatus(const char* name, int status);
|
void SetFieldArrayStatus(const char* name, int status);
|
||||||
const char* GetVolFieldArrayName(int index);
|
const char* GetFieldArrayName(int index);
|
||||||
|
|
||||||
// Description:
|
|
||||||
// pointField selection list control
|
|
||||||
virtual vtkDataArraySelection* GetPointFieldSelection();
|
|
||||||
int GetNumberOfPointFieldArrays();
|
|
||||||
int GetPointFieldArrayStatus(const char* name);
|
|
||||||
void SetPointFieldArrayStatus(const char* name, int status);
|
|
||||||
const char* GetPointFieldArrayName(int index);
|
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// lagrangianField selection list control
|
// lagrangianField selection list control
|
||||||
@ -182,9 +173,6 @@ protected:
|
|||||||
//- Construct null
|
//- Construct null
|
||||||
vtkPVFoamReader();
|
vtkPVFoamReader();
|
||||||
|
|
||||||
//- Disallow default bitwise copy construction
|
|
||||||
vtkPVFoamReader(const vtkPVFoamReader&) = delete;
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~vtkPVFoamReader();
|
~vtkPVFoamReader();
|
||||||
|
|
||||||
@ -213,12 +201,15 @@ protected:
|
|||||||
//- The file name for this case
|
//- The file name for this case
|
||||||
char* FileName;
|
char* FileName;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const vtkPVFoamReader&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
vtkPVFoamReader(const vtkPVFoamReader&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const vtkPVFoamReader&);
|
||||||
|
|
||||||
//- Add/remove patch names to/from the view
|
//- Add/remove patch names to/from the view
|
||||||
void updatePatchNamesView(const bool show);
|
void updatePatchNamesView(const bool show);
|
||||||
|
|
||||||
@ -236,8 +227,7 @@ private:
|
|||||||
int InterpolateVolFields;
|
int InterpolateVolFields;
|
||||||
|
|
||||||
vtkDataArraySelection* PartSelection;
|
vtkDataArraySelection* PartSelection;
|
||||||
vtkDataArraySelection* VolFieldSelection;
|
vtkDataArraySelection* FieldSelection;
|
||||||
vtkDataArraySelection* PointFieldSelection;
|
|
||||||
vtkDataArraySelection* LagrangianFieldSelection;
|
vtkDataArraySelection* LagrangianFieldSelection;
|
||||||
|
|
||||||
//- Cached data for output port0 (experimental!)
|
//- Cached data for output port0 (experimental!)
|
||||||
|
|||||||
@ -113,9 +113,6 @@ protected:
|
|||||||
//- Construct null
|
//- Construct null
|
||||||
vtkPVblockMeshReader();
|
vtkPVblockMeshReader();
|
||||||
|
|
||||||
//- Disallow default bitwise copy construction
|
|
||||||
vtkPVblockMeshReader(const vtkPVblockMeshReader&) = delete;
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~vtkPVblockMeshReader();
|
~vtkPVblockMeshReader();
|
||||||
|
|
||||||
@ -143,12 +140,15 @@ protected:
|
|||||||
|
|
||||||
char* FileName;
|
char* FileName;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const vtkPVblockMeshReader&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
vtkPVblockMeshReader(const vtkPVblockMeshReader&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const vtkPVblockMeshReader&);
|
||||||
|
|
||||||
//- Add/remove point numbers to/from the view
|
//- Add/remove point numbers to/from the view
|
||||||
void updatePointNumbersView(const bool show);
|
void updatePointNumbersView(const bool show);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,34 +43,6 @@ inline void vtkInsertNextOpenFOAMPoint
|
|||||||
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 vtkSetOpenFOAMPoint
|
|
||||||
(
|
|
||||||
vtkPoints *points,
|
|
||||||
const Foam::label id,
|
|
||||||
const Foam::point& p
|
|
||||||
)
|
|
||||||
{
|
|
||||||
points->SetPoint(id, p.x(), p.y(), p.z());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Convert OpenFOAM mesh vertices to VTK
|
|
||||||
inline vtkPoints* vtkSetOpenFOAMPoints(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
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -51,7 +51,6 @@ namespace Foam
|
|||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "vtkPVFoamAddToSelection.H"
|
#include "vtkPVFoamAddToSelection.H"
|
||||||
#include "vtkPVFoamUpdateInfoFields.H"
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::resetCounters()
|
void Foam::vtkPVFoam::resetCounters()
|
||||||
{
|
{
|
||||||
@ -428,14 +427,51 @@ void Foam::vtkPVFoam::updateInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update volume, point and lagrangian fields
|
// Update volume, point and lagrangian fields
|
||||||
updateInfoFields<fvPatchField, volMesh>
|
updateInfoFields();
|
||||||
|
updateInfoLagrangianFields();
|
||||||
|
|
||||||
|
{
|
||||||
|
// Use the db directly since this might be called without a mesh,
|
||||||
|
// but the region must get added back in
|
||||||
|
word regionPrefix;
|
||||||
|
if (meshRegion_ != polyMesh::defaultRegion)
|
||||||
|
{
|
||||||
|
regionPrefix = meshRegion_;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkDataArraySelection* select = reader_->GetFieldSelection();
|
||||||
|
|
||||||
|
stringList enabledEntries(getSelectedArrayEntries(select));
|
||||||
|
select->RemoveAllArrays();
|
||||||
|
|
||||||
|
const Time& runTime = dbPtr_();
|
||||||
|
const instantList times = runTime.times();
|
||||||
|
addToSelection<fvPatchField, volMesh>
|
||||||
(
|
(
|
||||||
reader_->GetVolFieldSelection()
|
select,
|
||||||
|
runTime,
|
||||||
|
times,
|
||||||
|
regionPrefix
|
||||||
);
|
);
|
||||||
updateInfoFields<pointPatchField, pointMesh>
|
addToSelection<fvsPatchField, surfaceMesh>
|
||||||
(
|
(
|
||||||
reader_->GetPointFieldSelection()
|
select,
|
||||||
|
runTime,
|
||||||
|
times,
|
||||||
|
regionPrefix
|
||||||
);
|
);
|
||||||
|
addToSelection<pointPatchField, pointMesh>
|
||||||
|
(
|
||||||
|
select,
|
||||||
|
runTime,
|
||||||
|
times,
|
||||||
|
regionPrefix
|
||||||
|
);
|
||||||
|
|
||||||
|
// Restore the enabled selections
|
||||||
|
setSelectedArrayEntries(select, enabledEntries);
|
||||||
|
}
|
||||||
|
|
||||||
updateInfoLagrangianFields();
|
updateInfoLagrangianFields();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -556,13 +592,14 @@ void Foam::vtkPVFoam::Update
|
|||||||
reader_->UpdateProgress(0.8);
|
reader_->UpdateProgress(0.8);
|
||||||
|
|
||||||
// Update fields
|
// Update fields
|
||||||
convertVolFields(output);
|
convertFields(output);
|
||||||
convertPointFields(output);
|
|
||||||
convertLagrangianFields(lagrangianOutput);
|
convertLagrangianFields(lagrangianOutput);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "done reader part" << endl;
|
Info<< "done reader part" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
reader_->UpdateProgress(0.95);
|
reader_->UpdateProgress(0.95);
|
||||||
|
|
||||||
meshChanged_ = fieldsChanged_ = false;
|
meshChanged_ = fieldsChanged_ = false;
|
||||||
|
|||||||
@ -37,13 +37,12 @@ SourceFiles
|
|||||||
vtkPVFoamMeshSet.C
|
vtkPVFoamMeshSet.C
|
||||||
vtkPVFoamMeshVolume.C
|
vtkPVFoamMeshVolume.C
|
||||||
vtkPVFoamMeshZone.C
|
vtkPVFoamMeshZone.C
|
||||||
vtkPVFoamFaceField.H
|
vtkPVFoamSurfaceField.H
|
||||||
vtkPVFoamLagrangianFields.H
|
vtkPVFoamLagrangianFields.H
|
||||||
vtkPVFoamPatchField.H
|
vtkPVFoamPatchField.H
|
||||||
vtkPVFoamPointFields.H
|
vtkPVFoamPointFields.H
|
||||||
vtkPVFoamPoints.H
|
vtkPVFoamPoints.H
|
||||||
vtkPVFoamUpdateInfo.C
|
vtkPVFoamUpdateInfo.C
|
||||||
vtkPVFoamUpdateInfoFields.H
|
|
||||||
vtkPVFoamUtils.C
|
vtkPVFoamUtils.C
|
||||||
vtkPVFoamVolFields.H
|
vtkPVFoamVolFields.H
|
||||||
vtkPVFoamAddToSelection.H
|
vtkPVFoamAddToSelection.H
|
||||||
@ -68,6 +67,8 @@ SourceFiles
|
|||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
#include "PrimitivePatchInterpolation.H"
|
#include "PrimitivePatchInterpolation.H"
|
||||||
#include "volPointInterpolation.H"
|
#include "volPointInterpolation.H"
|
||||||
|
#include "surfaceFieldsFwd.H"
|
||||||
|
#include "instantList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -380,9 +381,19 @@ class vtkPVFoam
|
|||||||
const string& suffix=string::null
|
const string& suffix=string::null
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Field info
|
//- Add objects of Type to paraview array selection
|
||||||
template<template<class> class patchType, class meshType>
|
template<template<class> class patchType, class meshType>
|
||||||
void updateInfoFields(vtkDataArraySelection*);
|
void addToSelection
|
||||||
|
(
|
||||||
|
vtkDataArraySelection *select,
|
||||||
|
const Time& runTime,
|
||||||
|
const instantList& times,
|
||||||
|
const word& regionPrefix,
|
||||||
|
const string& suffix=string::null
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Field info
|
||||||
|
void updateInfoFields();
|
||||||
|
|
||||||
//- Lagrangian field info
|
//- Lagrangian field info
|
||||||
void updateInfoLagrangianFields();
|
void updateInfoLagrangianFields();
|
||||||
@ -475,11 +486,8 @@ class vtkPVFoam
|
|||||||
|
|
||||||
// Field conversion functions
|
// Field conversion functions
|
||||||
|
|
||||||
//- Convert volume fields
|
//- Convert fields
|
||||||
void convertVolFields(vtkMultiBlockDataSet*);
|
void convertFields(vtkMultiBlockDataSet*);
|
||||||
|
|
||||||
//- Convert point fields
|
|
||||||
void convertPointFields(vtkMultiBlockDataSet*);
|
|
||||||
|
|
||||||
//- Convert Lagrangian fields
|
//- Convert Lagrangian fields
|
||||||
void convertLagrangianFields(vtkMultiBlockDataSet*);
|
void convertLagrangianFields(vtkMultiBlockDataSet*);
|
||||||
@ -542,9 +550,9 @@ class vtkPVFoam
|
|||||||
const label datasetNo
|
const label datasetNo
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Face set/zone field
|
//- Face set/zone field from volField
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertFaceField
|
void convertSurfaceField
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
vtkMultiBlockDataSet* output,
|
vtkMultiBlockDataSet* output,
|
||||||
@ -554,6 +562,27 @@ class vtkPVFoam
|
|||||||
const labelList& faceLabels
|
const labelList& faceLabels
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Face set/zone field from surfaceField
|
||||||
|
template<class Type>
|
||||||
|
void convertSurfaceField
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvsPatchField, surfaceMesh>& tf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const arrayRange& range,
|
||||||
|
const label datasetNo,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelList& faceLabels
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Surface fields - all types
|
||||||
|
template<class Type>
|
||||||
|
void convertSurfaceFields
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
);
|
||||||
|
|
||||||
//- Lagrangian fields - all types
|
//- Lagrangian fields - all types
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void convertLagrangianFields
|
void convertLagrangianFields
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -29,6 +29,7 @@ License
|
|||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "SortableList.H"
|
#include "SortableList.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
@ -67,6 +68,56 @@ Foam::label Foam::vtkPVFoam::addToSelection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<template<class> class patchType, class meshType>
|
||||||
|
void Foam::vtkPVFoam::addToSelection
|
||||||
|
(
|
||||||
|
vtkDataArraySelection *select,
|
||||||
|
const Time& runTime,
|
||||||
|
const instantList& times,
|
||||||
|
const word& regionPrefix,
|
||||||
|
const string& suffix
|
||||||
|
)
|
||||||
|
{
|
||||||
|
forAll(times, timei)
|
||||||
|
{
|
||||||
|
// Search for list of objects for this time and mesh region
|
||||||
|
IOobjectList objects(runTime, times[timei].name(), regionPrefix);
|
||||||
|
|
||||||
|
//- Add volume fields to GUI
|
||||||
|
addToSelection<GeometricField<scalar, patchType, meshType>>
|
||||||
|
(
|
||||||
|
select,
|
||||||
|
objects,
|
||||||
|
suffix
|
||||||
|
);
|
||||||
|
addToSelection<GeometricField<vector, patchType, meshType>>
|
||||||
|
(
|
||||||
|
select,
|
||||||
|
objects,
|
||||||
|
suffix
|
||||||
|
);
|
||||||
|
addToSelection<GeometricField<sphericalTensor, patchType, meshType>>
|
||||||
|
(
|
||||||
|
select,
|
||||||
|
objects,
|
||||||
|
suffix
|
||||||
|
);
|
||||||
|
addToSelection<GeometricField<symmTensor, patchType, meshType>>
|
||||||
|
(
|
||||||
|
select,
|
||||||
|
objects,
|
||||||
|
suffix
|
||||||
|
);
|
||||||
|
addToSelection<GeometricField<tensor, patchType, meshType>>
|
||||||
|
(
|
||||||
|
select,
|
||||||
|
objects,
|
||||||
|
suffix
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,117 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkPVFoamFaceField_H
|
|
||||||
#define vtkPVFoamFaceField_H
|
|
||||||
|
|
||||||
// VTK includes
|
|
||||||
#include "vtkCellData.h"
|
|
||||||
#include "vtkFloatArray.h"
|
|
||||||
#include "vtkMultiBlockDataSet.h"
|
|
||||||
#include "vtkPolyData.h"
|
|
||||||
|
|
||||||
#include "vtkOpenFOAMTupleRemap.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::vtkPVFoam::convertFaceField
|
|
||||||
(
|
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const labelList& faceLabels
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
|
||||||
const label nInternalFaces = mesh.nInternalFaces();
|
|
||||||
const labelList& faceOwner = mesh.faceOwner();
|
|
||||||
const labelList& faceNeigh = mesh.faceNeighbour();
|
|
||||||
|
|
||||||
vtkFloatArray* cellData = vtkFloatArray::New();
|
|
||||||
cellData->SetNumberOfTuples(faceLabels.size());
|
|
||||||
cellData->SetNumberOfComponents(nComp);
|
|
||||||
cellData->Allocate(nComp*faceLabels.size());
|
|
||||||
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];
|
|
||||||
|
|
||||||
// for interior faces: average owner/neighbour
|
|
||||||
// for boundary faces: owner
|
|
||||||
forAll(faceLabels, facei)
|
|
||||||
{
|
|
||||||
const label faceNo = faceLabels[facei];
|
|
||||||
if (faceNo < nInternalFaces)
|
|
||||||
{
|
|
||||||
Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]);
|
|
||||||
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const Type& t = tf[faceOwner[faceNo]];
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
|
||||||
vec[d] = component(t, d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vtkOpenFOAMTupleRemap<Type>(vec);
|
|
||||||
|
|
||||||
cellData->InsertTuple(facei, vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vtkPolyData::SafeDownCast
|
|
||||||
(
|
|
||||||
GetDataSetFromBlock(output, range, datasetNo)
|
|
||||||
) ->GetCellData()
|
|
||||||
->AddArray(cellData);
|
|
||||||
|
|
||||||
cellData->Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -82,7 +82,7 @@ Foam::IOobjectList Foam::vtkPVFoam::getObjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::convertVolFields
|
void Foam::vtkPVFoam::convertFields
|
||||||
(
|
(
|
||||||
vtkMultiBlockDataSet* output
|
vtkMultiBlockDataSet* output
|
||||||
)
|
)
|
||||||
@ -91,7 +91,7 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
|
|
||||||
wordHashSet selectedFields = getSelected
|
wordHashSet selectedFields = getSelected
|
||||||
(
|
(
|
||||||
reader_->GetVolFieldSelection()
|
reader_->GetFieldSelection()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectedFields.empty())
|
if (selectedFields.empty())
|
||||||
@ -168,92 +168,24 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
mesh, ppInterpList, objects, interpFields, output
|
mesh, ppInterpList, objects, interpFields, output
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug)
|
convertSurfaceFields<scalar>(mesh, objects, output);
|
||||||
{
|
convertSurfaceFields<vector>(mesh, objects, output);
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertVolFields" << endl;
|
convertSurfaceFields<sphericalTensor>(mesh, objects, output);
|
||||||
printMemory();
|
convertSurfaceFields<symmTensor>(mesh, objects, output);
|
||||||
}
|
convertSurfaceFields<tensor>(mesh, objects, output);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::convertPointFields
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const fvMesh& mesh = *meshPtr_;
|
|
||||||
|
|
||||||
wordHashSet selectedFields = getSelected
|
|
||||||
(
|
|
||||||
reader_->GetPointFieldSelection()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedFields.empty())
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "no point fields selected" << endl;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get objects (fields) for this time - only keep selected fields
|
|
||||||
// the region name is already in the mesh db
|
|
||||||
IOobjectList objects
|
|
||||||
(
|
|
||||||
getObjects
|
|
||||||
(
|
|
||||||
selectedFields,
|
|
||||||
mesh,
|
|
||||||
dbPtr_().timeName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (objects.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPVFoam::convertPointFields" << nl
|
|
||||||
<< "converting OpenFOAM volume fields -> point fields" << endl;
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
|
||||||
{
|
|
||||||
Info<< " " << iter()->name()
|
|
||||||
<< " == " << iter()->objectPath() << nl;
|
|
||||||
}
|
|
||||||
printMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct interpolation on the raw mesh
|
// Construct interpolation on the raw mesh
|
||||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||||
|
|
||||||
|
convertPointFields<scalar>(mesh, pMesh, objects, output);
|
||||||
convertPointFields<scalar>
|
convertPointFields<vector>(mesh, pMesh, objects, output);
|
||||||
(
|
convertPointFields<sphericalTensor>(mesh, pMesh, objects, output);
|
||||||
mesh, pMesh, objects, output
|
convertPointFields<symmTensor>(mesh, pMesh, objects, output);
|
||||||
);
|
convertPointFields<tensor>(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)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<end> Foam::vtkPVFoam::convertPointFields" << endl;
|
Info<< "<end> Foam::vtkPVFoam::convertVolFields" << endl;
|
||||||
printMemory();
|
printMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,318 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
InClass
|
||||||
|
vtkPVFoam
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef vtkPVFoamSurfaceField_H
|
||||||
|
#define vtkPVFoamSurfaceField_H
|
||||||
|
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "emptyFvsPatchField.H"
|
||||||
|
|
||||||
|
// VTK includes
|
||||||
|
#include "vtkCellData.h"
|
||||||
|
#include "vtkFloatArray.h"
|
||||||
|
#include "vtkMultiBlockDataSet.h"
|
||||||
|
#include "vtkPolyData.h"
|
||||||
|
|
||||||
|
#include "vtkOpenFOAMTupleRemap.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertSurfaceField
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& tf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const arrayRange& range,
|
||||||
|
const label datasetNo,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelList& faceLabels
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
const label nInternalFaces = mesh.nInternalFaces();
|
||||||
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
|
const labelList& faceNeigh = mesh.faceNeighbour();
|
||||||
|
|
||||||
|
vtkFloatArray* cellData = vtkFloatArray::New();
|
||||||
|
cellData->SetNumberOfTuples(faceLabels.size());
|
||||||
|
cellData->SetNumberOfComponents(nComp);
|
||||||
|
cellData->Allocate(nComp*faceLabels.size());
|
||||||
|
cellData->SetName(tf.name().c_str());
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert convertSurfaceField: "
|
||||||
|
<< tf.name()
|
||||||
|
<< " size = " << tf.size()
|
||||||
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << faceLabels.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
|
||||||
|
// For interior faces: average owner/neighbour
|
||||||
|
// For boundary faces: owner
|
||||||
|
forAll(faceLabels, facei)
|
||||||
|
{
|
||||||
|
const label faceNo = faceLabels[facei];
|
||||||
|
if (faceNo < nInternalFaces)
|
||||||
|
{
|
||||||
|
Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]);
|
||||||
|
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const Type& t = tf[faceOwner[faceNo]];
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(t, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vtkOpenFOAMTupleRemap<Type>(vec);
|
||||||
|
|
||||||
|
cellData->InsertTuple(facei, vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vtkPolyData::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, range, datasetNo)
|
||||||
|
) ->GetCellData()
|
||||||
|
->AddArray(cellData);
|
||||||
|
|
||||||
|
cellData->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertSurfaceField
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvsPatchField, surfaceMesh>& tf,
|
||||||
|
vtkMultiBlockDataSet* output,
|
||||||
|
const arrayRange& range,
|
||||||
|
const label datasetNo,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const labelList& faceLabels
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label nComp = pTraits<Type>::nComponents;
|
||||||
|
const label nInternalFaces = mesh.nInternalFaces();
|
||||||
|
|
||||||
|
vtkFloatArray* cellData = vtkFloatArray::New();
|
||||||
|
cellData->SetNumberOfTuples(faceLabels.size());
|
||||||
|
cellData->SetNumberOfComponents(nComp);
|
||||||
|
cellData->Allocate(nComp*faceLabels.size());
|
||||||
|
cellData->SetName(tf.name().c_str());
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "convert convertSurfaceField: "
|
||||||
|
<< tf.name()
|
||||||
|
<< " size = " << tf.size()
|
||||||
|
<< " nComp=" << nComp
|
||||||
|
<< " nTuples = " << faceLabels.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// To avoid whichPatch first flatten the field
|
||||||
|
Field<Type> flatFld(mesh.nFaces(), Zero);
|
||||||
|
SubField<Type>(flatFld, nInternalFaces) = tf.internalField();
|
||||||
|
forAll(tf.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
const fvsPatchField<Type>& fvs = tf.boundaryField()[patchi];
|
||||||
|
|
||||||
|
SubField<Type>
|
||||||
|
(
|
||||||
|
flatFld,
|
||||||
|
fvs.size(),
|
||||||
|
fvs.patch().start()
|
||||||
|
) = fvs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// For interior faces: average owner/neighbour
|
||||||
|
// For boundary faces: owner
|
||||||
|
forAll(faceLabels, facei)
|
||||||
|
{
|
||||||
|
const label faceNo = faceLabels[facei];
|
||||||
|
|
||||||
|
float vec[nComp];
|
||||||
|
for (direction d=0; d<nComp; ++d)
|
||||||
|
{
|
||||||
|
vec[d] = component(flatFld[faceNo], d);
|
||||||
|
}
|
||||||
|
vtkOpenFOAMTupleRemap<Type>(vec);
|
||||||
|
|
||||||
|
cellData->InsertTuple(facei, vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkPolyData::SafeDownCast
|
||||||
|
(
|
||||||
|
GetDataSetFromBlock(output, range, datasetNo)
|
||||||
|
) ->GetCellData()
|
||||||
|
->AddArray(cellData);
|
||||||
|
|
||||||
|
cellData->Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::vtkPVFoam::convertSurfaceFields
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const IOobjectList& objects,
|
||||||
|
vtkMultiBlockDataSet* output
|
||||||
|
)
|
||||||
|
{
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
// Restrict to GeometricField<Type, ...>
|
||||||
|
if
|
||||||
|
(
|
||||||
|
iter()->headerClassName()
|
||||||
|
!= GeometricField<Type, fvsPatchField, surfaceMesh>::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load field
|
||||||
|
const GeometricField<Type, fvsPatchField, surfaceMesh> tf
|
||||||
|
(
|
||||||
|
*iter(),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
// Convert patches - if activated
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = arrayRangePatches_.start();
|
||||||
|
partId < arrayRangePatches_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word patchName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
const label patchId = mesh.boundaryMesh().findPatchID(patchName);
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvsPatchField<Type>& ptf = tf.boundaryField()[patchId];
|
||||||
|
|
||||||
|
if (!isType<emptyFvsPatchField<Type>>(ptf))
|
||||||
|
{
|
||||||
|
convertPatchField
|
||||||
|
(
|
||||||
|
tf.name(),
|
||||||
|
ptf,
|
||||||
|
output,
|
||||||
|
arrayRangePatches_,
|
||||||
|
datasetNo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Convert face zones - if activated
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = arrayRangeFaceZones_.start();
|
||||||
|
partId < arrayRangeFaceZones_.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
convertSurfaceField
|
||||||
|
(
|
||||||
|
tf,
|
||||||
|
output,
|
||||||
|
arrayRangeFaceZones_,
|
||||||
|
datasetNo,
|
||||||
|
mesh,
|
||||||
|
zMesh[zoneId]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert face sets - if activated
|
||||||
|
for
|
||||||
|
(
|
||||||
|
int partId = arrayRangeFaceSets_.start();
|
||||||
|
partId < arrayRangeFaceSets_.end();
|
||||||
|
++partId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word selectName = getPartName(partId);
|
||||||
|
const label datasetNo = partDataset_[partId];
|
||||||
|
|
||||||
|
if (!partStatus_[partId] || datasetNo < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceSet fSet(mesh, selectName);
|
||||||
|
|
||||||
|
convertSurfaceField
|
||||||
|
(
|
||||||
|
tf,
|
||||||
|
output,
|
||||||
|
arrayRangeFaceSets_,
|
||||||
|
datasetNo,
|
||||||
|
mesh,
|
||||||
|
fSet.toc()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "vtkPVFoam.H"
|
#include "vtkPVFoam.H"
|
||||||
|
|
||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
|
#include "vtkPVFoamReader.h"
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
@ -34,11 +35,10 @@ License
|
|||||||
#include "polyBoundaryMeshEntries.H"
|
#include "polyBoundaryMeshEntries.H"
|
||||||
#include "entry.H"
|
#include "entry.H"
|
||||||
#include "Cloud.H"
|
#include "Cloud.H"
|
||||||
#include "vtkPVFoamReader.h"
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
// local headers
|
// Local includes
|
||||||
#include "vtkPVFoamAddToSelection.H"
|
#include "vtkPVFoamAddToSelection.H"
|
||||||
#include "vtkPVFoamUpdateInfoFields.H"
|
|
||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkDataArraySelection.h"
|
#include "vtkDataArraySelection.h"
|
||||||
@ -68,7 +68,7 @@ public:
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Member Functions
|
// Member functions
|
||||||
|
|
||||||
bool writeData(Ostream&) const
|
bool writeData(Ostream&) const
|
||||||
{
|
{
|
||||||
@ -252,7 +252,6 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
const wordList allPatchNames = patches.names();
|
const wordList allPatchNames = patches.names();
|
||||||
|
|
||||||
// Add patch groups
|
// Add patch groups
|
||||||
// ~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
@ -303,7 +302,6 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
|
|
||||||
|
|
||||||
// Add patches
|
// Add patches
|
||||||
// ~~~~~~~~~~~
|
|
||||||
|
|
||||||
if (!reader_->GetShowGroupsOnly())
|
if (!reader_->GetShowGroupsOnly())
|
||||||
{
|
{
|
||||||
@ -350,7 +348,6 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
|
|
||||||
|
|
||||||
// Read patches and determine sizes
|
// Read patches and determine sizes
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
wordList names(patchEntries.size());
|
wordList names(patchEntries.size());
|
||||||
labelList sizes(patchEntries.size());
|
labelList sizes(patchEntries.size());
|
||||||
@ -365,7 +362,6 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
|
|
||||||
|
|
||||||
// Add (non-zero) patch groups to the list of mesh parts
|
// Add (non-zero) patch groups to the list of mesh parts
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
HashTable<labelList, word> groups(patchEntries.size());
|
HashTable<labelList, word> groups(patchEntries.size());
|
||||||
|
|
||||||
@ -450,7 +446,6 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
|
|
||||||
|
|
||||||
// Add (non-zero) patches to the list of mesh parts
|
// Add (non-zero) patches to the list of mesh parts
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
if (!reader_->GetShowGroupsOnly())
|
if (!reader_->GetShowGroupsOnly())
|
||||||
{
|
{
|
||||||
@ -527,9 +522,7 @@ void Foam::vtkPVFoam::updateInfoZones
|
|||||||
|
|
||||||
wordList namesLst;
|
wordList namesLst;
|
||||||
|
|
||||||
//
|
|
||||||
// cellZones information
|
// cellZones information
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
if (meshPtr_)
|
if (meshPtr_)
|
||||||
{
|
{
|
||||||
namesLst = getZoneNames(meshPtr_->cellZones());
|
namesLst = getZoneNames(meshPtr_->cellZones());
|
||||||
@ -550,9 +543,7 @@ void Foam::vtkPVFoam::updateInfoZones
|
|||||||
arrayRangeCellZones_ += namesLst.size();
|
arrayRangeCellZones_ += namesLst.size();
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// faceZones information
|
// faceZones information
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
if (meshPtr_)
|
if (meshPtr_)
|
||||||
{
|
{
|
||||||
namesLst = getZoneNames(meshPtr_->faceZones());
|
namesLst = getZoneNames(meshPtr_->faceZones());
|
||||||
@ -573,9 +564,7 @@ void Foam::vtkPVFoam::updateInfoZones
|
|||||||
arrayRangeFaceZones_ += namesLst.size();
|
arrayRangeFaceZones_ += namesLst.size();
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// pointZones information
|
// pointZones information
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
if (meshPtr_)
|
if (meshPtr_)
|
||||||
{
|
{
|
||||||
namesLst = getZoneNames(meshPtr_->pointZones());
|
namesLst = getZoneNames(meshPtr_->pointZones());
|
||||||
@ -681,6 +670,105 @@ void Foam::vtkPVFoam::updateInfoSets
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPVFoam::updateInfoFields()
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<beg> Foam::vtkPVFoam::updateInfoFields "
|
||||||
|
" [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkDataArraySelection* fieldSelection = reader_->GetFieldSelection();
|
||||||
|
|
||||||
|
// Use the db directly since this might be called without a mesh,
|
||||||
|
// but the region must get added back in
|
||||||
|
word regionPrefix;
|
||||||
|
if (meshRegion_ != polyMesh::defaultRegion)
|
||||||
|
{
|
||||||
|
regionPrefix = meshRegion_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Time& runTime = dbPtr_();
|
||||||
|
const instantList times = runTime.times();
|
||||||
|
|
||||||
|
stringList enabledEntries;
|
||||||
|
|
||||||
|
if (fieldSelection->GetNumberOfArrays() == 0 && !meshPtr_)
|
||||||
|
{
|
||||||
|
const wordReList defaultFieldRes
|
||||||
|
(
|
||||||
|
configDict_.lookupOrDefault
|
||||||
|
(
|
||||||
|
"defaultFields",
|
||||||
|
wordReList(wordList{"p", "U"})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
wordHashSet objectNameSet;
|
||||||
|
forAll(times, timei)
|
||||||
|
{
|
||||||
|
// Search for list of objects for this time and mesh region
|
||||||
|
IOobjectList objects(runTime, times[timei].name(), regionPrefix);
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
objectNameSet.insert(iter.key());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const wordList objectNames(objectNameSet.toc());
|
||||||
|
const labelList defaultFields
|
||||||
|
(
|
||||||
|
findStrings(defaultFieldRes, objectNames)
|
||||||
|
);
|
||||||
|
|
||||||
|
enabledEntries.setSize(defaultFields.size());
|
||||||
|
forAll(defaultFields, i)
|
||||||
|
{
|
||||||
|
enabledEntries[i] = objectNames[defaultFields[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Preserve the enabled selections
|
||||||
|
enabledEntries = getSelectedArrayEntries(fieldSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldSelection->RemoveAllArrays();
|
||||||
|
|
||||||
|
addToSelection<fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
fieldSelection,
|
||||||
|
runTime,
|
||||||
|
times,
|
||||||
|
regionPrefix
|
||||||
|
);
|
||||||
|
addToSelection<fvsPatchField, surfaceMesh>
|
||||||
|
(
|
||||||
|
fieldSelection,
|
||||||
|
runTime,
|
||||||
|
times,
|
||||||
|
regionPrefix
|
||||||
|
);
|
||||||
|
addToSelection<pointPatchField, pointMesh>
|
||||||
|
(
|
||||||
|
fieldSelection,
|
||||||
|
runTime,
|
||||||
|
times,
|
||||||
|
regionPrefix
|
||||||
|
);
|
||||||
|
|
||||||
|
// Restore the enabled selections
|
||||||
|
setSelectedArrayEntries(fieldSelection, enabledEntries);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "<end> Foam::vtkPVFoam::updateInfoFields" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVFoam::updateInfoLagrangianFields()
|
void Foam::vtkPVFoam::updateInfoLagrangianFields()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@ -1,149 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
InClass
|
|
||||||
vtkPVFoam
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef vtkPVFoamUpdateInfoFields_H
|
|
||||||
#define vtkPVFoamUpdateInfoFields_H
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<template<class> class patchType, class meshType>
|
|
||||||
void Foam::vtkPVFoam::updateInfoFields
|
|
||||||
(
|
|
||||||
vtkDataArraySelection* select
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<beg> Foam::vtkPVFoam::updateInfoFields <"
|
|
||||||
<< meshType::Mesh::typeName
|
|
||||||
<< "> [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use the db directly since this might be called without a mesh,
|
|
||||||
// but the region must get added back in
|
|
||||||
word regionPrefix;
|
|
||||||
if (meshRegion_ != polyMesh::defaultRegion)
|
|
||||||
{
|
|
||||||
regionPrefix = meshRegion_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const instantList times = dbPtr_().times();
|
|
||||||
|
|
||||||
stringList enabledEntries;
|
|
||||||
|
|
||||||
if (select->GetNumberOfArrays() == 0 && !meshPtr_)
|
|
||||||
{
|
|
||||||
const wordReList defaultFieldRes
|
|
||||||
(
|
|
||||||
configDict_.lookupOrDefault
|
|
||||||
(
|
|
||||||
"defaultFields",
|
|
||||||
wordReList(wordList{"p", "U"})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
wordHashSet objectNameSet;
|
|
||||||
forAll(times, timei)
|
|
||||||
{
|
|
||||||
// Search for list of objects for this time and mesh region
|
|
||||||
IOobjectList objects(dbPtr_(), times[timei].name(), regionPrefix);
|
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
|
||||||
{
|
|
||||||
objectNameSet.insert(iter.key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const wordList objectNames(objectNameSet.toc());
|
|
||||||
const labelList defaultFields
|
|
||||||
(
|
|
||||||
findStrings(defaultFieldRes, objectNames)
|
|
||||||
);
|
|
||||||
|
|
||||||
enabledEntries.setSize(defaultFields.size());
|
|
||||||
forAll(defaultFields, i)
|
|
||||||
{
|
|
||||||
enabledEntries[i] = objectNames[defaultFields[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Preserve the enabled selections
|
|
||||||
enabledEntries = getSelectedArrayEntries(select);
|
|
||||||
}
|
|
||||||
|
|
||||||
select->RemoveAllArrays();
|
|
||||||
|
|
||||||
forAll(times, timei)
|
|
||||||
{
|
|
||||||
// Search for list of objects for this time and mesh region
|
|
||||||
IOobjectList objects(dbPtr_(), times[timei].name(), regionPrefix);
|
|
||||||
|
|
||||||
//- Add volume fields to GUI
|
|
||||||
addToSelection<GeometricField<scalar, patchType, meshType>>
|
|
||||||
(
|
|
||||||
select,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
addToSelection<GeometricField<vector, patchType, meshType>>
|
|
||||||
(
|
|
||||||
select,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
addToSelection<GeometricField<sphericalTensor, patchType, meshType>>
|
|
||||||
(
|
|
||||||
select,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
addToSelection<GeometricField<symmTensor, patchType, meshType>>
|
|
||||||
(
|
|
||||||
select,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
addToSelection<GeometricField<tensor, patchType, meshType>>
|
|
||||||
(
|
|
||||||
select,
|
|
||||||
objects
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore the enabled selections
|
|
||||||
setSelectedArrayEntries(select, enabledEntries);
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Info<< "<end> Foam::vtkPVFoam::updateInfoFields" << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -45,7 +45,6 @@ Description
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
//! \cond fileScope
|
|
||||||
// Extract up to the first non-word characters
|
// Extract up to the first non-word characters
|
||||||
inline word getFirstWord(const char* str)
|
inline word getFirstWord(const char* str)
|
||||||
{
|
{
|
||||||
@ -64,8 +63,6 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//! \endcond
|
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,7 +35,7 @@ InClass
|
|||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "volPointInterpolation.H"
|
#include "volPointInterpolation.H"
|
||||||
|
|
||||||
#include "vtkPVFoamFaceField.H"
|
#include "vtkPVFoamSurfaceField.H"
|
||||||
#include "vtkPVFoamPatchField.H"
|
#include "vtkPVFoamPatchField.H"
|
||||||
|
|
||||||
#include "vtkOpenFOAMTupleRemap.H"
|
#include "vtkOpenFOAMTupleRemap.H"
|
||||||
@ -121,9 +121,7 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Convert patches - if activated
|
// Convert patches - if activated
|
||||||
//
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int partId = arrayRangePatches_.start();
|
int partId = arrayRangePatches_.start();
|
||||||
@ -205,9 +203,7 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Convert face zones - if activated
|
// Convert face zones - if activated
|
||||||
//
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int partId = arrayRangeFaceZones_.start();
|
int partId = arrayRangeFaceZones_.start();
|
||||||
@ -231,7 +227,7 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
convertFaceField
|
convertSurfaceField
|
||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output,
|
output,
|
||||||
@ -240,13 +236,9 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
mesh,
|
mesh,
|
||||||
zMesh[zoneId]
|
zMesh[zoneId]
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: points
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Convert face sets - if activated
|
// Convert face sets - if activated
|
||||||
//
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
int partId = arrayRangeFaceSets_.start();
|
int partId = arrayRangeFaceSets_.start();
|
||||||
@ -264,7 +256,7 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
|
|
||||||
const faceSet fSet(mesh, selectName);
|
const faceSet fSet(mesh, selectName);
|
||||||
|
|
||||||
convertFaceField
|
convertSurfaceField
|
||||||
(
|
(
|
||||||
tf,
|
tf,
|
||||||
output,
|
output,
|
||||||
@ -273,8 +265,6 @@ void Foam::vtkPVFoam::convertVolFields
|
|||||||
mesh,
|
mesh,
|
||||||
fSet.toc()
|
fSet.toc()
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: points
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user