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 
45 class VTKREMOTINGSERVERMANAGER_EXPORT vtkSMExtractsController : public vtkObject
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  static bool IsExtractor(vtkSMProxy* extractor, vtkSMProxy* proxy);
168 
173  vtkSMProxy* GetInputForExtractor(vtkSMProxy* extractor) const;
174 
181  vtkTable* GetSummaryTable() const;
182 
189  void ResetSummaryTable();
190 
195  bool SaveSummaryTable(const std::string& fname, vtkSMSessionProxyManager* pxm);
196 
198 
203  using SummaryParametersT = std::map<std::string, std::string>;
204  bool AddSummaryEntry(vtkSMExtractWriterProxy* writer, const std::string& filename,
205  const SummaryParametersT& params = SummaryParametersT{});
207 
211  static bool IsExtractorEnabled(vtkSMProxy* extractor);
212 
216  static void SetExtractorEnabled(vtkSMProxy* extractor, bool val);
217 
218 protected:
220  ~vtkSMExtractsController() override;
221 
223 
231  bool CreateExtractsOutputDirectory(vtkSMSessionProxyManager* pxm) const;
232  bool CreateDir(const std::string& dname, vtkSMSessionProxyManager* pxm) const;
234 
238  std::string GetName(vtkSMExtractWriterProxy* writer);
239 
240 private:
242  void operator=(const vtkSMExtractsController&) = delete;
243 
248  static std::string GetSummaryTableFilenameColumnName(const std::string& fname);
249 
250  int TimeStep;
251  double Time;
252  char* ExtractsOutputDirectory;
253  char* EnvironmentExtractsOutputDirectory;
254  vtkSmartPointer<vtkTable> SummaryTable;
255  mutable std::string LastExtractsOutputDirectory;
256  mutable bool ExtractsOutputDirectoryValid;
257 
258  vtkSetStringMacro(EnvironmentExtractsOutputDirectory);
259 };
260 
261 #endif
vtkSMSessionProxyManager
Definition: vtkSMSessionProxyManager.h:135
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkTable
vtkObject::New
static vtkObject * New()
vtkSMExtractsController::CanExtract
bool CanExtract(vtkSMProxy *extractor, vtkSMProxy *input) const
Definition: vtkSMExtractsController.h:151
vtkSmartPointer< vtkTable >
vtkObject
vtkSMExtractsController::SummaryParametersT
std::map< std::string, std::string > SummaryParametersT
Called by vtkSMExtractWriterProxy subclasses to add an entry to the summary table.
Definition: vtkSMExtractsController.h:203
vtkSMProxy
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
vtkCollection
vtkSMExtractsController
controller for extract generation
Definition: vtkSMExtractsController.h:45
vtkIndent
vtkSmartPointer.h
vtkObject.h
vtkSMExtractWriterProxy
abstract class defining extract writer proxy API
Definition: vtkSMExtractWriterProxy.h:19
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE