Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #pragma ident "@(#) libfi/array/size.c 92.2 07/07/99 15:52:02"
00038 #include <liberrno.h>
00039 #include <stddef.h>
00040 #include <cray/dopevec.h>
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 _f_int
00052 _SIZE (DopeVectorType * source,
00053 _f_int *dimptr)
00054 {
00055 int iresult;
00056 int dim;
00057 int rank;
00058 int loopj;
00059
00060
00061
00062 if (source->p_or_a && !source->assoc)
00063 _lerror (_LELVL_ABORT, FENMPTAR, "SIZE");
00064
00065 rank = source->n_dim;
00066 if (dimptr == NULL) {
00067 iresult = 1;
00068
00069 for (loopj = 0; loopj < rank; loopj++)
00070 iresult = iresult * source->dimension[loopj].extent;
00071 }
00072 else {
00073
00074 dim = *dimptr - 1;
00075 if (dim < 0 || dim >= rank)
00076 _lerror (_LELVL_ABORT, FENMSCDM, "SIZE");
00077
00078
00079 iresult = source->dimension[dim].extent;
00080 }
00081
00082 return(iresult);
00083 }
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 #if defined (_UNICOS)
00095 #pragma duplicate _SIZE_4 as _SIZE_2
00096 #pragma duplicate _SIZE_4 as _SIZE_1
00097 #endif
00098
00099 _f_int4
00100 _SIZE_4 (DopeVectorType * source,
00101 _f_int *dimptr)
00102 {
00103 _f_int4 iresult;
00104 int dim;
00105 int rank;
00106 int loopj;
00107
00108
00109
00110 if (source->p_or_a && !source->assoc)
00111 _lerror (_LELVL_ABORT, FENMPTAR, "SIZE");
00112
00113 rank = source->n_dim;
00114 if (dimptr == NULL) {
00115 iresult = 1;
00116
00117 for (loopj = 0; loopj < rank; loopj++)
00118 iresult = iresult * source->dimension[loopj].extent;
00119 }
00120 else {
00121
00122 dim = *dimptr - 1;
00123 if (dim < 0 || dim >= rank)
00124 _lerror (_LELVL_ABORT, FENMSCDM, "SIZE");
00125
00126
00127 iresult = source->dimension[dim].extent;
00128 }
00129
00130 return(iresult);
00131 }
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 _f_int8
00143 _SIZE_8 (DopeVectorType * source,
00144 _f_int *dimptr)
00145 {
00146 _f_int8 iresult;
00147 int dim;
00148 int rank;
00149 int loopj;
00150
00151
00152
00153 if (source->p_or_a && !source->assoc)
00154 _lerror (_LELVL_ABORT, FENMPTAR, "SIZE");
00155
00156 rank = source->n_dim;
00157 if (dimptr == NULL) {
00158 iresult = 1;
00159
00160 for (loopj = 0; loopj < rank; loopj++)
00161 iresult = iresult * source->dimension[loopj].extent;
00162 }
00163 else {
00164
00165 dim = *dimptr - 1;
00166 if (dim < 0 || dim >= rank)
00167 _lerror (_LELVL_ABORT, FENMSCDM, "SIZE");
00168
00169
00170 iresult = source->dimension[dim].extent;
00171 }
00172
00173 return(iresult);
00174 }