Commit 494babf6 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Tweaks on design.

parent 5cc190f5
......@@ -42,12 +42,9 @@ public:
_vlLink_s &GetLink(int ptId);
unsigned short GetNcells(int ptId);
void BuildLinks(vlDataSet *data);
int *GetCells(int ptId);
void IncrementLinkCount(int ptId);
void AllocateLinks(int n);
void InsertCellReference(int ptId, unsigned short pos, int cellId);
void InsertNextCellReference(int ptId, int cellId);
void BuildLinks(vlDataSet *data);
void DeletePoint(int ptId);
void RemoveCellReference(int cellId, int ptId);
......@@ -57,6 +54,10 @@ public:
void Reset();
private:
void IncrementLinkCount(int ptId);
void AllocateLinks(int n);
void InsertCellReference(int ptId, unsigned short pos, int cellId);
_vlLink_s *Array; // pointer to data
int Size; // allocated size of data
int MaxId; // maximum index inserted thus far
......
......@@ -18,7 +18,7 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
vlLinkList::vlLinkList(int sz, int ext)
{
static _vlLink_s linkInit = {0,0};
static _vlLink_s linkInit = {0,NULL};
this->Size = sz;
this->Array = new _vlLink_s[sz];
......@@ -30,6 +30,14 @@ vlLinkList::vlLinkList(int sz, int ext)
vlLinkList::~vlLinkList()
{
if ( this->Array == NULL ) return;
for (int i=0; i<=this->MaxId; i++)
{
if ( this->Array[i].cells != NULL )
delete [] this->Array[i].cells;
}
delete [] this->Array;
}
......@@ -101,7 +109,8 @@ void vlLinkList::BuildLinks(vlDataSet *data)
}
// now allocate storage for the links
this->AllocateLinks(numPts);
this->AllocateLinks(numPts);
this->MaxId = numPts - 1;
// fill out lists with references to cells
linkLoc = new unsigned short[numPts];
......
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