Commit 9bb2ee82 authored by fogal1's avatar fogal1

Switch to vectors for easier debugging.

I guess memory management is simpler too.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@8001 18c085ea-50e0-402c-830e-de6fd14e8384
parent fcc4599b
......@@ -94,6 +94,10 @@ void QuicksortTuple3(Tuple3 *, int);
//
// Mark C. Miller, Mon Jan 22 22:09:01 PST 2007
// Changed MPI_COMM_WORLD to VISIT_MPI_COMM
//
// Tom Fogal, Wed Jun 17 19:05:26 MDT 2009
// Account for change to vectors.
//
// ****************************************************************************
avtImagePartition::avtImagePartition(int w, int h, int np, int tp)
......@@ -124,20 +128,16 @@ avtImagePartition::avtImagePartition(int w, int h, int np, int tp)
}
thisPartition = thisProcessor;
ptpAssignments = new int[numProcessors];
ptpAssignments.resize(numProcessors);
for (i = 0 ; i < numProcessors ; i++)
{
ptpAssignments[i] = i;
}
stpAssignments = new int[height];
for (i = 0 ; i < height ; i++)
{
stpAssignments[i] = 0;
}
stpAssignments.resize(height, 0);
partitionStartsOnScanline = new int[numProcessors];
partitionStopsOnScanline = new int[numProcessors];
partitionStartsOnScanline.resize(numProcessors);
partitionStopsOnScanline.resize(numProcessors);
for (i = 0 ; i < numProcessors ; i++)
{
partitionStartsOnScanline[i] = -1;
......@@ -161,33 +161,13 @@ avtImagePartition::avtImagePartition(int w, int h, int np, int tp)
// Hank Childs, Tue Jan 1 11:24:10 PST 2002
// Clean up new data members.
//
// Tom Fogal, Wed Jun 17 19:17:59 MDT 2009
// Account for change to vectors.
//
// ****************************************************************************
avtImagePartition::~avtImagePartition()
{
if (ptpAssignments != NULL)
{
delete [] ptpAssignments;
ptpAssignments = NULL;
}
if (stpAssignments != NULL)
{
delete [] stpAssignments;
stpAssignments = NULL;
}
if (partitionStartsOnScanline != NULL)
{
delete [] partitionStartsOnScanline;
partitionStartsOnScanline = NULL;
}
if (partitionStopsOnScanline != NULL)
{
delete [] partitionStopsOnScanline;
partitionStopsOnScanline = NULL;
}
}
......@@ -315,6 +295,7 @@ avtImagePartition::GetPartition(int part, int &minW, int &maxW, int &minH,
//
// Tom Fogal, Wed Jun 17 15:54:31 MDT 2009
// Fix size of array, preventing access to uninitialized values.
// Ensure the `scanline to partition' vector is large enough.
//
// ****************************************************************************
......@@ -331,6 +312,7 @@ avtImagePartition::EstablishPartitionBoundaries(int *samples)
//
const int n_scanlines = last_scanline - first_scanline;
std::vector<int> allSamples(n_scanlines);
stpAssignments.resize(n_scanlines, 0);
SumIntArrayAcrossAllProcessors(samples, &allSamples[0], n_scanlines);
//
......
......@@ -76,6 +76,9 @@
// Define private copy constructor and assignment operator to prevent
// accidental use of default, bitwise copy implementations.
//
// Tom Fogal, Wed Jun 17 19:04:46 MDT 2009
// Switch to vectors for easier debugging.
//
// ****************************************************************************
class PIPELINE_API avtImagePartition
......@@ -99,9 +102,9 @@ class PIPELINE_API avtImagePartition
void DetermineAssignments(int *);
const int *GetPartitionToProcessorAssignments(void)
{ return ptpAssignments; };
{ return &ptpAssignments[0]; };
const int *GetScanlineToPartitionAssignemnts(void)
{ return stpAssignments; };
{ return &stpAssignments[0]; };
int GetWidth(void) { return width; };
int GetHeight(void) { return height; };
......@@ -130,10 +133,10 @@ class PIPELINE_API avtImagePartition
bool establishedPartitionBoundaries;
int *ptpAssignments;
int *stpAssignments;
int *partitionStartsOnScanline;
int *partitionStopsOnScanline;
std::vector<int> ptpAssignments;
std::vector<int> stpAssignments;
std::vector<int> partitionStartsOnScanline;
std::vector<int> partitionStopsOnScanline;
private:
// These methods are defined to prevent accidental use of bitwise copy
......@@ -283,7 +286,4 @@ avtImagePartition::PartitionList(const int &minW, const int &maxW,
return (max-min+1);
}
#endif
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