fieldVisualisationBase.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 "fieldVisualisationBase.H"
30 #include "runTimePostProcessing.H"
31 
32 #include "doubleVector.H"
33 #include "foamVtkTools.H"
34 
35 // VTK includes
36 #include "vtkArrowSource.h"
37 #include "vtkCellDataToPointData.h"
38 #include "vtkCellData.h"
39 #include "vtkColorTransferFunction.h"
40 #include "vtkCompositeDataSet.h"
41 #include "vtkDataObjectTreeIterator.h"
42 #include "vtkFieldData.h"
43 #include "vtkGlyph3D.h"
44 #include "vtkLookupTable.h"
45 #include "vtkPointData.h"
46 #include "vtkPolyData.h"
47 #include "vtkPolyDataMapper.h"
48 #include "vtkRenderer.h"
49 #include "vtkSmartPointer.h"
50 #include "vtkSphereSource.h"
51 
52 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
53 
54 const Foam::Enum
55 <
56  Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
57  colourByType
58 >
61 ({
62  { colourByType::cbColour, "colour" },
63  { colourByType::cbField, "field" },
64 });
65 
66 const Foam::Enum
67 <
68  Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
69  colourMapType
70 >
73 ({
74  { colourMapType::cmCoolToWarm, "coolToWarm" },
75  { colourMapType::cmCoolToWarm, "blueWhiteRed" },
76  { colourMapType::cmColdAndHot, "coldAndHot" },
77  { colourMapType::cmFire, "fire" },
78  { colourMapType::cmRainbow, "rainbow" },
79  { colourMapType::cmGreyscale, "greyscale" },
80  { colourMapType::cmGreyscale, "grayscale" },
81  { colourMapType::cmXray, "xray" },
82 });
83 
84 
85 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
86 
90 (
91  const word& fieldName,
92  vtkDataSet* dataset
93 )
94 {
95  fieldSummary queried;
96 
97  if (dataset)
98  {
99  vtkDataArray* array;
100 
101  array = vtkDataArray::SafeDownCast
102  (
103  dataset->GetCellData()->GetAbstractArray(fieldName.c_str())
104  );
105 
106  if (array)
107  {
108  queried.nComponents_ = array->GetNumberOfComponents();
109  queried.association_ |= FieldAssociation::CELL_DATA;
110  queried.range_ += vtk::Tools::rangeOf(array);
111  }
112 
113  array = vtkDataArray::SafeDownCast
114  (
115  dataset->GetPointData()->GetAbstractArray(fieldName.c_str())
116  );
117 
118  if (array)
119  {
120  queried.nComponents_ = array->GetNumberOfComponents();
122  queried.range_ += vtk::Tools::rangeOf(array);
123  }
124  }
125 
126  return queried;
127 }
128 
129 
133 (
134  const word& fieldName,
135  vtkCompositeDataSet* data
136 )
137 {
138  fieldSummary queried;
139 
141 
142  iter->SetDataSet(data);
143  iter->VisitOnlyLeavesOn();
144  iter->SkipEmptyNodesOn();
145 
146  for
147  (
148  iter->InitTraversal();
149  !iter->IsDoneWithTraversal();
150  iter->GoToNextItem()
151  )
152  {
153  vtkDataSet* dataset = vtkDataSet::SafeDownCast
154  (
155  iter->GetCurrentDataObject()
156  );
157 
158  if (dataset)
159  {
160  fieldSummary local(queryFieldSummary(fieldName, dataset));
161 
162  if (!queried.nComponents_)
163  {
164  queried.nComponents_ = local.nComponents_;
165  }
166 
167  queried.association_ |= local.association_;
168  queried.range_ += local.range_;
169  }
170  }
171 
172  return queried;
173 }
174 
175 
179 (
180  const word& fieldName,
181  vtkDataSet* dataset
182 )
183 {
184  unsigned where(FieldAssociation::NO_DATA);
185 
186  if (dataset)
187  {
188  if (dataset->GetCellData()->HasArray(fieldName.c_str()))
189  {
190  where |= FieldAssociation::CELL_DATA;
191  }
192  if (dataset->GetPointData()->HasArray(fieldName.c_str()))
193  {
195  }
196  }
197 
198  return FieldAssociation(where);
199 }
200 
201 
205 (
206  const word& fieldName,
207  vtkCompositeDataSet* data
208 )
209 {
210  unsigned where(FieldAssociation::NO_DATA);
211 
213 
214  iter->SetDataSet(data);
215  iter->VisitOnlyLeavesOn();
216  iter->SkipEmptyNodesOn();
217 
218  for
219  (
220  iter->InitTraversal();
221  !iter->IsDoneWithTraversal();
222  iter->GoToNextItem()
223  )
224  {
225  vtkDataSet* dataset = vtkDataSet::SafeDownCast
226  (
227  iter->GetCurrentDataObject()
228  );
229 
230  where |= queryFieldAssociation(fieldName, dataset);
231  }
232 
233  return FieldAssociation(where);
234 }
235 
236 
238 (
239  const word& fieldName,
240  vtkFieldData* fieldData
241 )
242 {
243  if (!fieldData)
244  {
245  return;
246  }
247 
248  vtkDataArray* input = vtkDataArray::SafeDownCast
249  (
250  fieldData->GetAbstractArray(fieldName.c_str())
251  );
252 
253  if (!input)
254  {
255  return;
256  }
257 
258  const word magFieldName = "mag(" + fieldName + ")";
259 
260  vtkDataArray* output = vtkDataArray::SafeDownCast
261  (
262  fieldData->GetAbstractArray(magFieldName.c_str())
263  );
264 
265  if (output)
266  {
267  return;
268  }
269 
270 
271  // Simplfy and only handle scalar/vector input
272 
273  const int nCmpt = input->GetNumberOfComponents();
274  const vtkIdType len = input->GetNumberOfTuples();
275 
276  if (nCmpt == 1)
277  {
279 
280  data->SetName(magFieldName.c_str());
281  data->SetNumberOfComponents(1);
282  data->SetNumberOfTuples(len);
283 
284  double scratch;
285  for (vtkIdType i=0; i < len; ++i)
286  {
287  input->GetTuple(i, &scratch);
288 
289  scratch = Foam::mag(scratch);
290  data->SetTuple(i, &scratch);
291  }
292 
293  fieldData->AddArray(data);
294  }
295  else if (nCmpt == 3)
296  {
298 
299  data->SetName(magFieldName.c_str());
300  data->SetNumberOfComponents(1);
301  data->SetNumberOfTuples(len);
302 
303  doubleVector scratch;
304  for (vtkIdType i=0; i < len; ++i)
305  {
306  input->GetTuple(i, scratch.v_);
307 
308  scratch.x() = Foam::mag(scratch);
309 
310  data->SetTuple(i, scratch.v_);
311  }
312 
313  fieldData->AddArray(data);
314  }
315 }
316 
317 
319 (
320  const word& fieldName,
321  vtkDataSet* dataset
322 )
323 {
324  if (dataset)
325  {
326  addMagField(fieldName, dataset->GetCellData());
327  addMagField(fieldName, dataset->GetPointData());
328  }
329 }
330 
331 
333 (
334  const word& fieldName,
335  vtkCompositeDataSet* data
336 )
337 {
339 
340  iter->SetDataSet(data);
341  iter->VisitOnlyLeavesOn();
342  iter->SkipEmptyNodesOn();
343 
344  for
345  (
346  iter->InitTraversal();
347  !iter->IsDoneWithTraversal();
348  iter->GoToNextItem()
349  )
350  {
351  vtkDataSet* dataset = vtkDataSet::SafeDownCast
352  (
353  iter->GetCurrentDataObject()
354  );
355  addMagField(fieldName, dataset);
356  }
357 }
358 
359 
360 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
361 
364 {
365  if (Pstream::parRun())
366  {
367  Foam::reduce(nComponents_, maxOp<int>());
368  Foam::reduce(association_, bitOrOp<unsigned>());
370  }
371 }
372 
373 
374 Foam::Ostream& Foam::operator<<
375 (
376  Ostream& os,
377  const InfoProxy
378  <
380  >& proxy
381 )
382 {
383  os << "nComponents:" << proxy.t_.nComponents_
384  << " association:" << label(proxy.t_.association_)
385  << " min/max:" << proxy.t_.range_;
386 
387  return os;
388 }
389 
390 
391 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
392 
395 (
396  vtkLookupTable* lut
397 ) const
398 {
399  constexpr label nColours = 256;
400 
401  lut->SetNumberOfColors(nColours);
402 
404 
405  switch (colourMap_)
406  {
407  case cmCoolToWarm: // ParaView: "Cool To Warm"
408  {
409  ctf->SetColorSpaceToDiverging();
410  ctf->AddRGBPoint(0.0, 0.231372, 0.298039, 0.752941);
411  ctf->AddRGBPoint(0.5, 0.865003, 0.865003, 0.865003);
412  ctf->AddRGBPoint(1.0, 0.705882, 0.0156863, 0.14902);
413  // ctf->SetNanColor(1, 1, 0);
414  break;
415  }
416 
417  case cmColdAndHot: // ParaView : "Cold and Hot"
418  {
419  ctf->SetColorSpaceToRGB();
420  ctf->AddRGBPoint(0, 0, 1, 1);
421  ctf->AddRGBPoint(0.45, 0, 0, 1);
422  ctf->AddRGBPoint(0.5, 0, 0, 0.5019608);
423  ctf->AddRGBPoint(0.55, 1, 0, 0);
424  ctf->AddRGBPoint(1, 1, 1, 0);
425  break;
426  }
427 
428  case cmFire: // ParaView: Black-Body Radiation
429  {
430  ctf->SetColorSpaceToRGB();
431  ctf->AddRGBPoint(0, 0, 0, 0);
432  ctf->AddRGBPoint(0.4, 0.901961, 0, 0);
433  ctf->AddRGBPoint(0.8, 0.901961, 0.901961, 0);
434  ctf->AddRGBPoint(1, 1, 1, 1);
435  // ctf->SetNanColor(0, 0.49804, 1);
436  break;
437  }
438 
439  case cmRainbow:
440  {
441  ctf->SetColorSpaceToHSV();
442  ctf->AddRGBPoint(0, 0, 0, 1);
443  ctf->AddRGBPoint(0.5, 0, 1, 0);
444  ctf->AddRGBPoint(1, 1, 0, 0);
445  // ctf->SetNanColor(0.498039, 0.498039, 0.498039);
446  break;
447  }
448 
449  case cmGreyscale: // ParaView: grayscale
450  {
451  ctf->SetColorSpaceToRGB();
452  ctf->AddRGBPoint(0, 0, 0, 0);
453  ctf->AddRGBPoint(1, 1, 1, 1);
454  // ctf->SetNanColor(1, 0, 0);
455  break;
456  }
457 
458  case cmXray: // ParaView: "X ray"
459  {
460  ctf->SetColorSpaceToRGB();
461  ctf->AddRGBPoint(0, 1, 1, 1);
462  ctf->AddRGBPoint(1, 0, 0, 0);
463  // ctf->SetNanColor(1, 0, 0);
464  break;
465  }
466  }
467 
468 
469  double rgba[4] = { 0, 0, 0, 1 };
470  for (label i = 0; i < nColours; ++i)
471  {
472  ctf->GetColor(scalar(i)/scalar(nColours), rgba);
473  lut->SetTableValue(i, rgba);
474  }
475 }
476 
477 
480 (
481  const scalar position,
482  vtkRenderer* renderer,
483  vtkLookupTable* lut
484 ) const
485 {
486  // Add the scalar bar - only once!
487  if (renderer && Pstream::master())
488  {
489  scalarBar_.add(colours_["text"]->value(position), renderer, lut);
490  }
491 }
492 
493 
495 setField
496 (
497  const scalar position,
498  const word& colourFieldName,
499  const FieldAssociation fieldAssociation,
500  vtkMapper* mapper,
501  vtkRenderer* renderer
502 ) const
503 {
504  mapper->InterpolateScalarsBeforeMappingOn();
505 
506  switch (colourBy_)
507  {
508  case cbColour:
509  {
510  mapper->ScalarVisibilityOff();
511  break;
512  }
513 
514  case cbField:
515  {
516  // Create look-up table for colours
518  setColourMap(lut);
519  lut->SetVectorMode(vtkScalarsToColors::MAGNITUDE);
520  lut->SetTableRange(range_.first(), range_.second());
521 
522  // Configure the mapper
523  const char* fieldName = colourFieldName.c_str();
524  mapper->SelectColorArray(fieldName);
525 
526  // Use either point or cell data
527  // - if both point and cell data exists, preferentially choose
528  // point data. This is often the case when using glyphs.
529 
530  if (fieldAssociation & FieldAssociation::POINT_DATA)
531  {
532  mapper->SetScalarModeToUsePointFieldData();
533  }
534  else if (fieldAssociation & FieldAssociation::CELL_DATA)
535  {
536  mapper->SetScalarModeToUseCellFieldData();
537  }
538  else
539  {
541  << "Unable to determine cell or point data type "
542  << "- assuming point data";
543  mapper->SetScalarModeToUsePointFieldData();
544  }
545  mapper->SetScalarRange(range_.first(), range_.second());
546  mapper->SetColorModeToMapScalars();
547  mapper->SetLookupTable(lut);
548  mapper->ScalarVisibilityOn();
549 
550  // Add the scalar bar
551  addScalarBar(position, renderer, lut);
552  break;
553  }
554  }
555 
556  mapper->Modified();
557 }
558 
559 
561 addGlyphs
562 (
563  const scalar position,
564  const word& scaleFieldName,
565  const fieldSummary& scaleFieldInfo,
566  const word& colourFieldName,
567  const fieldSummary& colourFieldInfo,
568  const scalar maxGlyphLength,
569 
570  vtkPolyData* data,
571  vtkActor* actor,
572  vtkRenderer* renderer
573 ) const
574 {
575  // Determine whether we have CellData/PointData and (scalar/vector)
576  // or if we need to a cell->point data filter.
577 
578  if (!scaleFieldInfo.exists())
579  {
581  << "Cannot add glyphs. No such cell or point field: "
582  << scaleFieldName << endl;
583  return;
584  }
585 
586  if (!scaleFieldInfo.isScalar() && !scaleFieldInfo.isVector())
587  {
589  << "Glyphs can only be added to scalar or vector data. "
590  << "Unable to process field " << scaleFieldName << endl;
591  return;
592  }
593 
594 
595  // Setup glyphs
596 
597  // The min/max data range for the input data (cell or point),
598  // which will be slightly less after using a cell->point filter
599  // (since it averages), but is still essentially OK.
600 
601 
602  auto glyph = vtkSmartPointer<vtkGlyph3D>::New();
603  glyph->ScalingOn();
604 
605  auto glyphMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
606  glyphMapper->SetInputConnection(glyph->GetOutputPort());
607 
609 
610  // The data source is filtered or original (PointData)
611  if (!scaleFieldInfo.hasPointData() || !colourFieldInfo.hasPointData())
612  {
613  // CellData - Need a cell->point filter
615  cellToPoint->SetInputData(data);
616 
617  glyph->SetInputConnection(cellToPoint->GetOutputPort());
618  }
619  else
620  {
621  glyph->SetInputData(data);
622  }
623 
624 
625  if (scaleFieldInfo.nComponents_ == 1)
626  {
628  sphere->SetCenter(0, 0, 0);
629  sphere->SetRadius(0.5);
630 
631  // Setting higher resolution slows the rendering significantly
632  // sphere->SetPhiResolution(20);
633  // sphere->SetThetaResolution(20);
634 
635  glyph->SetSourceConnection(sphere->GetOutputPort());
636 
637  if (maxGlyphLength > 0)
638  {
639  // Using range from the data:
640  // glyph->SetRange
641  // (
642  // scaleFieldInfo.range_.first(),
643  // scaleFieldInfo.range_.second()
644  // );
645 
646  // Set range according to user-supplied limits
647  glyph->ClampingOn();
648  glyph->SetRange(range_.first(), range_.second());
649 
650  // If range[0] != min(value), maxGlyphLength behaviour will not
651  // be correct...
652  glyph->SetScaleFactor(maxGlyphLength);
653  }
654  else
655  {
656  glyph->SetScaleFactor(1);
657  }
658  glyph->SetScaleModeToScaleByScalar();
659  glyph->OrientOff();
660  glyph->SetColorModeToColorByScalar();
661  glyph->SetInputArrayToProcess
662  (
663  0, // index (0) = scalars
664  0, // port
665  0, // connection
666  vtkDataObject::FIELD_ASSOCIATION_POINTS,
667  scaleFieldName.c_str()
668  );
669  }
670  else if (scaleFieldInfo.nComponents_ == 3)
671  {
673  arrow->SetTipResolution(10);
674  arrow->SetTipRadius(0.1);
675  arrow->SetTipLength(0.35);
676  arrow->SetShaftResolution(10);
677  arrow->SetShaftRadius(0.03);
678 
679  glyph->SetSourceConnection(arrow->GetOutputPort());
680 
681  if (maxGlyphLength > 0)
682  {
683  // Set range according data limits
684  glyph->ClampingOn();
685  glyph->SetRange
686  (
687  scaleFieldInfo.range_.first(),
688  scaleFieldInfo.range_.second()
689  );
690  glyph->SetScaleFactor(maxGlyphLength);
691  }
692  else
693  {
694  glyph->SetScaleFactor(1);
695  }
696  glyph->SetScaleModeToScaleByVector();
697  glyph->OrientOn();
698  glyph->SetVectorModeToUseVector();
699  glyph->SetColorModeToColorByVector();
700  glyph->SetInputArrayToProcess
701  (
702  1, // index (1) = vectors
703  0, // port
704  0, // connection
705  vtkDataObject::FIELD_ASSOCIATION_POINTS,
706  scaleFieldName.c_str()
707  );
708  }
709 
710 
711  // Apply colouring etc.
712  // We already established PointData, which as either in the original,
713  // or generated with vtkCellDataToPointData filter.
714 
715  {
716  glyph->Update();
717 
718  setField
719  (
720  position,
721  colourFieldName,
722  FieldAssociation::POINT_DATA, // Original or after filter
723  glyphMapper,
724  renderer
725  );
726 
727  glyphMapper->Update();
728 
729  actor->SetMapper(glyphMapper);
730 
731  renderer->AddActor(actor);
732  }
733 }
734 
735 
736 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
737 
740 (
741  const dictionary& dict,
742  const HashPtrTable<Function1<vector>>& colours
743 )
744 :
745  colours_(colours),
746  fieldName_(dict.get<word>("field")),
747  smooth_(dict.getOrDefault("smooth", false)),
748  colourBy_(cbColour),
749  colourMap_(cmRainbow),
750  range_(),
751  scalarBar_()
752 {
753  colourByTypeNames.readEntry("colourBy", dict, colourBy_);
754 
755  switch (colourBy_)
756  {
757  case cbColour:
758  {
759  scalarBar_.hide();
760  break;
761  }
762 
763  case cbField:
764  {
765  dict.readEntry("range", range_);
766  colourMapTypeNames.readIfPresent("colourMap", dict, colourMap_);
767 
768  const dictionary* sbar = dict.findDict("scalarBar");
769 
770  if (sbar)
771  {
772  scalarBar_.read(*sbar);
773  }
774  else
775  {
776  scalarBar_.hide();
777  }
778  break;
779  }
780  }
781 }
782 
783 
784 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
785 
788 {}
789 
790 
791 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
792 
795 {
796  return colours_;
797 }
798 
799 
800 const Foam::word&
802 const
803 {
804  return fieldName_;
805 }
806 
807 
808 // ************************************************************************* //
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::queryFieldAssociation
static FieldAssociation queryFieldAssociation(const word &fieldName, vtkDataSet *dataset)
Query DataSet for field name and its field association.
Definition: fieldVisualisationBase.C:179
Foam::maxOp
Definition: ops.H:223
Foam::bitOrOp
Definition: ops.H:230
Foam::Vector::x
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:78
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldVisualisationBase
fieldVisualisationBase(const fieldVisualisationBase &)=delete
No copy construct.
Foam::Enum
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: IOstreamOption.H:51
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::FieldAssociation
FieldAssociation
Enumeration of the data field associations.
Definition: fieldVisualisationBase.H:160
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:47
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::range_
Tuple2< scalar, scalar > range_
Range of values.
Definition: fieldVisualisationBase.H:240
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldSummary
General field characteristics.
Definition: fieldVisualisationBase.H:172
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldSummary::isScalar
bool isScalar() const
True if nComponents_ == 1.
Definition: fieldVisualisationBase.H:190
foamVtkTools.H
Foam::expressions::patchExpr::POINT_DATA
Point data.
Definition: patchExprFwd.H:60
Foam::cellToPoint
A topoSetPointSource to select points based on usage in cells.
Definition: cellToPoint.H:83
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldSummary::reduce
void reduce()
Parallel reduction. A no-op if Pstream::parRun() is false.
Definition: fieldVisualisationBase.C:363
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:414
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldSummary::isVector
bool isVector() const
True if nComponents_ == 3.
Definition: fieldVisualisationBase.H:196
vtkSmartPointer
Definition: runTimePostProcessing.H:148
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::vtk::legacy::fieldData
void fieldData(vtk::formatter &fmt, label nFields)
Emit "FIELD FieldData <n>".
Definition: foamVtkOutputI.H:133
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::addMagField
static void addMagField(const word &fieldName, vtkFieldData *fieldData)
Add "mag(..)" field for filters that only accept scalars.
Definition: fieldVisualisationBase.C:238
Foam::VectorSpace::v_
Cmpt v_[Ncmpts]
The components of this vector space.
Definition: VectorSpace.H:83
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
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldSummary::range_
scalarMinMax range_
Definition: fieldVisualisationBase.H:176
Foam::expressions::patchExpr::NO_DATA
No data.
Definition: patchExprFwd.H:59
sphere
Specialization of rigidBody to construct a sphere given the mass and radius.
Foam::expressions::patchExpr::FieldAssociation
FieldAssociation
The field association for patch expressions (mutually exclusive)
Definition: patchExprFwd.H:57
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:51
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::colourMapTypeNames
static const Enum< colourMapType > colourMapTypeNames
Enumeration names for colourMapType.
Definition: fieldVisualisationBase.H:154
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::setColourMap
void setColourMap(vtkLookupTable *lut) const
Set the colour map.
Definition: fieldVisualisationBase.C:395
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::setField
void setField(const scalar position, const word &colourFieldName, const FieldAssociation fieldAssociation, vtkMapper *mapper, vtkRenderer *renderer) const
Set field/configure mapper, add scalar bar.
Definition: fieldVisualisationBase.C:496
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::runTimePostPro::fieldVisualisationBase::fieldSummary::exists
bool exists() const
True if association_ is non-zero.
Definition: fieldVisualisationBase.H:202
setField
surfacesMesh setField(triSurfaceToAgglom)
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::queryFieldSummary
static fieldSummary queryFieldSummary(const word &fieldName, vtkDataSet *dataset)
Query DataSet for field name and its field association.
Definition: fieldVisualisationBase.C:90
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::functionObjects::runTimePostPro::fieldVisualisationBase::fieldSummary::association_
unsigned association_
Definition: fieldVisualisationBase.H:175
Foam::UPstream::master
static bool master(const label communicator=0)
Am I the master process.
Definition: UPstream.H:438
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
doubleVector.H
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::addGlyphs
void addGlyphs(const scalar position, const word &scaleFieldName, const fieldSummary &scaleFieldInfo, const word &colourFieldName, const fieldSummary &colourFieldInfo, const scalar maxGlyphLength, vtkPolyData *data, vtkActor *actor, vtkRenderer *renderer) const
Add glyphs.
Definition: fieldVisualisationBase.C:562
fieldVisualisationBase.H
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::colours
const HashPtrTable< Function1< vector > > & colours() const
Return the colours.
Definition: fieldVisualisationBase.C:794
runTimePostProcessing.H
Foam::minMaxOp
Combine values and/or MinMax ranges.
Definition: MinMaxOps.H:114
Foam::HashPtrTable
A HashTable of pointers to objects of type <T>.
Definition: HashPtrTable.H:54
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:62
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::colourByTypeNames
static const Enum< colourByType > colourByTypeNames
Enumeration names for colourByType.
Definition: fieldVisualisationBase.H:139
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::~fieldVisualisationBase
virtual ~fieldVisualisationBase()
Destructor.
Definition: fieldVisualisationBase.C:787
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:294
Foam::vtk::Tools::rangeOf
scalarMinMax rangeOf(vtkDataArray *data)
Min/Max of scalar, or mag() of non-scalars. Includes nullptr check.
Definition: foamVtkToolsI.H:127
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:54
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldSummary::nComponents_
int nComponents_
Definition: fieldVisualisationBase.H:174
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldName
const word & fieldName() const
Return the field name.
Definition: fieldVisualisationBase.C:801
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::fieldSummary::hasPointData
bool hasPointData() const
True if there is a POINT_DATA association.
Definition: fieldVisualisationBase.H:208
Foam::functionObjects::runTimePostPro::fieldVisualisationBase::addScalarBar
void addScalarBar(const scalar position, vtkRenderer *renderer, vtkLookupTable *lut) const
Add scalar bar (if visible) to renderer.
Definition: fieldVisualisationBase.C:480