Attached Files | avs.patch [^] (5,683 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: vtkAVSucdReader.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/IO/vtkAVSucdReader.cxx,v
retrieving revision 1.21
diff -u -3 -p -r1.21 vtkAVSucdReader.cxx
--- a/vtkAVSucdReader.cxx 5 Jun 2004 15:20:56 -0000 1.21
+++ b/vtkAVSucdReader.cxx 28 Jun 2004 16:42:48 -0000
@@ -304,9 +304,25 @@ void vtkAVSucdReader::ExecuteInformation
ncomp_list = new int[this->NumberOfNodeFields];
this->ReadIntBlock(this->NumberOfNodeFields, ncomp_list);
+ this->NodeDataInfo = new DataInfo[this->NumberOfNodeFields];
+
+ float *mx = new float[this->NumberOfNodeFields];
+ // read now the minimums for node_data
+ this->ReadFloatBlock(this->NumberOfNodeFields, mx);
+ for(i=0; i < this->NumberOfNodeFields; i++)
+ {
+ this->NodeDataInfo[i].min = mx[i];
+ }
+ // read now the maximums for node_data
+ this->ReadFloatBlock(this->NumberOfNodeFields, mx);
+ for(i=0; i < this->NumberOfNodeFields; i++)
+ {
+ this->NodeDataInfo[i].max = mx[i];
+ }
+ delete [] mx;
+
offset += 1024 + 1024 + 4 + 3 * 4 * this->NumberOfNodeFields;
- this->NodeDataInfo = new DataInfo[this->NumberOfNodeFields];
k = 0;
for(i=0; i < this->NumberOfNodeComponents; i++)
{
@@ -334,9 +350,25 @@ void vtkAVSucdReader::ExecuteInformation
ncomp_list = new int[this->NumberOfCellFields];
this->ReadIntBlock(this->NumberOfCellFields, ncomp_list);
+ this->CellDataInfo = new DataInfo[this->NumberOfCellFields];
+
+ float *mx = new float[this->NumberOfCellFields];
+ // read now the minimums for cell_data
+ this->ReadFloatBlock(this->NumberOfCellFields, mx);
+ for(i=0; i < this->NumberOfCellFields; i++)
+ {
+ this->NodeDataInfo[i].min = mx[i];
+ }
+ // read now the maximums for cell_data
+ this->ReadFloatBlock(this->NumberOfCellFields, mx);
+ for(i=0; i < this->NumberOfCellFields; i++)
+ {
+ this->NodeDataInfo[i].max = mx[i];
+ }
+ delete [] mx;
+
offset += 1024 + 1024 + 4 + 3 * 4 * this->NumberOfCellFields;
- this->CellDataInfo = new DataInfo[this->NumberOfCellFields];
k = 0;
for(i=0; i < this->NumberOfCellComponents; i++)
{
@@ -390,6 +422,28 @@ void vtkAVSucdReader::ExecuteInformation
}
//----------------------------------------------------------------------------
+void vtkAVSucdReader::GetCellDataRange(int cellComp, int index, float *min, float *max)
+{
+ if (index >= this->CellDataInfo[cellComp].veclen || index < 0)
+ {
+ index = 0; // if wrong index, set it to zero
+ }
+ *min = this->CellDataInfo[index].min;
+ *max = this->CellDataInfo[index].max;
+}
+
+//----------------------------------------------------------------------------
+void vtkAVSucdReader::GetNodeDataRange(int nodeComp, int index, float *min, float *max)
+{
+ if (index >= this->NodeDataInfo[nodeComp].veclen || index < 0)
+ {
+ index = 0; // if wrong index, set it to zero
+ }
+ *min = this->NodeDataInfo[index].min;
+ *max = this->NodeDataInfo[index].max;
+}
+
+//----------------------------------------------------------------------------
void vtkAVSucdReader::ReadGeometry()
{
vtkUnstructuredGrid *output = this->GetOutput();
@@ -986,6 +1040,30 @@ int vtkAVSucdReader::GetNumberOfPointArr
}
//----------------------------------------------------------------------------
+void vtkAVSucdReader::EnableAllPointArrays()
+{
+ this->PointDataArraySelection->EnableAllArrays();
+}
+
+//----------------------------------------------------------------------------
+void vtkAVSucdReader::DisableAllPointArrays()
+{
+ this->PointDataArraySelection->DisableAllArrays();
+}
+
+//----------------------------------------------------------------------------
+void vtkAVSucdReader::EnableAllCellArrays()
+{
+ this->CellDataArraySelection->EnableAllArrays();
+}
+
+//----------------------------------------------------------------------------
+void vtkAVSucdReader::DisableAllCellArrays()
+{
+ this->CellDataArraySelection->DisableAllArrays();
+}
+
+//----------------------------------------------------------------------------
int vtkAVSucdReader::GetLabel(char *string, int number, char *label)
{
int i, j, k, len;
Index: vtkAVSucdReader.h
===================================================================
RCS file: /cvsroot/VTK/VTK/IO/vtkAVSucdReader.h,v
retrieving revision 1.6
diff -u -3 -p -r1.6 vtkAVSucdReader.h
--- a/vtkAVSucdReader.h 5 Jun 2004 15:20:56 -0000 1.6
+++ b/vtkAVSucdReader.h 28 Jun 2004 16:42:48 -0000
@@ -106,6 +106,19 @@ public:
void SetPointArrayStatus(const char* name, int status);
void SetCellArrayStatus(const char* name, int status);
+ void DisableAllCellArrays();
+ void EnableAllCellArrays();
+ void DisableAllPointArrays();
+ void EnableAllPointArrays();
+
+ // get min and max value for the index-th value of a cell component
+ // index varies from 0 to (veclen - 1)
+ void GetCellDataRange(int cellComp, int index, float *min, float *max);
+
+ // get min and max value for the index-th value of a node component
+ // index varies from 0 to (veclen - 1)
+ void GetNodeDataRange(int nodeComp, int index, float *min, float *max);
+
protected:
vtkAVSucdReader();
~vtkAVSucdReader();
@@ -153,6 +166,8 @@ protected:
struct DataInfo {
long foffset; // offset in binary file
int veclen; // number of components in the node or cell variable
+ float min; // pre-calculated data min stored in UCD file
+ float max; // pre-calculated data max stored in UCD file
};
//ETX
|