| ceed-operator.c (791c445d41323413ee17f1c6f1595f78c25768e3) | ceed-operator.c (990fdeb6bb8fc9af2da4472bdc0d1f57da5da0e5) |
|---|---|
| 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/ceed.h> --- 57 unchanged lines hidden (view full) --- 66 "be used with CEED_BASIS_COLLOCATED", 67 // LCOV_EXCL_STOP 68 qf_field->field_name); 69 ierr = CeedBasisGetDimension(b, &dim); CeedChk(ierr); 70 ierr = CeedBasisGetNumComponents(b, &num_comp); CeedChk(ierr); 71 if (r != CEED_ELEMRESTRICTION_NONE && restr_num_comp != num_comp) { 72 // LCOV_EXCL_START 73 return CeedError(ceed, CEED_ERROR_DIMENSION, | 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/ceed.h> --- 57 unchanged lines hidden (view full) --- 66 "be used with CEED_BASIS_COLLOCATED", 67 // LCOV_EXCL_STOP 68 qf_field->field_name); 69 ierr = CeedBasisGetDimension(b, &dim); CeedChk(ierr); 70 ierr = CeedBasisGetNumComponents(b, &num_comp); CeedChk(ierr); 71 if (r != CEED_ELEMRESTRICTION_NONE && restr_num_comp != num_comp) { 72 // LCOV_EXCL_START 73 return CeedError(ceed, CEED_ERROR_DIMENSION, |
| 74 "Field '%s' of size %d and EvalMode %s: ElemRestriction " 75 "has %d components, but Basis has %d components", | 74 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction " 75 "has %" CeedInt_FMT " components, but Basis has %" CeedInt_FMT " components", |
| 76 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], 77 restr_num_comp, 78 num_comp); 79 // LCOV_EXCL_STOP 80 } 81 } 82 // Field size 83 switch(eval_mode) { 84 case CEED_EVAL_NONE: 85 if (size != restr_num_comp) 86 // LCOV_EXCL_START 87 return CeedError(ceed, CEED_ERROR_DIMENSION, | 76 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], 77 restr_num_comp, 78 num_comp); 79 // LCOV_EXCL_STOP 80 } 81 } 82 // Field size 83 switch(eval_mode) { 84 case CEED_EVAL_NONE: 85 if (size != restr_num_comp) 86 // LCOV_EXCL_START 87 return CeedError(ceed, CEED_ERROR_DIMENSION, |
| 88 "Field '%s' of size %d and EvalMode %s: ElemRestriction has %d components", | 88 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s: ElemRestriction has " 89 CeedInt_FMT " components", |
| 89 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], 90 restr_num_comp); 91 // LCOV_EXCL_STOP 92 break; 93 case CEED_EVAL_INTERP: 94 if (size != num_comp) 95 // LCOV_EXCL_START 96 return CeedError(ceed, CEED_ERROR_DIMENSION, | 90 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], 91 restr_num_comp); 92 // LCOV_EXCL_STOP 93 break; 94 case CEED_EVAL_INTERP: 95 if (size != num_comp) 96 // LCOV_EXCL_START 97 return CeedError(ceed, CEED_ERROR_DIMENSION, |
| 97 "Field '%s' of size %d and EvalMode %s: ElemRestriction/Basis has %d components", | 98 "Field '%s' of size %" CeedInt_FMT 99 " and EvalMode %s: ElemRestriction/Basis has " 100 CeedInt_FMT " components", |
| 98 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], 99 num_comp); 100 // LCOV_EXCL_STOP 101 break; 102 case CEED_EVAL_GRAD: 103 if (size != num_comp * dim) 104 // LCOV_EXCL_START 105 return CeedError(ceed, CEED_ERROR_DIMENSION, | 101 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], 102 num_comp); 103 // LCOV_EXCL_STOP 104 break; 105 case CEED_EVAL_GRAD: 106 if (size != num_comp * dim) 107 // LCOV_EXCL_START 108 return CeedError(ceed, CEED_ERROR_DIMENSION, |
| 106 "Field '%s' of size %d and EvalMode %s in %d dimensions: " 107 "ElemRestriction/Basis has %d components", | 109 "Field '%s' of size %" CeedInt_FMT " and EvalMode %s in %" CeedInt_FMT 110 " dimensions: " 111 "ElemRestriction/Basis has %" CeedInt_FMT " components", |
| 108 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], dim, 109 num_comp); 110 // LCOV_EXCL_STOP 111 break; 112 case CEED_EVAL_WEIGHT: 113 // No additional checks required 114 break; 115 case CEED_EVAL_DIV: --- 22 unchanged lines hidden (view full) --- 138**/ 139static int CeedOperatorFieldView(CeedOperatorField field, 140 CeedQFunctionField qf_field, 141 CeedInt field_number, bool sub, bool input, 142 FILE *stream) { 143 const char *pre = sub ? " " : ""; 144 const char *in_out = input ? "Input" : "Output"; 145 | 112 qf_field->field_name, qf_field->size, CeedEvalModes[qf_field->eval_mode], dim, 113 num_comp); 114 // LCOV_EXCL_STOP 115 break; 116 case CEED_EVAL_WEIGHT: 117 // No additional checks required 118 break; 119 case CEED_EVAL_DIV: --- 22 unchanged lines hidden (view full) --- 142**/ 143static int CeedOperatorFieldView(CeedOperatorField field, 144 CeedQFunctionField qf_field, 145 CeedInt field_number, bool sub, bool input, 146 FILE *stream) { 147 const char *pre = sub ? " " : ""; 148 const char *in_out = input ? "Input" : "Output"; 149 |
| 146 fprintf(stream, "%s %s field %d:\n" | 150 fprintf(stream, "%s %s field %" CeedInt_FMT ":\n" |
| 147 "%s Name: \"%s\"\n", 148 pre, in_out, field_number, pre, qf_field->field_name); 149 | 151 "%s Name: \"%s\"\n", 152 pre, in_out, field_number, pre, qf_field->field_name); 153 |
| 150 fprintf(stream, "%s Size: %d\n", pre, qf_field->size); | 154 fprintf(stream, "%s Size: %" CeedInt_FMT "\n", pre, qf_field->size); |
| 151 152 fprintf(stream, "%s EvalMode: %s\n", pre, 153 CeedEvalModes[qf_field->eval_mode]); 154 155 if (field->basis == CEED_BASIS_COLLOCATED) 156 fprintf(stream, "%s Collocated basis\n", pre); 157 158 if (field->vec == CEED_VECTOR_ACTIVE) --- 20 unchanged lines hidden (view full) --- 179 const char *pre = sub ? " " : ""; 180 181 CeedInt num_elem, num_qpts; 182 ierr = CeedOperatorGetNumElements(op, &num_elem); CeedChk(ierr); 183 ierr = CeedOperatorGetNumQuadraturePoints(op, &num_qpts); CeedChk(ierr); 184 185 CeedInt total_fields = 0; 186 ierr = CeedOperatorGetNumArgs(op, &total_fields); CeedChk(ierr); | 155 156 fprintf(stream, "%s EvalMode: %s\n", pre, 157 CeedEvalModes[qf_field->eval_mode]); 158 159 if (field->basis == CEED_BASIS_COLLOCATED) 160 fprintf(stream, "%s Collocated basis\n", pre); 161 162 if (field->vec == CEED_VECTOR_ACTIVE) --- 20 unchanged lines hidden (view full) --- 183 const char *pre = sub ? " " : ""; 184 185 CeedInt num_elem, num_qpts; 186 ierr = CeedOperatorGetNumElements(op, &num_elem); CeedChk(ierr); 187 ierr = CeedOperatorGetNumQuadraturePoints(op, &num_qpts); CeedChk(ierr); 188 189 CeedInt total_fields = 0; 190 ierr = CeedOperatorGetNumArgs(op, &total_fields); CeedChk(ierr); |
| 187 fprintf(stream, "%s %d elements with %d quadrature points each\n", | 191 fprintf(stream, "%s %" CeedInt_FMT " elements with %" CeedInt_FMT 192 " quadrature points each\n", |
| 188 pre, num_elem, num_qpts); 189 | 193 pre, num_elem, num_qpts); 194 |
| 190 fprintf(stream, "%s %d field%s\n", pre, total_fields, | 195 fprintf(stream, "%s %" CeedInt_FMT " field%s\n", pre, total_fields, |
| 191 total_fields>1 ? "s" : ""); 192 | 196 total_fields>1 ? "s" : ""); 197 |
| 193 fprintf(stream, "%s %d input field%s:\n", pre, op->qf->num_input_fields, | 198 fprintf(stream, "%s %" CeedInt_FMT " input field%s:\n", pre, 199 op->qf->num_input_fields, |
| 194 op->qf->num_input_fields>1 ? "s" : ""); 195 for (CeedInt i=0; i<op->qf->num_input_fields; i++) { 196 ierr = CeedOperatorFieldView(op->input_fields[i], op->qf->input_fields[i], 197 i, sub, 1, stream); CeedChk(ierr); 198 } 199 | 200 op->qf->num_input_fields>1 ? "s" : ""); 201 for (CeedInt i=0; i<op->qf->num_input_fields; i++) { 202 ierr = CeedOperatorFieldView(op->input_fields[i], op->qf->input_fields[i], 203 i, sub, 1, stream); CeedChk(ierr); 204 } 205 |
| 200 fprintf(stream, "%s %d output field%s:\n", pre, op->qf->num_output_fields, | 206 fprintf(stream, "%s %" CeedInt_FMT " output field%s:\n", pre, 207 op->qf->num_output_fields, |
| 201 op->qf->num_output_fields>1 ? "s" : ""); 202 for (CeedInt i=0; i<op->qf->num_output_fields; i++) { 203 ierr = CeedOperatorFieldView(op->output_fields[i], op->qf->output_fields[i], 204 i, sub, 0, stream); CeedChk(ierr); 205 } 206 return CEED_ERROR_SUCCESS; 207} 208 --- 506 unchanged lines hidden (view full) --- 715 // LCOV_EXCL_STOP 716 717 CeedInt num_elem; 718 ierr = CeedElemRestrictionGetNumElements(r, &num_elem); CeedChk(ierr); 719 if (r != CEED_ELEMRESTRICTION_NONE && op->has_restriction && 720 op->num_elem != num_elem) 721 // LCOV_EXCL_START 722 return CeedError(op->ceed, CEED_ERROR_DIMENSION, | 208 op->qf->num_output_fields>1 ? "s" : ""); 209 for (CeedInt i=0; i<op->qf->num_output_fields; i++) { 210 ierr = CeedOperatorFieldView(op->output_fields[i], op->qf->output_fields[i], 211 i, sub, 0, stream); CeedChk(ierr); 212 } 213 return CEED_ERROR_SUCCESS; 214} 215 --- 506 unchanged lines hidden (view full) --- 722 // LCOV_EXCL_STOP 723 724 CeedInt num_elem; 725 ierr = CeedElemRestrictionGetNumElements(r, &num_elem); CeedChk(ierr); 726 if (r != CEED_ELEMRESTRICTION_NONE && op->has_restriction && 727 op->num_elem != num_elem) 728 // LCOV_EXCL_START 729 return CeedError(op->ceed, CEED_ERROR_DIMENSION, |
| 723 "ElemRestriction with %d elements incompatible with prior " 724 "%d elements", num_elem, op->num_elem); | 730 "ElemRestriction with %" CeedInt_FMT " elements incompatible with prior " 731 CeedInt_FMT " elements", num_elem, op->num_elem); |
| 725 // LCOV_EXCL_STOP 726 727 CeedInt num_qpts = 0; 728 if (b != CEED_BASIS_COLLOCATED) { 729 ierr = CeedBasisGetNumQuadraturePoints(b, &num_qpts); CeedChk(ierr); 730 if (op->num_qpts && op->num_qpts != num_qpts) 731 // LCOV_EXCL_START 732 return CeedError(op->ceed, CEED_ERROR_DIMENSION, | 732 // LCOV_EXCL_STOP 733 734 CeedInt num_qpts = 0; 735 if (b != CEED_BASIS_COLLOCATED) { 736 ierr = CeedBasisGetNumQuadraturePoints(b, &num_qpts); CeedChk(ierr); 737 if (op->num_qpts && op->num_qpts != num_qpts) 738 // LCOV_EXCL_START 739 return CeedError(op->ceed, CEED_ERROR_DIMENSION, |
| 733 "Basis with %d quadrature points " 734 "incompatible with prior %d points", num_qpts, | 740 "Basis with %" CeedInt_FMT " quadrature points " 741 "incompatible with prior %" CeedInt_FMT " points", num_qpts, |
| 735 op->num_qpts); 736 // LCOV_EXCL_STOP 737 } 738 CeedQFunctionField qf_field; 739 CeedOperatorField *op_field; 740 bool is_input = true; 741 for (CeedInt i=0; i<op->qf->num_input_fields; i++) { 742 if (!strcmp(field_name, (*op->qf->input_fields[i]).field_name)) { --- 473 unchanged lines hidden (view full) --- 1216 bool has_name = op->name; 1217 1218 if (op->is_composite) { 1219 fprintf(stream, "Composite CeedOperator%s%s\n", 1220 has_name ? " - " : "", has_name ? op->name : ""); 1221 1222 for (CeedInt i=0; i<op->num_suboperators; i++) { 1223 has_name = op->sub_operators[i]->name; | 742 op->num_qpts); 743 // LCOV_EXCL_STOP 744 } 745 CeedQFunctionField qf_field; 746 CeedOperatorField *op_field; 747 bool is_input = true; 748 for (CeedInt i=0; i<op->qf->num_input_fields; i++) { 749 if (!strcmp(field_name, (*op->qf->input_fields[i]).field_name)) { --- 473 unchanged lines hidden (view full) --- 1223 bool has_name = op->name; 1224 1225 if (op->is_composite) { 1226 fprintf(stream, "Composite CeedOperator%s%s\n", 1227 has_name ? " - " : "", has_name ? op->name : ""); 1228 1229 for (CeedInt i=0; i<op->num_suboperators; i++) { 1230 has_name = op->sub_operators[i]->name; |
| 1224 fprintf(stream, " SubOperator %d%s%s:\n", i, | 1231 fprintf(stream, " SubOperator %" CeedInt_FMT "%s%s:\n", i, |
| 1225 has_name ? " - " : "", 1226 has_name ? op->sub_operators[i]->name : ""); 1227 ierr = CeedOperatorSingleView(op->sub_operators[i], 1, stream); 1228 CeedChk(ierr); 1229 } 1230 } else { 1231 fprintf(stream, "CeedOperator%s%s\n", 1232 has_name ? " - " : "", has_name ? op->name : ""); --- 484 unchanged lines hidden --- | 1232 has_name ? " - " : "", 1233 has_name ? op->sub_operators[i]->name : ""); 1234 ierr = CeedOperatorSingleView(op->sub_operators[i], 1, stream); 1235 CeedChk(ierr); 1236 } 1237 } else { 1238 fprintf(stream, "CeedOperator%s%s\n", 1239 has_name ? " - " : "", has_name ? op->name : ""); --- 484 unchanged lines hidden --- |