Commit 3640b5e5 authored by Ken Martin's avatar Ken Martin
Browse files

ENH: cleaned up header files

parent 12863dfe
......@@ -38,13 +38,13 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
=========================================================================*/
// .NAME vtkActor2D - a actor that draws data into the viewport overlay plane
// .NAME vtkActor2D - a actor that draws 2D data
// .SECTION Description
// vtkActor2D is similar to vtkActor, but it is made to be used with
// two dimensional images and annotation. vtkActor2D has a position
// (inherited from vtkProp) but does not use a transformation matrix
// like vtkActor. vtkActor2D has a reference to a vtkMapper2D object
// which does the rendering.
// vtkActor2D is similar to vtkActor, but it is made to be used with two
// dimensional images and annotation. vtkActor2D has a position but does not
// use a transformation matrix like vtkActor. vtkActor2D has a reference to
// a vtkMapper2D object which does the rendering.
// .SECTION See Also
// vtkProp2D vtkMapper2D vtkProperty2D
......@@ -57,29 +57,25 @@ class vtkMapper2D;
class VTK_EXPORT vtkActor2D : public vtkProp2D
{
public:
// Description:
// Creates an actor2D with the following defaults:
// position -1, -1 (view coordinates)
// orientation 0, scale (1,1), layer 0, visibility on
// Description:
// Creates an actor2D with the following defaults:
// position -1, -1 (view coordinates)
// orientation 0, scale (1,1), layer 0, visibility on
vtkActor2D();
// Description:
// Destroy an actor2D.
// Description:
// Destroy an actor2D.
~vtkActor2D();
static vtkActor2D* New() {return new vtkActor2D;};
void PrintSelf(ostream& os, vtkIndent indent);
const char *GetClassName() {return "vtkActor2D";};
// Description:
// Renders an actor2D's property and then it's mapper.
// Description:
// Renders an actor2D's property and then it's mapper.
virtual void Render(vtkViewport *viewport);
// Description:
// Set/Get the vtkMapper2D which defines the data to be drawn.
vtkSetObjectMacro(Mapper, vtkMapper2D);
......
......@@ -58,33 +58,33 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
class VTK_EXPORT vtkActor2DCollection : public vtkCollection
{
public:
// Description:
// Desctructor for the vtkActor2DCollection class. This removes all
// objects from the collection.
// Description:
// Desctructor for the vtkActor2DCollection class. This removes all
// objects from the collection.
~vtkActor2DCollection();
static vtkActor2DCollection *New() {return new vtkActor2DCollection;};
const char *GetClassName() {return "vtkActor2DCollection";};
// Description:
// Sorts the vtkActor2DCollection by layer number. Smaller layer
// numbers are first. Layer numbers can be any integer value.
// Description:
// Sorts the vtkActor2DCollection by layer number. Smaller layer
// numbers are first. Layer numbers can be any integer value.
void Sort();
// Description:
// Add an actor to the list. The new actor is
// inserted in the list according to it's layer
// number.
// Description:
// Add an actor to the list. The new actor is inserted in the list
// according to it's layer number.
void AddItem(vtkActor2D *a);
// Description:
// Standard Collection methods
int IsItemPresent(vtkActor2D *a);
vtkActor2D *GetNextItem();
vtkActor2D *GetLastItem();
// Description:
// Sort and then render the collection of 2D actors.
// Description:
// Sort and then render the collection of 2D actors.
void Render(vtkViewport* viewport);
......@@ -92,23 +92,16 @@ protected:
virtual void DeleteElement(vtkCollectionElement *);
};
// Description:
// Determine whether a particular actor is present. Returns its position
// in the list.
inline int vtkActor2DCollection::IsItemPresent(vtkActor2D *a)
{
return this->vtkCollection::IsItemPresent((vtkObject *)a);
}
// Description:
// Get the next actor in the list.
inline vtkActor2D *vtkActor2DCollection::GetNextItem()
{
return (vtkActor2D *)(this->GetNextItemAsObject());
}
// Description:
// Get the last actor in the list.
inline vtkActor2D *vtkActor2DCollection::GetLastItem()
{
if ( this->Bottom == NULL )
......
......@@ -57,10 +57,9 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
class VTK_EXPORT vtkAttributeData : public vtkReferenceCount
{
public:
// Description:
// Construct object with an initial data array of type dataType (by default
// dataType is VTK_FLOAT.
// Description:
// Construct object with an initial data array of type dataType (by default
// dataType is VTK_FLOAT.
vtkAttributeData(int dataType=VTK_FLOAT);
~vtkAttributeData();
......
......@@ -53,90 +53,101 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
class VTK_EXPORT vtkBitArray : public vtkDataArray
{
public:
// Description:
// Instantiate object.
vtkBitArray(int numComp=1);
~vtkBitArray();
static vtkBitArray *New() {return new vtkBitArray;};
virtual const char *GetClassName() {return "vtkBitArray";};
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Allocate memory for this array. Delete old storage only if necessary.
// Description:
// Allocate memory for this array. Delete old storage only if necessary.
int Allocate(const int sz, const int ext=1000);
// Description:
// Release storage and reset array to initial state.
// Description:
// Release storage and reset array to initial state.
void Initialize();
static vtkBitArray *New() {return new vtkBitArray;};
virtual const char *GetClassName() {return "vtkBitArray";};
void PrintSelf(ostream& os, vtkIndent indent);
// satisfy vtkDataArray API
vtkDataArray *MakeObject() {return new vtkBitArray(this->NumberOfComponents);};
int GetDataType() {return VTK_BIT;};
// Description:
// Set the number of n-tuples in the array.
// Description:
// Set the number of n-tuples in the array.
void SetNumberOfTuples(const int number);
// Description:
// Get a pointer to a tuple at the ith location. This is a dangerous method
// (it is not thread safe since a pointer is returned).
// Description:
// Get a pointer to a tuple at the ith location. This is a dangerous method
// (it is not thread safe since a pointer is returned).
float *GetTuple(const int i);
// Description:
// Copy the tuple value into a user-provided array.
// Description:
// Copy the tuple value into a user-provided array.
void GetTuple(const int i, float * tuple);
// Description:
// Set the tuple value at the ith location in the array.
// Description:
// Set the tuple value at the ith location in the array.
void SetTuple(const int i, const float * tuple);
// Description:
// Insert (memory allocation performed) the tuple into the ith location
// in the array.
// Description:
// Insert (memory allocation performed) the tuple into the ith location
// in the array.
void InsertTuple(const int i, const float * tuple);
// Description:
// Insert (memory allocation performed) the tuple onto the end of the array.
// Description:
// Insert (memory allocation performed) the tuple onto the end of the array.
int InsertNextTuple(const float * tuple);
// Description:
// Free any uunrequired memory.
void Squeeze();
// access/insertion methods
// Description:
// Get the data at a particular index.
// Description:
// Get the data at a particular index.
int GetValue(const int id);
// Description:
// Fast method based setting of values without memory checks. First
// use SetNumberOfValues then use SetValue to actually set them.
// Description:
// Specify the number of values for this object to hold. Does an
// allocation as well as setting the MaxId ivar. Used in conjunction with
// SetValue() method for fast insertion.
void SetNumberOfValues(const int number);
// Description:
// Set the data at a particular index. Does not do range checking. Make sure
// you use the method SetNumberOfValues() before inserting data.
void SetValue(const int id, const int value);
// Description:
// Insets values and checks to make sure there is enough memory
void InsertValue(const int id, const int i);
int InsertNextValue(const int i);
// Description:
// Direct manipulation of the underlying data.
unsigned char *GetPointer(const int id) {return this->Array + id/8;}
// Description:
// Get the address of a particular data index. Make sure data is allocated
// for the number of items requested. Set MaxId according to the number of
// data values requested.
unsigned char *WritePointer(const int id, const int number);
void *GetVoidPointer(const int id) {return (void *)this->GetPointer(id);};
// Description:
// Deep copy of another bit array.
// Description:
// Deep copy of another bit array.
void DeepCopy(vtkDataArray& da);
// Description:
// This method lets the user specify data to be held by the array. The
// array argument is a pointer to the data. size is the size of
// the array supplied by the user. Set save to 1 to keep the class
// from deleting the array when it cleans up or reallocates memory.
// The class uses the actual array provided; it does not copy the data
// from the suppled array.
// Description:
// This method lets the user specify data to be held by the array. The
// array argument is a pointer to the data. size is the size of
// the array supplied by the user. Set save to 1 to keep the class
// from deleting the array when it cleans up or reallocates memory.
// The class uses the actual array provided; it does not copy the data
// from the suppled array.
void SetArray(unsigned char* array, int size, int save);
private:
......@@ -149,10 +160,6 @@ private:
int SaveUserArray;
};
// Description:
// Get the address of a particular data index. Make sure data is allocated
// for the number of items requested. Set MaxId according to the number of
// data values requested.
inline unsigned char *vtkBitArray::WritePointer(const int id, const int number)
{
int newSize=id+number;
......@@ -167,19 +174,12 @@ inline unsigned char *vtkBitArray::WritePointer(const int id, const int number)
return this->Array + id/8;
}
// Description:
// Specify the number of values for this object to hold. Does an
// allocation as well as setting the MaxId ivar. Used in conjunction with
// SetValue() method for fast insertion.
inline void vtkBitArray::SetNumberOfValues(const int number)
{
this->Allocate(number);
this->MaxId = number - 1;
}
// Description:
// Set the data at a particular index. Does not do range checking. Make sure
// you use the method SetNumberOfValues() before inserting data.
inline void vtkBitArray::SetValue(const int id, const int value)
{
if (value)
......@@ -192,8 +192,6 @@ inline void vtkBitArray::SetValue(const int id, const int value)
}
}
// Description:
// Insert data at a specified position in the array.
inline void vtkBitArray::InsertValue(const int id, const int i)
{
if ( id >= this->Size )
......@@ -214,15 +212,11 @@ inline void vtkBitArray::InsertValue(const int id, const int i)
}
}
// Description:
// Insert data at the end of the array. Return its location in the array.
inline int vtkBitArray::InsertNextValue(const int i)
{
this->InsertValue (++this->MaxId,i); return this->MaxId;
}
// Description:
// Resize object to just fit data requirement. Reclaims extra memory.
inline void vtkBitArray::Squeeze() {this->Resize (this->MaxId+1);}
#endif
......
......@@ -56,26 +56,23 @@ public:
static vtkByteSwap *New() {return new vtkByteSwap;};
const char *GetClassName() {return "vtkByteSwap";};
// Description:
// Swap 2 byte word.
// Description:
// Swap 2 byte word to be LE.
static void Swap2LE(short *s);
// Description:
// Swap four byte word.
// Description:
// Swap four byte word to be LE.
static void Swap4LE(char *c);
static void Swap4LE(float *p) { vtkByteSwap::Swap4LE((char *)p);};
static void Swap4LE(int *i) { vtkByteSwap::Swap4LE((char *)i);};
static void Swap4LE(unsigned long *i) { vtkByteSwap::Swap4LE((char *)i);};
static void Swap4LE(long *i) { vtkByteSwap::Swap4LE((char *)i);};
// Description:
// Swap bunch of bytes. Num is the number of four byte words to swap.
// Description:
// Swap bunch of bytes to be LE. Num is the number of four byte words to swap.
static void Swap4LERange(char *c,int num);
static void Swap4LERange(unsigned char *c,int num)
{ vtkByteSwap::Swap4LERange((char *)c,num);};
static void Swap4LERange(float *p,int num)
......@@ -86,19 +83,17 @@ public:
{ vtkByteSwap::Swap4LERange((char *)i,num);};
// Description:
// Swap four byte word.
// Description:
// Swap four byte word to be BE.
static void Swap4BE(char *c);
static void Swap4BE(float *p) { vtkByteSwap::Swap4BE((char *)p);};
static void Swap4BE(int *i) { vtkByteSwap::Swap4BE((char *)i);};
static void Swap4BE(unsigned long *i) { vtkByteSwap::Swap4BE((char *)i);};
// Description:
// Swap bunch of bytes. Num is the number of four byte words to swap.
// Description:
// Swap bunch of bytes to be BE. Num is the number of four byte words to swap.
static void Swap4BERange(char *c,int num);
static void Swap4BERange(float *p,int num)
{ vtkByteSwap::Swap4BERange((char *)p,num); };
static void Swap4BERange(int *i,int num)
......@@ -107,10 +102,11 @@ public:
{ vtkByteSwap::Swap4BERange((char *)i,num); };
// Description:
// Swap bunch of bytes. Num is the number of four byte words to swap.
// Description:
// Swap bunch of bytes to BE. Num is the number of four byte words to swap.
// The results are written out to prevent having to keep the swapped
// copy in memory.
static void SwapWrite4BERange(char *c,int num,FILE *fp);
static void SwapWrite4BERange(float *p,int num, FILE *fp)
{ vtkByteSwap::SwapWrite4BERange((char *)p,num,fp);};
static void SwapWrite4BERange(int *i,int num,FILE *fp)
......@@ -119,37 +115,34 @@ public:
{ vtkByteSwap::SwapWrite4BERange((char *)i,num,fp);};
// Description:
// Swap 2 byte word.
// Description:
// Swap 2 byte word to BE.
static void Swap2BE(short *s);
// Description:
// Swap bunch of bytes. Num is the number of two byte words to swap.
// Description:
// Swap bunch of bytes to BE. Num is the number of two byte words to swap.
static void Swap2BERange(char *c,int num);
// Description:
// Swap bunch of bytes. Num is the number of two byte words to swap.
static void Swap2LERange(char *c,int num);
static void Swap2BERange(short *i,int num)
{ vtkByteSwap::Swap2BERange((char *)i,num);};
// Description:
// Swap bunch of bytes to LE. Num is the number of two byte words to swap.
static void Swap2LERange(char *c,int num);
static void Swap2LERange(short *i,int num)
{ vtkByteSwap::Swap2LERange((char *)i,num);};
// Description:
// Swap bunch of bytes. Num is the number of four byte words to swap.
// Description:
// Swap bunch of bytes to BE. Num is the number of two byte words to swap.
// The results are written out to prevent having to keep the swapped
// copy in memory.
static void SwapWrite2BERange(char *c,int num,FILE *fp);
static void SwapWrite2BERange(short *i,int num, FILE *fp)
{vtkByteSwap::SwapWrite2BERange((char *)i,num,fp);};
// Description:
// Swaps the bytes of a buffer. Uses an arbitrary word size, but
// assumes the word size is divisible by two.
// Description:
// Swaps the bytes of a buffer. Uses an arbitrary word size, but
// assumes the word size is divisible by two.
static void SwapVoidRange(void *buffer, int numWords, int wordSize);
};
......
......@@ -46,6 +46,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// cases visualization datasets may explicitly represent cells (e.g.,
// vtkPolyData, vtkUnstructuredGrid), and in some cases, the datasets are
// implicitly composed of cells (e.g., vtkStructuredPoints).
//
// .SECTION Caveats
// The #define VTK_CELL_SIZE is a parameter used to construct cells and provide
// a general guideline for controlling object execution. This parameter is
......@@ -55,6 +56,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// vtkHexahedron vtkLine vtkPixel vtkPolyLine vtkPolyVertex
// vtkPolygon vtkQuad vtkTetra vtkTriangle
// vtkTriangleStrip vtkVertex vtkVoxel
#ifndef __vtkCell_h
#define __vtkCell_h
......@@ -76,18 +78,14 @@ class vtkCellData;
class VTK_EXPORT vtkCell : public vtkObject
{
public:
// Description:
// Construct cell.
vtkCell();
void Initialize(int npts, int *pts, vtkPoints *p);
const char *GetClassName() {return "vtkCell";};
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Create concrete copy of this cell. Initially, the copy is made by performing
// a ShallowCopy() operation.
// Create concrete copy of this cell. Initially, the copy is made by
// performing a ShallowCopy() operation.
virtual vtkCell *MakeObject() = 0;
// Description:
......@@ -230,60 +228,58 @@ public:
virtual int Triangulate(int index, vtkIdList &ptIds, vtkPoints &pts) = 0;
// Description:
// Compute derivatives given cell subId and parametric coordinates. The values
// array is a series of data value(s) at the cell points. There is a one-to-one
// correspondence between cell point and data value(s). Dim is the number of
// data values per cell point. Derivs are derivatives in the x-y-z coordinate
// directions for each data value. Thus, if computing derivatives for a
// scalar function in a hexahedron, dim=1, 8 values are supplied, and 3 deriv
// values are returned (i.e., derivatives in x-y-z directions). On the other
// hand, if computing derivatives of velocity (vx,vy,vz) dim=3, 24 values are
// supplied ((vx,vy,vz)1, (vx,vy,vz)2, ....()8), and 9 deriv values are
// returned ((d(vx)/dx),(d(vx)/dy),(d(vx)/dz), (d(vy)/dx),(d(vy)/dy),
// (d(vy)/dz), (d(vz)/dx),(d(vz)/dy),(d(vz)/dz)).
// Compute derivatives given cell subId and parametric coordinates. The
// values array is a series of data value(s) at the cell points. There is a
// one-to-one correspondence between cell point and data value(s). Dim is
// the number of data values per cell point. Derivs are derivatives in the
// x-y-z coordinate directions for each data value. Thus, if computing
// derivatives for a scalar function in a hexahedron, dim=1, 8 values are
// supplied, and 3 deriv values are returned (i.e., derivatives in x-y-z
// directions). On the other hand, if computing derivatives of velocity
// (vx,vy,vz) dim=3, 24 values are supplied ((vx,vy,vz)1, (vx,vy,vz)2,
// ....()8), and 9 deriv values are returned
// ((d(vx)/dx),(d(vx)/dy),(d(vx)/dz), (d(vy)/dx),(d(vy)/dy), (d(vy)/dz),
// (d(vz)/dx),(d(vz)/dy),(d(vz)/dz)).
virtual void Derivatives(int subId, float pcoords[3], float *values,
int dim, float *derivs) = 0;
// Description:
// Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax). Copy result into
// user provided array.
// Description:
// Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax). Copy result
// into user provided array.
void GetBounds(float bounds[6]);
// Description:
// Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax). Return pointer
// to array of six float values.
// Description:
// Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax). Return pointer
// to array of six float values.
float *GetBounds();
// Description:
// Compute Length squared of cell (i.e., bounding box diagonal squared).
// Description:
// Compute Length squared of cell (i.e., bounding box diagonal squared).
float GetLength2();
// Description:
// Return center of the cell in parametric coordinates.
// Note that the parametric center is not always located
// at (0.5,0.5,0.5). The return value is the subId that
// the center is in (if a composite cell). If you want the
// center in x-y-z space, invoke the EvaluateLocation() method.
// Description:
// Return center of the cell in parametric coordinates. Note that the
// parametric center is not always located at (0.5,0.5,0.5). The return
// value is the subId that the center is in (if a composite cell). If you
// want the center in x-y-z space, invoke the EvaluateLocation() method.
virtual int GetParametricCenter(float pcoords[3]);
// Quick intersection of cell bounding box. Returns != 0 for hit.
// Description:
// Bounding box intersection modified from Graphics Gems Vol I.
// Note: the intersection ray is assumed normalized, such that
// valid intersections can only occur between [0,1]. Method returns non-zero
// value if bounding box is hit. Origin[3] starts the ray, dir[3] is the
// components of the ray in the x-y-z directions, coord[3] is the location
// of hit, and t is the parametric coordinate along line.
// Description:
// Bounding box intersection modified from Graphics Gems Vol I. Note: the
// intersection ray is assumed normalized, such that valid intersections
// can only occur between [0,1]. Method returns non-zero value if bounding
// box is hit. Origin[3] starts the ray, dir[3] is the components of the
// ray in the x-y-z directions, coord[3] is the location of hit, and t is
// the parametric coordinate along line.
static char HitBBox(float bounds[6], float origin[3], float dir[3],
float coord[3], float& t);
// left public for quick computational access
vtkPoints Points;
vtkIdList PointIds;
......
......@@ -51,6 +51,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
// random access. This functionality (when necessary) is accomplished by
// using the vtkCellTypes and vtkCellLinks objects to extend the definition of
// the data structure.
//
// .SECTION See Also
// vtkCellTypes vtkCellLinks
......@@ -67,55 +68,130 @@ public:
vtkCellArray (const int sz, const int ext=1000);
vtkCellArray(const vtkCellArray& ca);
~vtkCellArray();
int Allocate(const int sz, const int ext=1000)
{return this->Ia->Allocate(sz,ext);};
void Initialize() {this->Ia->Initialize();};
static vtkCellArray *New() {return new vtkCellArray;};
const char *GetClassName() {return "vtkCellArray";};
int GetNumberOfCells();
// Description:
// Allocate memory and set the size to extend by.
int Allocate(const int sz, const int ext=1000)
{return this->Ia->Allocate(sz,ext);};