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 | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 // OpenFOAM includes
27 #include "pointData.H"
28 #include "runTimePostProcessing.H"
29 
30 // VTK includes
31 #include "vtkActor.h"
32 #include "vtkPolyDataMapper.h"
33 #include "vtkProperty.h"
34 #include "vtkRenderer.h"
35 #include "vtkSmartPointer.h"
36 #include "vtkTubeFilter.h"
37 #include "vtkLookupTable.h"
38 
39 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43  template<>
45  {
46  "sphere",
47  "vector"
48  };
49 
52 }
53 
56 
57 
58 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
59 
61 (
62  const label frameI,
63  vtkActor* actor,
64  vtkPolyDataMapper* mapper,
65  vtkPolyData* data
66 ) const
67 {
68  geometryBase::initialiseActor(actor);
69 
70  vector colour = pointColour_->value(frameI);
71  actor->GetProperty()->SetColor(colour[0], colour[1], colour[2]);
72 
73  switch (representation_)
74  {
75  case rtSphere:
76  case rtVector:
77  {
78  break;
79  }
80  }
81 }
82 
83 
84 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
85 
87 (
88  const runTimePostProcessing& parent,
89  const dictionary& dict,
90  const HashPtrTable<DataEntry<vector>, word>& colours
91 )
92 :
93  geometryBase(parent, dict, colours),
94  representation_
95  (
96  representationTypeNames.read(dict.lookup("representation"))
97  ),
98  maxGlyphLength_(readScalar(dict.lookup("maxGlyphLength"))),
99  pointColour_(NULL)
100 {
101  if (dict.found("pointColour"))
102  {
103  pointColour_.reset(DataEntry<vector>::New("pointColour", dict).ptr());
104  }
105  else
106  {
107  pointColour_.reset(colours["point"]->clone().ptr());
108  }
109 
110  switch (representation_)
111  {
112  case rtSphere:
113  {
114  break;
115  }
116  case rtVector:
117  {
118  break;
119  }
120  }
121 
122 }
123 
124 
125 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
126 
128 (
129  const runTimePostProcessing& parent,
130  const dictionary& dict,
131  const HashPtrTable<DataEntry<vector>, word>& colours,
132  const word& pointDataType
133 )
134 {
135  if (debug)
136  {
137  Info<< "Selecting pointData " << pointDataType << endl;
138  }
139 
140  dictionaryConstructorTable::iterator cstrIter =
141  dictionaryConstructorTablePtr_->find(pointDataType);
142 
143  if (cstrIter == dictionaryConstructorTablePtr_->end())
144  {
146  << "Unknown pointData type "
147  << pointDataType << nl << nl
148  << "Valid pointData types are:" << endl
149  << dictionaryConstructorTablePtr_->sortedToc()
150  << exit(FatalError);
151  }
152 
153  return autoPtr<pointData>(cstrIter()(parent, dict, colours));
154 }
155 
156 
157 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
158 
160 {}
161 
162 
163 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::pointData
Variant of pointEdgePoint with some transported additional data. WIP - should be templated on data li...
Definition: pointData.H:53
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
pointData.H
Foam::geometryBase
Definition: geometryBase.H:56
Foam::runTimePostProcessing
Function object to generate images during run-time.
Definition: runTimePostProcessing.H:83
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:59
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::pointData::pointData
pointData()
Construct null.
Definition: pointDataI.H:32
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
readScalar
#define readScalar
Definition: doubleScalar.C:38
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::pointData::addPoints
void addPoints(const label frameI, vtkActor *actor, vtkPolyDataMapper *mapper, vtkPolyData *data) const
Add the point data to the renderer.
Definition: pointData.C:61
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
runTimePostProcessing.H
Foam::HashPtrTable
A HashTable specialization for hashing pointers.
Definition: HashPtrTable.H:50
Foam::pointData::~pointData
virtual ~pointData()
Destructor.
Definition: pointData.C:159
Foam::Vector< scalar >
Foam::DataEntry
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: DataEntry.H:52
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
Foam::pointData::representationTypeNames
static const NamedEnum< representationType, 2 > representationTypeNames
Definition: pointData.H:67
Foam::NamedEnum
Initialise the NamedEnum HashTable from the static list of names.
Definition: NamedEnum.H:52
Foam::pointData::New
static autoPtr< pointData > New(const runTimePostProcessing &parent, const dictionary &dict, const HashPtrTable< DataEntry< vector >, word > &colours, const word &pointDataName)
Return a reference to the selected RAS model.
Definition: pointData.C:128