Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Scott Wittenburg
VTK
Commits
c49426a4
Commit
c49426a4
authored
Jan 10, 2005
by
Amy Squillacote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: convert to using the new pipeline
parent
143e172f
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
552 additions
and
310 deletions
+552
-310
IO/vtkDataObjectReader.cxx
IO/vtkDataObjectReader.cxx
+35
-16
IO/vtkDataObjectReader.h
IO/vtkDataObjectReader.h
+4
-3
IO/vtkDataReader.cxx
IO/vtkDataReader.cxx
+31
-1
IO/vtkDataReader.h
IO/vtkDataReader.h
+20
-3
IO/vtkDataSetReader.cxx
IO/vtkDataSetReader.cxx
+118
-42
IO/vtkDataSetReader.h
IO/vtkDataSetReader.h
+5
-2
IO/vtkPolyDataReader.cxx
IO/vtkPolyDataReader.cxx
+48
-44
IO/vtkPolyDataReader.h
IO/vtkPolyDataReader.h
+4
-2
IO/vtkRectilinearGridReader.cxx
IO/vtkRectilinearGridReader.cxx
+55
-39
IO/vtkRectilinearGridReader.h
IO/vtkRectilinearGridReader.h
+9
-2
IO/vtkStructuredGridReader.cxx
IO/vtkStructuredGridReader.cxx
+57
-39
IO/vtkStructuredGridReader.h
IO/vtkStructuredGridReader.h
+9
-2
IO/vtkStructuredPointsReader.cxx
IO/vtkStructuredPointsReader.cxx
+87
-56
IO/vtkStructuredPointsReader.h
IO/vtkStructuredPointsReader.h
+10
-2
IO/vtkUnstructuredGridReader.cxx
IO/vtkUnstructuredGridReader.cxx
+56
-55
IO/vtkUnstructuredGridReader.h
IO/vtkUnstructuredGridReader.h
+4
-2
No files found.
IO/vtkDataObjectReader.cxx
View file @
c49426a4
...
...
@@ -15,19 +15,23 @@
#include "vtkDataObjectReader.h"
#include "vtkObjectFactory.h"
#include "vtkExecutive.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkFieldData.h"
#include "vtkDataObject.h"
vtkCxxRevisionMacro
(
vtkDataObjectReader
,
"1.1
8
"
);
vtkCxxRevisionMacro
(
vtkDataObjectReader
,
"1.1
9
"
);
vtkStandardNewMacro
(
vtkDataObjectReader
);
vtkDataObjectReader
::
vtkDataObjectReader
()
{
this
->
SetOutput
(
vtkDataObject
::
New
());
vtkDataObject
*
output
=
vtkDataObject
::
New
();
this
->
SetOutput
(
output
);
// Releasing data for pipeline parallism.
// Filters will know it is empty.
this
->
O
utput
s
[
0
]
->
ReleaseData
();
this
->
O
utput
s
[
0
]
->
Delete
();
o
utput
->
ReleaseData
();
o
utput
->
Delete
();
}
vtkDataObjectReader
::~
vtkDataObjectReader
()
...
...
@@ -37,22 +41,29 @@ vtkDataObjectReader::~vtkDataObjectReader()
//----------------------------------------------------------------------------
vtkDataObject
*
vtkDataObjectReader
::
GetOutput
()
{
if
(
this
->
NumberOfOutputs
<
1
)
{
return
NULL
;
}
return
(
vtkDataObject
*
)(
this
->
Outputs
[
0
]);
return
this
->
GetOutput
(
0
);
}
//----------------------------------------------------------------------------
vtkDataObject
*
vtkDataObjectReader
::
GetOutput
(
int
port
)
{
return
vtkDataObject
::
SafeDownCast
(
this
->
GetOutputDataObject
(
port
));
}
//----------------------------------------------------------------------------
void
vtkDataObjectReader
::
SetOutput
(
vtkDataObject
*
output
)
{
this
->
vtkSource
::
SetNth
Output
(
0
,
output
);
this
->
GetExecutive
()
->
Set
Output
Data
(
0
,
output
);
}
void
vtkDataObjectReader
::
Execute
()
int
vtkDataObjectReader
::
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
outputVector
)
{
vtkInformation
*
outInfo
=
outputVector
->
GetInformationObject
(
0
);
vtkDataObject
*
output
=
outInfo
->
Get
(
vtkDataObject
::
DATA_OBJECT
());
char
line
[
256
];
vtkFieldData
*
field
=
NULL
;
...
...
@@ -60,7 +71,7 @@ void vtkDataObjectReader::Execute()
if
(
!
(
this
->
OpenVTKFile
())
||
!
this
->
ReadHeader
())
{
return
;
return
1
;
}
// Read field data until end-of-file
...
...
@@ -72,7 +83,7 @@ void vtkDataObjectReader::Execute()
field
=
this
->
ReadFieldData
();
//reads named field (or first found)
if
(
field
!=
NULL
)
{
this
->
GetO
utput
()
->
SetFieldData
(
field
);
o
utput
->
SetFieldData
(
field
);
field
->
Delete
();
}
}
...
...
@@ -81,19 +92,27 @@ void vtkDataObjectReader::Execute()
{
vtkErrorMacro
(
<<
"Field reader cannot read datasets"
);
this
->
CloseVTKFile
();
return
;
return
1
;
}
else
{
vtkErrorMacro
(
<<
"Unrecognized keyword: "
<<
line
);
this
->
CloseVTKFile
();
return
;
return
1
;
}
}
//while field not read
this
->
CloseVTKFile
();
return
1
;
}
int
vtkDataObjectReader
::
FillOutputPortInformation
(
int
,
vtkInformation
*
info
)
{
info
->
Set
(
vtkDataObject
::
DATA_TYPE_NAME
(),
"vtkDataObject"
);
return
1
;
}
void
vtkDataObjectReader
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
...
...
IO/vtkDataObjectReader.h
View file @
c49426a4
...
...
@@ -42,15 +42,16 @@ public:
// Description:
// Get the output field of this reader.
vtkDataObject
*
GetOutput
();
vtkDataObject
*
GetOutput
(
int
idx
)
{
return
this
->
vtkSource
::
GetOutput
(
idx
);
};
vtkDataObject
*
GetOutput
(
int
idx
);
void
SetOutput
(
vtkDataObject
*
);
protected:
vtkDataObjectReader
();
~
vtkDataObjectReader
();
void
Execute
();
virtual
int
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
);
virtual
int
FillOutputPortInformation
(
int
,
vtkInformation
*
);
private:
vtkDataObjectReader
(
const
vtkDataObjectReader
&
);
// Not implemented.
void
operator
=
(
const
vtkDataObjectReader
&
);
// Not implemented.
...
...
IO/vtkDataReader.cxx
View file @
c49426a4
...
...
@@ -22,6 +22,8 @@
#include "vtkErrorCode.h"
#include "vtkFieldData.h"
#include "vtkFloatArray.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkIntArray.h"
#include "vtkLongArray.h"
#include "vtkLookupTable.h"
...
...
@@ -30,6 +32,7 @@
#include "vtkPointSet.h"
#include "vtkRectilinearGrid.h"
#include "vtkShortArray.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkUnsignedCharArray.h"
#include "vtkUnsignedIntArray.h"
#include "vtkUnsignedLongArray.h"
...
...
@@ -38,7 +41,7 @@
#include <ctype.h>
#include <sys/stat.h>
vtkCxxRevisionMacro
(
vtkDataReader
,
"1.13
2
"
);
vtkCxxRevisionMacro
(
vtkDataReader
,
"1.13
3
"
);
vtkStandardNewMacro
(
vtkDataReader
);
vtkCxxSetObjectMacro
(
vtkDataReader
,
InputArray
,
vtkCharArray
);
...
...
@@ -98,6 +101,9 @@ vtkDataReader::vtkDataReader()
this
->
ReadAllColorScalars
=
0
;
this
->
ReadAllTCoords
=
0
;
this
->
ReadAllFields
=
0
;
this
->
SetNumberOfInputPorts
(
0
);
this
->
SetNumberOfOutputPorts
(
1
);
}
vtkDataReader
::~
vtkDataReader
()
...
...
@@ -2067,6 +2073,30 @@ const char *vtkDataReader::GetFieldDataNameInFile(int i)
}
}
int
vtkDataReader
::
ProcessRequest
(
vtkInformation
*
request
,
vtkInformationVector
**
inputVector
,
vtkInformationVector
*
outputVector
)
{
// generate the data
if
(
request
->
Has
(
vtkDemandDrivenPipeline
::
REQUEST_DATA
()))
{
return
this
->
RequestData
(
request
,
inputVector
,
outputVector
);
}
if
(
request
->
Has
(
vtkStreamingDemandDrivenPipeline
::
REQUEST_UPDATE_EXTENT
()))
{
return
this
->
RequestUpdateExtent
(
request
,
inputVector
,
outputVector
);
}
// execute information
if
(
request
->
Has
(
vtkDemandDrivenPipeline
::
REQUEST_INFORMATION
()))
{
return
this
->
RequestInformation
(
request
,
inputVector
,
outputVector
);
}
return
this
->
Superclass
::
ProcessRequest
(
request
,
inputVector
,
outputVector
);
}
void
vtkDataReader
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
{
this
->
Superclass
::
PrintSelf
(
os
,
indent
);
...
...
IO/vtkDataReader.h
View file @
c49426a4
...
...
@@ -26,7 +26,7 @@
#ifndef __vtkDataReader_h
#define __vtkDataReader_h
#include "vtk
Source
.h"
#include "vtk
Algorithm
.h"
#define VTK_ASCII 1
#define VTK_BINARY 2
...
...
@@ -39,11 +39,11 @@ class vtkFieldData;
class
vtkPointSet
;
class
vtkRectilinearGrid
;
class
VTK_IO_EXPORT
vtkDataReader
:
public
vtk
Source
class
VTK_IO_EXPORT
vtkDataReader
:
public
vtk
Algorithm
{
public:
static
vtkDataReader
*
New
();
vtkTypeRevisionMacro
(
vtkDataReader
,
vtk
Source
);
vtkTypeRevisionMacro
(
vtkDataReader
,
vtk
Algorithm
);
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
);
// Description:
...
...
@@ -297,6 +297,11 @@ public:
istream
*
GetIStream
()
{
return
this
->
IS
;};
//ETX
// Description:
// Read the meta information from the file. This needs to be public to it
// can be accessed by vtkDataSetReader.
virtual
int
ReadMetaData
(
vtkInformation
*
)
{
return
1
;
}
protected:
vtkDataReader
();
~
vtkDataReader
();
...
...
@@ -375,6 +380,18 @@ protected:
// vtkWriter::EncodeName.
void
DecodeArrayName
(
char
*
resname
,
const
char
*
name
);
virtual
int
ProcessRequest
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
);
virtual
int
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
)
{
return
1
;
}
virtual
int
RequestUpdateExtent
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
)
{
return
1
;
}
virtual
int
RequestInformation
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
)
{
return
1
;
}
private:
vtkDataReader
(
const
vtkDataReader
&
);
// Not implemented.
void
operator
=
(
const
vtkDataReader
&
);
// Not implemented.
...
...
IO/vtkDataSetReader.cxx
View file @
c49426a4
...
...
@@ -14,11 +14,14 @@
=========================================================================*/
#include "vtkDataSetReader.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
#include "vtkPolyDataReader.h"
#include "vtkRectilinearGrid.h"
#include "vtkRectilinearGridReader.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkStructuredGrid.h"
#include "vtkStructuredGridReader.h"
#include "vtkStructuredPoints.h"
...
...
@@ -26,11 +29,16 @@
#include "vtkUnstructuredGrid.h"
#include "vtkUnstructuredGridReader.h"
vtkCxxRevisionMacro
(
vtkDataSetReader
,
"1.6
5
"
);
vtkCxxRevisionMacro
(
vtkDataSetReader
,
"1.6
6
"
);
vtkStandardNewMacro
(
vtkDataSetReader
);
vtkDataSetReader
::
vtkDataSetReader
()
{
// need a default output, and can't create a vtkDataSet because it's an
// abstract class, so default must be a subclass of vtkDataSet
vtkPolyData
*
output
=
vtkPolyData
::
New
();
this
->
GetExecutive
()
->
SetOutputData
(
0
,
output
);
output
->
Delete
();
}
vtkDataSetReader
::~
vtkDataSetReader
()
...
...
@@ -39,37 +47,111 @@ vtkDataSetReader::~vtkDataSetReader()
vtkDataSet
*
vtkDataSetReader
::
GetOutput
()
{
// check to see if an execute is necessary.
if
(
this
->
Outputs
&&
this
->
Outputs
[
0
]
&&
this
->
Outputs
[
0
]
->
GetUpdateTime
()
>
this
->
GetMTime
(
))
if
(
this
->
GetFileName
()
==
NULL
&&
(
this
->
GetReadFromInputString
()
==
0
||
(
this
->
GetInputArray
()
==
NULL
&&
this
->
GetInputString
()
==
NULL
)
))
{
return
(
vtkDataSet
*
)(
this
->
Outputs
[
0
]);
vtkWarningMacro
(
<<
"FileName must be set"
);
return
(
vtkDataSet
*
)
NULL
;
}
// The filename might have changed (changing the output).
// We need to re execute.
if
(
this
->
GetFileName
()
==
NULL
&&
(
this
->
GetReadFromInputString
()
==
0
||
vtkDataObject
*
output
=
this
->
GetOutputDataObject
(
0
);
int
outputType
=
this
->
ReadOutputType
();
if
(
output
&&
(
output
->
GetDataObjectType
()
==
outputType
))
{
return
vtkDataSet
::
SafeDownCast
(
output
);
}
switch
(
outputType
)
{
case
VTK_POLY_DATA
:
output
=
vtkPolyData
::
New
();
this
->
GetExecutive
()
->
SetOutputData
(
0
,
output
);
output
->
Delete
();
break
;
case
VTK_STRUCTURED_POINTS
:
output
=
vtkStructuredPoints
::
New
();
output
->
Delete
();
break
;
case
VTK_STRUCTURED_GRID
:
output
=
vtkStructuredGrid
::
New
();
this
->
GetExecutive
()
->
SetOutputData
(
0
,
output
);
output
->
Delete
();
break
;
case
VTK_RECTILINEAR_GRID
:
output
=
vtkRectilinearGrid
::
New
();
this
->
GetExecutive
()
->
SetOutputData
(
0
,
output
);
output
->
Delete
();
break
;
case
VTK_UNSTRUCTURED_GRID
:
output
=
vtkUnstructuredGrid
::
New
();
this
->
GetExecutive
()
->
SetOutputData
(
0
,
output
);
output
->
Delete
();
break
;
default:
return
NULL
;
}
return
this
->
GetOutput
(
0
);
}
int
vtkDataSetReader
::
RequestInformation
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
outputVector
)
{
vtkInformation
*
outInfo
=
outputVector
->
GetInformationObject
(
0
);
if
(
this
->
GetFileName
()
==
NULL
&&
(
this
->
GetReadFromInputString
()
==
0
||
(
this
->
GetInputArray
()
==
NULL
&&
this
->
GetInputString
()
==
NULL
)))
{
vtkWarningMacro
(
<<
"FileName must be set"
);
return
(
vtkDataSet
*
)
NULL
;
return
0
;
}
this
->
Execute
();
if
(
this
->
Outputs
==
NULL
)
vtkDataReader
*
reader
=
0
;
int
retVal
;
switch
(
this
->
ReadOutputType
())
{
return
NULL
;
case
VTK_POLY_DATA
:
reader
=
vtkPolyDataReader
::
New
();
break
;
case
VTK_STRUCTURED_POINTS
:
reader
=
vtkStructuredPointsReader
::
New
();
break
;
case
VTK_STRUCTURED_GRID
:
reader
=
vtkStructuredGridReader
::
New
();
break
;
case
VTK_RECTILINEAR_GRID
:
reader
=
vtkRectilinearGridReader
::
New
();
break
;
case
VTK_UNSTRUCTURED_GRID
:
reader
=
vtkUnstructuredGridReader
::
New
();
break
;
default:
reader
=
NULL
;
}
else
if
(
reader
)
{
return
(
vtkDataSet
*
)
this
->
Outputs
[
0
];
reader
->
SetFileName
(
this
->
GetFileName
());
reader
->
SetReadFromInputString
(
this
->
GetReadFromInputString
());
reader
->
SetInputArray
(
this
->
GetInputArray
());
reader
->
SetInputString
(
this
->
GetInputString
());
retVal
=
reader
->
ReadMetaData
(
outInfo
);
reader
->
Delete
();
return
retVal
;
}
return
1
;
}
void
vtkDataSetReader
::
Execute
()
int
vtkDataSetReader
::
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
outputVector
)
{
vtkDataObject
*
output
;
vtkInformation
*
outInfo
=
outputVector
->
GetInformationObject
(
0
);
vtkDataObject
*
output
=
outInfo
->
Get
(
vtkDataObject
::
DATA_OBJECT
());
vtkDebugMacro
(
<<
"Reading vtk dataset..."
);
...
...
@@ -99,20 +181,19 @@ void vtkDataSetReader::Execute()
preader
->
SetReadAllFields
(
this
->
GetReadAllFields
());
preader
->
Update
();
// Can we use the old output?
output
=
this
->
Outputs
?
this
->
Outputs
[
0
]
:
NULL
;
if
(
!
(
output
&&
strcmp
(
output
->
GetClassName
(),
"vtkPolyData"
)
==
0
))
{
// Hack to make sure that the object is not modified
// with SetNthOutput. Otherwise, extra executions occur.
vtkTimeStamp
ts
=
this
->
MTime
;
output
=
vtkPolyData
::
New
();
this
->
Set
Nth
Output
(
0
,
output
);
this
->
GetExecutive
()
->
SetOutput
Data
(
0
,
output
);
output
->
Delete
();
this
->
MTime
=
ts
;
}
output
->
ShallowCopy
(
preader
->
GetOutput
());
preader
->
Delete
();
return
;
return
1
;
}
case
VTK_STRUCTURED_POINTS
:
{
...
...
@@ -138,20 +219,19 @@ void vtkDataSetReader::Execute()
preader
->
SetReadAllFields
(
this
->
GetReadAllFields
());
preader
->
Update
();
// Can we use the old output?
output
=
this
->
Outputs
?
this
->
Outputs
[
0
]
:
NULL
;
if
(
!
(
output
&&
strcmp
(
output
->
GetClassName
(),
"vtkStructuredPoints"
)
==
0
))
{
// Hack to make sure that the object is not modified
// with SetNthOutput. Otherwise, extra executions occur.
vtkTimeStamp
ts
=
this
->
MTime
;
output
=
vtkStructuredPoints
::
New
();
this
->
Set
Nth
Output
(
0
,
output
);
this
->
GetExecutive
()
->
SetOutput
Data
(
0
,
output
);
output
->
Delete
();
this
->
MTime
=
ts
;
}
output
->
ShallowCopy
(
preader
->
GetOutput
());
preader
->
Delete
();
return
;
return
1
;
}
case
VTK_STRUCTURED_GRID
:
{
...
...
@@ -177,20 +257,19 @@ void vtkDataSetReader::Execute()
preader
->
SetReadAllFields
(
this
->
GetReadAllFields
());
preader
->
Update
();
// Can we use the old output?
output
=
this
->
Outputs
?
this
->
Outputs
[
0
]
:
NULL
;
if
(
!
(
output
&&
strcmp
(
output
->
GetClassName
(),
"vtkStructuredGrid"
)
==
0
))
{
// Hack to make sure that the object is not modified
// with SetNthOutput. Otherwise, extra executions occur.
vtkTimeStamp
ts
=
this
->
MTime
;
output
=
vtkStructuredGrid
::
New
();
this
->
Set
Nth
Output
(
0
,
output
);
this
->
GetExecutive
()
->
SetOutput
Data
(
0
,
output
);
output
->
Delete
();
this
->
MTime
=
ts
;
}
output
->
ShallowCopy
(
preader
->
GetOutput
());
preader
->
Delete
();
return
;
return
1
;
}
case
VTK_RECTILINEAR_GRID
:
{
...
...
@@ -216,20 +295,19 @@ void vtkDataSetReader::Execute()
preader
->
SetReadAllFields
(
this
->
GetReadAllFields
());
preader
->
Update
();
// Can we use the old output?
output
=
this
->
Outputs
?
this
->
Outputs
[
0
]
:
NULL
;
if
(
!
(
output
&&
strcmp
(
output
->
GetClassName
(),
"vtkRectilinearGrid"
)
==
0
))
{
// Hack to make sure that the object is not modified
// with SetNthOutput. Otherwise, extra executions occur.
vtkTimeStamp
ts
=
this
->
MTime
;
output
=
vtkRectilinearGrid
::
New
();
this
->
Set
Nth
Output
(
0
,
output
);
this
->
GetExecutive
()
->
SetOutput
Data
(
0
,
output
);
output
->
Delete
();
this
->
MTime
=
ts
;
}
output
->
ShallowCopy
(
preader
->
GetOutput
());
preader
->
Delete
();
return
;
return
1
;
}
case
VTK_UNSTRUCTURED_GRID
:
{
...
...
@@ -255,27 +333,26 @@ void vtkDataSetReader::Execute()
preader
->
SetReadAllFields
(
this
->
GetReadAllFields
());
preader
->
Update
();
// Can we use the old output?
output
=
this
->
Outputs
?
this
->
Outputs
[
0
]
:
NULL
;
if
(
!
(
output
&&
strcmp
(
output
->
GetClassName
(),
"vtkUnstructuredGrid"
)
==
0
))
{
// Hack to make sure that the object is not modified
// with SetNthOutput. Otherwise, extra executions occur.
vtkTimeStamp
ts
=
this
->
MTime
;
output
=
vtkUnstructuredGrid
::
New
();
this
->
Set
Nth
Output
(
0
,
output
);
this
->
GetExecutive
()
->
SetOutput
Data
(
0
,
output
);
output
->
Delete
();
this
->
MTime
=
ts
;
}
output
->
ShallowCopy
(
preader
->
GetOutput
());
preader
->
Delete
();
return
;
return
1
;
}
default:
vtkErrorMacro
(
"Could not read file "
<<
this
->
FileName
);
}
return
0
;
}
int
vtkDataSetReader
::
ReadOutputType
()
{
char
line
[
256
];
...
...
@@ -333,12 +410,10 @@ int vtkDataSetReader::ReadOutputType()
return
-
1
;
}
}
else
if
(
!
strncmp
(
this
->
LowerCase
(
line
),
"field"
,(
unsigned
long
)
5
)
)
{
//vtkErrorMacro(<<"This object can only read datasets, not fields");
}
else
{
//vtkErrorMacro(<<"Expecting DATASET keyword, got " << line << " instead");
...
...
@@ -347,10 +422,6 @@ int vtkDataSetReader::ReadOutputType()
return
-
1
;
}
vtkPolyData
*
vtkDataSetReader
::
GetPolyDataOutput
()
{
return
vtkPolyData
::
SafeDownCast
(
this
->
GetOutput
());
...
...
@@ -376,7 +447,6 @@ vtkRectilinearGrid *vtkDataSetReader::GetRectilinearGridOutput()
return
vtkRectilinearGrid
::
SafeDownCast
(
this
->
GetOutput
());
}
//----------------------------------------------------------------------------
void
vtkDataSetReader
::
Update
()
{
...
...
@@ -393,5 +463,11 @@ void vtkDataSetReader::PrintSelf(ostream& os, vtkIndent indent)
vtkDataSet
*
vtkDataSetReader
::
GetOutput
(
int
idx
)
{
return
static_cast
<
vtkDataSet
*>
(
this
->
vtkSource
::
GetOutput
(
idx
));
return
vtkDataSet
::
SafeDownCast
(
this
->
GetOutputDataObject
(
idx
));
}
int
vtkDataSetReader
::
FillOutputPortInformation
(
int
,
vtkInformation
*
info
)
{
info
->
Set
(
vtkDataObject
::
DATA_TYPE_NAME
(),
"vtkDataSet"
);
return
1
;
}
IO/vtkDataSetReader.h
View file @
c49426a4
...
...
@@ -79,8 +79,11 @@ protected:
vtkDataSetReader
();
~
vtkDataSetReader
();
void
Execute
();
vtkDataReader
*
Reader
;
virtual
int
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
);
virtual
int
FillOutputPortInformation
(
int
,
vtkInformation
*
);
virtual
int
RequestInformation
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
);
private:
vtkDataSetReader
(
const
vtkDataSetReader
&
);
// Not implemented.
...
...
IO/vtkPolyDataReader.cxx
View file @
c49426a4
...
...
@@ -17,19 +17,22 @@
#include "vtkCellArray.h"
#include "vtkFieldData.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro
(
vtkPolyDataReader
,
"1.2
7
"
);
vtkCxxRevisionMacro
(
vtkPolyDataReader
,
"1.2
8
"
);
vtkStandardNewMacro
(
vtkPolyDataReader
);
vtkPolyDataReader
::
vtkPolyDataReader
()
{
this
->
vtkSource
::
SetNthOutput
(
0
,
vtkPolyData
::
New
());
vtkPolyData
*
output
=
vtkPolyData
::
New
();
this
->
SetOutput
(
output
);
// Releasing data for pipeline parallism.
// Filters will know it is empty.
this
->
O
utput
s
[
0
]
->
ReleaseData
();
this
->
O
utput
s
[
0
]
->
Delete
();
o
utput
->
ReleaseData
();
o
utput
->
Delete
();
this
->
ExecutePiece
=
this
->
ExecuteNumberOfPieces
=
0
;
this
->
ExecuteGhostLevel
=
0
;
}
...
...
@@ -47,43 +50,39 @@ vtkPolyData* vtkPolyDataReader::GetOutput()
//----------------------------------------------------------------------------
vtkPolyData
*
vtkPolyDataReader
::
GetOutput
(
int
idx
)
{
return
static_cast
<
vtkPolyData
*>
(
this
->
vtkSource
::
GetOutpu
t
(
idx
));
return
vtkPolyData
::
SafeDownCast
(
this
->
GetOutputDataObjec
t
(
idx
));
}