ceed-operator.c (a76d53b23b42cf4129fc1a76571fa0b84f1099db) ceed-operator.c (c4e3f59b2ea5a0c95cc0118aa5026c447cce3092)
1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8#include <ceed-impl.h>

--- 21 unchanged lines hidden (view full) ---

30 @param[in] b Operator Field Basis
31
32 @return An error code: 0 - success, otherwise - failure
33
34 @ref Developer
35**/
36static int CeedOperatorCheckField(Ceed ceed, CeedQFunctionField qf_field, CeedElemRestriction r, CeedBasis b) {
37 CeedEvalMode eval_mode = qf_field->eval_mode;
1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8#include <ceed-impl.h>

--- 21 unchanged lines hidden (view full) ---

30 @param[in] b Operator Field Basis
31
32 @return An error code: 0 - success, otherwise - failure
33
34 @ref Developer
35**/
36static int CeedOperatorCheckField(Ceed ceed, CeedQFunctionField qf_field, CeedElemRestriction r, CeedBasis b) {
37 CeedEvalMode eval_mode = qf_field->eval_mode;
38 CeedInt dim = 1, num_comp = 1, Q_comp = 1, restr_num_comp = 1, size = qf_field->size;
38 CeedInt dim = 1, num_comp = 1, q_comp = 1, restr_num_comp = 1, size = qf_field->size;
39
40 // Restriction
41 if (r != CEED_ELEMRESTRICTION_NONE) {
42 if (eval_mode == CEED_EVAL_WEIGHT) {
43 // LCOV_EXCL_START
44 return CeedError(ceed, CEED_ERROR_INCOMPATIBLE, "CEED_ELEMRESTRICTION_NONE should be used for a field with eval mode CEED_EVAL_WEIGHT");
45 // LCOV_EXCL_STOP
46 }

--- 9 unchanged lines hidden (view full) ---

56 if (eval_mode == CEED_EVAL_NONE) {
57 // LCOV_EXCL_START
58 return CeedError(ceed, CEED_ERROR_INCOMPATIBLE, "Field '%s' configured with CEED_EVAL_NONE must be used with CEED_BASIS_COLLOCATED",
59 qf_field->field_name);
60 // LCOV_EXCL_STOP
61 }
62 CeedCall(CeedBasisGetDimension(b, &dim));
63 CeedCall(CeedBasisGetNumComponents(b, &num_comp));
39
40 // Restriction
41 if (r != CEED_ELEMRESTRICTION_NONE) {
42 if (eval_mode == CEED_EVAL_WEIGHT) {
43 // LCOV_EXCL_START
44 return CeedError(ceed, CEED_ERROR_INCOMPATIBLE, "CEED_ELEMRESTRICTION_NONE should be used for a field with eval mode CEED_EVAL_WEIGHT");
45 // LCOV_EXCL_STOP
46 }

--- 9 unchanged lines hidden (view full) ---

56 if (eval_mode == CEED_EVAL_NONE) {
57 // LCOV_EXCL_START
58 return CeedError(ceed, CEED_ERROR_INCOMPATIBLE, "Field '%s' configured with CEED_EVAL_NONE must be used with CEED_BASIS_COLLOCATED",
59 qf_field->field_name);
60 // LCOV_EXCL_STOP
61 }
62 CeedCall(CeedBasisGetDimension(b, &dim));
63 CeedCall(CeedBasisGetNumComponents(b, &num_comp));
64 CeedCall(CeedBasisGetNumQuadratureComponents(b, &Q_comp));
64 CeedCall(CeedBasisGetNumQuadratureComponents(b, eval_mode, &q_comp));
65 if (r != CEED_ELEMRESTRICTION_NONE && restr_num_comp != num_comp) {
66 // LCOV_EXCL_START
67 return CeedError(ceed, CEED_ERROR_DIMENSION,
68 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction has %" CeedInt_FMT
69 " components, but Basis has %" CeedInt_FMT " components",
70 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], restr_num_comp, num_comp);
71 // LCOV_EXCL_STOP
72 }

--- 10 unchanged lines hidden (view full) ---

83 // LCOV_EXCL_START
84 return CeedError(ceed, CEED_ERROR_DIMENSION,
85 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction has %" CeedInt_FMT " components", qf_field->field_name,
86 qf_field->size, CeedEvalModes[qf_field->eval_mode], restr_num_comp);
87 // LCOV_EXCL_STOP
88 }
89 break;
90 case CEED_EVAL_INTERP:
65 if (r != CEED_ELEMRESTRICTION_NONE && restr_num_comp != num_comp) {
66 // LCOV_EXCL_START
67 return CeedError(ceed, CEED_ERROR_DIMENSION,
68 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction has %" CeedInt_FMT
69 " components, but Basis has %" CeedInt_FMT " components",
70 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], restr_num_comp, num_comp);
71 // LCOV_EXCL_STOP
72 }

--- 10 unchanged lines hidden (view full) ---

83 // LCOV_EXCL_START
84 return CeedError(ceed, CEED_ERROR_DIMENSION,
85 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction has %" CeedInt_FMT " components", qf_field->field_name,
86 qf_field->size, CeedEvalModes[qf_field->eval_mode], restr_num_comp);
87 // LCOV_EXCL_STOP
88 }
89 break;
90 case CEED_EVAL_INTERP:
91 if (size != num_comp * Q_comp) {
91 case CEED_EVAL_GRAD:
92 case CEED_EVAL_DIV:
93 case CEED_EVAL_CURL:
94 if (size != num_comp * q_comp) {
92 // LCOV_EXCL_START
93 return CeedError(ceed, CEED_ERROR_DIMENSION,
94 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction/Basis has %" CeedInt_FMT " components",
95 // LCOV_EXCL_START
96 return CeedError(ceed, CEED_ERROR_DIMENSION,
97 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction/Basis has %" CeedInt_FMT " components",
95 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], num_comp * Q_comp);
98 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], num_comp * q_comp);
96 // LCOV_EXCL_STOP
97 }
98 break;
99 // LCOV_EXCL_STOP
100 }
101 break;
99 case CEED_EVAL_GRAD:
100 if (size != num_comp * dim) {
101 // LCOV_EXCL_START
102 return CeedError(ceed, CEED_ERROR_DIMENSION,
103 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s in %" CeedInt_FMT " dimensions: ElemRestriction/Basis has %" CeedInt_FMT
104 " components",
105 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], dim, num_comp);
106 // LCOV_EXCL_STOP
107 }
108 break;
109 case CEED_EVAL_WEIGHT:
110 // No additional checks required
111 break;
102 case CEED_EVAL_WEIGHT:
103 // No additional checks required
104 break;
112 case CEED_EVAL_DIV:
113 if (size != num_comp) {
114 // LCOV_EXCL_START
115 return CeedError(ceed, CEED_ERROR_DIMENSION,
116 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction/Basis has %" CeedInt_FMT " components",
117 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], num_comp);
118 // LCOV_EXCL_STOP
119 }
120 break;
121 case CEED_EVAL_CURL:
122 // Not implemented
123 break;
124 }
125 return CEED_ERROR_SUCCESS;
126}
127
128/**
129 @brief View a field of a CeedOperator
130
131 @param[in] field Operator field to view

--- 1736 unchanged lines hidden ---
105 }
106 return CEED_ERROR_SUCCESS;
107}
108
109/**
110 @brief View a field of a CeedOperator
111
112 @param[in] field Operator field to view

--- 1736 unchanged lines hidden ---