Commit 4f0860ff authored by Charles Law's avatar Charles Law
Browse files

Works with paraview's batch mode now.

parent 000a4b08
...@@ -69,7 +69,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -69,7 +69,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
vtkStandardNewMacro(vtkXdmfReader); vtkStandardNewMacro(vtkXdmfReader);
vtkCxxRevisionMacro(vtkXdmfReader, "1.5"); vtkCxxRevisionMacro(vtkXdmfReader, "1.6");
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) #if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__))
# include <direct.h> # include <direct.h>
...@@ -96,7 +96,10 @@ vtkXdmfReader::vtkXdmfReader() ...@@ -96,7 +96,10 @@ vtkXdmfReader::vtkXdmfReader()
{ {
this->Internals = new vtkXdmfReaderInternal; this->Internals = new vtkXdmfReaderInternal;
// I have this flag because I do not want to change the initialization
// of the output to the generic output. It might break something;
this->SetOutput(vtkDataObject::New()); this->SetOutput(vtkDataObject::New());
this->OutputsInitialized = 0;
// Releasing data for pipeline parallism. // Releasing data for pipeline parallism.
// Filters will know it is empty. // Filters will know it is empty.
this->Outputs[0]->ReleaseData(); this->Outputs[0]->ReleaseData();
...@@ -164,6 +167,10 @@ vtkXdmfReader::~vtkXdmfReader() ...@@ -164,6 +167,10 @@ vtkXdmfReader::~vtkXdmfReader()
vtkDataSet *vtkXdmfReader::GetOutput() vtkDataSet *vtkXdmfReader::GetOutput()
{ {
if ( ! this->OutputsInitialized)
{
this->ExecuteInformation();
}
if (this->NumberOfOutputs < 1) if (this->NumberOfOutputs < 1)
{ {
return NULL; return NULL;
...@@ -172,18 +179,27 @@ vtkDataSet *vtkXdmfReader::GetOutput() ...@@ -172,18 +179,27 @@ vtkDataSet *vtkXdmfReader::GetOutput()
return static_cast<vtkDataSet *>(this->Outputs[0]); return static_cast<vtkDataSet *>(this->Outputs[0]);
} }
//----------------------------------------------------------------------------
void vtkXdmfReader::SetOutput(vtkDataSet *output) void vtkXdmfReader::SetOutput(vtkDataSet *output)
{ {
this->OutputsInitialized = 1;
this->vtkSource::SetNthOutput(0, output); this->vtkSource::SetNthOutput(0, output);
} }
//----------------------------------------------------------------------------
void vtkXdmfReader::SetOutput(vtkDataObject *output) void vtkXdmfReader::SetOutput(vtkDataObject *output)
{ {
this->OutputsInitialized = 1;
this->vtkSource::SetNthOutput(0, output); this->vtkSource::SetNthOutput(0, output);
} }
//----------------------------------------------------------------------------
vtkDataSet *vtkXdmfReader::GetOutput(int idx) vtkDataSet *vtkXdmfReader::GetOutput(int idx)
{ {
if ( ! this->OutputsInitialized)
{
this->ExecuteInformation();
}
return static_cast<vtkDataSet *>( this->Superclass::GetOutput(idx) ); return static_cast<vtkDataSet *>( this->Superclass::GetOutput(idx) );
} }
...@@ -863,6 +879,9 @@ void vtkXdmfReader::ExecuteInformation() ...@@ -863,6 +879,9 @@ void vtkXdmfReader::ExecuteInformation()
int type_changed = 0; int type_changed = 0;
if ( vGrid ) if ( vGrid )
{ {
// Put this here so that GetOutput
// does not call ExecuteInfomrtion again.
this->OutputsInitialized = 1;
if ( this->GetOutput()->GetClassName() != vGrid->GetClassName() ) if ( this->GetOutput()->GetClassName() != vGrid->GetClassName() )
{ {
type_changed = 1; type_changed = 1;
......
...@@ -192,6 +192,7 @@ protected: ...@@ -192,6 +192,7 @@ protected:
vtkXdmfReaderInternal* Internals; vtkXdmfReaderInternal* Internals;
int Stride[3]; int Stride[3];
int OutputsInitialized;
private: private:
vtkXdmfReader(const vtkXdmfReader&); // Not implemented vtkXdmfReader(const vtkXdmfReader&); // Not implemented
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment