Skip to content

Commit

Permalink
Move fix to CeedOperatorSetupFieldsAtPoints_Ref
Browse files Browse the repository at this point in the history
  • Loading branch information
zatkins-dev committed Mar 11, 2024
1 parent 23629c2 commit 6efa0d7
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions backends/ref/ceed-ref-operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 6efa0d7

Please sign in to comment.