Commit 1a7b9211 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH:Will's changes

parent 9f27eed3
......@@ -84,7 +84,7 @@ vtkPolygon \
vtkPriorityQueue \
vtkQuad \
vtkRectilinearGrid \
vtkRefCount \
vtkReferenceCount \
vtkShortArray \
vtkShortScalars \
vtkSource \
......
......@@ -55,7 +55,8 @@ vtkAGraymap::vtkAGraymap(const vtkAGraymap& fs)
vtkAGraymap::vtkAGraymap(const int sz, const int ext)
{
this->S = new vtkUnsignedCharArray(2*sz,2*ext);
this->S = vtkUnsignedCharArray::New();
this->S->Allocate(2*sz,2*ext);
}
......
......@@ -81,8 +81,8 @@ public:
vtkAGraymap &operator=(const vtkAGraymap& fs);
void operator+=(const vtkAGraymap& fs) {*(this->S) += *(fs.S);};
void Reset() {this->S->Reset();};
unsigned char *GetPtr(const int id);
unsigned char *WritePtr(const int id, const int number);
unsigned char *GetPointer(const int id);
unsigned char *WritePointer(const int id, const int number);
// vtkColorScalar interface.
unsigned char *GetColor(int id);
......@@ -100,7 +100,7 @@ public:
int InsertNextAGrayValue(unsigned char ga[2]);
// Used by vtkImageToStructuredPoints (Proper length array is up to user!)
vtkSetRefCountedObjectMacro(S, vtkUnsignedCharArray);
vtkSetReferenceCountedObjectMacro(S, vtkUnsignedCharArray);
vtkGetObjectMacro(S, vtkUnsignedCharArray);
protected:
......@@ -151,9 +151,9 @@ inline int vtkAGraymap::InsertNextColor(unsigned char rgba[4])
// Description:
// Get pointer to array of data starting at data position "id". Form of
// data is a list of repeated intensity/alpha pairs.
inline unsigned char *vtkAGraymap::GetPtr(const int id)
inline unsigned char *vtkAGraymap::GetPointer(const int id)
{
return this->S->GetPtr(2*id);
return this->S->GetPointer(2*id);
}
// Description:
......@@ -161,9 +161,9 @@ inline unsigned char *vtkAGraymap::GetPtr(const int id)
// bumped by number (and memory allocated if necessary). Id is the
// location you wish to write into; number is the number of scalars to
// write.
inline unsigned char *vtkAGraymap::WritePtr(const int id, const int number)
inline unsigned char *vtkAGraymap::WritePointer(const int id, const int number)
{
return this->S->WritePtr(2*id,2*number);
return this->S->WritePointer(2*id,2*number);
}
#endif
......@@ -53,7 +53,8 @@ vtkAPixmap::vtkAPixmap(const vtkAPixmap& fs)
vtkAPixmap::vtkAPixmap(const int sz, const int ext)
{
this->S = new vtkUnsignedCharArray(4*sz,4*ext);
this->S = vtkUnsignedCharArray::New();
this->S->Allocate(4*sz,4*ext);
}
vtkAPixmap::~vtkAPixmap()
......@@ -81,7 +82,7 @@ void vtkAPixmap::GetColor(int id, unsigned char rgba[4])
{
unsigned char *_rgba;
_rgba = this->S->GetPtr(4*id);
_rgba = this->S->GetPointer(4*id);
rgba[0] = _rgba[0];
rgba[1] = _rgba[1];
rgba[2] = _rgba[2];
......@@ -98,7 +99,7 @@ void vtkAPixmap::SetNumberOfColors(int number)
void vtkAPixmap::SetColor(int id, unsigned char rgba[4])
{
id *= 4;
memcpy (this->S->GetPtr(id), rgba, 4);
memcpy (this->S->GetPointer(id), rgba, 4);
}
// Description:
......
......@@ -76,8 +76,8 @@ public:
vtkAPixmap &operator=(const vtkAPixmap& fs);
void operator+=(const vtkAPixmap& fs) {*(this->S) += *(fs.S);};
void Reset() {this->S->Reset();};
unsigned char *GetPtr(const int id);
unsigned char *WritePtr(const int id, const int number);
unsigned char *GetPointer(const int id);
unsigned char *WritePointer(const int id, const int number);
// vtkColorScalar interface.
unsigned char *GetColor(int id);
......@@ -88,7 +88,7 @@ public:
int InsertNextColor(unsigned char rgba[4]);
// Used by vtkImageToStructuredPoints (Proper length array is up to user!)
vtkSetRefCountedObjectMacro(S, vtkUnsignedCharArray);
vtkSetReferenceCountedObjectMacro(S, vtkUnsignedCharArray);
vtkGetObjectMacro(S, vtkUnsignedCharArray);
protected:
......@@ -99,14 +99,14 @@ protected:
// Return a rgba color at array location i.
inline unsigned char *vtkAPixmap::GetColor(int i)
{
return this->S->GetPtr(4*i);
return this->S->GetPointer(4*i);
}
// Description:
// Get pointer to array of data starting at data position "id".
inline unsigned char *vtkAPixmap::GetPtr(const int id)
inline unsigned char *vtkAPixmap::GetPointer(const int id)
{
return this->S->GetPtr(4*id);
return this->S->GetPointer(4*id);
}
// Description:
......@@ -114,9 +114,9 @@ inline unsigned char *vtkAPixmap::GetPtr(const int id)
// bumped by number (and memory allocated if necessary). Id is the
// location you wish to write into; number is the number of scalars to
// write.
inline unsigned char *vtkAPixmap::WritePtr(const int id, const int number)
inline unsigned char *vtkAPixmap::WritePointer(const int id, const int number)
{
return this->S->WritePtr(4*id,4*number);
return this->S->WritePointer(4*id,4*number);
}
#endif
......@@ -69,8 +69,8 @@ public:
void SetValue(const int id, const int value);
vtkBitArray &InsertValue(const int id, const int i);
int InsertNextValue(const int i);
unsigned char *GetPtr(const int id);
unsigned char *WritePtr(const int id, const int number);
unsigned char *GetPointer(const int id);
unsigned char *WritePointer(const int id, const int number);
// special operators
vtkBitArray &operator=(const vtkBitArray& ia);
......@@ -93,7 +93,7 @@ private:
// Description:
// Get the address of a particular data index.
inline unsigned char *vtkBitArray::GetPtr(const int id)
inline unsigned char *vtkBitArray::GetPointer(const int id)
{
return this->Array + id/8;
};
......@@ -102,7 +102,7 @@ inline unsigned char *vtkBitArray::GetPtr(const int id)
// 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::WritePtr(const int id, const int number)
inline unsigned char *vtkBitArray::WritePointer(const int id, const int number)
{
int newSize=id+number;
if ( newSize > this->Size ) this->Resize(newSize);
......
......@@ -53,7 +53,8 @@ vtkBitScalars::vtkBitScalars(const vtkBitScalars& cs)
vtkBitScalars::vtkBitScalars(const int sz, const int ext)
{
this->S = new vtkBitArray(sz,ext);
this->S = vtkBitArray::New();
this->S->Allocate(sz,ext);
}
vtkBitScalars::~vtkBitScalars()
......
......@@ -79,8 +79,8 @@ public:
void GetScalars(vtkIdList& ptIds, vtkFloatScalars& fs);
// miscellaneous
unsigned char *GetPtr(const int id);
unsigned char *WritePtr(const int id, const int number);
unsigned char *GetPointer(const int id);
unsigned char *WritePointer(const int id, const int number);
vtkBitScalars &operator=(const vtkBitScalars& cs);
void operator+=(const vtkBitScalars& cs) {*(this->S) += *(cs.S);};
void Reset() {this->S->Reset();};
......@@ -96,9 +96,9 @@ inline void vtkBitScalars::SetNumberOfScalars(int number)
// Description:
// Get pointer to array of data starting at data position "id".
inline unsigned char *vtkBitScalars::GetPtr(const int id)
inline unsigned char *vtkBitScalars::GetPointer(const int id)
{
return this->S->GetPtr(id);
return this->S->GetPointer(id);
}
// Description:
......@@ -106,9 +106,9 @@ inline unsigned char *vtkBitScalars::GetPtr(const int id)
// bumped by number (and memory allocated if necessary). Id is the
// location you wish to write into; number is the number of scalars to
// write.
inline unsigned char *vtkBitScalars::WritePtr(const int id, const int number)
inline unsigned char *vtkBitScalars::WritePointer(const int id, const int number)
{
return this->S->WritePtr(id,number);
return this->S->WritePointer(id,number);
}
#endif
......@@ -53,7 +53,8 @@ vtkBitmap::vtkBitmap(const vtkBitmap& fs)
vtkBitmap::vtkBitmap(const int sz, const int ext)
{
this->S = new vtkBitArray(sz,ext);
this->S = vtkBitArray::New();
this->S->Allocate(sz,ext);
}
vtkBitmap::~vtkBitmap()
......
......@@ -76,8 +76,8 @@ public:
vtkBitmap &operator=(const vtkBitmap& fs);
void operator+=(const vtkBitmap& fs) {*(this->S) += *(fs.S);};
void Reset() {this->S->Reset();};
unsigned char *GetPtr(const int id);
unsigned char *WritePtr(const int id, const int number);
unsigned char *GetPointer(const int id);
unsigned char *WritePointer(const int id, const int number);
// vtkColorScalar interface.
unsigned char *GetColor(int id);
......@@ -105,18 +105,18 @@ inline void vtkBitmap::SetNumberOfColors(int number)
// Description:
// Get pointer to byte containing bit in question. You will have to decompose
// byte to obtain appropriate bit value.
inline unsigned char *vtkBitmap::GetPtr(const int id)
inline unsigned char *vtkBitmap::GetPointer(const int id)
{
return this->S->GetPtr(id);
return this->S->GetPointer(id);
}
// Description:
// Get pointer to data. Useful for direct writes into object. MaxId is bumped
// by number (and memory allocated if necessary). Id is the location you
// wish to write into; number is the number of rgba colors to write.
inline unsigned char *vtkBitmap::WritePtr(const int id, const int number)
inline unsigned char *vtkBitmap::WritePointer(const int id, const int number)
{
return this->S->WritePtr(id,number);
return this->S->WritePointer(id,number);
}
#endif
......@@ -49,7 +49,8 @@ vtkCellArray::vtkCellArray()
vtkCellArray::vtkCellArray(const int sz, const int ext)
{
this->Ia = new vtkIntArray(sz,ext);
this->Ia = vtkIntArray::New();
this->Ia->Allocate(sz,ext);
this->NumberOfCells = 0;
this->Location = 0;
}
......
......@@ -60,7 +60,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "vtkIntArray.h"
#include "vtkCell.h"
class VTK_EXPORT vtkCellArray : public vtkRefCount
class VTK_EXPORT vtkCellArray : public vtkReferenceCount
{
public:
vtkCellArray();
......@@ -102,8 +102,8 @@ public:
int GetMaxCellSize();
// miscellaneous pointer type operations (for fast read/write operations)
int *GetPtr();
int *WritePtr(const int ncells, const int size);
int *GetPointer();
int *WritePointer(const int ncells, const int size);
// reuse memory
void Reset();
......@@ -124,7 +124,7 @@ inline int vtkCellArray::GetNumberOfCells() {return this->NumberOfCells;};
inline int vtkCellArray::InsertNextCell(int npts, int* pts)
{
int i = this->Ia->GetMaxId() + 1;
int *ptr = this->Ia->WritePtr(i,npts+1);
int *ptr = this->Ia->WritePointer(i,npts+1);
for ( *ptr++ = npts, i = 0; i < npts; i++) *ptr++ = *pts++;
......@@ -140,7 +140,7 @@ inline int vtkCellArray::InsertNextCell(vtkIdList &pts)
{
int npts = pts.GetNumberOfIds();
int i = this->Ia->GetMaxId() + 1;
int *ptr = this->Ia->WritePtr(i,npts+1);
int *ptr = this->Ia->WritePointer(i,npts+1);
for ( *ptr++ = npts, i = 0; i < npts; i++) *ptr++ = pts.GetId(i);
......@@ -184,7 +184,7 @@ inline int vtkCellArray::InsertNextCell(vtkCell *cell)
{
int npts = cell->GetNumberOfPoints();
int i = this->Ia->GetMaxId() + 1;
int *ptr = this->Ia->WritePtr(i,npts+1);
int *ptr = this->Ia->WritePointer(i,npts+1);
for ( *ptr++ = npts, i = 0; i < npts; i++) *ptr++ = cell->PointIds.GetId(i);
......@@ -233,7 +233,7 @@ inline int vtkCellArray::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);
pts = this->Ia->GetPointer(this->Location);
this->Location += npts;
return 1;
}
......@@ -261,7 +261,7 @@ inline int vtkCellArray::GetNumberOfConnectivityEntries()
// the internal array.
inline void vtkCellArray::GetCell(int loc, int &npts, int* &pts)
{
npts=this->Ia->GetValue(loc++); pts=this->Ia->GetPtr(loc);
npts=this->Ia->GetValue(loc++); pts=this->Ia->GetPointer(loc);
}
// Description:
......@@ -278,7 +278,7 @@ inline void vtkCellArray::ReverseCell(int loc)
{
int i, tmp;
int npts=this->Ia->GetValue(loc);
int *pts=this->Ia->GetPtr(loc+1);
int *pts=this->Ia->GetPointer(loc+1);
for (i=0; i < (npts/2); i++)
{
tmp = pts[i];
......@@ -291,26 +291,26 @@ inline void vtkCellArray::ReverseCell(int loc)
// Replace the point ids of the cell with a different list of point ids.
inline void vtkCellArray::ReplaceCell(int loc, int npts, int *pts)
{
int *oldPts=this->Ia->GetPtr(loc+1);
int *oldPts=this->Ia->GetPointer(loc+1);
for (int i=0; i < npts; i++) oldPts[i] = pts[i];
}
// Description:
// Get pointer to array of cell data.
inline int *vtkCellArray::GetPtr()
inline int *vtkCellArray::GetPointer()
{
return this->Ia->GetPtr(0);
return this->Ia->GetPointer(0);
}
// Description:
// Get pointer to data array for purpose of direct writes of data. Size is the
// total storage consumed by the cell array. ncells is the number of cells
// represented in the array.
inline int *vtkCellArray::WritePtr(const int ncells, const int size)
inline int *vtkCellArray::WritePointer(const int ncells, const int size)
{
this->NumberOfCells = ncells;
this->Location = 0;
return this->Ia->WritePtr(0,size);
return this->Ia->WritePointer(0,size);
}
#endif
......@@ -50,7 +50,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#ifndef __vtkCellList_h
#define __vtkCellList_h
#include "vtkRefCount.h"
#include "vtkReferenceCount.h"
#include "vtkCellType.h"
struct _vtkCell_s {
......@@ -58,7 +58,7 @@ struct _vtkCell_s {
int loc; //location in associated CellArray object
};
class VTK_EXPORT vtkCellList : public vtkRefCount
class VTK_EXPORT vtkCellList : public vtkReferenceCount
{
public:
vtkCellList() : Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
......
......@@ -68,8 +68,8 @@ public:
void SetValue(const int id, const char c);
vtkCharArray &InsertValue(const int id, const char c);
int InsertNextValue(const char c);
char *GetPtr(const int id);
char *WritePtr(const int id, const int number);
char *GetPointer(const int id);
char *WritePointer(const int id, const int number);
// special operators
vtkCharArray &operator=(const vtkCharArray& ia);
......@@ -114,13 +114,13 @@ inline void vtkCharArray::SetValue(const int id, const char value)
// Description:
// Get the address of a particular data index.
inline char *vtkCharArray::GetPtr(const int id) {return this->Array + id;};
inline char *vtkCharArray::GetPointer(const int id) {return this->Array + id;};
// 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 char *vtkCharArray::WritePtr(const int id, const int number)
inline char *vtkCharArray::WritePointer(const int id, const int number)
{
int newSize=id+number;
if ( newSize > this->Size ) this->Resize(newSize);
......
......@@ -82,7 +82,7 @@ public:
// Description:
// Get pointer to array of data starting at data position "id".
virtual unsigned char *GetPtr(const int id) = 0;
virtual unsigned char *GetPointer(const int id) = 0;
// abstract interface for vtkColorScalars
// Description:
......
......@@ -95,7 +95,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include "vtkPolyVertex.h"
#include "vtkPolygon.h"
#include "vtkQuad.h"
#include "vtkRefCount.h"
#include "vtkReferenceCount.h"
#include "vtkScalars.h"
#include "vtkShortArray.h"
#include "vtkShortScalars.h"
......
......@@ -47,9 +47,9 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#ifndef __vtkDoubleArray_h
#define __vtkDoubleArray_h
#include "vtkRefCount.h"
#include "vtkReferenceCount.h"
class VTK_EXPORT vtkDoubleArray : public vtkRefCount
class VTK_EXPORT vtkDoubleArray : public vtkReferenceCount
{
public:
vtkDoubleArray():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
......@@ -68,8 +68,8 @@ public:
void SetValue(const int id, const double value);
vtkDoubleArray &InsertValue(const int id, const double f);
int InsertNextValue(const double f);
double *GetPtr(const int id);
double *WritePtr(const int id, const int number);
double *GetPointer(const int id);
double *WritePointer(const int id, const int number);
// special operators
vtkDoubleArray &operator=(const vtkDoubleArray& fa);
......@@ -114,13 +114,13 @@ inline void vtkDoubleArray::SetValue(const int id, const double value)
// Description:
// Get the address of a particular data index.
inline double *vtkDoubleArray::GetPtr(const int id) {return this->Array + id;};
inline double *vtkDoubleArray::GetPointer(const int id) {return this->Array + id;};
// 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 double *vtkDoubleArray::WritePtr(const int id, const int number)
inline double *vtkDoubleArray::WritePointer(const int id, const int number)
{
int newSize=id+number;
if ( newSize > this->Size ) this->Resize(newSize);
......
......@@ -116,7 +116,8 @@ void vtkEdgeTable::InsertEdge(int p1, int p2)
if ( this->Table[index] == NULL )
{
this->Table[index] = new vtkIdList(6,12);
this->Table[index] = vtkIdList::New();
this->Table[index]->Allocate(6,12);
}
this->Table[index]->InsertNextId(search);
......
......@@ -47,9 +47,9 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#ifndef __vtkFloatArray_h
#define __vtkFloatArray_h
#include "vtkRefCount.h"
#include "vtkReferenceCount.h"
class VTK_EXPORT vtkFloatArray : public vtkRefCount
class VTK_EXPORT vtkFloatArray : public vtkReferenceCount
{
public:
vtkFloatArray():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
......@@ -68,8 +68,8 @@ public:
void SetValue(const int id, const float value);
vtkFloatArray &InsertValue(const int id, const float f);
int InsertNextValue(const float f);
float *GetPtr(const int id);
float *WritePtr(const int id, const int number);
float *GetPointer(const int id);
float *WritePointer(const int id, const int number);
// special operators
vtkFloatArray &operator=(const vtkFloatArray& fa);
......@@ -114,13 +114,13 @@ inline void vtkFloatArray::SetValue(const int id, const float value)
// Description:
// Get the address of a particular data index.
inline float *vtkFloatArray::GetPtr(const int id) {return this->Array + id;};
inline float *vtkFloatArray::GetPointer(const int id) {return this->Array + id;};
// 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 float *vtkFloatArray::WritePtr(const int id, const int number)
inline float *vtkFloatArray::WritePointer(const int id, const int number)
{
int newSize=id+number;
if ( newSize > this->Size ) this->Resize(newSize);
......
......@@ -53,7 +53,8 @@ vtkFloatNormals::vtkFloatNormals(const vtkFloatNormals& fn)
vtkFloatNormals::vtkFloatNormals(const int sz, const int ext)
{
this->N = new vtkFloatArray(3*sz,3*ext);
this->N = vtkFloatArray::New();
this->N->Allocate(3*sz,3*ext);
}
vtkFloatNormals::~vtkFloatNormals()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment