ParaView
vtkIntersectFragments.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: $RCSfile$
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 =========================================================================*/
22 #ifndef vtkIntersectFragments_h
23 #define vtkIntersectFragments_h
24 
25 #include "vtkMultiBlockDataSetAlgorithm.h"
26 #include "vtkPVVTKExtensionsDefaultModule.h" //needed for exports
27 #include <string> //
28 #include <vector> //
29 
30 class vtkPolyData;
31 // class vtkMultiBlockDataSet;
32 class vtkPoints;
33 class vtkDoubleArray;
34 class vtkIntArray;
35 class vtkImplicitFunction;
36 class vtkMultiProcessController;
38 class vtkCutter;
39 
40 class VTKPVVTKEXTENSIONSDEFAULT_EXPORT vtkIntersectFragments : public vtkMultiBlockDataSetAlgorithm
41 {
42 public:
43  static vtkIntersectFragments* New();
44  vtkTypeMacro(vtkIntersectFragments, vtkMultiBlockDataSetAlgorithm);
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
48 
49 
52  virtual void SetCutFunction(vtkImplicitFunction*);
53  vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
55 
58  void SetGeometryInputConnection(vtkAlgorithmOutput* algOutput);
62  void SetStatisticsInputConnection(vtkAlgorithmOutput* algOutput);
66  vtkMTimeType GetMTime();
67 
68 protected:
71 
73  virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
74  virtual int FillInputPortInformation(int port, vtkInformation* info);
75  virtual int FillOutputPortInformation(int port, vtkInformation* info);
77  // Make list of what we own
78  int IdentifyLocalFragments();
79  // Copy structure from multi block of polydata.
80  int CopyInputStructureStats(vtkMultiBlockDataSet* dest, vtkMultiBlockDataSet* src);
81  // Copy structure from mutli block of multi piece
82  int CopyInputStructureGeom(vtkMultiBlockDataSet* dest, vtkMultiBlockDataSet* src);
83  //
84  int PrepareToProcessRequest();
85  //
86  int Intersect();
87  // Build arrays that describe which fragment
88  // intersections are not empty.
89  void BuildLoadingArray(std::vector<vtkIdType>& loadingArray, int blockId);
90  int PackLoadingArray(vtkIdType*& buffer, int blockId);
91  int UnPackLoadingArray(
92  vtkIdType* buffer, int bufSize, std::vector<vtkIdType>& loadingArray, int blockId);
93  //
94  void ComputeGeometricAttributes();
95  // Send my geometric attribuites to a single process.
96  int SendGeometricAttributes(const int recipientProcId);
97  // size buffers & new containers
98  int PrepareToCollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
99  std::vector<std::vector<vtkDoubleArray*> >& centers, std::vector<std::vector<int*> >& ids);
100  // Free resources.
101  int CleanUpAfterCollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
102  std::vector<std::vector<vtkDoubleArray*> >& centers, std::vector<std::vector<int*> >& ids);
103  // Recieve all geometric attributes from all other
104  // processes.
105  int CollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
106  std::vector<std::vector<vtkDoubleArray*> >& centers, std::vector<std::vector<int*> >& ids);
107  // size local copy to hold all.
108  int PrepareToMergeGeometricAttributes(std::vector<std::vector<int> >& unique);
109  // Gather geometric attributes on a single process.
110  int GatherGeometricAttributes(const int recipientProcId);
111  // Copy attributes from input to output
112  int CopyAttributesToStatsOutput(const int controllingProcId);
113  //
114  int CleanUpAfterRequest();
115 
117  //
118  vtkMultiProcessController* Controller;
119  // Global ids of what we own before the intersection.
120  std::vector<std::vector<int> > FragmentIds;
121  // Centers, and global fragment ids.
122  // an array for each block.
123  std::vector<vtkDoubleArray*> IntersectionCenters;
124  std::vector<std::vector<int> > IntersectionIds;
125  //
126  vtkCutter* Cutter;
127  // data in/out
128  vtkMultiBlockDataSet* GeomIn;
129  vtkMultiBlockDataSet* GeomOut;
130  vtkMultiBlockDataSet* StatsIn;
131  vtkMultiBlockDataSet* StatsOut;
132  int NBlocks;
133  // only used on controller.
134  std::vector<int> NFragmentsIntersected;
135 
137  vtkImplicitFunction* CutFunction;
138  double Progress;
140 
141 private:
142  vtkIntersectFragments(const vtkIntersectFragments&) VTK_DELETE_FUNCTION;
143  void operator=(const vtkIntersectFragments&) VTK_DELETE_FUNCTION;
144 };
145 
146 #endif
std::vector< std::vector< int > > FragmentIds
vtkMultiBlockDataSet * StatsOut
vtkMultiBlockDataSet * StatsIn
vtkMultiBlockDataSet * GeomIn
Geometry intersection operations.
vtkMultiProcessController * Controller
data
std::vector< vtkDoubleArray * > IntersectionCenters
vtkMultiBlockDataSet * GeomOut
std::vector< std::vector< int > > IntersectionIds
vtkImplicitFunction * CutFunction
PARAVIEW interface data.
std::vector< int > NFragmentsIntersected