Skip to content

Commit 08dee38

Browse files
committed
use sunindextype1d where needed
1 parent 7cbe0de commit 08dee38

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

include/sundials/sundials_types.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,20 @@ typedef sunrealtype*** sunrealtype3d;
150150

151151
typedef SUNDIALS_INDEX_TYPE sunindextype;
152152

153+
154+
/*
155+
*-----------------------------------------------------------------------------
156+
* Type(s): sunindextype1d, sunindextype2d, sunindextype3d
157+
* These types are to be used in place of sunindextype*, sunindextype**, and
158+
* sunindextype*** when semantically these map to arrays. I.e., if sunindextype*
159+
* refers to an array, then use sunindextype1d. If it refers to a
160+
* a pointer to a singular value (for "out" params), use sunindextype*.
161+
*-----------------------------------------------------------------------------
162+
*/
163+
typedef sunindextype* sunindextype1d;
164+
typedef sunindextype** sunindextype2d;
165+
typedef sunindextype*** sunindextype3d;
166+
153167
/*
154168
*------------------------------------------------------------------
155169
* Type : suncountertype

include/sunmatrix/sunmatrix_band.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ SUNDIALS_EXPORT sunindextype SUNBandMatrix_UpperBandwidth(SUNMatrix A);
108108
SUNDIALS_EXPORT sunindextype SUNBandMatrix_StoredUpperBandwidth(SUNMatrix A);
109109
SUNDIALS_EXPORT sunindextype SUNBandMatrix_LDim(SUNMatrix A);
110110
SUNDIALS_EXPORT sunindextype SUNBandMatrix_LData(SUNMatrix A);
111-
SUNDIALS_EXPORT sunrealtype* SUNBandMatrix_Data(SUNMatrix A);
112-
SUNDIALS_EXPORT sunrealtype** SUNBandMatrix_Cols(SUNMatrix A);
113-
SUNDIALS_EXPORT sunrealtype* SUNBandMatrix_Column(SUNMatrix A, sunindextype j);
111+
SUNDIALS_EXPORT sunrealtype1d SUNBandMatrix_Data(SUNMatrix A);
112+
SUNDIALS_EXPORT sunrealtype2d SUNBandMatrix_Cols(SUNMatrix A);
113+
SUNDIALS_EXPORT sunrealtype1d SUNBandMatrix_Column(SUNMatrix A, sunindextype j);
114114

115115
SUNDIALS_EXPORT SUNMatrix_ID SUNMatGetID_Band(SUNMatrix A);
116116
SUNDIALS_EXPORT SUNMatrix SUNMatClone_Band(SUNMatrix A);

include/sunmatrix/sunmatrix_dense.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ SUNDIALS_EXPORT void SUNDenseMatrix_Print(SUNMatrix A, FILE* outfile);
8585
SUNDIALS_EXPORT sunindextype SUNDenseMatrix_Rows(SUNMatrix A);
8686
SUNDIALS_EXPORT sunindextype SUNDenseMatrix_Columns(SUNMatrix A);
8787
SUNDIALS_EXPORT sunindextype SUNDenseMatrix_LData(SUNMatrix A);
88-
SUNDIALS_EXPORT sunrealtype* SUNDenseMatrix_Data(SUNMatrix A);
89-
SUNDIALS_EXPORT sunrealtype** SUNDenseMatrix_Cols(SUNMatrix A);
90-
SUNDIALS_EXPORT sunrealtype* SUNDenseMatrix_Column(SUNMatrix A, sunindextype j);
88+
SUNDIALS_EXPORT sunrealtype1d SUNDenseMatrix_Data(SUNMatrix A);
89+
SUNDIALS_EXPORT sunrealtype2d SUNDenseMatrix_Cols(SUNMatrix A);
90+
SUNDIALS_EXPORT sunrealtype1d SUNDenseMatrix_Column(SUNMatrix A, sunindextype j);
9191

9292
SUNDIALS_EXPORT SUNMatrix_ID SUNMatGetID_Dense(SUNMatrix A);
9393
SUNDIALS_EXPORT SUNMatrix SUNMatClone_Dense(SUNMatrix A);

include/sunmatrix/sunmatrix_sparse.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ SUNDIALS_EXPORT
143143
int SUNSparseMatrix_SparseType(SUNMatrix A);
144144

145145
SUNDIALS_EXPORT
146-
sunrealtype* SUNSparseMatrix_Data(SUNMatrix A);
146+
sunrealtype1d SUNSparseMatrix_Data(SUNMatrix A);
147147

148148
SUNDIALS_EXPORT
149-
sunindextype* SUNSparseMatrix_IndexValues(SUNMatrix A);
149+
sunindextype1d SUNSparseMatrix_IndexValues(SUNMatrix A);
150150

151151
SUNDIALS_EXPORT
152-
sunindextype* SUNSparseMatrix_IndexPointers(SUNMatrix A);
152+
sunindextype1d SUNSparseMatrix_IndexPointers(SUNMatrix A);
153153

154154
SUNDIALS_EXPORT
155155
SUNMatrix_ID SUNMatGetID_Sparse(SUNMatrix A);

0 commit comments

Comments
 (0)