@@ -950,18 +950,6 @@ def _arg_check(self, args, intervals, **kwargs):
950950 for i , s in zip (self .dimensions , data .shape , strict = True ):
951951 i ._arg_check (args , s , intervals [i ])
952952
953- # SparseTimeFunctions use int64 indexing regardless of index mode
954- if not self .is_SparseTimeFunction and \
955- args .options ['index-mode' ] == 'int32' and \
956- args .options ['linearize' ] and \
957- self .is_regular and \
958- data .size - 1 >= np .iinfo (np .int32 ).max :
959- raise InvalidArgument (f"`{ self .name } `, with its { data .size } elements, is too "
960- "big for int32 pointer arithmetic. Consider using the "
961- "'index-mode=int64' option, the save=Buffer(..) "
962- "API (TimeFunction only), or domain "
963- "decomposition via MPI" )
964-
965953 def _arg_finalize (self , args , alias = None ):
966954 key = alias or self
967955 return {key .name : self ._C_make_dataobj (alias = key , ** args )}
@@ -1343,6 +1331,28 @@ def avg(self, p=None, dims=None):
13431331 tot = self .sum (p , dims )
13441332 return tot / len (tot .args )
13451333
1334+ def _arg_check (self , args , intervals , ** kwargs ):
1335+ """
1336+ Check that `args` contains legal runtime values bound to `self`.
1337+
1338+ Raises
1339+ ------
1340+ InvalidArgument
1341+ If an incompatibility is detected.
1342+ """
1343+ data = args [self .name ]
1344+
1345+ if args .options ['index-mode' ] == 'int32' and \
1346+ args .options ['linearize' ] and \
1347+ data .size - 1 >= np .iinfo (np .int32 ).max :
1348+ raise InvalidArgument (f"`{ self .name } `, with its { data .size } elements, is too "
1349+ "big for int32 pointer arithmetic. Consider using the "
1350+ "'index-mode=int64' option, the save=Buffer(..) "
1351+ "API (TimeFunction only), or domain "
1352+ "decomposition via MPI" )
1353+
1354+ return super ()._arg_check (args , intervals , ** kwargs )
1355+
13461356
13471357class TimeFunction (Function ):
13481358
0 commit comments