OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / vtk / vtkGridSynchronizedTemplates3D.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkGridSynchronizedTemplates3D.h,v $
5   Language:  C++
6   Date:      $Date: 2003/01/09 19:21:05 $
7   Version:   $Revision: 1.32 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
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.
16
17      THIS CLASS IS PATENT PENDING.
18
19      Application of this software for commercial purposes requires 
20      a license grant from Kitware. Contact:
21          Ken Martin
22          Kitware
23          469 Clifton Corporate Parkway,
24          Clifton Park, NY 12065
25          Phone:1-518-371-3971 
26      for more information.
27
28 =========================================================================*/
29 // .NAME vtkGridSynchronizedTemplates3D - generate isosurface from structured grids
30
31 // .SECTION Description
32 // vtkGridSynchronizedTemplates3D is a 3D implementation of the synchronized 
33 // template algorithm.
34
35 // .SECTION Caveats
36 // This filter is specialized to 3D grids.
37
38 // .SECTION See Also
39 // vtkContourFilter vtkSynchronizedTemplates3D
40
41 #ifndef __vtkGridSynchronizedTemplates3D_h
42 #define __vtkGridSynchronizedTemplates3D_h
43
44 #include "vtkStructuredGridToPolyDataFilter.h"
45 #include "vtkContourValues.h" // Because it passes all the calls to it
46
47 class vtkKitwareContourFilter;
48 class vtkMultiThreader;
49
50 class VTK_PATENTED_EXPORT vtkGridSynchronizedTemplates3D : public vtkStructuredGridToPolyDataFilter
51 {
52 public:
53   static vtkGridSynchronizedTemplates3D *New();
54   vtkTypeRevisionMacro(vtkGridSynchronizedTemplates3D,vtkStructuredGridToPolyDataFilter);
55   void PrintSelf(ostream& os, vtkIndent indent);
56
57   // Description:
58   // Because we delegate to vtkContourValues
59   unsigned long int GetMTime();
60
61   // Description:
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);
69
70   // Description:
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);
80
81   // Description:
82   // Set/Get the computation of scalars.
83   vtkSetMacro(ComputeScalars,int);
84   vtkGetMacro(ComputeScalars,int);
85   vtkBooleanMacro(ComputeScalars,int);
86
87   // Description:
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);}
91
92   // Description:
93   // Get the ith contour value.
94   float GetValue(int i) {return this->ContourValues->GetValue(i);}
95
96   // Description:
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();}
100
101   // Description:
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);}
107
108   // Description:
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);}
114
115   // Description:
116   // Get the number of contours in the list of contour values.
117   int GetNumberOfContours() {
118     return this->ContourValues->GetNumberOfContours();}
119
120   // Description:
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);}
125
126   // Description:
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);}
131
132   // Description:
133   // Needed by templated functions.
134   int *GetExecuteExtent() {return this->ExecuteExtent;}
135   void ThreadedExecute(int *exExt, int threadId);
136
137   // Description:
138   // Get/Set the number of threads to create when rendering
139   vtkSetClampMacro( NumberOfThreads, int, 1, VTK_MAX_THREADS );
140   vtkGetMacro( NumberOfThreads, int );
141
142   // Description:
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);
146
147 protected:
148   vtkGridSynchronizedTemplates3D();
149   ~vtkGridSynchronizedTemplates3D();
150
151   // Description:
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);}
157   
158   void Execute();
159   void ExecuteInformation();
160
161   void ComputeInputUpdateExtents( vtkDataObject *output );
162
163   int ComputeNormals;
164   int ComputeGradients;
165   int ComputeScalars;
166   vtkContourValues *ContourValues;
167
168   int NumberOfThreads;
169   vtkMultiThreader *Threader;
170   int MinimumPieceSize[3];
171   int ExecuteExtent[6];
172
173   vtkPolyData *Threads[VTK_MAX_THREADS];
174
175   char *InputScalarsSelection;
176   vtkSetStringMacro(InputScalarsSelection);
177
178 private:
179   //BTX
180   friend class VTK_PATENTED_EXPORT vtkKitwareContourFilter;
181   //ETX
182 private:
183   vtkGridSynchronizedTemplates3D(const vtkGridSynchronizedTemplates3D&);  // Not implemented.
184   void operator=(const vtkGridSynchronizedTemplates3D&);  // Not implemented.
185 };
186
187
188 #endif