mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve file reader support for runTimePostProcessing (#1091)
- support .vtp format for geometry, surface, line, cloud. - use native reader for handling vtk, vtp, obj, stl surface files. For other formats, use the MeshedSurface (the surfMesh lib) to handle reading and Foam::vtk::Tools::Patch to handle the conversion to vtkPolyData. This combination is more memory efficient. - update tutorial case to include vtp surface geometry
This commit is contained in:
@ -22,14 +22,14 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::functionObjects::runTimePostPro::runTimePostProcessingDummy
|
Foam::functionObjects::runTimePostProcessingDummy
|
||||||
|
|
||||||
Group
|
Group
|
||||||
grpGraphicsFunctionObjects
|
grpGraphicsFunctionObjects
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Dummy implementation of runTimePostProcessing to report when
|
Dummy implementation of Foam::functionObjects::runTimePostProcessing
|
||||||
the real version is unavailable.
|
to report when the real version is unavailable.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
runTimePostProcessingDummy.C
|
runTimePostProcessingDummy.C
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -49,9 +49,11 @@ License
|
|||||||
|
|
||||||
const Foam::Enum
|
const Foam::Enum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldVisualisationBase::colourByType
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
colourByType
|
||||||
>
|
>
|
||||||
Foam::functionObjects::fieldVisualisationBase::colourByTypeNames
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
colourByTypeNames
|
||||||
({
|
({
|
||||||
{ colourByType::cbColour, "colour" },
|
{ colourByType::cbColour, "colour" },
|
||||||
{ colourByType::cbField, "field" },
|
{ colourByType::cbField, "field" },
|
||||||
@ -59,9 +61,11 @@ Foam::functionObjects::fieldVisualisationBase::colourByTypeNames
|
|||||||
|
|
||||||
const Foam::Enum
|
const Foam::Enum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldVisualisationBase::colourMapType
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
colourMapType
|
||||||
>
|
>
|
||||||
Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
colourMapTypeNames
|
||||||
({
|
({
|
||||||
{ colourMapType::cmRainbow, "rainbow" },
|
{ colourMapType::cmRainbow, "rainbow" },
|
||||||
{ colourMapType::cmBlueWhiteRed, "blueWhiteRed" },
|
{ colourMapType::cmBlueWhiteRed, "blueWhiteRed" },
|
||||||
@ -72,7 +76,8 @@ Foam::functionObjects::fieldVisualisationBase::colourMapTypeNames
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::fieldVisualisationBase::setColourMap
|
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
setColourMap
|
||||||
(
|
(
|
||||||
vtkLookupTable* lut
|
vtkLookupTable* lut
|
||||||
) const
|
) const
|
||||||
@ -130,7 +135,8 @@ void Foam::functionObjects::fieldVisualisationBase::setColourMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldVisualisationBase::addScalarBar
|
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
addScalarBar
|
||||||
(
|
(
|
||||||
const scalar position,
|
const scalar position,
|
||||||
vtkRenderer* renderer,
|
vtkRenderer* renderer,
|
||||||
@ -239,7 +245,8 @@ void Foam::functionObjects::fieldVisualisationBase::addScalarBar
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldVisualisationBase::setField
|
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
setField
|
||||||
(
|
(
|
||||||
const scalar position,
|
const scalar position,
|
||||||
const word& colourFieldName,
|
const word& colourFieldName,
|
||||||
@ -272,11 +279,11 @@ void Foam::functionObjects::fieldVisualisationBase::setField
|
|||||||
// Note: if both point and cell data exists, preferentially
|
// Note: if both point and cell data exists, preferentially
|
||||||
// choosing point data. This is often the case when using
|
// choosing point data. This is often the case when using
|
||||||
// glyphs
|
// glyphs
|
||||||
if (pData->GetPointData()->HasArray(fieldName) == 1)
|
if (pData->GetPointData()->HasArray(fieldName))
|
||||||
{
|
{
|
||||||
mapper->SetScalarModeToUsePointFieldData();
|
mapper->SetScalarModeToUsePointFieldData();
|
||||||
}
|
}
|
||||||
else if (pData->GetCellData()->HasArray(fieldName) == 1)
|
else if (pData->GetCellData()->HasArray(fieldName))
|
||||||
{
|
{
|
||||||
mapper->SetScalarModeToUseCellFieldData();
|
mapper->SetScalarModeToUseCellFieldData();
|
||||||
}
|
}
|
||||||
@ -302,8 +309,8 @@ void Foam::functionObjects::fieldVisualisationBase::setField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
addGlyphs
|
||||||
(
|
(
|
||||||
const scalar position,
|
const scalar position,
|
||||||
const word& scaleFieldName,
|
const word& scaleFieldName,
|
||||||
@ -320,20 +327,49 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
|||||||
|
|
||||||
glyph->SetInputData(data);
|
glyph->SetInputData(data);
|
||||||
glyph->ScalingOn();
|
glyph->ScalingOn();
|
||||||
bool ok = true;
|
|
||||||
|
bool needPointData = false;
|
||||||
|
|
||||||
// Determine whether we have scalar or vector data
|
// Determine whether we have scalar or vector data
|
||||||
|
// and if we need to convert CellData -> PointData
|
||||||
|
|
||||||
label nComponents = -1;
|
label nComponents = -1;
|
||||||
const char* scaleFieldNameChar = scaleFieldName.c_str();
|
const char* scaleFieldNameChar = scaleFieldName.c_str();
|
||||||
if (data->GetPointData()->HasArray(scaleFieldNameChar) == 1)
|
if (data->GetPointData()->HasArray(scaleFieldNameChar))
|
||||||
{
|
{
|
||||||
nComponents =
|
nComponents =
|
||||||
data->GetPointData()->GetArray(scaleFieldNameChar)
|
data->GetPointData()->GetArray(scaleFieldNameChar)
|
||||||
->GetNumberOfComponents();
|
->GetNumberOfComponents();
|
||||||
}
|
}
|
||||||
else if (data->GetCellData()->HasArray(scaleFieldNameChar) == 1)
|
else if (data->GetCellData()->HasArray(scaleFieldNameChar))
|
||||||
|
{
|
||||||
|
// Need to convert CellData to PointData
|
||||||
|
needPointData = true;
|
||||||
|
|
||||||
|
nComponents =
|
||||||
|
data->GetCellData()->GetArray(scaleFieldNameChar)
|
||||||
|
->GetNumberOfComponents();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Cannot add glyphs. No such cell or point field: "
|
||||||
|
<< scaleFieldName << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const bool ok = (nComponents == 1 || nComponents == 3);
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Glyphs can only be added to scalar or vector data. "
|
||||||
|
<< "Unable to process field " << scaleFieldName << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (needPointData)
|
||||||
{
|
{
|
||||||
// Need to convert cell data to point data
|
|
||||||
auto cellToPoint = vtkSmartPointer<vtkCellDataToPointData>::New();
|
auto cellToPoint = vtkSmartPointer<vtkCellDataToPointData>::New();
|
||||||
cellToPoint->SetInputData(data);
|
cellToPoint->SetInputData(data);
|
||||||
cellToPoint->Update();
|
cellToPoint->Update();
|
||||||
@ -342,16 +378,8 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
|||||||
|
|
||||||
// Store in main vtkPolyData
|
// Store in main vtkPolyData
|
||||||
data->GetPointData()->AddArray(pData);
|
data->GetPointData()->AddArray(pData);
|
||||||
|
}
|
||||||
|
|
||||||
nComponents = pData->GetNumberOfComponents();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Glyphs can only be added to scalar or vector data. "
|
|
||||||
<< "Unable to process field " << scaleFieldName << endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nComponents == 1)
|
if (nComponents == 1)
|
||||||
{
|
{
|
||||||
@ -367,18 +395,16 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
|||||||
|
|
||||||
if (maxGlyphLength > 0)
|
if (maxGlyphLength > 0)
|
||||||
{
|
{
|
||||||
double range[2];
|
// Can get range from point data:
|
||||||
|
|
||||||
// Can use values to find range
|
// double range[2];
|
||||||
// vtkDataArray* values =
|
// vtkDataArray* values =
|
||||||
// data->GetPointData()->GetScalars(scaleFieldNameChar);
|
// data->GetPointData()->GetScalars(scaleFieldNameChar);
|
||||||
// values->GetRange(range);
|
// values->GetRange(range);
|
||||||
|
|
||||||
// Set range according to user-supplied limits
|
// Set range according to user-supplied limits
|
||||||
range[0] = range_.first();
|
|
||||||
range[1] = range_.second();
|
|
||||||
glyph->ClampingOn();
|
glyph->ClampingOn();
|
||||||
glyph->SetRange(range);
|
glyph->SetRange(range_.first(), range_.second());
|
||||||
|
|
||||||
// If range[0] != min(value), maxGlyphLength behaviour will not
|
// If range[0] != min(value), maxGlyphLength behaviour will not
|
||||||
// be correct...
|
// be correct...
|
||||||
@ -450,15 +476,7 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
|||||||
scaleFieldNameChar
|
scaleFieldNameChar
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Glyphs can only be added to scalar and vector fields."
|
|
||||||
<< " Field " << scaleFieldName << " has " << nComponents
|
|
||||||
<< " components" << endl;
|
|
||||||
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
@ -477,10 +495,11 @@ void Foam::functionObjects::fieldVisualisationBase::addGlyphs
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
fieldVisualisationBase
|
||||||
(
|
(
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
colours_(colours),
|
colours_(colours),
|
||||||
@ -504,16 +523,17 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
|||||||
|
|
||||||
colourMapTypeNames.readIfPresent("colourMap", dict, colourMap_);
|
colourMapTypeNames.readIfPresent("colourMap", dict, colourMap_);
|
||||||
|
|
||||||
const dictionary& sbarDict = dict.subDict("scalarBar");
|
const dictionary& sbDict = dict.subDict("scalarBar");
|
||||||
sbarDict.readEntry("visible", scalarBar_.visible_);
|
sbDict.readEntry("visible", scalarBar_.visible_);
|
||||||
|
|
||||||
if (scalarBar_.visible_)
|
if (scalarBar_.visible_)
|
||||||
{
|
{
|
||||||
sbarDict.readEntry("vertical", scalarBar_.vertical_);
|
sbDict.readEntry("vertical", scalarBar_.vertical_);
|
||||||
sbarDict.readEntry("position", scalarBar_.position_);
|
sbDict.readEntry("position", scalarBar_.position_);
|
||||||
sbarDict.readEntry("title", scalarBar_.title_);
|
sbDict.readEntry("title", scalarBar_.title_);
|
||||||
sbarDict.readEntry("fontSize", scalarBar_.fontSize_);
|
sbDict.readEntry("fontSize", scalarBar_.fontSize_);
|
||||||
sbarDict.readEntry("labelFormat", scalarBar_.labelFormat_);
|
sbDict.readEntry("labelFormat", scalarBar_.labelFormat_);
|
||||||
sbarDict.readEntry("numberOfLabels", scalarBar_.numberOfLabels_);
|
sbDict.readEntry("numberOfLabels", scalarBar_.numberOfLabels_);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -523,21 +543,23 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::fieldVisualisationBase::~fieldVisualisationBase()
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
|
||||||
|
~fieldVisualisationBase()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
|
const Foam::HashPtrTable<Foam::Function1<Foam::vector>, Foam::word>&
|
||||||
Foam::functionObjects::fieldVisualisationBase::colours() const
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::colours() const
|
||||||
{
|
{
|
||||||
return colours_;
|
return colours_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::word&
|
const Foam::word&
|
||||||
Foam::functionObjects::fieldVisualisationBase::fieldName() const
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldName()
|
||||||
|
const
|
||||||
{
|
{
|
||||||
return fieldName_;
|
return fieldName_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::functionObjects::fieldVisualisationBase
|
Foam::functionObjects::runTimePostPro::fieldVisualisationBase
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Base class for scene objects
|
Base class for scene objects
|
||||||
@ -42,26 +42,29 @@ SourceFiles
|
|||||||
#include "HashPtrTable.H"
|
#include "HashPtrTable.H"
|
||||||
#include "Function1.H"
|
#include "Function1.H"
|
||||||
|
|
||||||
|
// VTK includes
|
||||||
#include "vtkSmartPointer.h"
|
#include "vtkSmartPointer.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkActor;
|
class vtkActor;
|
||||||
class vtkLookupTable;
|
class vtkLookupTable;
|
||||||
|
class vtkMapper;
|
||||||
class vtkPolyData;
|
class vtkPolyData;
|
||||||
class vtkPolyDataMapper;
|
class vtkPolyDataMapper;
|
||||||
class vtkRenderer;
|
class vtkRenderer;
|
||||||
|
|
||||||
|
|
||||||
class vtkMapper;
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
// Forward declarations
|
||||||
class runTimePostProcessing;
|
class runTimePostProcessing;
|
||||||
|
|
||||||
|
namespace runTimePostPro
|
||||||
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class fieldVisualisationBase Declaration
|
Class fieldVisualisationBase Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -91,20 +94,9 @@ public:
|
|||||||
static const Enum<colourMapType> colourMapTypeNames;
|
static const Enum<colourMapType> colourMapTypeNames;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
fieldVisualisationBase(const fieldVisualisationBase&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const fieldVisualisationBase&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected Data
|
||||||
|
|
||||||
struct scalarBar
|
struct scalarBar
|
||||||
{
|
{
|
||||||
@ -118,7 +110,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Colours
|
//- Colours
|
||||||
const HashPtrTable<Function1<vector>, word>& colours_;
|
const HashPtrTable<Function1<vector>>& colours_;
|
||||||
|
|
||||||
//- Field name
|
//- Field name
|
||||||
word fieldName_;
|
word fieldName_;
|
||||||
@ -171,6 +163,12 @@ protected:
|
|||||||
vtkRenderer* renderer
|
vtkRenderer* renderer
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
fieldVisualisationBase(const fieldVisualisationBase&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const fieldVisualisationBase&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -180,7 +178,7 @@ public:
|
|||||||
fieldVisualisationBase
|
fieldVisualisationBase
|
||||||
(
|
(
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -190,18 +188,19 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the colours
|
//- Return the colours
|
||||||
const HashPtrTable<Function1<vector>, word>& colours() const;
|
const HashPtrTable<Function1<vector>>& colours() const;
|
||||||
|
|
||||||
//- Return the field name
|
//- Return the field name
|
||||||
const word& fieldName() const;
|
const word& fieldName() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace runTimePostPro
|
||||||
} // End namespace functionObjects
|
} // End namespace functionObjects
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectBase
|
|||||||
(
|
(
|
||||||
const stateFunctionObject& state,
|
const stateFunctionObject& state,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fieldVisualisationBase(dict, colours),
|
fieldVisualisationBase(dict, colours),
|
||||||
|
|||||||
@ -109,13 +109,13 @@ protected:
|
|||||||
// \note does not change the stateFunctionObject
|
// \note does not change the stateFunctionObject
|
||||||
bool removeFile(const word& keyword, const word& subDictName);
|
bool removeFile(const word& keyword, const word& subDictName);
|
||||||
|
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
functionObjectBase(const functionObjectBase&) = delete;
|
functionObjectBase(const functionObjectBase&) = delete;
|
||||||
|
|
||||||
//- No copy assignment
|
//- No copy assignment
|
||||||
void operator=(const functionObjectBase&) = delete;
|
void operator=(const functionObjectBase&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
//- Run-time type information
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
(
|
(
|
||||||
const stateFunctionObject& state,
|
const stateFunctionObject& state,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,10 +35,12 @@ License
|
|||||||
#include "vtkSmartPointer.h"
|
#include "vtkSmartPointer.h"
|
||||||
#include "vtkPolyData.h"
|
#include "vtkPolyData.h"
|
||||||
#include "vtkPolyDataMapper.h"
|
#include "vtkPolyDataMapper.h"
|
||||||
#include "vtkXMLPolyDataReader.h"
|
|
||||||
#include "vtkPolyDataReader.h"
|
|
||||||
#include "vtkProperty.h"
|
#include "vtkProperty.h"
|
||||||
|
|
||||||
|
// VTK Readers
|
||||||
|
#include "vtkPolyDataReader.h"
|
||||||
|
#include "vtkXMLPolyDataReader.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -60,7 +62,7 @@ Foam::functionObjects::runTimePostPro::functionObjectCloud::functionObjectCloud
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
pointData(parent, dict, colours),
|
pointData(parent, dict, colours),
|
||||||
@ -101,7 +103,6 @@ addGeometryToScene
|
|||||||
// containing all fields.
|
// containing all fields.
|
||||||
|
|
||||||
inputFileName_ = getFileName("file", cloudName_);
|
inputFileName_ = getFileName("file", cloudName_);
|
||||||
inputFileName_.expand();
|
|
||||||
|
|
||||||
if (inputFileName_.empty())
|
if (inputFileName_.empty())
|
||||||
{
|
{
|
||||||
@ -113,6 +114,7 @@ addGeometryToScene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vtkSmartPointer<vtkPolyData> dataset;
|
vtkSmartPointer<vtkPolyData> dataset;
|
||||||
|
|
||||||
if (inputFileName_.hasExt("vtp"))
|
if (inputFileName_.hasExt("vtp"))
|
||||||
@ -128,9 +130,17 @@ addGeometryToScene
|
|||||||
// Invalid name - ignore.
|
// Invalid name - ignore.
|
||||||
// Don't support VTK legacy format at all - it is too wasteful
|
// Don't support VTK legacy format at all - it is too wasteful
|
||||||
// and cumbersome.
|
// and cumbersome.
|
||||||
|
|
||||||
|
WarningInFunction
|
||||||
|
<< "Could not read "<< inputFileName_ << nl
|
||||||
|
<< "Only VTK (.vtp) files are supported"
|
||||||
|
<< ". Cloud will not be processed"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
inputFileName_.clear();
|
inputFileName_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dataset)
|
if (dataset)
|
||||||
{
|
{
|
||||||
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||||
|
|||||||
@ -56,20 +56,9 @@ class functionObjectCloud
|
|||||||
public pointData,
|
public pointData,
|
||||||
public functionObjectBase
|
public functionObjectBase
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
functionObjectCloud(const functionObjectCloud&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const functionObjectCloud&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected Data
|
||||||
|
|
||||||
//- Name of functionObjectCloud
|
//- Name of functionObjectCloud
|
||||||
word cloudName_;
|
word cloudName_;
|
||||||
@ -83,6 +72,16 @@ protected:
|
|||||||
//- Actor
|
//- Actor
|
||||||
vtkSmartPointer<vtkActor> actor_;
|
vtkSmartPointer<vtkActor> actor_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
functionObjectCloud(const functionObjectCloud&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const functionObjectCloud&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
//- Run-time type information
|
||||||
@ -96,7 +95,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,11 +30,15 @@ License
|
|||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkActor.h"
|
#include "vtkActor.h"
|
||||||
|
#include "vtkPolyData.h"
|
||||||
|
#include "vtkPolyDataMapper.h"
|
||||||
|
#include "vtkProperty.h"
|
||||||
#include "vtkRenderer.h"
|
#include "vtkRenderer.h"
|
||||||
#include "vtkSmartPointer.h"
|
#include "vtkSmartPointer.h"
|
||||||
#include "vtkPolyDataMapper.h"
|
|
||||||
|
// VTK Readers
|
||||||
#include "vtkPolyDataReader.h"
|
#include "vtkPolyDataReader.h"
|
||||||
#include "vtkProperty.h"
|
#include "vtkXMLPolyDataReader.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -51,13 +55,51 @@ namespace runTimePostPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
static vtkSmartPointer<vtkPolyData> getPolyDataFile(const Foam::fileName& fName)
|
||||||
|
{
|
||||||
|
// Not extremely elegant...
|
||||||
|
vtkSmartPointer<vtkPolyData> dataset;
|
||||||
|
|
||||||
|
if (fName.ext() == "vtk")
|
||||||
|
{
|
||||||
|
auto reader = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||||
|
|
||||||
|
reader->SetFileName(fName.c_str());
|
||||||
|
reader->Update();
|
||||||
|
dataset = reader->GetOutput();
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fName.ext() == "vtp")
|
||||||
|
{
|
||||||
|
auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
|
||||||
|
|
||||||
|
reader->SetFileName(fName.c_str());
|
||||||
|
reader->Update();
|
||||||
|
dataset = reader->GetOutput();
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::runTimePostPro::functionObjectLine::functionObjectLine
|
Foam::functionObjects::runTimePostPro::functionObjectLine::functionObjectLine
|
||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
pathline(parent, dict, colours),
|
pathline(parent, dict, colours),
|
||||||
@ -99,21 +141,28 @@ addGeometryToScene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fName.hasExt("vtk"))
|
|
||||||
|
auto polyData = getPolyDataFile(fName);
|
||||||
|
|
||||||
|
if (!polyData || polyData->GetNumberOfPoints() == 0)
|
||||||
{
|
{
|
||||||
auto lines = vtkSmartPointer<vtkPolyDataReader>::New();
|
WarningInFunction
|
||||||
lines->SetFileName(fName.c_str());
|
<< "Could not read "<< fName << nl
|
||||||
lines->Update();
|
<< "Only VTK (.vtp, .vtk) files are supported"
|
||||||
|
<< endl;
|
||||||
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
return;
|
||||||
setField(position, fieldName_, mapper, renderer, lines->GetOutput());
|
|
||||||
|
|
||||||
actor_->SetMapper(mapper);
|
|
||||||
|
|
||||||
addLines(position, actor_, lines->GetOutput());
|
|
||||||
|
|
||||||
renderer->AddActor(actor_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||||
|
|
||||||
|
setField(position, fieldName_, mapper, renderer, polyData);
|
||||||
|
|
||||||
|
actor_->SetMapper(mapper);
|
||||||
|
|
||||||
|
addLines(position, actor_, polyData);
|
||||||
|
|
||||||
|
renderer->AddActor(actor_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,6 +175,7 @@ void Foam::functionObjects::runTimePostPro::functionObjectLine::updateActors
|
|||||||
actor_->GetProperty()->SetOpacity(opacity(position));
|
actor_->GetProperty()->SetOpacity(opacity(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::runTimePostPro::functionObjectLine::clear()
|
bool Foam::functionObjects::runTimePostPro::functionObjectLine::clear()
|
||||||
{
|
{
|
||||||
if (functionObjectBase::clear())
|
if (functionObjectBase::clear())
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,9 +56,15 @@ class functionObjectLine
|
|||||||
public pathline,
|
public pathline,
|
||||||
public functionObjectBase
|
public functionObjectBase
|
||||||
{
|
{
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
// Private Member Functions
|
// Protected Data
|
||||||
|
|
||||||
|
//- Actor
|
||||||
|
vtkSmartPointer<vtkActor> actor_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
functionObjectLine(const functionObjectLine&) = delete;
|
functionObjectLine(const functionObjectLine&) = delete;
|
||||||
@ -67,14 +73,6 @@ private:
|
|||||||
void operator=(const functionObjectLine&) = delete;
|
void operator=(const functionObjectLine&) = delete;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
//- Actor
|
|
||||||
vtkSmartPointer<vtkActor> actor_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
//- Run-time type information
|
||||||
@ -88,7 +86,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,12 +30,16 @@ License
|
|||||||
|
|
||||||
// VTK includes
|
// VTK includes
|
||||||
#include "vtkActor.h"
|
#include "vtkActor.h"
|
||||||
|
#include "vtkPolyData.h"
|
||||||
#include "vtkPolyDataMapper.h"
|
#include "vtkPolyDataMapper.h"
|
||||||
#include "vtkPolyDataReader.h"
|
|
||||||
#include "vtkProperty.h"
|
#include "vtkProperty.h"
|
||||||
#include "vtkRenderer.h"
|
#include "vtkRenderer.h"
|
||||||
#include "vtkSmartPointer.h"
|
#include "vtkSmartPointer.h"
|
||||||
|
|
||||||
|
// VTK Readers
|
||||||
|
#include "vtkPolyDataReader.h"
|
||||||
|
#include "vtkXMLPolyDataReader.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -51,6 +55,44 @@ namespace runTimePostPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
static vtkSmartPointer<vtkPolyData> getPolyDataFile(const Foam::fileName& fName)
|
||||||
|
{
|
||||||
|
// Not extremely elegant...
|
||||||
|
vtkSmartPointer<vtkPolyData> dataset;
|
||||||
|
|
||||||
|
if (fName.ext() == "vtk")
|
||||||
|
{
|
||||||
|
auto reader = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||||
|
|
||||||
|
reader->SetFileName(fName.c_str());
|
||||||
|
reader->Update();
|
||||||
|
dataset = reader->GetOutput();
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fName.ext() == "vtp")
|
||||||
|
{
|
||||||
|
auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
|
||||||
|
|
||||||
|
reader->SetFileName(fName.c_str());
|
||||||
|
reader->Update();
|
||||||
|
dataset = reader->GetOutput();
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::runTimePostPro::functionObjectSurface::
|
Foam::functionObjects::runTimePostPro::functionObjectSurface::
|
||||||
@ -58,7 +100,7 @@ functionObjectSurface
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometrySurface(parent, dict, colours, List<fileName>()),
|
geometrySurface(parent, dict, colours, List<fileName>()),
|
||||||
@ -99,37 +141,38 @@ addGeometryToScene
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
auto polyData = getPolyDataFile(fName);
|
||||||
|
|
||||||
|
if (!polyData || polyData->GetNumberOfPoints() == 0)
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Could not read "<< fName << nl
|
||||||
|
<< "Only VTK (.vtp, .vtk) files are supported"
|
||||||
|
<< endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (representation_ == rtGlyph)
|
if (representation_ == rtGlyph)
|
||||||
{
|
{
|
||||||
auto surf = vtkSmartPointer<vtkPolyDataReader>::New();
|
|
||||||
surf->SetFileName(fName.c_str());
|
|
||||||
surf->Update();
|
|
||||||
|
|
||||||
addGlyphs
|
addGlyphs
|
||||||
(
|
(
|
||||||
position,
|
position,
|
||||||
fieldName_,
|
fieldName_,
|
||||||
fieldName_,
|
fieldName_,
|
||||||
maxGlyphLength_,
|
maxGlyphLength_,
|
||||||
surf->GetOutput(),
|
polyData,
|
||||||
surfaceActor_,
|
surfaceActor_,
|
||||||
renderer
|
renderer
|
||||||
);
|
);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (fName.hasExt("vtk"))
|
|
||||||
{
|
{
|
||||||
auto surf = vtkSmartPointer<vtkPolyDataReader>::New();
|
addFeatureEdges(renderer, polyData);
|
||||||
surf->SetFileName(fName.c_str());
|
|
||||||
surf->Update();
|
|
||||||
|
|
||||||
addFeatureEdges(renderer, surf->GetOutput());
|
|
||||||
|
|
||||||
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||||
mapper->SetInputConnection(surf->GetOutputPort());
|
mapper->SetInputData(polyData);
|
||||||
|
|
||||||
setField(position, fieldName_, mapper, renderer, surf->GetOutput());
|
setField(position, fieldName_, mapper, renderer, polyData);
|
||||||
|
|
||||||
surfaceActor_->SetMapper(mapper);
|
surfaceActor_->SetMapper(mapper);
|
||||||
|
|
||||||
@ -137,12 +180,6 @@ addGeometryToScene
|
|||||||
|
|
||||||
renderer->AddActor(surfaceActor_);
|
renderer->AddActor(surfaceActor_);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Only VTK file types are supported"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,10 +56,9 @@ class functionObjectSurface
|
|||||||
public geometrySurface,
|
public geometrySurface,
|
||||||
public functionObjectBase
|
public functionObjectBase
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
private:
|
// Protected Member Functions
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
functionObjectSurface(const functionObjectSurface&) = delete;
|
functionObjectSurface(const functionObjectSurface&) = delete;
|
||||||
@ -81,7 +80,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "runTimePostProcessing.H"
|
#include "runTimePostProcessing.H"
|
||||||
#include "Constant.H"
|
#include "Constant.H"
|
||||||
|
|
||||||
|
// VTK includes
|
||||||
#include "vtkActor.h"
|
#include "vtkActor.h"
|
||||||
#include "vtkProperty.h"
|
#include "vtkProperty.h"
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
parent_(parent),
|
parent_(parent),
|
||||||
@ -96,7 +97,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
|
|||||||
{
|
{
|
||||||
if (dict.found("opacity"))
|
if (dict.found("opacity"))
|
||||||
{
|
{
|
||||||
opacity_.reset(Function1<scalar>::New("opacity", dict).ptr());
|
opacity_.reset(Function1<scalar>::New("opacity", dict));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,6 +43,7 @@ SourceFiles
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkRenderer;
|
class vtkRenderer;
|
||||||
class vtkActor;
|
class vtkActor;
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class runTimePostProcessing;
|
class runTimePostProcessing;
|
||||||
|
|
||||||
namespace runTimePostPro
|
namespace runTimePostPro
|
||||||
@ -78,17 +80,6 @@ public:
|
|||||||
static const Enum<renderModeType> renderModeTypeNames;
|
static const Enum<renderModeType> renderModeTypeNames;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
geometryBase(const geometryBase&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const geometryBase&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
@ -109,7 +100,7 @@ protected:
|
|||||||
autoPtr<Function1<scalar>> opacity_;
|
autoPtr<Function1<scalar>> opacity_;
|
||||||
|
|
||||||
//- Reference to the colours
|
//- Reference to the colours
|
||||||
const HashPtrTable<Function1<vector>, word>& colours_;
|
const HashPtrTable<Function1<vector>>& colours_;
|
||||||
|
|
||||||
|
|
||||||
// Protected functions
|
// Protected functions
|
||||||
@ -117,6 +108,12 @@ protected:
|
|||||||
//- Initialise actor
|
//- Initialise actor
|
||||||
void initialiseActor(vtkActor* actor) const;
|
void initialiseActor(vtkActor* actor) const;
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
geometryBase(const geometryBase&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const geometryBase&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -127,7 +124,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent_,
|
const runTimePostProcessing& parent_,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -137,24 +134,26 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the reference to the parent function object
|
//- Return the reference to the parent function object
|
||||||
const runTimePostProcessing& parent() const;
|
const runTimePostProcessing& parent() const;
|
||||||
|
|
||||||
//- Return the name
|
//- Return the name
|
||||||
const word& name() const;
|
const word& name() const;
|
||||||
|
|
||||||
//- Return the visible flag
|
//- Return the visible flag
|
||||||
bool visible() const;
|
bool visible() const;
|
||||||
|
|
||||||
//- Return the opacity
|
//- Return the opacity
|
||||||
scalar opacity(const scalar position) const;
|
scalar opacity(const scalar position) const;
|
||||||
|
|
||||||
//- Return reference to the colours
|
//- Return reference to the colours
|
||||||
const HashPtrTable<Function1<vector>, word>& colours() const;
|
const HashPtrTable<Function1<vector>>& colours() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Scene interaction
|
||||||
|
|
||||||
//- Add geometry to scene
|
//- Add geometry to scene
|
||||||
virtual void addGeometryToScene
|
virtual void addGeometryToScene
|
||||||
(
|
(
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,7 +26,8 @@ License
|
|||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
#include "geometrySurface.H"
|
#include "geometrySurface.H"
|
||||||
#include "stringOps.H"
|
#include "stringOps.H"
|
||||||
#include "triSurface.H"
|
#include "foamVtkTools.H"
|
||||||
|
#include "MeshedSurfaces.H"
|
||||||
#include "runTimePostProcessing.H"
|
#include "runTimePostProcessing.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
@ -42,7 +43,12 @@ License
|
|||||||
#include "vtkProperty.h"
|
#include "vtkProperty.h"
|
||||||
#include "vtkRenderer.h"
|
#include "vtkRenderer.h"
|
||||||
#include "vtkSmartPointer.h"
|
#include "vtkSmartPointer.h"
|
||||||
#include "vtkTriangle.h"
|
|
||||||
|
// VTK Readers
|
||||||
|
#include "vtkOBJReader.h"
|
||||||
|
#include "vtkSTLReader.h"
|
||||||
|
#include "vtkPolyDataReader.h"
|
||||||
|
#include "vtkXMLPolyDataReader.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -58,6 +64,78 @@ namespace runTimePostPro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
static vtkSmartPointer<vtkPolyData> getPolyDataFile(const Foam::fileName& fName)
|
||||||
|
{
|
||||||
|
// Not extremely elegant...
|
||||||
|
vtkSmartPointer<vtkPolyData> dataset;
|
||||||
|
|
||||||
|
if (fName.ext() == "vtk")
|
||||||
|
{
|
||||||
|
auto reader = vtkSmartPointer<vtkPolyDataReader>::New();
|
||||||
|
|
||||||
|
reader->SetFileName(fName.c_str());
|
||||||
|
reader->Update();
|
||||||
|
dataset = reader->GetOutput();
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fName.ext() == "vtp")
|
||||||
|
{
|
||||||
|
auto reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
|
||||||
|
|
||||||
|
reader->SetFileName(fName.c_str());
|
||||||
|
reader->Update();
|
||||||
|
dataset = reader->GetOutput();
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fName.ext() == "obj")
|
||||||
|
{
|
||||||
|
auto reader = vtkSmartPointer<vtkOBJReader>::New();
|
||||||
|
|
||||||
|
reader->SetFileName(fName.c_str());
|
||||||
|
reader->Update();
|
||||||
|
dataset = reader->GetOutput();
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fName.ext() == "stl" || fName.ext() == "stlb")
|
||||||
|
{
|
||||||
|
auto reader = vtkSmartPointer<vtkSTLReader>::New();
|
||||||
|
|
||||||
|
reader->SetFileName(fName.c_str());
|
||||||
|
reader->Update();
|
||||||
|
dataset = reader->GetOutput();
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Fallback to using OpenFOAM to read the surface and convert afterwards
|
||||||
|
Foam::meshedSurface surf(fName);
|
||||||
|
|
||||||
|
dataset = Foam::vtk::Tools::Patch::mesh(surf);
|
||||||
|
|
||||||
|
dataset->GetCellData()->SetNormals
|
||||||
|
(
|
||||||
|
Foam::vtk::Tools::Patch::faceNormals(surf)
|
||||||
|
);
|
||||||
|
|
||||||
|
return dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
||||||
@ -74,53 +152,22 @@ void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
|||||||
<< " object" << exit(FatalError);
|
<< " object" << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
triSurface surf(fName);
|
auto surf = getPolyDataFile(fName);
|
||||||
|
|
||||||
const Field<point>& surfPoints = surf.points();
|
if (!surf || surf->GetNumberOfPoints() == 0)
|
||||||
const Field<vector>& surfFaceNormals = surf.faceNormals();
|
|
||||||
|
|
||||||
auto points = vtkSmartPointer<vtkPoints>::New();
|
|
||||||
auto triangles = vtkSmartPointer<vtkCellArray>::New();
|
|
||||||
auto faceNormals = vtkSmartPointer<vtkDoubleArray>::New();
|
|
||||||
|
|
||||||
faceNormals->SetNumberOfComponents(3);
|
|
||||||
|
|
||||||
forAll(surfPoints, i)
|
|
||||||
{
|
{
|
||||||
const point& pt = surfPoints[i];
|
FatalErrorInFunction
|
||||||
points->InsertNextPoint(pt.x(), pt.y(), pt.z());
|
<< "Could not read "<< fName << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(surf, i)
|
|
||||||
{
|
|
||||||
const Foam::face& f = surf[i];
|
|
||||||
|
|
||||||
auto triangle = vtkSmartPointer<vtkTriangle>::New();
|
|
||||||
triangle->GetPointIds()->SetId(0, f[0]);
|
|
||||||
triangle->GetPointIds()->SetId(1, f[1]);
|
|
||||||
triangle->GetPointIds()->SetId(2, f[2]);
|
|
||||||
triangles->InsertNextCell(triangle);
|
|
||||||
|
|
||||||
double n[3];
|
|
||||||
n[0] = surfFaceNormals[i].x();
|
|
||||||
n[1] = surfFaceNormals[i].y();
|
|
||||||
n[2] = surfFaceNormals[i].z();
|
|
||||||
|
|
||||||
faceNormals->InsertNextTuple(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
surf.clearOut();
|
|
||||||
|
|
||||||
auto polyData = vtkSmartPointer<vtkPolyData>::New();
|
|
||||||
polyData->SetPoints(points);
|
|
||||||
polyData->SetPolys(triangles);
|
|
||||||
polyData->GetCellData()->SetNormals(faceNormals);
|
|
||||||
|
|
||||||
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||||
mapper->ScalarVisibilityOff();
|
|
||||||
mapper->SetInputData(polyData);
|
|
||||||
|
|
||||||
addFeatureEdges(renderer, polyData);
|
mapper->ScalarVisibilityOff();
|
||||||
|
|
||||||
|
mapper->SetInputData(surf);
|
||||||
|
|
||||||
|
addFeatureEdges(renderer, surf);
|
||||||
|
|
||||||
surfaceActor_->SetMapper(mapper);
|
surfaceActor_->SetMapper(mapper);
|
||||||
|
|
||||||
@ -136,7 +183,7 @@ Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
surface(parent, dict, colours),
|
surface(parent, dict, colours),
|
||||||
@ -150,7 +197,7 @@ Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours,
|
const HashPtrTable<Function1<vector>>& colours,
|
||||||
const List<fileName>& fileNames
|
const List<fileName>& fileNames
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -159,12 +206,6 @@ Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::runTimePostPro::geometrySurface::~geometrySurface()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
||||||
@ -178,10 +219,10 @@ void Foam::functionObjects::runTimePostPro::geometrySurface::addGeometryToScene
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(fileNames_, i)
|
for (fileName f : fileNames_) // Use a copy
|
||||||
{
|
{
|
||||||
fileName fName = fileNames_[i].expand();
|
f.expand();
|
||||||
addGeometryToScene(position, renderer, fName);
|
addGeometryToScene(position, renderer, f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,8 +251,8 @@ void Foam::functionObjects::runTimePostPro::geometrySurface::updateActors
|
|||||||
|
|
||||||
bool Foam::functionObjects::runTimePostPro::geometrySurface::clear()
|
bool Foam::functionObjects::runTimePostPro::geometrySurface::clear()
|
||||||
{
|
{
|
||||||
// Note: not removing geometry files
|
// Note: do not remove geometry files
|
||||||
// - these are usually static files that are used e.g. for meshing
|
// - often static files used for other purposes as well (eg meshing)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::geometrySurface
|
Foam::functionObjects::runTimePostPro::geometrySurface
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Visualisation of surface geometry data
|
Visualisation of surface geometry data
|
||||||
@ -39,6 +39,7 @@ SourceFiles
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkPolyData;
|
class vtkPolyData;
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -56,17 +57,6 @@ class geometrySurface
|
|||||||
:
|
:
|
||||||
public surface
|
public surface
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
geometrySurface(const geometrySurface&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const geometrySurface&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
@ -85,6 +75,12 @@ protected:
|
|||||||
const fileName& fName
|
const fileName& fName
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
geometrySurface(const geometrySurface&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const geometrySurface&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -99,7 +95,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
@ -107,18 +103,18 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours,
|
const HashPtrTable<Function1<vector>>& colours,
|
||||||
const List<fileName>& fileNames
|
const List<fileName>& fileNames
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~geometrySurface();
|
virtual ~geometrySurface() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Add surface(s) to scene
|
//- Add geometry surface(s) to scene
|
||||||
virtual void addGeometryToScene
|
virtual void addGeometryToScene
|
||||||
(
|
(
|
||||||
const scalar position,
|
const scalar position,
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -78,7 +78,7 @@ void Foam::functionObjects::runTimePostPro::pathline::addLines
|
|||||||
actor->GetProperty()->SetColor(colour[0], colour[1], colour[2]);
|
actor->GetProperty()->SetColor(colour[0], colour[1], colour[2]);
|
||||||
|
|
||||||
vtkPolyDataMapper* mapper =
|
vtkPolyDataMapper* mapper =
|
||||||
vtkPolyDataMapper::SafeDownCast(actor->GetMapper());
|
vtkPolyDataMapper::SafeDownCast(actor->GetMapper());
|
||||||
|
|
||||||
switch (representation_)
|
switch (representation_)
|
||||||
{
|
{
|
||||||
@ -123,7 +123,7 @@ Foam::functionObjects::runTimePostPro::pathline::pathline
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometryBase(parent, dict, colours),
|
geometryBase(parent, dict, colours),
|
||||||
@ -136,7 +136,7 @@ Foam::functionObjects::runTimePostPro::pathline::pathline
|
|||||||
{
|
{
|
||||||
if (dict.found("lineColour"))
|
if (dict.found("lineColour"))
|
||||||
{
|
{
|
||||||
lineColour_.reset(Function1<vector>::New("lineColour", dict).ptr());
|
lineColour_.reset(Function1<vector>::New("lineColour", dict));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -174,7 +174,7 @@ Foam::functionObjects::runTimePostPro::pathline::New
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours,
|
const HashPtrTable<Function1<vector>>& colours,
|
||||||
const word& pathlineType
|
const word& pathlineType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -22,9 +22,10 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::pathline
|
Foam::functionObjects::runTimePostPro::pathline
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Visualisation of line data (eg, streamlines)
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pathline.C
|
pathline.C
|
||||||
@ -40,6 +41,7 @@ SourceFiles
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkActor;
|
class vtkActor;
|
||||||
class vtkPolyData;
|
class vtkPolyData;
|
||||||
class vtkPolyDataMapper;
|
class vtkPolyDataMapper;
|
||||||
@ -74,17 +76,6 @@ public:
|
|||||||
static const Enum<representationType> representationTypeNames;
|
static const Enum<representationType> representationTypeNames;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
pathline(const pathline&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const pathline&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
@ -109,6 +100,12 @@ protected:
|
|||||||
vtkPolyData* data
|
vtkPolyData* data
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
pathline(const pathline&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const pathline&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -126,7 +123,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
),
|
),
|
||||||
(parent, dict, colours)
|
(parent, dict, colours)
|
||||||
);
|
);
|
||||||
@ -139,7 +136,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -150,7 +147,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours,
|
const HashPtrTable<Function1<vector>>& colours,
|
||||||
const word& pathlineName
|
const word& pathlineName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -93,7 +93,7 @@ Foam::functionObjects::runTimePostPro::pointData::pointData
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometryBase(parent, dict, colours),
|
geometryBase(parent, dict, colours),
|
||||||
@ -106,7 +106,7 @@ Foam::functionObjects::runTimePostPro::pointData::pointData
|
|||||||
{
|
{
|
||||||
if (dict.found("pointColour"))
|
if (dict.found("pointColour"))
|
||||||
{
|
{
|
||||||
pointColour_.reset(Function1<vector>::New("pointColour", dict).ptr());
|
pointColour_.reset(Function1<vector>::New("pointColour", dict));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ Foam::functionObjects::runTimePostPro::pointData::New
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours,
|
const HashPtrTable<Function1<vector>>& colours,
|
||||||
const word& pointDataType
|
const word& pointDataType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,6 +25,7 @@ Class
|
|||||||
Foam::functionObjects::runTimePostPro::pointData
|
Foam::functionObjects::runTimePostPro::pointData
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Visualisation of point data
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pointData.C
|
pointData.C
|
||||||
@ -40,6 +41,7 @@ SourceFiles
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkActor;
|
class vtkActor;
|
||||||
class vtkPolyData;
|
class vtkPolyData;
|
||||||
class vtkPolyDataMapper;
|
class vtkPolyDataMapper;
|
||||||
@ -72,17 +74,6 @@ public:
|
|||||||
static const Enum<representationType> representationTypeNames;
|
static const Enum<representationType> representationTypeNames;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
pointData(const pointData&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const pointData&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
@ -108,6 +99,12 @@ protected:
|
|||||||
vtkPolyData* data
|
vtkPolyData* data
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
pointData(const pointData&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const pointData&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -125,7 +122,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
),
|
),
|
||||||
(parent, dict, colours)
|
(parent, dict, colours)
|
||||||
);
|
);
|
||||||
@ -138,7 +135,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +146,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours,
|
const HashPtrTable<Function1<vector>>& colours,
|
||||||
const word& pointDataName
|
const word& pointDataName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,6 @@ License
|
|||||||
#include "vtkRenderer.h"
|
#include "vtkRenderer.h"
|
||||||
#include "vtkRenderWindow.h"
|
#include "vtkRenderWindow.h"
|
||||||
#include "vtkSmartPointer.h"
|
#include "vtkSmartPointer.h"
|
||||||
|
|
||||||
#include "vtkLight.h"
|
#include "vtkLight.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -60,6 +59,48 @@ namespace functionObjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
static void addGeometryToScene
|
||||||
|
(
|
||||||
|
PtrList<Type>& objects,
|
||||||
|
const scalar position,
|
||||||
|
vtkRenderer* renderer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (Type& obj : objects)
|
||||||
|
{
|
||||||
|
obj.addGeometryToScene(position, renderer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
static void updateActors(PtrList<Type>& objects, const scalar position)
|
||||||
|
{
|
||||||
|
for (Type& obj : objects)
|
||||||
|
{
|
||||||
|
obj.updateActors(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
static void cleanup(PtrList<Type>& objects)
|
||||||
|
{
|
||||||
|
for (Type& obj : objects)
|
||||||
|
{
|
||||||
|
obj.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::runTimePostProcessing::runTimePostProcessing
|
Foam::functionObjects::runTimePostProcessing::runTimePostProcessing
|
||||||
@ -95,7 +136,6 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
|
|||||||
outputDict.readEntry("width", output_.width_);
|
outputDict.readEntry("width", output_.width_);
|
||||||
outputDict.readEntry("height", output_.height_);
|
outputDict.readEntry("height", output_.height_);
|
||||||
|
|
||||||
|
|
||||||
readObjects(dict.subOrEmptyDict("points"), points_);
|
readObjects(dict.subOrEmptyDict("points"), points_);
|
||||||
readObjects(dict.subOrEmptyDict("lines"), lines_);
|
readObjects(dict.subOrEmptyDict("lines"), lines_);
|
||||||
readObjects(dict.subOrEmptyDict("surfaces"), surfaces_);
|
readObjects(dict.subOrEmptyDict("surfaces"), surfaces_);
|
||||||
@ -107,16 +147,19 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
|
|||||||
if (!dEntry.isDict())
|
if (!dEntry.isDict())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(textDict)
|
FatalIOErrorInFunction(textDict)
|
||||||
|
<< textDict.dictName()
|
||||||
<< "text must be specified in dictionary format"
|
<< "text must be specified in dictionary format"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dictionary& objectDict = dEntry.dict();
|
||||||
|
|
||||||
text_.append
|
text_.append
|
||||||
(
|
(
|
||||||
new runTimePostPro::text
|
new runTimePostPro::text
|
||||||
(
|
(
|
||||||
*this,
|
*this,
|
||||||
dEntry.dict(),
|
objectDict,
|
||||||
scene_.colours()
|
scene_.colours()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -167,76 +210,27 @@ bool Foam::functionObjects::runTimePostProcessing::write()
|
|||||||
|
|
||||||
renderWindow->AddRenderer(renderer);
|
renderWindow->AddRenderer(renderer);
|
||||||
|
|
||||||
// Add the points
|
|
||||||
forAll(points_, i)
|
|
||||||
{
|
|
||||||
points_[i].addGeometryToScene(0, renderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the lines
|
addGeometryToScene(points_, 0, renderer);
|
||||||
forAll(lines_, i)
|
addGeometryToScene(lines_, 0, renderer);
|
||||||
{
|
addGeometryToScene(surfaces_, 0, renderer);
|
||||||
lines_[i].addGeometryToScene(0, renderer);
|
addGeometryToScene(text_, 0, renderer);
|
||||||
}
|
|
||||||
|
|
||||||
// Add the surfaces
|
|
||||||
forAll(surfaces_, i)
|
|
||||||
{
|
|
||||||
surfaces_[i].addGeometryToScene(0, renderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the text
|
|
||||||
forAll(text_, i)
|
|
||||||
{
|
|
||||||
text_[i].addGeometryToScene(0, renderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (scene_.loop(renderer))
|
while (scene_.loop(renderer))
|
||||||
{
|
{
|
||||||
scalar position = scene_.position();
|
const scalar position = scene_.position();
|
||||||
|
|
||||||
// Update the text
|
updateActors(text_, position);
|
||||||
forAll(text_, i)
|
updateActors(points_, position);
|
||||||
{
|
updateActors(lines_, position);
|
||||||
text_[i].updateActors(position);
|
updateActors(surfaces_, position);
|
||||||
}
|
|
||||||
|
|
||||||
// Update the points
|
|
||||||
forAll(points_, i)
|
|
||||||
{
|
|
||||||
points_[i].updateActors(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the lines
|
|
||||||
forAll(lines_, i)
|
|
||||||
{
|
|
||||||
lines_[i].updateActors(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the surfaces
|
|
||||||
forAll(surfaces_, i)
|
|
||||||
{
|
|
||||||
surfaces_[i].updateActors(position);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up
|
// Cleanup
|
||||||
forAll(text_, i)
|
cleanup(text_);
|
||||||
{
|
cleanup(points_);
|
||||||
text_[i].clear();
|
cleanup(lines_);
|
||||||
}
|
cleanup(surfaces_);
|
||||||
forAll(points_, i)
|
|
||||||
{
|
|
||||||
points_[i].clear();
|
|
||||||
}
|
|
||||||
forAll(lines_, i)
|
|
||||||
{
|
|
||||||
lines_[i].clear();
|
|
||||||
}
|
|
||||||
forAll(surfaces_, i)
|
|
||||||
{
|
|
||||||
surfaces_[i].clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Instead of relying on the destructor, manually restore the previous
|
// Instead of relying on the destructor, manually restore the previous
|
||||||
|
|||||||
@ -21,8 +21,15 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Namespace
|
||||||
|
Foam::functionObjects::runTimePostPro
|
||||||
|
|
||||||
|
Description
|
||||||
|
Classes and objects used in the implementation of
|
||||||
|
Foam::functionObjects::runTimePostProcessing
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::functionObjects::runTimePostPro::runTimePostProcessing
|
Foam::functionObjects::runTimePostProcessing
|
||||||
|
|
||||||
Group
|
Group
|
||||||
grpGraphicsFunctionObjects
|
grpGraphicsFunctionObjects
|
||||||
@ -34,9 +41,9 @@ Description
|
|||||||
which provide a broad set of functionality for scene composition and
|
which provide a broad set of functionality for scene composition and
|
||||||
manipulation.
|
manipulation.
|
||||||
|
|
||||||
Images are generated using a combination of function object output, and
|
Images are generated using a combination of function object output
|
||||||
additional data e.gg triangulated surfaces and text. Current capabilities
|
and additional data - eg, surfaces and text.
|
||||||
include support for:
|
Current capabilities include support for:
|
||||||
- Camera
|
- Camera
|
||||||
- Objects
|
- Objects
|
||||||
- Points
|
- Points
|
||||||
@ -45,6 +52,8 @@ Description
|
|||||||
- Scalar bars
|
- Scalar bars
|
||||||
- Annotations
|
- Annotations
|
||||||
- Selection of colour maps
|
- Selection of colour maps
|
||||||
|
.
|
||||||
|
|
||||||
Scene configuration is performed using standard OpenFOAM dictionaries, using
|
Scene configuration is performed using standard OpenFOAM dictionaries, using
|
||||||
the main headings of: output=, camera, colours, points, lines,
|
the main headings of: output=, camera, colours, points, lines,
|
||||||
surfaces and text.
|
surfaces and text.
|
||||||
@ -65,6 +74,7 @@ SourceFiles
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkRenderer;
|
class vtkRenderer;
|
||||||
class vtkRenderWindow;
|
class vtkRenderWindow;
|
||||||
|
|
||||||
@ -74,10 +84,11 @@ namespace functionObjects
|
|||||||
{
|
{
|
||||||
namespace runTimePostPro
|
namespace runTimePostPro
|
||||||
{
|
{
|
||||||
class pointData;
|
// Forward declarations
|
||||||
class pathline;
|
class pointData;
|
||||||
class surface;
|
class pathline;
|
||||||
class text;
|
class surface;
|
||||||
|
class text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
|
|||||||
@ -38,7 +38,6 @@ License
|
|||||||
#include "vtkRenderWindow.h"
|
#include "vtkRenderWindow.h"
|
||||||
#include "vtkWindowToImageFilter.h"
|
#include "vtkWindowToImageFilter.h"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::runTimePostPro::scene::readCamera
|
void Foam::functionObjects::runTimePostPro::scene::readCamera
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -70,6 +70,7 @@ SourceFiles
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkActor;
|
class vtkActor;
|
||||||
class vtkRenderer;
|
class vtkRenderer;
|
||||||
class vtkRenderWindow;
|
class vtkRenderWindow;
|
||||||
@ -123,7 +124,7 @@ protected:
|
|||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Colours
|
//- Colours
|
||||||
HashPtrTable<Function1<vector>, word> colours_;
|
HashPtrTable<Function1<vector>> colours_;
|
||||||
|
|
||||||
|
|
||||||
// Camera settings
|
// Camera settings
|
||||||
@ -197,26 +198,27 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the colours
|
//- Return the colours
|
||||||
const HashPtrTable<Function1<vector>, word>& colours() const;
|
const HashPtrTable<Function1<vector>>& colours() const;
|
||||||
|
|
||||||
//- Return the current frame index
|
//- Return the current frame index
|
||||||
label frameIndex() const;
|
label frameIndex() const;
|
||||||
|
|
||||||
//- Return the current position (in range 0-1)
|
//- Return the current position (in range 0-1)
|
||||||
scalar position() const;
|
scalar position() const;
|
||||||
|
|
||||||
void read(const dictionary& dict);
|
|
||||||
|
|
||||||
void initialise(vtkRenderer* renderer, const word& outputName);
|
void read(const dictionary& dict);
|
||||||
|
|
||||||
//- Main control loop
|
void initialise(vtkRenderer* renderer, const word& outputName);
|
||||||
bool loop(vtkRenderer* renderer);
|
|
||||||
|
|
||||||
//- Save image to file
|
//- Main control loop
|
||||||
void saveImage(vtkRenderWindow* renderWindow) const;
|
bool loop(vtkRenderer* renderer);
|
||||||
|
|
||||||
|
//- Save image to file
|
||||||
|
void saveImage(vtkRenderWindow* renderWindow) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,7 @@ void Foam::functionObjects::runTimePostPro::surface::setRepresentation
|
|||||||
}
|
}
|
||||||
case rtWireframe:
|
case rtWireframe:
|
||||||
{
|
{
|
||||||
// note: colour is set using general SetColour, not setEdgeColor
|
// note: colour is set using general SetColor, not SetEdgeColor
|
||||||
actor->GetProperty()->SetRepresentationToWireframe();
|
actor->GetProperty()->SetRepresentationToWireframe();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometryBase(parent, dict, colours),
|
geometryBase(parent, dict, colours),
|
||||||
@ -163,10 +163,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
|
|||||||
|
|
||||||
if (dict.found("surfaceColour"))
|
if (dict.found("surfaceColour"))
|
||||||
{
|
{
|
||||||
surfaceColour_.reset
|
surfaceColour_.reset(Function1<vector>::New("surfaceColour", dict));
|
||||||
(
|
|
||||||
Function1<vector>::New("surfaceColour", dict).ptr()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -175,7 +172,7 @@ Foam::functionObjects::runTimePostPro::surface::surface
|
|||||||
|
|
||||||
if (dict.found("edgeColour"))
|
if (dict.found("edgeColour"))
|
||||||
{
|
{
|
||||||
edgeColour_.reset(Function1<vector>::New("edgeColour", dict).ptr());
|
edgeColour_.reset(Function1<vector>::New("edgeColour", dict));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -200,7 +197,7 @@ Foam::functionObjects::runTimePostPro::surface::New
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours,
|
const HashPtrTable<Function1<vector>>& colours,
|
||||||
const word& surfaceType
|
const word& surfaceType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,6 +25,7 @@ Class
|
|||||||
Foam::functionObjects::runTimePostPro::surface
|
Foam::functionObjects::runTimePostPro::surface
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Visualisation of surface data
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surface.C
|
surface.C
|
||||||
@ -37,11 +38,11 @@ SourceFiles
|
|||||||
#include "geometryBase.H"
|
#include "geometryBase.H"
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
|
|
||||||
#include "vtkSmartPointer.h"
|
#include "vtkSmartPointer.h"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkActor;
|
class vtkActor;
|
||||||
class vtkRenderer;
|
class vtkRenderer;
|
||||||
class vtkPolyData;
|
class vtkPolyData;
|
||||||
@ -77,17 +78,6 @@ public:
|
|||||||
static const Enum<representationType> representationTypeNames;
|
static const Enum<representationType> representationTypeNames;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
surface(const surface&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const surface&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
@ -126,6 +116,12 @@ protected:
|
|||||||
vtkPolyData* data
|
vtkPolyData* data
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
surface(const surface&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const surface&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -143,7 +139,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
),
|
),
|
||||||
(parent, dict, colours)
|
(parent, dict, colours)
|
||||||
);
|
);
|
||||||
@ -156,7 +152,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +163,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours,
|
const HashPtrTable<Function1<vector>>& colours,
|
||||||
const word& surfaceName
|
const word& surfaceName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,7 +40,7 @@ Foam::functionObjects::runTimePostPro::text::text
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometryBase(parent, dict, colours),
|
geometryBase(parent, dict, colours),
|
||||||
@ -55,7 +55,7 @@ Foam::functionObjects::runTimePostPro::text::text
|
|||||||
|
|
||||||
if (dict.found("colour"))
|
if (dict.found("colour"))
|
||||||
{
|
{
|
||||||
colour_.reset(Function1<vector>::New("colour", dict).ptr());
|
colour_.reset(Function1<vector>::New("colour", dict));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,6 +25,8 @@ Class
|
|||||||
Foam::functionObjects::runTimePostPro::text
|
Foam::functionObjects::runTimePostPro::text
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Define text element for runTimePostProcessing
|
||||||
|
|
||||||
Example of text object specification:
|
Example of text object specification:
|
||||||
\verbatim
|
\verbatim
|
||||||
text1
|
text1
|
||||||
@ -39,10 +41,22 @@ Description
|
|||||||
// colour (0 1 1);
|
// colour (0 1 1);
|
||||||
|
|
||||||
// Optional entry
|
// Optional entry
|
||||||
timeStamp yes; //Append solution time to string
|
timeStamp yes; // Append solution time to string
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
Dictionary controls
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
visible | Display the text | yes |
|
||||||
|
string | Text to display | yes |
|
||||||
|
position | The (x y) viewport position | yes |
|
||||||
|
size | The font size in points | yes |
|
||||||
|
bold | Use bold font | yes |
|
||||||
|
colour | Override default text colour | no |
|
||||||
|
timeStamp | Append solution timeName to string | no | false
|
||||||
|
\endtable
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
text.C
|
text.C
|
||||||
|
|
||||||
@ -56,6 +70,7 @@ SourceFiles
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
class vtkRenderer;
|
class vtkRenderer;
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -73,20 +88,9 @@ class text
|
|||||||
:
|
:
|
||||||
public geometryBase
|
public geometryBase
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
text(const text&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const text&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected Data
|
||||||
|
|
||||||
//- Text
|
//- Text
|
||||||
string string_;
|
string string_;
|
||||||
@ -107,6 +111,15 @@ protected:
|
|||||||
bool timeStamp_;
|
bool timeStamp_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
text(const text&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const text&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -116,7 +129,7 @@ public:
|
|||||||
(
|
(
|
||||||
const runTimePostProcessing& parent,
|
const runTimePostProcessing& parent,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const HashPtrTable<Function1<vector>, word>& colours
|
const HashPtrTable<Function1<vector>>& colours
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,4 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
|
|
||||||
cleanCase0
|
cleanCase0
|
||||||
|
|
||||||
|
rm -f ppGeometry.vtp 2>/dev/null
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -19,6 +19,9 @@ runApplication topoSet
|
|||||||
|
|
||||||
runApplication createPatch -overwrite
|
runApplication createPatch -overwrite
|
||||||
|
|
||||||
|
runApplication surfaceMeshTriangulate \
|
||||||
|
-patches hole ppGeometry.vtp -constant -time ''
|
||||||
|
|
||||||
echo "End"
|
echo "End"
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -15,6 +15,8 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
libs ("libOpenFOAM.so" "libfieldFunctionObjects.so");
|
||||||
|
|
||||||
application pimpleFoam;
|
application pimpleFoam;
|
||||||
|
|
||||||
startFrom latestTime;
|
startFrom latestTime;
|
||||||
@ -49,10 +51,10 @@ adjustTimeStep yes;
|
|||||||
|
|
||||||
maxCo 0.2;
|
maxCo 0.2;
|
||||||
|
|
||||||
|
|
||||||
functions
|
functions
|
||||||
{
|
{
|
||||||
#include "sampling"
|
#include "sampling"
|
||||||
|
#include "streamLines"
|
||||||
#include "runTimePostProcessing"
|
#include "runTimePostProcessing"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,12 +29,12 @@ postPro1
|
|||||||
// Parallel projection flag
|
// Parallel projection flag
|
||||||
parallelProjection yes;
|
parallelProjection yes;
|
||||||
|
|
||||||
clipBox (-0.2 -0.2 0)(1.65 0.2 1.25); // optional
|
// clipBox is optional
|
||||||
|
|
||||||
position (-2.28 1.28 2.24);
|
position (-2.28 1.28 2.24);
|
||||||
focalPoint (0.003 0.008 0.024);
|
focalPoint (0 0.008 0.024);
|
||||||
up (0.26 0.930 -0.266);
|
up (0.26 0.930 -0.266);
|
||||||
zoom 1.25;
|
zoom 1.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default colours
|
// Default colours
|
||||||
@ -44,7 +44,7 @@ postPro1
|
|||||||
{
|
{
|
||||||
background (0.317647 0.341176 0.431373);
|
background (0.317647 0.341176 0.431373);
|
||||||
background2 ${background};
|
background2 ${background};
|
||||||
text (0 0 0);
|
text (0.75 0.75 0.75);
|
||||||
edge (1 0 0);
|
edge (1 0 0);
|
||||||
surface (0.5 0.5 0.5);
|
surface (0.5 0.5 0.5);
|
||||||
line (1 0 0);
|
line (1 0 0);
|
||||||
@ -52,9 +52,24 @@ postPro1
|
|||||||
|
|
||||||
lines
|
lines
|
||||||
{
|
{
|
||||||
|
streamline
|
||||||
|
{
|
||||||
|
type functionObjectLine;
|
||||||
|
functionObject streamLines;
|
||||||
|
representation tube;
|
||||||
|
visible yes;
|
||||||
|
tubeRadius 0.0025;
|
||||||
|
colourBy field;
|
||||||
|
field U;
|
||||||
|
range (0 10);
|
||||||
|
opacity 0.6;
|
||||||
|
scalarBar
|
||||||
|
{
|
||||||
|
visible no;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_plane
|
_plane
|
||||||
{
|
{
|
||||||
type functionObjectSurface;
|
type functionObjectSurface;
|
||||||
@ -77,6 +92,17 @@ postPro1
|
|||||||
|
|
||||||
surfaces
|
surfaces
|
||||||
{
|
{
|
||||||
|
geom
|
||||||
|
{
|
||||||
|
type geometry;
|
||||||
|
files ("<case>/ppGeometry.vtp");
|
||||||
|
renderMode phong;
|
||||||
|
representation surface;
|
||||||
|
edgeColour (0.5 0.5 0.5);
|
||||||
|
visible yes;
|
||||||
|
featureEdges no;
|
||||||
|
opacity 0.8;
|
||||||
|
}
|
||||||
plane0
|
plane0
|
||||||
{
|
{
|
||||||
${_plane};
|
${_plane};
|
||||||
@ -104,11 +130,11 @@ postPro1
|
|||||||
{
|
{
|
||||||
text1
|
text1
|
||||||
{
|
{
|
||||||
string "elipsekkLOmega";
|
string "ellipse kkLOmega";
|
||||||
position (0.1 0.05);
|
position (0.6 0.05);
|
||||||
size 24;
|
size 18;
|
||||||
bold no;
|
bold yes;
|
||||||
visible yes;
|
visible yes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
streamLines
|
||||||
|
{
|
||||||
|
type streamLine;
|
||||||
|
|
||||||
|
writeControl writeTime;
|
||||||
|
|
||||||
|
setFormat vtk;
|
||||||
|
|
||||||
|
// Velocity field to use for tracking.
|
||||||
|
U U;
|
||||||
|
|
||||||
|
// Tracked forwards (+U) or backwards (-U)
|
||||||
|
trackForward true;
|
||||||
|
|
||||||
|
// Names of fields to sample. Should contain above velocity field!
|
||||||
|
fields (p U);
|
||||||
|
|
||||||
|
// Steps particles can travel before being removed
|
||||||
|
lifeTime 10000;
|
||||||
|
|
||||||
|
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
|
||||||
|
nSubCycle 5;
|
||||||
|
|
||||||
|
// Cloud name to use
|
||||||
|
cloud particleTracks;
|
||||||
|
|
||||||
|
// Seeding method.
|
||||||
|
seedSampleSet
|
||||||
|
{
|
||||||
|
type uniform;
|
||||||
|
axis x; //distance;
|
||||||
|
|
||||||
|
// Note: tracks slightly offset so as not to be on a face
|
||||||
|
start (-0.70 -0.25 0.025);
|
||||||
|
end (-0.70 0.25 0.025);
|
||||||
|
nPoints 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user