diff --git a/backends/ref/ceed-ref-operator.c b/backends/ref/ceed-ref-operator.c index 78344e5f6c..3a3780bcf3 100644 --- a/backends/ref/ceed-ref-operator.c +++ b/backends/ref/ceed-ref-operator.c @@ -20,7 +20,7 @@ static int CeedOperatorSetupFields_Ref(CeedQFunction qf, CeedOperator op, bool i CeedVector *q_vecs, CeedInt start_e, CeedInt num_fields, CeedInt Q) { Ceed ceed; bool is_at_points; - CeedSize e_size, q_size, at_points_e_size_padding = 0; + CeedSize e_size, q_size; CeedInt num_comp, size, P; CeedQFunctionField *qf_fields; CeedOperatorField *op_fields; @@ -50,24 +50,7 @@ static int CeedOperatorSetupFields_Ref(CeedQFunction qf, CeedOperator op, bool i CeedCallBackend(CeedQFunctionFieldGetEvalMode(qf_fields[i], &eval_mode)); if (eval_mode != CEED_EVAL_WEIGHT) { CeedCallBackend(CeedOperatorFieldGetElemRestriction(op_fields[i], &elem_rstr)); - if (is_at_points) { - CeedSize e_size; - - CeedCallBackend(CeedElemRestrictionGetEVectorSize(elem_rstr, &e_size)); - if (at_points_e_size_padding == 0) { - CeedInt num_elem, num_points, max_points, num_comp; - - CeedCallBackend(CeedElemRestrictionGetNumElements(elem_rstr, &num_elem)); - CeedCallBackend(CeedElemRestrictionGetNumPointsInElement(elem_rstr, num_elem - 1, &num_points)); - CeedCallBackend(CeedElemRestrictionGetMaxPointsInElement(elem_rstr, &max_points)); - CeedCallBackend(CeedElemRestrictionGetNumComponents(elem_rstr, &num_comp)); - at_points_e_size_padding = (max_points - num_points) * num_comp; - } - CeedCallBackend(CeedVectorCreate(ceed, e_size + at_points_e_size_padding, &e_vecs_full[i + start_e])); - CeedCallBackend(CeedVectorSetValue(e_vecs_full[i + start_e], 0.0)); - } else { - CeedCallBackend(CeedElemRestrictionCreateVector(elem_rstr, NULL, &e_vecs_full[i + start_e])); - } + CeedCallBackend(CeedElemRestrictionCreateVector(elem_rstr, NULL, &e_vecs_full[i + start_e])); } switch (eval_mode) { @@ -574,7 +557,7 @@ static int CeedOperatorSetupFieldsAtPoints_Ref(CeedQFunction qf, CeedOperator op CeedVector *q_vecs, CeedInt start_e, CeedInt num_fields, CeedInt Q) { Ceed ceed; CeedSize e_size, q_size; - CeedInt max_num_points, num_comp, size, P; + CeedInt e_size_padding = 0, max_num_points, num_comp, size, P; CeedQFunctionField *qf_fields; CeedOperatorField *op_fields; @@ -617,13 +600,27 @@ static int CeedOperatorSetupFieldsAtPoints_Ref(CeedQFunction qf, CeedOperator op CeedCallBackend(CeedQFunctionFieldGetEvalMode(qf_fields[i], &eval_mode)); if (eval_mode != CEED_EVAL_WEIGHT) { - CeedRestrictionType rstr_type; CeedElemRestriction elem_rstr; + CeedSize e_size; + bool is_at_points; CeedCallBackend(CeedOperatorFieldGetElemRestriction(op_fields[i], &elem_rstr)); CeedCallBackend(CeedElemRestrictionGetNumComponents(elem_rstr, &num_comp)); - CeedCallBackend(CeedElemRestrictionGetType(elem_rstr, &rstr_type)); - CeedCallBackend(CeedElemRestrictionCreateVector(elem_rstr, NULL, &e_vecs_full[i + start_e])); + CeedCallBackend(CeedElemRestrictionIsPoints(elem_rstr, &is_at_points)); + if (is_at_points) { + CeedCallBackend(CeedElemRestrictionGetEVectorSize(elem_rstr, &e_size)); + if (e_size_padding == 0) { + CeedInt num_points, num_elem; + + CeedCallBackend(CeedElemRestrictionGetNumElements(elem_rstr, &num_elem)); + CeedCallBackend(CeedElemRestrictionGetNumPointsInElement(elem_rstr, num_elem - 1, &num_points)); + e_size_padding = (max_num_points - num_points) * num_comp; + } + CeedCallBackend(CeedVectorCreate(ceed, e_size + e_size_padding, &e_vecs_full[i + start_e])); + CeedCallBackend(CeedVectorSetValue(e_vecs_full[i + start_e], 0.0)); + } else { + CeedCallBackend(CeedElemRestrictionCreateVector(elem_rstr, NULL, &e_vecs_full[i + start_e])); + } } switch (eval_mode) {