vtkIntersectFragments.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
3 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkIntersectFragments_h
12 #define vtkIntersectFragments_h
13 
15 #include "vtkPVVTKExtensionsFiltersMaterialInterfaceModule.h" //needed for exports
16 #include <string> //
17 #include <vector> //
18 
19 class vtkPolyData;
20 // class vtkMultiBlockDataSet;
21 class vtkPoints;
22 class vtkDoubleArray;
23 class vtkIntArray;
27 class vtkCutter;
28 
31 {
32 public:
33  static vtkIntersectFragments* New();
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
39 
42  virtual void SetCutFunction(vtkImplicitFunction*);
43  vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
45 
48  void SetGeometryInputConnection(vtkAlgorithmOutput* algOutput);
52  void SetStatisticsInputConnection(vtkAlgorithmOutput* algOutput);
56  vtkMTimeType GetMTime() override;
57 
58 protected:
60  ~vtkIntersectFragments() override;
61 
64  int FillInputPortInformation(int port, vtkInformation* info) override;
65  int FillOutputPortInformation(int port, vtkInformation* info) override;
67  // Make list of what we own
68  int IdentifyLocalFragments();
69  // Copy structure from multi block of polydata.
70  int CopyInputStructureStats(vtkMultiBlockDataSet* dest, vtkMultiBlockDataSet* src);
71  // Copy structure from multi block of multi piece
72  int CopyInputStructureGeom(vtkMultiBlockDataSet* dest, vtkMultiBlockDataSet* src);
73  //
74  int PrepareToProcessRequest();
75  //
76  int Intersect();
77  // Build arrays that describe which fragment
78  // intersections are not empty.
79  void BuildLoadingArray(std::vector<vtkIdType>& loadingArray, int blockId);
80  int PackLoadingArray(vtkIdType*& buffer, int blockId);
81  int UnPackLoadingArray(
82  vtkIdType* buffer, int bufSize, std::vector<vtkIdType>& loadingArray, int blockId);
83  //
84  void ComputeGeometricAttributes();
85  // Send my geometric attribuites to a single process.
86  int SendGeometricAttributes(int recipientProcId);
87  // size buffers & new containers
88  int PrepareToCollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
89  std::vector<std::vector<vtkDoubleArray*>>& centers, std::vector<std::vector<int*>>& ids);
90  // Free resources.
91  int CleanUpAfterCollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
92  std::vector<std::vector<vtkDoubleArray*>>& centers, std::vector<std::vector<int*>>& ids);
93  // Receive all geometric attributes from all other
94  // processes.
95  int CollectGeometricAttributes(std::vector<vtkMaterialInterfaceCommBuffer>& buffers,
96  std::vector<std::vector<vtkDoubleArray*>>& centers, std::vector<std::vector<int*>>& ids);
97  // size local copy to hold all.
98  int PrepareToMergeGeometricAttributes(std::vector<std::vector<int>>& unique);
99  // Gather geometric attributes on a single process.
100  int GatherGeometricAttributes(int recipientProcId);
101  // Copy attributes from input to output
102  int CopyAttributesToStatsOutput(int controllingProcId);
103  //
104  int CleanUpAfterRequest();
105 
107  //
109  // Global ids of what we own before the intersection.
110  std::vector<std::vector<int>> FragmentIds;
111  // Centers, and global fragment ids.
112  // an array for each block.
113  std::vector<vtkDoubleArray*> IntersectionCenters;
114  std::vector<std::vector<int>> IntersectionIds;
115  //
117  // data in/out
122  int NBlocks;
123  // only used on controller.
124  std::vector<int> NFragmentsIntersected;
125 
128  double Progress;
130 
131 private:
133  void operator=(const vtkIntersectFragments&) = delete;
134 };
135 
136 #endif
std::vector< std::vector< int > > FragmentIds
vtkMultiBlockDataSet * StatsOut
#define VTKPVVTKEXTENSIONSFILTERSMATERIALINTERFACE_EXPORT
int vtkIdType
vtkMultiBlockDataSet * StatsIn
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkMultiBlockDataSet * GeomIn
vtkTypeUInt64 vtkMTimeType
static vtkMultiBlockDataSetAlgorithm * New()
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Geometry intersection operations.
virtual vtkMTimeType GetMTime()
vtkMultiProcessController * Controller
data
std::vector< vtkDoubleArray * > IntersectionCenters
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkMultiBlockDataSet * GeomOut
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
void operator=(const vtkObjectBase &)
std::vector< std::vector< int > > IntersectionIds
vtkImplicitFunction * CutFunction
PARAVIEW interface data.
std::vector< int > NFragmentsIntersected