VTK  9.2.6
vtkRandomPool.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkRandomPool.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
41
42#ifndef vtkRandomPool_h
43#define vtkRandomPool_h
44
45#include "vtkCommonCoreModule.h" // For export macro
46#include "vtkObject.h"
47
49class vtkDataArray;
50
51class VTKCOMMONCORE_EXPORT vtkRandomPool : public vtkObject
52{
53public:
55
58 static vtkRandomPool* New();
59 vtkTypeMacro(vtkRandomPool, vtkObject);
60 void PrintSelf(ostream& os, vtkIndent indent) override;
62
64
68 virtual void SetSequence(vtkRandomSequence* seq);
69 vtkGetObjectMacro(Sequence, vtkRandomSequence);
71
73
78 vtkSetClampMacro(Size, vtkIdType, 1, VTK_ID_MAX);
79 vtkGetMacro(Size, vtkIdType);
81
83
91
96 vtkIdType GetTotalSize() { return (this->Size * this->NumberOfComponents); }
97
99
111 const double* GeneratePool();
112 const double* GetPool() { return this->Pool; }
113 double GetValue(vtkIdType i) { return this->Pool[(i % this->TotalSize)]; }
114 double GetValue(vtkIdType i, int compNum)
115 {
116 return this->Pool[(compNum + this->NumberOfComponents * i) % this->TotalSize];
117 }
118
119
121
133 void PopulateDataArray(vtkDataArray* da, double minRange, double maxRange);
134 void PopulateDataArray(vtkDataArray* da, int compNumber, double minRange, double maxRange);
136
138
143 vtkSetClampMacro(ChunkSize, vtkIdType, 1000, VTK_INT_MAX);
144 vtkGetMacro(ChunkSize, vtkIdType);
146
147protected:
149 ~vtkRandomPool() override;
150
151 // Keep track of last generation time
153
154 // Data members to support public API
159
160 // Internal data members
162 double* Pool;
163
164private:
165 vtkRandomPool(const vtkRandomPool&) = delete;
166 void operator=(const vtkRandomPool&) = delete;
167};
168
169#endif
a simple class to control print indentation
Definition vtkIndent.h:40
virtual void SetSequence(vtkRandomSequence *seq)
Specify the random sequence generator used to produce the random pool.
~vtkRandomPool() override
vtkRandomSequence * Sequence
double GetValue(vtkIdType i)
These methods provide access to the raw random pool as a double array.
static vtkRandomPool * New()
Standard methods for instantiation, type information, and printing.
vtkTimeStamp GenerateTime
const double * GeneratePool()
These methods provide access to the raw random pool as a double array.
void PopulateDataArray(vtkDataArray *da, double minRange, double maxRange)
Methods to populate data arrays of various types with values within a specified (min,...
vtkIdType ChunkSize
const double * GetPool()
These methods provide access to the raw random pool as a double array.
double GetValue(vtkIdType i, int compNum)
These methods provide access to the raw random pool as a double array.
vtkIdType GetTotalSize()
This convenience method returns the total size of the memory pool, i.e., Size*NumberOfComponents.
void PopulateDataArray(vtkDataArray *da, int compNumber, double minRange, double maxRange)
Methods to populate data arrays of various types with values within a specified (min,...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, type information, and printing.
vtkIdType TotalSize
Generate a sequence of random numbers.
record modification and/or execution time
#define vtkDataArray
int vtkIdType
Definition vtkType.h:332
#define VTK_ID_MAX
Definition vtkType.h:336
#define VTK_INT_MAX
Definition vtkType.h:155