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

ENH: Added documentation.

parent 4cca10ec
......@@ -6,8 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
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.
......@@ -15,9 +13,15 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Abstract specification of computational cells.
//
// .NAME vlCell - abstract class to specify cell behavior
// .SECTION Description
// vlCell is an abstract class that specifies the interfaces for data cells.
// Data cells are simple topological elements like points, lines, polygons,
// and tetrahedra that visualization datasets are composed of. In some
// cases visualization datasets may explicitly represent cells (e.g.,
// vlPolyData, vlUnstructuredGrid), and in some cases, the datasets are
// implicitly composed of cells (e.g., vlStructuredPoints).
#ifndef __vlCell_h
#define __vlCell_h
......@@ -43,27 +47,48 @@ public:
// objects, and because they are used internally, do not use memory
// reference counting.
// Type of cell
// Description:
// Return the type of cell.
virtual int GetCellType() = 0;
// Dimensionality of cell (0,1,2, or 3)
// Description:
// Return the topological dimensional of the cell (0,1,2, or 3).
virtual int GetCellDimension() = 0;
// Point coordinates for cell.
// Description:
// Get the point coordinates for the cell.
vlFloatPoints *GetPoints() {return &this->Points;};
// Number of points (and other topological entities) in cell
// Description:
// Return the number of points in the cell.
int GetNumberOfPoints() {return this->PointIds.GetNumberOfIds();};
// Description:
// Return the number of edges in the cell.
virtual int GetNumberOfEdges() = 0;
// Description:
// Return the number of faces in the cell.
virtual int GetNumberOfFaces() = 0;
// Get topological entities
// Description:
// Return the list of point ids defining cell.
vlIdList *GetPointIds() {return &this->PointIds;};
// Description:
// For cell point i, return the actual point id.
int GetPointId(int ptId) {return this->PointIds.GetId(ptId);};
// Description:
// Return the edge cell from the edgeId of the cell.
virtual vlCell *GetEdge(int edgeId) = 0;
// Description:
// Return the face cell from the faceId of the cell.
virtual vlCell *GetFace(int faceId) = 0;
// given a point x[3] return inside(=1) or outside(=0) cell; evaluate
// Description:
// Given a point x[3] return inside(=1) or outside(=0) cell; evaluate
// parametric coordinates, sub-cell id (!=0 only if cell is composite),
// distance squared of point x[3] to cell (in particular, the sub-cell
// indicated), and interpolation weights in cell.
......@@ -71,20 +96,19 @@ public:
int& subId, float pcoords[3],
float& dist2, float weights[MAX_CELL_SIZE]) = 0;
// Description:
// Determine global coordinate from subId and parametric coordinates
virtual void EvaluateLocation(int& subId, float pcoords[3],
float x[3], float weights[MAX_CELL_SIZE]) = 0;
// Description:
// Generate contouring primitives
virtual void Contour(float value, vlFloatScalars *cellScalars,
vlFloatPoints *points, vlCellArray *verts,
vlCellArray *lines, vlCellArray *polys,
vlFloatScalars *scalars) = 0;
// Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax)
float *GetBounds();
// Compute Length squared of cell (i.e., bounding box diagonal squared)
float GetLength2();
// Quick intersection of cell bounding box. Returns != 0 for hit.
......
......@@ -6,8 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
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.
......@@ -15,17 +13,20 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Define cell array. The cell array is a raw integer list representing many
// cells. The form of the list is: (n,id1,id2,...,idn, n,id1,id2,...,idn, ...)
// .NAME vlCellArray - object represents cell connectivity
// .SECTION Description
// vlCellArray is a supporting object that explicitly represents cell
// connectivity. The cell array structure is a raw integer list
// of the form: (n,id1,id2,...,idn, n,id1,id2,...,idn, ...)
// where n is the number of points in the cell, and id is a zero-offset index
// into an associated point list.
//
// Advantages of this data structure are its compactness, simplicity, and easy
// interface to external data. However, it is totally inadequate for random
// access. This functionality (when necessary) is accomplished by using the
// CellList and LinkList objects to extend the definition of data structure.
//
// vlCellList and vlLinkList objects to extend the definition of data
// structure.
#ifndef __vlCellArray_h
#define __vlCellArray_h
......@@ -44,101 +45,25 @@ public:
~vlCellArray() {};
char *GetClassName() {return "vlCellArray";};
// return number of cells represented by this list
int GetNumberOfCells() {return this->NumberOfCells;};
// Methods to create cells from different inputs.
// Create a cell by specifying the number of pts and an array of point id's
void InsertNextCell(int npts, int* pts)
{
int id = this->Ia.GetMaxId() + npts + 1;
this->Ia.InsertValue(id,pts[npts-1]);
this->Ia[id-npts] = npts;
for (int i=0; i<npts-1; i++) this->Ia[id-npts+i+1] = pts[i];
this->NumberOfCells++;
this->Location += npts + 1;
}
// Create cells by specifying count, and then adding points one at a time using
// method InsertCellPoint()
void InsertNextCell(int npts)
{
this->Location = this->Ia.InsertNextValue(npts) + 1;
this->NumberOfCells++;
}
void InsertCellPoint(int id)
{this->Ia.InsertValue(this->Location++,id);};
// Create a cell from a cell object
void InsertNextCell(vlCell *cell)
{
int npts = cell->GetNumberOfPoints();
int id = this->Ia.GetMaxId() + npts + 1;
this->Ia.InsertValue(id,cell->PointIds.GetId(npts-1));
this->Ia[id-npts] = npts;
for (int i=0; i<npts-1; i++) this->Ia[id-npts+i+1] = cell->PointIds.GetId(i);
this->NumberOfCells++;
this->Location += npts + 1;
}
// utility routines to help manage memory of cell data structure. EstimateSize()
// returns a value used to initialize cell array based on number of cells and
// maximum number of points making up cell. If every cell is the same size (in
// terms of number of points) then the estimate is guaranteed exact.
// The Squeeze() function recovers memory from estimated size.
int EstimateSize(int numCells, int maxPtsPerCell)
{return numCells*(1+maxPtsPerCell);};
void Squeeze() {this->Ia.Squeeze();};
// These are cell traversal methods. More efficient than DataSet traversal
// methods. Both traversal methods can be used together, if necessary.
// Cell traversal methods are initialized with InitTraveral() and then
// followed by repeated calls to GetNextCell()
void InitTraversal() {this->Location=0;};
int GetNextCell(int& npts, int* &pts)
{
if ( this->Ia.GetMaxId() >= 0 && this->Location <= this->Ia.GetMaxId() )
{
npts = this->Ia.GetValue(this->Location++);
pts = this->Ia.GetPtr(this->Location);
this->Location += npts;
return 1;
}
else
{
return 0;
}
}
// access methods for building data structures
int GetSize() {return Ia.GetSize();};
void GetCell(int loc, int &npts, int* &pts)
{npts=this->Ia.GetValue(loc++); pts=this->Ia.GetPtr(loc);};
// Use only in conjunction with cell traversal methods
int GetLocation(int npts) {return (this->Location - npts - 1);};
int GetNumberOfCells();
void InsertNextCell(int npts, int* pts);
void InsertNextCell(int npts);
void InsertCellPoint(int id);
void InsertNextCell(vlCell *cell);
int EstimateSize(int numCells, int maxPtsPerCell);
void Squeeze();
void InitTraversal();
int GetNextCell(int& npts, int* &pts);
int GetSize();
void GetCell(int loc, int &npts, int* &pts);
int GetLocation(int npts);
// Special method flips ordering of current cell. Works in conjunction with
// cell traversal methods.
void ReverseCell(int loc)
{
int i, tmp;
int npts=this->Ia.GetValue(loc);
int *pts=this->Ia.GetPtr(loc+1);
for (i=0; i < (npts/2); i++)
{
tmp = pts[i];
pts[i] = pts[npts-i-1];
pts[npts-i-1] = tmp;
}
}
void ReplaceCell(int loc, vlIdList& ptIds)
{
int i;
int npts=this->Ia.GetValue(loc);
int *pts=this->Ia.GetPtr(loc+1);
for (i=0; i < npts; i++) pts[i] = ptIds.GetId(i);
}
void ReverseCell(int loc);
void ReplaceCell(int loc, vlIdList& ptIds);
protected:
int NumberOfCells;
......@@ -146,4 +71,135 @@ protected:
vlIntArray Ia;
};
// Description:
// Get the number of cells in the array.
inline int vlCellArray::GetNumberOfCells() {return this->NumberOfCells;};
// Description:
// Create a cell by specifying the number of pts and an array of point id's
inline void vlCellArray::InsertNextCell(int npts, int* pts)
{
int id = this->Ia.GetMaxId() + npts + 1;
this->Ia.InsertValue(id,pts[npts-1]);
this->Ia[id-npts] = npts;
for (int i=0; i<npts-1; i++) this->Ia[id-npts+i+1] = pts[i];
this->NumberOfCells++;
this->Location += npts + 1;
}
// Description:
// Create cells by specifying count, and then adding points one at a time using
// method InsertCellPoint()
inline void vlCellArray::InsertNextCell(int npts)
{
this->Location = this->Ia.InsertNextValue(npts) + 1;
this->NumberOfCells++;
}
// Description:
// Used in conjunction with InsertNextCell(int npts) to add another point
// to the list of cells.
inline void vlCellArray::InsertCellPoint(int id)
{
this->Ia.InsertValue(this->Location++,id);
}
// Description:
// Insert a cell object.
inline void vlCellArray::InsertNextCell(vlCell *cell)
{
int npts = cell->GetNumberOfPoints();
int id = this->Ia.GetMaxId() + npts + 1;
this->Ia.InsertValue(id,cell->PointIds.GetId(npts-1));
this->Ia[id-npts] = npts;
for (int i=0; i<npts-1; i++) this->Ia[id-npts+i+1] = cell->PointIds.GetId(i);
this->NumberOfCells++;
this->Location += npts + 1;
}
// Description:
// Utility routines helps manage memory of cell array. EstimateSize()
// returns a value used to initialize and allocate memory for array based
// on number of cells and maximum number of points making up cell. If
// every cell is the same size (in terms of number of points) then the
// memory estimate is guaranteed exact. (If not exact, use Squeeze() to
// reclaim any extra memory).
inline int vlCellArray::EstimateSize(int numCells, int maxPtsPerCell)
{
return numCells*(1+maxPtsPerCell);
}
// Description:
// Reclaim any extra memory.
inline void vlCellArray::Squeeze() {this->Ia.Squeeze();}
// Description:
// Cell traversal methods that are more efficient than vlDataSet traversal
// methods. InitTraversal() initializes the traversal of the list of cells.
inline void vlCellArray::InitTraversal() {this->Location=0;}
// Description:
// Cell traversal methods that are more efficient than vlDataSet traversal
// methods. GetNextCell() gets the next cell in the list. If end of list
// is encountered, 0 is returned.
inline int vlCellArray::GetNextCell(int& npts, int* &pts)
{
if ( this->Ia.GetMaxId() >= 0 && this->Location <= this->Ia.GetMaxId() )
{
npts = this->Ia.GetValue(this->Location++);
pts = this->Ia.GetPtr(this->Location);
this->Location += npts;
return 1;
}
else
{
return 0;
}
}
// Description:
// Get the size of the allocated data.
inline int vlCellArray::GetSize() {return Ia.GetSize();};
// Description:
// Internal method used to retrieve a cell given an offset into
// the internal array.
inline void vlCellArray::GetCell(int loc, int &npts, int* &pts)
{
npts=this->Ia.GetValue(loc++); pts=this->Ia.GetPtr(loc);
}
// Description:
// Computes the current location within the internal array. Used in conjunction
// with GetCell(int loc,...).
inline int vlCellArray::GetLocation(int npts) {
return (this->Location - npts - 1);
}
// Description:
// Special method inverts ordering of current cell. Must be called carefully or
// the cell topology may be corrupted.
inline void vlCellArray::ReverseCell(int loc)
{
int i, tmp;
int npts=this->Ia.GetValue(loc);
int *pts=this->Ia.GetPtr(loc+1);
for (i=0; i < (npts/2); i++)
{
tmp = pts[i];
pts[i] = pts[npts-i-1];
pts[npts-i-1] = tmp;
}
}
// Description:
// Replace the point ids of the cell with a different list of point ids.
inline void vlCellArray::ReplaceCell(int loc, vlIdList& ptIds)
{
int i;
int npts=this->Ia.GetValue(loc);
int *pts=this->Ia.GetPtr(loc+1);
for (i=0; i < npts; i++) pts[i] = ptIds.GetId(i);
}
#endif
......@@ -13,12 +13,13 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Supplemental object to CellArray to allow random access into cells.
// The "location" field is the location in the CellArray list in terms of an
// .NAME vlCellList - object provides direct access to cells in vlCellArray
// .SECTION Description
// Supplemental object to vlCellArray to allow random access into cells.
// The "location" field is the location in the vlCellArray list in terms of an
// integer offset. An integer offset was used instead of a pointer for easy
// storage and inter-process communication.
//
#ifndef __vlCellList_h
#define __vlCellList_h
......@@ -35,11 +36,13 @@ public:
vlCellList(const int sz, const int ext);
~vlCellList();
char *GetClassName() {return "vlCellList";};
vlCell_s &GetCell(const int id) {return this->Array[id];};
unsigned char GetCellType(const int id) {return this->Array[id].type;};
int GetCellLocation(const int id) {return this->Array[id].loc;};
vlCell_s &GetCell(const int id);
unsigned char GetCellType(const int id);
int GetCellLocation(const int id);
void InsertCell(const int id, const unsigned char type, const int loc);
int InsertNextCell(const unsigned char type, const int loc);
void Squeeze();
void Reset();
......@@ -51,4 +54,25 @@ private:
vlCell_s *Resize(const int sz); // function to resize data
};
// Description:
// Return a reference to a cell list structure.
inline vlCell_s &vlCellList::GetCell(const int id)
{
return this->Array[id];
}
// Description:
// Return the type of cell.
inline unsigned char vlCellList::GetCellType(const int cellId)
{
return this->Array[cellId].type;
}
// Description:
// Return the location of the cell in the associated vlCellArray.
inline int vlCellList::GetCellLocation(const int cellId)
{
return this->Array[cellId].loc;
}
#endif
......@@ -6,8 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
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.
......@@ -15,10 +13,14 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Class to localize mapping of cell types to object. Adding new cell type
// means adding new & unique #define and then implementing the object.
//
// .NAME vlCellType - define types of cells
// .SECTION Description
// vlCellType defines the allowable cell types in the visualization
// library (vl). In vl, datasets consist of collections of cells.
// Different datasets consist of different cell types. The cells may be
// explicitly represented (as in vlPolyData), or may be implicit to the
// data type (vlStructuredPoints).
#ifndef __vlCellTypes_h
#define __vlCellTypes_h
......
......@@ -6,8 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
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.
......@@ -15,6 +13,11 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
// .NAME vlDataSetCollection - maintain a list of dataset objects
// .SECTION Description
// vlDataSetCollection is an object that creates and manipulates lists of
// datasets. See also vlCollection and subclasses.
#ifndef __vlDataSetCollection_hh
#define __vlDataSetCollection_hh
......@@ -30,22 +33,23 @@ class vlDataSetCollectionElement
class vlDataSetCollection : public vlObject
{
public:
int NumberOfItems;
private:
vlDataSetCollectionElement *Top;
vlDataSetCollectionElement *Bottom;
public:
vlDataSetCollection();
void PrintSelf(ostream& os, vlIndent indent);
char *GetClassName() {return "vlDataSetCollection";};
void AddItem(vlDataSet *);
void RemoveItem(vlDataSet *);
int IsItemPresent(vlDataSet *);
int GetNumberOfItems();
vlDataSet *GetItem(int num);
void PrintSelf(ostream& os, vlIndent indent);
char *GetClassName() {return "vlDataSetCollection";};
private:
int NumberOfItems;
vlDataSetCollectionElement *Top;
vlDataSetCollectionElement *Bottom;
};
#endif
......@@ -13,9 +13,11 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// DataSetFilter takes general DataSet as input
//
// .NAME vlDataSetFilter - filter that takes vlDataSet as input
// .SECTION Description
// vlDataSetFilter is a filter that takes a single vlDataSet data object
// as input.
#ifndef __vlDataSetFilter_h
#define __vlDataSetFilter_h
......@@ -31,6 +33,9 @@ public:
void PrintSelf(ostream& os, vlIndent indent);
void Update();
// Description:
// Specify the input object.
vlSetObjectMacro(Input,vlDataSet);
vlGetObjectMacro(Input,vlDataSet);
......
......@@ -6,8 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
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.
......@@ -15,9 +13,11 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Computational class for hexahedron
//
// .NAME vlHexahedron - a cell that represents a 3D parallelpiped
// .SECTION Description
// vlHexahedron is a concrete implementation of vlCell to represent a 3D
// parallelpiped (a "cube" topology).
#ifndef __vlHexahedron_h
#define __vlHexahedron_h
......
......@@ -6,8 +6,6 @@
Date: $Date$
Version: $Revision$
Description:
---------------------------------------------------------------------------
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.
......@@ -15,9 +13,10 @@ without the express written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Computational class for lines.
//
// .NAME vlLine - cell represents a 1D line
// .SECTION Description
// vlLine is a concrete implementation of vlCell to represent a 1D line.
#ifndef __vlLine_h
#define __vlLine_h
......
......@@ -13,13 +13,14 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Supplemental object to CellArray and CellList to allow access from points
// to cells using the points. LinkList is a collection of Links, each link
// representing a dynamic list of cell id's using the point. The information
// provided by this object can be used to determine neighbors and construct
// other local topological information.
//
// .NAME vlLinkList - object represents upward pointers from point list to cell list
// .SECTION Description
// vlLinkList is a supplemental object to CellArray and CellList to allow
// access from points to cells using the points. LinkList is a collection
// of Links, each link represents a dynamic list of cell id's using the
// point. The information provided by this object can be used to determine
// neighbors and construct other local topological information.
#ifndef __vlLinkList_h
#define __vlLinkList_h
......@@ -37,13 +38,13 @@ public:
vlLinkList(int sz, int ext=1000);