1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkStreamSurface.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 =========================================================================*/
15 /**
16  * @class   vtkStreamSurface
17  * @brief   Advect a stream surface in a vector field
18  *
19  * vtkStreamSurface is a surface streamer that generates a surface using the vectors in the input.
20  * Depending on the UseIterativeSeeding parameter, the simple or iterative version is called.
21  * The iterative version produces better surfaces, but takes longer.
22  *
23  * @par Thanks:
24  * Developed by Roxana Bujack and Karen Tsai at Los Alamos National Laboratory under LDRD 20190143ER
25  */
26 #ifndef vtkStreamSurface_h
27 #define vtkStreamSurface_h
28 
29 #include "vtkFiltersFlowPathsModule.h" // For export macro
30 #include "vtkStreamTracer.h"
31 
32 class vtkAppendPolyData;
33 class vtkRuledSurfaceFilter;
34 
35 class VTKFILTERSFLOWPATHS_EXPORT vtkStreamSurface : public vtkStreamTracer
36 {
37 public:
38   static vtkStreamSurface* New();
39   vtkTypeMacro(vtkStreamSurface, vtkStreamTracer);
40   void PrintSelf(ostream& os, vtkIndent indent) override;
41 
42   ///@{
43   /**
44    * Specify/see if the simple (fast) or iterative (correct) version is called
45    */
46   vtkSetMacro(UseIterativeSeeding, bool);
47   vtkGetMacro(UseIterativeSeeding, bool);
48   ///@}
49 
50 protected:
51   vtkStreamSurface();
52   ~vtkStreamSurface() override;
53 
54   int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
55 
56 private:
57   vtkStreamSurface(const vtkStreamSurface&) = delete;
58   void operator=(const vtkStreamSurface&) = delete;
59 
60   /**
61    * first advect all point in seeds and then connect the resulting streamlines to a surface
62    * field is the vector values dataset in which the streamsurface is advected
63    * seeds is the polydata with the start curve
64    * output is the final streamsurface
65    * @return 1 if successful, 0 if empty
66    */
67   int AdvectSimple(vtkDataSet* field, vtkPolyData* seeds, vtkPolyData* output);
68 
69   /**
70    * loop: 1.advect one step at a time
71    * 2. then form surface strip and add it to existing surface
72    * 3. then check if points have diverged and insert new ones if necessary
73    * field is the vecotr values dataset in which the streamsurface is advected
74    * seeds is the polydata with the start curve
75    * output is the final streamsurface
76    * @param field: vector field in which the surfave is advected
77    * @param seeds: initial values
78    * @param integrationDirection: forward, backward, or both
79    * @param output: the final surface
80    * @return 1 if successful, 0 if not
81    */
82   int AdvectIterative(
83     vtkDataSet* field, vtkPolyData* seeds, int integrationDirection, vtkPolyData* output);
84 
85   /**
86    * depending on this boolen the simple (fast) or iterative (correct) version is called
87    */
88   bool UseIterativeSeeding = false;
89 
90   vtkNew<vtkRuledSurfaceFilter> RuledSurface;
91   vtkNew<vtkStreamTracer> StreamTracer;
92   vtkNew<vtkAppendPolyData> AppendSurfaces;
93 };
94 #endif
95