Commit 28f59ace authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Modified interface for readers.

parent 55d93250
......@@ -64,6 +64,11 @@ public:
void ReverseCell(int loc);
void ReplaceCell(int loc, int npts, int *pts);
// miscellaneous pointer type operations (for fast read/write operations)
int *GetPtr();
int *WritePtr(const int ncells, const int size);
void WrotePtr();
protected:
int NumberOfCells;
int Location;
......@@ -206,4 +211,28 @@ inline void vlCellArray::ReplaceCell(int loc, int npts, int *pts)
for (int i=0; i < npts; i++) oldPts[i] = pts[i];
}
// Description:
// Get pointer to array of cell data.
inline int *vlCellArray::GetPtr()
{
return this->Ia.GetPtr(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.
// Use the method WrotePtr() to mark completion of write.
inline int *vlCellArray::WritePtr(const int ncells, const int size)
{
this->NumberOfCells = ncells;
this->Location = 0;
return this->Ia.WritePtr(0,size);
}
// Description:
// Terminate direct write of data. Although dummy routine now, reserved for
// future use.
inline void vlCellArray::WrotePtr() {}
#endif
......@@ -38,12 +38,12 @@ public:
char *GetDataType() {return "vlUnstructuredGrid";};
void PrintSelf(ostream& os, vlIndent indent);
// cell creation methods
// cell creation/manipulation methods
void Allocate(int numCells=1000, int extSize=1000);
int InsertNextCell(int type, vlIdList& ptIds);
int InsertNextCell(int type, int npts, int pts[MAX_CELL_SIZE]);
void InsertCells(int numCells, int width, int* data);
void InsertCells(int numCells, int* data);
void SetCells(int *types, vlCellArray *cells);
vlCellArray *GetCells() {return this->Connectivity;};
// dataset interface
vlDataSet *MakeObject() {return new vlUnstructuredGrid(*this);};
......
......@@ -216,14 +216,20 @@ int vlUnstructuredGrid::InsertNextCell(int type, int npts,
this->Cells->InsertNextCell(type,this->Connectivity->GetLocation(npts));
}
void vlUnstructuredGrid::InsertCells(int numCells, int width, int *data)
void vlUnstructuredGrid::SetCells(int *types, vlCellArray *cells)
{
int i, npts, *pts;
}
void vlUnstructuredGrid::InsertCells(int numCells, int *data)
{
// set cell array
if ( this->Connectivity ) this->Connectivity->UnRegister(this);
this->Connectivity = cells;
if ( this->Connectivity ) this->Connectivity->Register(this);
// build types
for (i=0, cells->InitTraversal(); cells->GetNextCell(npts,pts); i++)
{
this->Cells->InsertNextCell(types[i],this->Connectivity->GetLocation(npts));
}
}
void vlUnstructuredGrid::BuildLinks()
......
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