Fixed a memory allocation problem with the Uentries array in the SStructMatrix

data structure.
This commit is contained in:
falgout 2012-08-27 16:29:36 +00:00
parent 6e7fc7d69d
commit fb4f84a511
4 changed files with 9 additions and 1 deletions

View File

@ -74,6 +74,7 @@ HYPRE_SStructGraphCreate( MPI_Comm comm,
hypre_SStructGraphIUVEntries(graph) = NULL;
hypre_SStructGraphUVEntries(graph) = NULL;
hypre_SStructGraphUVESize(graph) = 0;
hypre_SStructGraphUEMaxSize(graph) = 0;
hypre_SStructGraphUVEOffsets(graph) = NULL;
hypre_SStructGraphRefCount(graph) = 1;
@ -605,6 +606,8 @@ HYPRE_SStructGraphAssemble( HYPRE_SStructGraph graph )
}
hypre_SStructUVEntryNUEntries(Uventry) = nUentries;
hypre_SStructUVEntryUEntries(Uventry) = Uentries;
hypre_SStructGraphUEMaxSize(graph) =
hypre_max(hypre_SStructGraphUEMaxSize(graph), nUentries);
i = nUentries - 1;
hypre_SStructUVEntryToPart(Uventry, i) = to_part;

View File

@ -129,9 +129,10 @@ HYPRE_SStructMatrixCreate( MPI_Comm comm,
size = hypre_max(size, hypre_SStructStencilSize(stencils[part][vi]));
}
}
hypre_SStructMatrixEntriesSize(matrix) = size;
hypre_SStructMatrixSEntries(matrix) = hypre_TAlloc(HYPRE_Int, size);
size += hypre_SStructGraphUEMaxSize(graph);
hypre_SStructMatrixUEntries(matrix) = hypre_TAlloc(HYPRE_Int, size);
hypre_SStructMatrixEntriesSize(matrix) = size;
hypre_SStructMatrixTmpColCoords(matrix) = NULL;
hypre_SStructMatrixTmpCoeffs(matrix) = NULL;

View File

@ -457,6 +457,7 @@ typedef struct hypre_SStructGraph_struct
HYPRE_Int *iUventries; /* rank indexes into Uventries */
hypre_SStructUVEntry **Uventries;
HYPRE_Int Uvesize; /* size of Uventries array */
HYPRE_Int Uemaxsize; /* max size of Uentries */
HYPRE_Int **Uveoffsets; /* offsets for computing rank indexes */
HYPRE_Int ref_count;
@ -501,6 +502,7 @@ typedef struct hypre_SStructGraph_struct
#define hypre_SStructGraphUVEntries(graph) ((graph) -> Uventries)
#define hypre_SStructGraphUVEntry(graph, i) ((graph) -> Uventries[i])
#define hypre_SStructGraphUVESize(graph) ((graph) -> Uvesize)
#define hypre_SStructGraphUEMaxSize(graph) ((graph) -> Uemaxsize)
#define hypre_SStructGraphUVEOffsets(graph) ((graph) -> Uveoffsets)
#define hypre_SStructGraphUVEOffset(graph, p, v)((graph) -> Uveoffsets[p][v])

View File

@ -78,6 +78,7 @@ typedef struct hypre_SStructGraph_struct
HYPRE_Int *iUventries; /* rank indexes into Uventries */
hypre_SStructUVEntry **Uventries;
HYPRE_Int Uvesize; /* size of Uventries array */
HYPRE_Int Uemaxsize; /* max size of Uentries */
HYPRE_Int **Uveoffsets; /* offsets for computing rank indexes */
HYPRE_Int ref_count;
@ -122,6 +123,7 @@ typedef struct hypre_SStructGraph_struct
#define hypre_SStructGraphUVEntries(graph) ((graph) -> Uventries)
#define hypre_SStructGraphUVEntry(graph, i) ((graph) -> Uventries[i])
#define hypre_SStructGraphUVESize(graph) ((graph) -> Uvesize)
#define hypre_SStructGraphUEMaxSize(graph) ((graph) -> Uemaxsize)
#define hypre_SStructGraphUVEOffsets(graph) ((graph) -> Uveoffsets)
#define hypre_SStructGraphUVEOffset(graph, p, v)((graph) -> Uveoffsets[p][v])