vtkSMExtractsController.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
28 #ifndef vtkSMExtractsController_h
29 #define vtkSMExtractsController_h
30 
31 #include "vtkObject.h"
32 #include "vtkRemotingServerManagerModule.h" // for exports
33 #include "vtkSmartPointer.h" // for vtkSmartPointer
34 
35 #include <map> // for std::map
36 #include <string> // for std::string
37 #include <vector> // for std::vector
38 
39 class vtkCollection;
41 class vtkSMProxy;
43 class vtkTable;
44 
46 {
47 public:
48  static vtkSMExtractsController* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
53 
57  vtkSetClampMacro(TimeStep, int, 0, VTK_INT_MAX);
58  vtkGetMacro(TimeStep, int);
59  vtkSetMacro(Time, double);
60  vtkGetMacro(Time, double);
62 
64 
73  vtkSetStringMacro(ExtractsOutputDirectory);
74  vtkGetStringMacro(ExtractsOutputDirectory);
76 
83  const char* GetRealExtractsOutputDirectory() const;
84 
91  bool Extract(vtkSMProxy* extractor);
92 
100  bool Extract(vtkSMSessionProxyManager* pxm);
101 
109  bool Extract();
110 
115  bool Extract(vtkCollection* collection);
116 
118 
124  bool IsAnyTriggerActivated(vtkSMSessionProxyManager* pxm);
125  bool IsAnyTriggerActivated();
126  bool IsAnyTriggerActivated(vtkCollection* collection);
128 
133  bool IsTriggerActivated(vtkSMProxy* extractor);
134 
138  std::vector<vtkSMProxy*> FindExtractors(vtkSMProxy* proxy) const;
139 
144  std::vector<vtkSMProxy*> GetSupportedExtractorPrototypes(vtkSMProxy* proxy) const;
145 
150  bool CanExtract(vtkSMProxy* extractor, const std::vector<vtkSMProxy*>& inputs) const;
151  bool CanExtract(vtkSMProxy* extractor, vtkSMProxy* input) const
152  {
153  return this->CanExtract(extractor, std::vector<vtkSMProxy*>{ input });
154  }
155 
157 
160  vtkSMProxy* CreateExtractor(
161  vtkSMProxy* proxy, const char* xmlname, const char* registrationName = nullptr) const;
163 
167  vtkSMProxy* CreateSteeringExtractor(
168  vtkSMProxy* proxy, const char* registrationName = nullptr) const;
169 
173  static bool IsExtractor(vtkSMProxy* extractor, vtkSMProxy* proxy);
174 
179  vtkSMProxy* GetInputForExtractor(vtkSMProxy* extractor) const;
180 
187  vtkTable* GetSummaryTable() const;
188 
195  void ResetSummaryTable();
196 
201  bool SaveSummaryTable(const std::string& fname, vtkSMSessionProxyManager* pxm);
202 
204 
209  using SummaryParametersT = std::map<std::string, std::string>;
210  bool AddSummaryEntry(vtkSMExtractWriterProxy* writer, const std::string& filename,
211  const SummaryParametersT& params = SummaryParametersT{});
213 
217  static bool IsExtractorEnabled(vtkSMProxy* extractor);
218 
222  static void SetExtractorEnabled(vtkSMProxy* extractor, bool val);
223 
224 protected:
226  ~vtkSMExtractsController() override;
227 
229 
237  bool CreateExtractsOutputDirectory(vtkSMSessionProxyManager* pxm) const;
238  bool CreateDir(const std::string& dname, vtkSMSessionProxyManager* pxm) const;
240 
244  std::string GetName(vtkSMExtractWriterProxy* writer);
245 
246 private:
248  void operator=(const vtkSMExtractsController&) = delete;
249 
254  static std::string GetSummaryTableFilenameColumnName(const std::string& fname);
255 
256  int TimeStep;
257  double Time;
258  char* ExtractsOutputDirectory;
259  char* EnvironmentExtractsOutputDirectory;
260  vtkSmartPointer<vtkTable> SummaryTable;
261  mutable std::string LastExtractsOutputDirectory;
262  mutable bool ExtractsOutputDirectoryValid;
263 
264  vtkSetStringMacro(EnvironmentExtractsOutputDirectory);
265 };
266 
267 #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:140
static vtkObject * New()
void operator=(const vtkObjectBase &)
controller for extract generation