Commit eee52148 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: No more virtual base classes.

parent df5cb925
......@@ -202,10 +202,8 @@ inline void vlCellArray::ReverseCell(int loc)
// Replace the point ids of the cell with a different list of point ids.
inline void vlCellArray::ReplaceCell(int loc, int npts, int *pts)
{
int i;
int npts=this->Ia.GetValue(loc);
int *oldPts=this->Ia.GetPtr(loc+1);
for (i=0; i < npts; i++) oldPts[i] = pts[i];
for (int i=0; i < npts; i++) oldPts[i] = pts[i];
}
#endif
......@@ -29,7 +29,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "PtData.hh"
#include "Cell.hh"
class vlDataSet : virtual public vlObject
class vlDataSet : public vlObject
{
public:
vlDataSet();
......@@ -43,7 +43,7 @@ public:
virtual void Initialize();
// Description:
// Absorb update methods which propagate through network.
// Provides opportunity for data to clean itself up before execution.
virtual void Update() {};
// Description:
......
......@@ -21,64 +21,48 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlDataSetCollection_hh
#define __vlDataSetCollection_hh
#include "Object.hh"
#include "Collect.hh"
#include "DataSet.hh"
class vlDataSetCollectionElement
{
public:
vlDataSetCollectionElement():Item(NULL),Next(NULL) {};
vlDataSet *Item;
vlDataSetCollectionElement *Next;
};
class vlDataSetCollection : public vlObject
class vlDataSetCollection : public vlCollection
{
public:
vlDataSetCollection();
~vlDataSetCollection();
void PrintSelf(ostream& os, vlIndent indent);
char *GetClassName() {return "vlDataSetCollection";};
void AddItem(vlDataSet *);
void RemoveItem(vlDataSet *);
int IsItemPresent(vlDataSet *);
int GetNumberOfItems();
void InitTraversal();
vlDataSet *GetNextItem();
protected:
int NumberOfItems;
vlDataSetCollectionElement *Top;
vlDataSetCollectionElement *Bottom;
vlDataSetCollectionElement *Current;
};
// Description:
// Initialize the traversal of the collection. This means the data pointer
// is set at the beginning of the list.
inline void vlDataSetCollection::InitTraversal()
// Add an DataSet to the list.
inline void vlDataSetCollection::AddItem(vlDataSet *ds)
{
this->vlCollection::AddItem((vlObject *)ds);
}
// Description:
// Remove an DataSet from the list.
inline void vlDataSetCollection::RemoveItem(vlDataSet *ds)
{
this->Current = this->Top;
this->vlCollection::RemoveItem((vlObject *)ds);
}
// Description:
// Get the next item in the collection. NULL is returned if the collection
// is exhausted.
inline vlDataSet *vlDataSetCollection::GetNextItem()
// Determine whether a particular DataSet is present. Returns its position
// in the list.
inline int vlDataSetCollection::IsItemPresent(vlDataSet *ds)
{
vlDataSetCollectionElement *elem=this->Current;
return this->vlCollection::IsItemPresent((vlObject *)ds);
}
if ( elem != NULL )
{
this->Current = elem->Next;
return elem->Item;
}
else
{
return NULL;
}
// Description:
// Get the next DataSet in the list.
inline vlDataSet *vlDataSetCollection::GetNextItem()
{
return (vlDataSet *)(this->vlCollection::GetNextItem());
}
#endif
......@@ -27,21 +27,13 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
class vlDataSetFilter : public vlFilter
{
public:
vlDataSetFilter();
vlDataSetFilter() {};
~vlDataSetFilter();
char *GetClassName() {return "vlDataSetFilter";};
void PrintSelf(ostream& os, vlIndent indent);
void Update();
// Description:
// Specify the input object.
vlSetObjectMacro(Input,vlDataSet);
vlGetObjectMacro(Input,vlDataSet);
protected:
vlDataSet *Input;
void _PrintSelf(ostream& os, vlIndent indent);
void SetInput(vlDataSet *input);
void SetInput(vlDataSet &input) {this->SetInput(&input);};
vlDataSet *GetInput() {return this->Input;};
};
#endif
......
......@@ -16,34 +16,35 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
// .NAME vlFilter - abstract class for specifying filter behaviour
// .SECTION Description
// vlFilter is an abstract class that specifies the interface for data
// filters. Each filter must have an Update() method that will cause the
// filter to execute if its input or the filter itself has been modified
// since the last execution time.
// filters. Each filter must have an UpdateFilter() and Execute() method
// that will cause the filter to execute if its input or the filter itself
// has been modified since the last execution time.
#ifndef __vlFilter_h
#define __vlFilter_h
#include "Object.hh"
#include "LWObject.hh"
#include "DataSet.hh"
class vlFilter : virtual public vlObject
class vlFilter : public vlLWObject
{
public:
vlFilter();
~vlFilter() {};
char *GetClassName() {return "vlFilter";};
void PrintSelf(ostream& os, vlIndent indent);
virtual ~vlFilter() {};
void _PrintSelf(ostream& os, vlIndent indent);
// Description:
// All filters must provide a method to update the visualization
// pipeline.
virtual void Update() = 0;
virtual void UpdateFilter();
void SetStartMethod(void (*f)(void *), void *arg);
void SetEndMethod(void (*f)(void *), void *arg);
protected:
virtual void Execute()
{vlErrorMacro(<< "Execute is a Filter subclass responsibility");};
vlDataSet *Input;
virtual void Execute();
char Updating;
void (*StartMethod)(void *);
void *StartMethodArg;
......
......@@ -42,7 +42,7 @@ public:
// modified time
virtual unsigned long int GetMTime();
void Modified();
virtual void Modified();
// printing
virtual void PrintSelf(ostream& os, vlIndent indent);
......
......@@ -27,7 +27,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "DataSet.hh"
#include "Locator.hh"
class vlPointSet : virtual public vlDataSet
class vlPointSet : public vlDataSet
{
public:
vlPointSet();
......
......@@ -21,64 +21,47 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlPolyDataCollection_hh
#define __vlPolyDataCollection_hh
#include "Object.hh"
#include "Collect.hh"
#include "PolyData.hh"
class vlPolyDataCollectionElement
{
public:
vlPolyDataCollectionElement():Item(NULL),Next(NULL) {};
vlPolyData *Item;
vlPolyDataCollectionElement *Next;
};
class vlPolyDataCollection : public vlObject
class vlPolyDataCollection : public vlCollection
{
public:
vlPolyDataCollection();
~vlPolyDataCollection();
void PrintSelf(ostream& os, vlIndent indent);
char *GetClassName() {return "vlPolyDataCollection";};
void AddItem(vlPolyData *);
void RemoveItem(vlPolyData *);
int IsItemPresent(vlPolyData *);
int GetNumberOfItems();
void InitTraversal();
vlPolyData *GetNextItem();
protected:
int NumberOfItems;
vlPolyDataCollectionElement *Top;
vlPolyDataCollectionElement *Bottom;
vlPolyDataCollectionElement *Current;
};
// Description:
// Initialize the traversal of the collection. This means the data pointer
// is set at the beginning of the list.
inline void vlPolyDataCollection::InitTraversal()
// Add an PolyData to the list.
inline void vlPolyDataCollection::AddItem(vlPolyData *ds)
{
this->Current = this->Top;
this->vlCollection::AddItem((vlObject *)ds);
}
// Description:
// Get the next item in the collection. NULL is returned if the collection
// is exhausted.
inline vlPolyData *vlPolyDataCollection::GetNextItem()
// Remove an PolyData from the list.
inline void vlPolyDataCollection::RemoveItem(vlPolyData *ds)
{
vlPolyDataCollectionElement *elem=this->Current;
this->vlCollection::RemoveItem((vlObject *)ds);
}
if ( elem != NULL )
{
this->Current = elem->Next;
return elem->Item;
}
else
{
return NULL;
}
// Description:
// Determine whether a particular PolyData is present. Returns its position
// in the list.
inline int vlPolyDataCollection::IsItemPresent(vlPolyData *ds)
{
return this->vlCollection::IsItemPresent((vlObject *)ds);
}
// Description:
// Get the next PolyData in the list.
inline vlPolyData *vlPolyDataCollection::GetNextItem()
{
return (vlPolyData *)(this->vlCollection::GetNextItem());
}
#endif
......@@ -24,23 +24,17 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#include "Filter.hh"
#include "PolyData.hh"
class vlPolyFilter : public vlFilter {
class vlPolyFilter : public vlFilter
{
public:
vlPolyFilter() : Input(NULL) {};
vlPolyFilter() {};
~vlPolyFilter();
char *GetClassName() {return "vlPolyFilter";};
void PrintSelf(ostream& os, vlIndent indent);
void Update();
// Description:
// Specify the input object.
vlSetObjectMacro(Input,vlPolyData);
vlGetObjectMacro(Input,vlPolyData);
protected:
vlPolyData *Input;
void _PrintSelf(ostream& os, vlIndent indent);
void SetInput(vlPolyData *input);
void SetInput(vlPolyData &input) {this->SetInput(&input);};
vlPolyData *GetInput() {return (vlPolyData *)this->Input;};
};
#endif
......
......@@ -27,21 +27,13 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
class vlPointSetFilter : public vlFilter
{
public:
vlPointSetFilter();
vlPointSetFilter() {};
~vlPointSetFilter();
char *GetClassName() {return "vlPointSetFilter";};
void PrintSelf(ostream& os, vlIndent indent);
void Update();
// Description:
// Specify the input object.
vlSetObjectMacro(Input,vlPointSet);
vlGetObjectMacro(Input,vlPointSet);
protected:
vlPointSet *Input;
void _PrintSelf(ostream& os, vlIndent indent);
void SetInput(vlPointSet *input);
void SetInput(vlPointSet &input) {this->SetInput(&input);};
vlPointSet *GetInput() {return (vlPointSet *)this->Input;};
};
#endif
......
......@@ -37,6 +37,8 @@ public:
char *GetDataType() {return "vlStructuredGrid";};
void PrintSelf(ostream& os, vlIndent indent);
unsigned long GetMtime();
// dataset interface
vlDataSet *MakeObject() {return new vlStructuredGrid(*this);};
void Initialize();
......@@ -45,11 +47,9 @@ public:
int GetCellType(int cellId);
float *GetPoint(int ptId) {return this->vlPointSet::GetPoint(ptId);};
int FindCell(float x[3], vlCell *cell, float tol2, int& subId, float pcoords[3]) { return this->vlPointSet::FindCell(x,cell,tol2,subId,pcoords);}
int GetNumberOfCells() {return this->vlStructuredData::GetNumberOfCells();};
void GetCellPoints(int cellId, vlIdList& ptIds) {this->vlStructuredData::GetCellPoints(cellId,ptIds);};
void GetPointCells(int ptId, vlIdList& cellIds) {this->vlStructuredData::GetPointCells(ptId,cellIds);};
void GetCellNeighbors(int cellId, vlIdList& ptIds, vlIdList& cellIds)
{this->vlStructuredData::GetCellNeighbors(cellId,ptIds,cellIds);};
int GetNumberOfCells();
void GetCellPoints(int cellId, vlIdList& ptIds);
void GetPointCells(int ptId, vlIdList& cellIds);
protected:
// points inherited
......@@ -57,4 +57,19 @@ protected:
// blanking information inherited
};
inline int vlStructuredGrid::GetNumberOfCells()
{
return this->vlStructuredData::_GetNumberOfCells();
}
inline void vlStructuredGrid::GetCellPoints(int cellId, vlIdList& ptIds)
{
this->vlStructuredData::_GetCellPoints(cellId,ptIds);
}
inline void vlStructuredGrid::GetPointCells(int ptId, vlIdList& cellIds)
{
this->vlStructuredData::_GetPointCells(ptId,cellIds);
}
#endif
......@@ -6,44 +6,35 @@
Date: $Date$
Version: $Revision$
This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.
This file is part of the Visualization Library. No part of this file or its
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
// .NAME vlStructuredDataFilter - filter that takes vlStructuredData as input
// .NAME vlStructuredGridFilter - filter that takes vlStructuredGrid as input
// .SECTION Description
// vlStructuredDataFilter is a filter that takes a single
// vlStructuredData data object as input.
// vlStructuredGridFilter is a filter that takes a single
// vlStructuredGrid Grid object as input.
#ifndef __vlStructuredDataFilter_h
#define __vlStructuredDataFilter_h
#ifndef __vlStructuredGridFilter_h
#define __vlStructuredGridFilter_h
#include "Filter.hh"
#include "StrData.hh"
#include "SGrid.hh"
class vlStructuredDataFilter : public vlFilter
class vlStructuredGridFilter : public vlFilter
{
public:
vlStructuredDataFilter();
~vlStructuredDataFilter();
char *GetClassName() {return "vlStructuredDataFilter";};
void PrintSelf(ostream& os, vlIndent indent);
vlStructuredGridFilter();
~vlStructuredGridFilter();
void _PrintSelf(ostream& os, vlIndent indent);
void Update();
// Description:
// Specify the input object.
vlSetObjectMacro(Input,vlStructuredData);
vlGetObjectMacro(Input,vlStructuredData);
protected:
vlStructuredData *Input;
void SetInput(vlStructuredGrid *input);
void SetInput(vlStructuredGrid &input) {this->SetInput(&input);};
vlStructuredGrid *GetInput() {return (vlStructuredGrid *)this->Input;};
};
#endif
......@@ -23,8 +23,9 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlStructuredData_h
#define __vlStructuredData_h
#include "DataSet.hh"
#include "LWObject.hh"
#include "BArray.hh"
#include "IdList.hh"
#define SINGLE_POINT 0
#define X_LINE 1
......@@ -35,25 +36,19 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#define XZ_PLANE 6
#define XYZ_GRID 7
class vlStructuredData : virtual public vlDataSet {
class vlStructuredData : public vlLWObject
{
public:
vlStructuredData();
vlStructuredData(const vlStructuredData& sds);
~vlStructuredData();
char *GetClassName() {return "vlStructuredData";};
void PrintSelf(ostream& os, vlIndent indent);
// dataset interface
int GetNumberOfCells();
int GetNumberOfPoints();
void Initialize();
void GetCellPoints(int cellId, vlIdList& ptIds);
void GetPointCells(int ptId, vlIdList& cellIds);
virtual ~vlStructuredData();
void _PrintSelf(ostream& os, vlIndent indent);
// specific object methods
// setting object dimensions
void SetDimensions(int i, int j, int k);
void SetDimensions(int dim[3]);
vlGetVectorMacro(Dimensions,int,3);
int *GetDimensions();
void GetDimensions(int dim[3]);
int GetDataDimension();
......@@ -65,6 +60,13 @@ public:
int IsPointVisible(int ptId);
protected:
// methods to support datasets (done because of MI problems)
int _GetNumberOfCells();
int _GetNumberOfPoints();
void _Initialize();
void _GetCellPoints(int cellId, vlIdList& ptIds);
void _GetPointCells(int ptId, vlIdList& cellIds);
int Dimensions[3];
int DataDescription;
int Blanking;
......
......@@ -23,9 +23,11 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlStructuredPoints_h
#define __vlStructuredPoints_h
#include "DataSet.hh"
#include "StrData.hh"
class vlStructuredPoints : public vlStructuredData {
class vlStructuredPoints : public vlDataSet, public vlStructuredData
{
public:
vlStructuredPoints();
vlStructuredPoints(const vlStructuredPoints& v);
......@@ -34,13 +36,20 @@ public:
char *GetDataType() {return "vlStructuredPoints";};
void PrintSelf(ostream& os, vlIndent indent);
unsigned long GetMtime();
// dataset interface
vlDataSet *MakeObject() {return new vlStructuredPoints(*this);};
int GetNumberOfCells();
int GetNumberOfPoints();
float *GetPoint(int ptId);
vlCell *GetCell(int cellId);
void Initialize();
int FindCell(float x[3], vlCell *cell, float tol2, int& subId, float pcoords[3]);
int GetCellType(int cellId);
void GetCellPoints(int cellId, vlIdList& ptIds);
void GetPointCells(int ptId, vlIdList& cellIds);
// Description:
// Set the aspect ratio of the cubical cells that compose the structured
......@@ -59,4 +68,24 @@ protected:
float AspectRatio[3];
};
inline int vlStructuredPoints::GetNumberOfCells()
{
return this->vlStructuredData::_GetNumberOfCells();
}
inline int vlStructuredPoints::GetNumberOfPoints()
{
return this->vlStructuredData::_GetNumberOfCells();
}
inline void vlStructuredPoints::GetCellPoints(int cellId, vlIdList& ptIds)
{
this->vlStructuredData::_GetCellPoints(cellId, ptIds);
}
inline void vlStructuredPoints::GetPointCells(int ptId, vlIdList& cellIds)
{
this->vlStructuredData::_GetPointCells(ptId, cellIds);
}
#endif
......@@ -28,20 +28,13 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
class vlStructuredPointsFilter : public vlFilter
{
public:
vlStructuredPointsFilter();
vlStructuredPointsFilter() {};
~vlStructuredPointsFilter();
char *GetClassName() {return "vlStructuredPointsFilter";};
void PrintSelf(ostream& os, vlIndent indent);
void _PrintSelf(ostream& os, vlIndent indent);
void Update();
// Description:
// Specify the input object.
vlSetObjectMacro(Input,vlStructuredPoints);
vlGetObjectMacro(Input,vlStructuredPoints);
protected:
vlStructuredPoints *Input;
void SetInput(vlStructuredPoints *input);
void SetInput(vlStructuredPoints &input) {this->SetInput(&input);};
vlStructuredPoints *GetInput() {return (vlStructuredPoints *)this->Input;};
};
......
......@@ -13,58 +13,24 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Abstract class for objects that filter DataSets
//
#include "DataSetF.hh"
vlDataSetFilter::vlDataSetFilter()
{
this->Input = NULL;
}
vlDataSetFilter::~vlDataSetFilter()
{
}
void vlDataSetFilter::Update()
// Description: