--- /dev/null
+#include "vtkFileSeriesGroupReader.h"
+
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkMultiBlockDataSet.h>
+#include <vtkObjectFactory.h>
+#include <vtkSmartPointer.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+
+#include <vector>
+#include <string>
+
+vtkStandardNewMacro(vtkFileSeriesGroupReader);
+
+//=============================================================================
+struct vtkFileSeriesGroupReaderInternals
+{
+ std::vector<std::string> FileNames;
+};
+
+//=============================================================================
+vtkFileSeriesGroupReader::vtkFileSeriesGroupReader()
+ : Internals(new vtkFileSeriesGroupReaderInternals())
+{
+ this->SetNumberOfInputPorts(0);
+ this->SetNumberOfOutputPorts(1);
+}
+
+//-----------------------------------------------------------------------------
+vtkFileSeriesGroupReader::~vtkFileSeriesGroupReader() = default;
+
+//----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::AddFileName(const char* name)
+{
+ // Make sure the reader always has a filename set
+ this->ReaderSetFileName(name);
+
+ this->AddFileNameInternal(name);
+ this->Modified();
+}
+
+//----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::RemoveAllFileNames()
+{
+ this->RemoveAllFileNamesInternal();
+ this->Modified();
+}
+
+//----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::RemoveAllFileNamesInternal()
+{
+ this->Internals->FileNames.clear();
+}
+
+//----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::AddFileNameInternal(const char* name)
+{
+ this->Internals->FileNames.emplace_back(name);
+}
+
+//----------------------------------------------------------------------------
+unsigned int vtkFileSeriesGroupReader::GetNumberOfFileNames()
+{
+ return static_cast<unsigned int>(this->Internals->FileNames.size());
+}
+
+//----------------------------------------------------------------------------
+const char* vtkFileSeriesGroupReader::GetFileName(unsigned int idx)
+{
+ if (idx >= this->Internals->FileNames.size())
+ {
+ return nullptr;
+ }
+ return this->Internals->FileNames[idx].c_str();
+}
+
+//----------------------------------------------------------------------------
+int vtkFileSeriesGroupReader::CanReadFile(const char* filename)
+{
+ if (!this->Reader)
+ {
+ return 0;
+ }
+
+ return this->ReaderCanReadFile(filename);
+}
+
+//----------------------------------------------------------------------------
+int vtkFileSeriesGroupReader::RequestInformation(
+ vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
+{
+ return this->Reader->ProcessRequest(request, inputVector, outputVector);
+}
+
+//----------------------------------------------------------------------------
+int vtkFileSeriesGroupReader::RequestData(vtkInformation* vtkNotUsed(request),
+ vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
+{
+ auto output = vtkMultiBlockDataSet::GetData(outputVector, 0);
+ output->SetNumberOfBlocks(this->GetNumberOfFileNames());
+
+ vtkInformation* info = outputVector->GetInformationObject(0);
+ double time = info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
+
+ for (unsigned int i = 0; i < this->GetNumberOfFileNames(); i++)
+ {
+ this->ReaderSetFileName(this->GetFileName(i));
+ this->Reader->UpdateTimeStep(time);
+ vtkDataObject* outputReader = this->Reader->GetOutputDataObject(0);
+ vtkSmartPointer<vtkDataObject> outputLeaf = vtkSmartPointer<vtkDataObject>::Take(outputReader->NewInstance());
+ outputLeaf->DeepCopy(outputReader);
+ output->SetBlock(i, outputLeaf);
+ }
+
+ return 1;
+}
+
+//------------------------------------------------------------------------------
+int vtkFileSeriesGroupReader::FillOutputPortInformation(
+ int vtkNotUsed(port), vtkInformation* info)
+{
+ info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet");
+ return 1;
+}
+
+//-----------------------------------------------------------------------------
+void vtkFileSeriesGroupReader::PrintSelf(ostream& os, vtkIndent indent)
+{
+ this->Superclass::PrintSelf(os, indent);
+
+ os << indent << "MetaFileName: " << (this->_MetaFileName ? this->_MetaFileName : "(none)")
+ << endl;
+}
--- /dev/null
+#ifndef vtkFileSeriesGroupReader_h
+#define vtkFileSeriesGroupReader_h
+
+#include "vtkMetaReader.h"
+
+#include <memory>
+
+struct vtkFileSeriesGroupReaderInternals;
+
+class VTK_EXPORT vtkFileSeriesGroupReader : public vtkMetaReader
+{
+public:
+ static vtkFileSeriesGroupReader* New();
+ vtkTypeMacro(vtkFileSeriesGroupReader, vtkMetaReader);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
+
+ /**
+ * CanReadFile is forwarded to the internal reader if it supports it.
+ */
+ virtual int CanReadFile(const char* filename);
+
+ /**
+ * Adds names of files to be read. The files are read in the order
+ * they are added.
+ */
+ virtual void AddFileName(const char* fname);
+
+ /**
+ * Remove all file names.
+ */
+ virtual void RemoveAllFileNames();
+
+ /**
+ * Returns the number of file names added by AddFileName.
+ */
+ virtual unsigned int GetNumberOfFileNames();
+
+ /**
+ * Returns the name of a file with index idx.
+ */
+ virtual const char* GetFileName(unsigned int idx);
+
+protected:
+ vtkFileSeriesGroupReader();
+ ~vtkFileSeriesGroupReader() override;
+
+ /**
+ * Add/Remove filenames without changing the MTime.
+ */
+ void RemoveAllFileNamesInternal();
+ void AddFileNameInternal(const char*);
+
+ int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
+ int RequestData(vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector, vtkInformationVector* outputVector);
+ int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info);
+
+private:
+ vtkFileSeriesGroupReader(const vtkFileSeriesGroupReader&) = delete;
+ void operator=(const vtkFileSeriesGroupReader&) = delete;
+
+ std::unique_ptr<vtkFileSeriesGroupReaderInternals> Internals;
+};
+
+#endif
</IntVectorProperty>
</SourceProxy>
+
+ <SourceProxy class="vtkFileSeriesGroupReader"
+ file_name_method="SetFileName"
+ label="MED Reader Group"
+ name="MEDReaderGroup"
+ si_class="vtkSIMetaReaderProxy">
+ <SubProxy>
+ <Proxy name="Reader"
+ proxygroup="sources"
+ proxyname="MEDReader"></Proxy>
+ <ExposedProperties>
+ <Property name="Reload" />
+ <Property name="FieldsTreeInfo" />
+ <Property name="FieldsStatus" />
+ <Property name="VectorsProperty" />
+ <Property name="Separator" />
+ <Property name="TimeModeProperty" />
+ <Property name="TimesFlagsInfo" />
+ <Property name="TimesFlagsStatus" />
+ <Property name="GhostCellGeneratorCallForPara" />
+ </ExposedProperties>
+ </SubProxy>
+ <StringVectorProperty animateable="0"
+ clean_command="RemoveAllFileNames"
+ command="AddFileName"
+ name="FileNames"
+ number_of_elements="0"
+ panel_visibility="never"
+ repeat_command="1">
+ <FileListDomain name="files" />
+ <Documentation>The list of files to be read by the
+ reader.</Documentation>
+ </StringVectorProperty>
+ <DoubleVectorProperty
+ information_only="1"
+ name="TimestepValues"
+ repeatable="1">
+ <TimeStepsInformationHelper />
+ </DoubleVectorProperty>
+
+ <Hints>
+ <ReaderFactory extensions="med rmed"
+ file_description="MED Files">
+ </ReaderFactory>
+ </Hints>
+ </SourceProxy>
</ProxyGroup>
<ProxyGroup name="filters">