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