1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkGridSynchronizedTemplates3D.h,v $
6 Date: $Date: 2003/01/09 19:21:05 $
7 Version: $Revision: 1.32 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 THIS CLASS IS PATENT PENDING.
19 Application of this software for commercial purposes requires
20 a license grant from Kitware. Contact:
23 469 Clifton Corporate Parkway,
24 Clifton Park, NY 12065
28 =========================================================================*/
29 // .NAME vtkGridSynchronizedTemplates3D - generate isosurface from structured grids
31 // .SECTION Description
32 // vtkGridSynchronizedTemplates3D is a 3D implementation of the synchronized
33 // template algorithm.
36 // This filter is specialized to 3D grids.
39 // vtkContourFilter vtkSynchronizedTemplates3D
41 #ifndef __vtkGridSynchronizedTemplates3D_h
42 #define __vtkGridSynchronizedTemplates3D_h
44 #include "vtkStructuredGridToPolyDataFilter.h"
45 #include "vtkContourValues.h" // Because it passes all the calls to it
47 class vtkKitwareContourFilter;
48 class vtkMultiThreader;
50 class VTK_PATENTED_EXPORT vtkGridSynchronizedTemplates3D : public vtkStructuredGridToPolyDataFilter
53 static vtkGridSynchronizedTemplates3D *New();
54 vtkTypeRevisionMacro(vtkGridSynchronizedTemplates3D,vtkStructuredGridToPolyDataFilter);
55 void PrintSelf(ostream& os, vtkIndent indent);
58 // Because we delegate to vtkContourValues
59 unsigned long int GetMTime();
62 // Set/Get the computation of normals. Normal computation is fairly
63 // expensive in both time and storage. If the output data will be
64 // processed by filters that modify topology or geometry, it may be
65 // wise to turn Normals and Gradients off.
66 vtkSetMacro(ComputeNormals,int);
67 vtkGetMacro(ComputeNormals,int);
68 vtkBooleanMacro(ComputeNormals,int);
71 // Set/Get the computation of gradients. Gradient computation is
72 // fairly expensive in both time and storage. Note that if
73 // ComputeNormals is on, gradients will have to be calculated, but
74 // will not be stored in the output dataset. If the output data
75 // will be processed by filters that modify topology or geometry, it
76 // may be wise to turn Normals and Gradients off.
77 vtkSetMacro(ComputeGradients,int);
78 vtkGetMacro(ComputeGradients,int);
79 vtkBooleanMacro(ComputeGradients,int);
82 // Set/Get the computation of scalars.
83 vtkSetMacro(ComputeScalars,int);
84 vtkGetMacro(ComputeScalars,int);
85 vtkBooleanMacro(ComputeScalars,int);
88 // Set a particular contour value at contour number i. The index i ranges
89 // between 0<=i<NumberOfContours.
90 void SetValue(int i, float value) {this->ContourValues->SetValue(i,value);}
93 // Get the ith contour value.
94 float GetValue(int i) {return this->ContourValues->GetValue(i);}
97 // Get a pointer to an array of contour values. There will be
98 // GetNumberOfContours() values in the list.
99 float *GetValues() {return this->ContourValues->GetValues();}
102 // Fill a supplied list with contour values. There will be
103 // GetNumberOfContours() values in the list. Make sure you allocate
104 // enough memory to hold the list.
105 void GetValues(float *contourValues) {
106 this->ContourValues->GetValues(contourValues);}
109 // Set the number of contours to place into the list. You only really
110 // need to use this method to reduce list size. The method SetValue()
111 // will automatically increase list size as needed.
112 void SetNumberOfContours(int number) {
113 this->ContourValues->SetNumberOfContours(number);}
116 // Get the number of contours in the list of contour values.
117 int GetNumberOfContours() {
118 return this->ContourValues->GetNumberOfContours();}
121 // Generate numContours equally spaced contour values between specified
122 // range. Contour values will include min/max range values.
123 void GenerateValues(int numContours, float range[2]) {
124 this->ContourValues->GenerateValues(numContours, range);}
127 // Generate numContours equally spaced contour values between specified
128 // range. Contour values will include min/max range values.
129 void GenerateValues(int numContours, float rangeStart, float rangeEnd)
130 {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
133 // Needed by templated functions.
134 int *GetExecuteExtent() {return this->ExecuteExtent;}
135 void ThreadedExecute(int *exExt, int threadId);
138 // Get/Set the number of threads to create when rendering
139 vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
140 vtkGetMacro( NumberOfThreads, int );
143 // This filter will initiate streaming so that no piece requested
144 // from the input will be larger than this value (KiloBytes).
145 void SetInputMemoryLimit(long limit);
148 vtkGridSynchronizedTemplates3D();
149 ~vtkGridSynchronizedTemplates3D();
152 // If you want to contour by an arbitrary array, then set its name here.
153 // By default this in NULL and the filter will use the active scalar array.
154 vtkGetStringMacro(InputScalarsSelection);
155 void SelectInputScalars(const char *fieldName)
156 {this->SetInputScalarsSelection(fieldName);}
159 void ExecuteInformation();
161 void ComputeInputUpdateExtents( vtkDataObject *output );
164 int ComputeGradients;
166 vtkContourValues *ContourValues;
169 vtkMultiThreader *Threader;
170 int MinimumPieceSize[3];
171 int ExecuteExtent[6];
173 vtkPolyData *Threads[VTK_MAX_THREADS];
175 char *InputScalarsSelection;
176 vtkSetStringMacro(InputScalarsSelection);
180 friend class VTK_PATENTED_EXPORT vtkKitwareContourFilter;
183 vtkGridSynchronizedTemplates3D(const vtkGridSynchronizedTemplates3D&); // Not implemented.
184 void operator=(const vtkGridSynchronizedTemplates3D&); // Not implemented.