vtkSMExtractsController.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMExtractsController.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
40 #ifndef vtkSMExtractsController_h
41 #define vtkSMExtractsController_h
42 
43 #include "vtkObject.h"
44 #include "vtkRemotingServerManagerModule.h" // for exports
45 #include "vtkSmartPointer.h" // for vtkSmartPointer
46 
47 #include <map> // for std::map
48 #include <string> // for std::string
49 #include <vector> // for std::vector
50 
51 class vtkCollection;
53 class vtkSMProxy;
55 class vtkTable;
56 
58 {
59 public:
60  static vtkSMExtractsController* New();
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
65 
69  vtkSetClampMacro(TimeStep, int, 0, VTK_INT_MAX);
70  vtkGetMacro(TimeStep, int);
71  vtkSetMacro(Time, double);
72  vtkGetMacro(Time, double);
74 
76 
85  vtkSetStringMacro(ExtractsOutputDirectory);
86  vtkGetStringMacro(ExtractsOutputDirectory);
88 
95  const char* GetRealExtractsOutputDirectory() const;
96 
103  bool Extract(vtkSMProxy* extractor);
104 
112  bool Extract(vtkSMSessionProxyManager* pxm);
113 
121  bool Extract();
122 
127  bool Extract(vtkCollection* collection);
128 
130 
136  bool IsAnyTriggerActivated(vtkSMSessionProxyManager* pxm);
137  bool IsAnyTriggerActivated();
138  bool IsAnyTriggerActivated(vtkCollection* collection);
140 
145  bool IsTriggerActivated(vtkSMProxy* extractor);
146 
150  std::vector<vtkSMProxy*> FindExtractors(vtkSMProxy* proxy) const;
151 
156  std::vector<vtkSMProxy*> GetSupportedExtractorPrototypes(vtkSMProxy* proxy) const;
157 
162  bool CanExtract(vtkSMProxy* extractor, const std::vector<vtkSMProxy*>& inputs) const;
163  bool CanExtract(vtkSMProxy* extractor, vtkSMProxy* input) const
164  {
165  return this->CanExtract(extractor, std::vector<vtkSMProxy*>{ input });
166  }
167 
169 
172  vtkSMProxy* CreateExtractor(
173  vtkSMProxy* proxy, const char* xmlname, const char* registrationName = nullptr) const;
175 
179  static bool IsExtractor(vtkSMProxy* extractor, vtkSMProxy* proxy);
180 
185  vtkSMProxy* GetInputForExtractor(vtkSMProxy* extractor) const;
186 
193  vtkTable* GetSummaryTable() const;
194 
201  void ResetSummaryTable();
202 
207  bool SaveSummaryTable(const std::string& fname, vtkSMSessionProxyManager* pxm);
208 
210 
215  using SummaryParametersT = std::map<std::string, std::string>;
216  bool AddSummaryEntry(vtkSMExtractWriterProxy* writer, const std::string& filename,
217  const SummaryParametersT& params = SummaryParametersT{});
219 
223  static bool IsExtractorEnabled(vtkSMProxy* extractor);
224 
228  static void SetExtractorEnabled(vtkSMProxy* extractor, bool val);
229 
230 protected:
232  ~vtkSMExtractsController() override;
233 
235 
243  bool CreateExtractsOutputDirectory(vtkSMSessionProxyManager* pxm) const;
244  bool CreateDir(const std::string& dname, vtkSMSessionProxyManager* pxm) const;
246 
250  std::string GetName(vtkSMExtractWriterProxy* writer);
251 
252 private:
254  void operator=(const vtkSMExtractsController&) = delete;
255 
260  static std::string GetSummaryTableFilenameColumnName(const std::string& fname);
261 
262  int TimeStep;
263  double Time;
264  char* ExtractsOutputDirectory;
265  char* EnvironmentExtractsOutputDirectory;
266  vtkSmartPointer<vtkTable> SummaryTable;
267  mutable std::string LastExtractsOutputDirectory;
268  mutable bool ExtractsOutputDirectoryValid;
269 
270  vtkSetStringMacro(EnvironmentExtractsOutputDirectory);
271 };
272 
273 #endif
#define VTKREMOTINGSERVERMANAGER_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
bool CanExtract(vtkSMProxy *extractor, vtkSMProxy *input) const
std::map< std::string, std::string > SummaryParametersT
Called by vtkSMExtractWriterProxy subclasses to add an entry to the summary table.
abstract class defining extract writer proxy API
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
static vtkObject * New()
void operator=(const vtkObjectBase &)
controller for extract generation