@@ -836,6 +836,7 @@ int CeedQFunctionAddInput(CeedQFunction qf, const char *field_name, CeedInt size
836836
837837 CeedCall (CeedQFunctionIsImmutable (qf , & is_immutable ));
838838 CeedCheck (!is_immutable , CeedQFunctionReturnCeed (qf ), CEED_ERROR_MAJOR , "QFunction cannot be changed after set as immutable" );
839+ CeedCheck (qf -> num_input_fields < CEED_FIELD_MAX , CeedQFunctionReturnCeed (qf ), CEED_ERROR_MINOR , "Can only add %d input fields" , CEED_FIELD_MAX );
839840 CeedCheck (eval_mode != CEED_EVAL_WEIGHT || size == 1 , CeedQFunctionReturnCeed (qf ), CEED_ERROR_DIMENSION , "CEED_EVAL_WEIGHT should have size 1" );
840841 for (CeedInt i = 0 ; i < qf -> num_input_fields ; i ++ ) {
841842 CeedCheck (strcmp (field_name , qf -> input_fields [i ]-> field_name ), CeedQFunctionReturnCeed (qf ), CEED_ERROR_MINOR ,
@@ -878,6 +879,7 @@ int CeedQFunctionAddOutput(CeedQFunction qf, const char *field_name, CeedInt siz
878879
879880 CeedCall (CeedQFunctionIsImmutable (qf , & is_immutable ));
880881 CeedCheck (!is_immutable , CeedQFunctionReturnCeed (qf ), CEED_ERROR_MAJOR , "CeedQFunction cannot be changed after set as immutable" );
882+ CeedCheck (qf -> num_output_fields < CEED_FIELD_MAX , CeedQFunctionReturnCeed (qf ), CEED_ERROR_MINOR , "Can only add %d output fields" , CEED_FIELD_MAX );
881883 CeedCheck (eval_mode != CEED_EVAL_WEIGHT , CeedQFunctionReturnCeed (qf ), CEED_ERROR_DIMENSION ,
882884 "Cannot create CeedQFunction output with CEED_EVAL_WEIGHT" );
883885 for (CeedInt i = 0 ; i < qf -> num_input_fields ; i ++ ) {
0 commit comments