pointData.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015-2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // OpenFOAM includes
29 #include "pointData.H"
30 #include "runTimePostProcessing.H"
31 
32 // VTK includes
33 #include "vtkActor.h"
34 #include "vtkPolyDataMapper.h"
35 #include "vtkProperty.h"
36 #include "vtkRenderer.h"
37 #include "vtkSmartPointer.h"
38 
39 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 namespace functionObjects
44 {
45 namespace runTimePostPro
46 {
47  defineTypeName(pointData);
48  defineRunTimeSelectionTable(pointData, dictionary);
49 }
50 }
51 }
52 
53 const Foam::Enum
54 <
56 >
58 ({
59  { representationType::rtSphere, "sphere" },
60  { representationType::rtVector, "vector" },
61 });
62 
63 
64 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
65 
67 (
68  const label framei,
69  vtkActor* actor,
70  vtkPolyDataMapper* mapper,
71  vtkPolyData* data
72 ) const
73 {
74  geometryBase::initialiseActor(actor);
75 
76  vector colour = pointColour_->value(framei);
77  actor->GetProperty()->SetColor(colour[0], colour[1], colour[2]);
78 
79  switch (representation_)
80  {
81  case rtSphere:
82  case rtVector:
83  {
84  break;
85  }
86  }
87 }
88 
89 
90 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
91 
93 (
94  const runTimePostProcessing& parent,
95  const dictionary& dict,
96  const HashPtrTable<Function1<vector>>& colours
97 )
98 :
99  geometryBase(parent, dict, colours),
100  representation_
101  (
102  representationTypeNames.get("representation", dict)
103  ),
104  maxGlyphLength_(dict.get<scalar>("maxGlyphLength")),
105  pointColour_(nullptr)
106 {
107  if (dict.found("pointColour"))
108  {
109  pointColour_.reset(Function1<vector>::New("pointColour", dict));
110  }
111  else
112  {
113  pointColour_.reset(colours["point"]->clone().ptr());
114  }
115 
116  switch (representation_)
117  {
118  case rtSphere:
119  {
120  break;
121  }
122  case rtVector:
123  {
124  break;
125  }
126  }
127 
128 }
129 
130 
131 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
132 
135 (
136  const runTimePostProcessing& parent,
137  const dictionary& dict,
138  const HashPtrTable<Function1<vector>>& colours,
139  const word& pointDataType
140 )
141 {
142  DebugInfo << "Selecting pointData " << pointDataType << endl;
143 
144  auto cstrIter = dictionaryConstructorTablePtr_->cfind(pointDataType);
145 
146  if (!cstrIter.found())
147  {
149  (
150  dict,
151  "pointData",
152  pointDataType,
153  *dictionaryConstructorTablePtr_
154  ) << exit(FatalIOError);
155  }
156 
157  return autoPtr<pointData>(cstrIter()(parent, dict, colours));
158 }
159 
160 
161 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
162 
164 {}
165 
166 
167 // ************************************************************************* //
Foam::Enum
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: IOstreamOption.H:51
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::functionObjects::runTimePostPro::pointData::representationType
representationType
Point representation types.
Definition: pointData.H:98
Foam::functionObjects::runTimePostPro::pointData::New
static autoPtr< pointData > New(const runTimePostProcessing &parent, const dictionary &dict, const HashPtrTable< Function1< vector >> &colours, const word &pointDataName)
Return selected pointData.
Definition: pointData.C:135
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::functionObjects::runTimePostPro::pointData::addPoints
void addPoints(const label framei, vtkActor *actor, vtkPolyDataMapper *mapper, vtkPolyData *data) const
Add the point data to the renderer.
Definition: pointData.C:67
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:56
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:380
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::functionObjects::runTimePostProcessing
Generate images during run-time.
Definition: runTimePostProcessing.H:170
Foam::functionObjects::runTimePostPro::pointData::~pointData
virtual ~pointData()
Destructor.
Definition: pointData.C:163
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::functionObjects::runTimePostPro::geometryBase
Base class for surface, text handling etc.
Definition: geometryBase.H:101
Foam::functionObjects::runTimePostPro::pointData::pointData
pointData(const pointData &)=delete
No copy construct.
runTimePostProcessing.H
DebugInfo
#define DebugInfo
Report an information message using Foam::Info.
Definition: messageStream.H:350
pointData.H
Foam::HashPtrTable
A HashTable of pointers to objects of type <T>.
Definition: HashPtrTable.H:54
Foam::Vector< scalar >
Foam::functionObjects::runTimePostPro::defineTypeName
defineTypeName(contourFilter)
Foam::functionObjects::runTimePostPro::defineRunTimeSelectionTable
defineRunTimeSelectionTable(pathline, dictionary)
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:54
Foam::functionObjects::runTimePostPro::pointData::representationTypeNames
static const Enum< representationType > representationTypeNames
Names for point representation types.
Definition: pointData.H:105