| ceed-basis.c (73441d2798f40b051fe979327dbc45bfa6942f05) | ceed-basis.c (99e754f07c08eea4e6609a33ed68aeb9dcf08b08) |
|---|---|
| 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> --- 1460 unchanged lines hidden (view full) --- 1469 CeedCheck(basis->Apply, ceed, CEED_ERROR_UNSUPPORTED, "Backend does not support CeedBasisApply"); 1470 1471 // Check compatibility of topological and geometrical dimensions 1472 CeedCheck((t_mode == CEED_TRANSPOSE && v_length % num_nodes == 0 && u_length % num_qpts == 0) || 1473 (t_mode == CEED_NOTRANSPOSE && u_length % num_nodes == 0 && v_length % num_qpts == 0), 1474 ceed, CEED_ERROR_DIMENSION, "Length of input/output vectors incompatible with basis dimensions"); 1475 1476 // Check vector lengths to prevent out of bounds issues | 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> --- 1460 unchanged lines hidden (view full) --- 1469 CeedCheck(basis->Apply, ceed, CEED_ERROR_UNSUPPORTED, "Backend does not support CeedBasisApply"); 1470 1471 // Check compatibility of topological and geometrical dimensions 1472 CeedCheck((t_mode == CEED_TRANSPOSE && v_length % num_nodes == 0 && u_length % num_qpts == 0) || 1473 (t_mode == CEED_NOTRANSPOSE && u_length % num_nodes == 0 && v_length % num_qpts == 0), 1474 ceed, CEED_ERROR_DIMENSION, "Length of input/output vectors incompatible with basis dimensions"); 1475 1476 // Check vector lengths to prevent out of bounds issues |
| 1477 bool good_dims = true; | 1477 bool has_good_dims = true; |
| 1478 switch (eval_mode) { 1479 case CEED_EVAL_NONE: 1480 case CEED_EVAL_INTERP: 1481 case CEED_EVAL_GRAD: 1482 case CEED_EVAL_DIV: 1483 case CEED_EVAL_CURL: | 1478 switch (eval_mode) { 1479 case CEED_EVAL_NONE: 1480 case CEED_EVAL_INTERP: 1481 case CEED_EVAL_GRAD: 1482 case CEED_EVAL_DIV: 1483 case CEED_EVAL_CURL: |
| 1484 good_dims = | 1484 has_good_dims = |
| 1485 ((t_mode == CEED_TRANSPOSE && u_length >= num_elem * num_comp * num_qpts * q_comp && v_length >= num_elem * num_comp * num_nodes) || 1486 (t_mode == CEED_NOTRANSPOSE && v_length >= num_elem * num_qpts * num_comp * q_comp && u_length >= num_elem * num_comp * num_nodes)); 1487 break; 1488 case CEED_EVAL_WEIGHT: | 1485 ((t_mode == CEED_TRANSPOSE && u_length >= num_elem * num_comp * num_qpts * q_comp && v_length >= num_elem * num_comp * num_nodes) || 1486 (t_mode == CEED_NOTRANSPOSE && v_length >= num_elem * num_qpts * num_comp * q_comp && u_length >= num_elem * num_comp * num_nodes)); 1487 break; 1488 case CEED_EVAL_WEIGHT: |
| 1489 good_dims = v_length >= num_elem * num_qpts; | 1489 has_good_dims = v_length >= num_elem * num_qpts; |
| 1490 break; 1491 } | 1490 break; 1491 } |
| 1492 CeedCheck(good_dims, ceed, CEED_ERROR_DIMENSION, "Input/output vectors too short for basis and evaluation mode"); | 1492 CeedCheck(has_good_dims, ceed, CEED_ERROR_DIMENSION, "Input/output vectors too short for basis and evaluation mode"); |
| 1493 1494 CeedCall(basis->Apply(basis, num_elem, t_mode, eval_mode, u, v)); 1495 return CEED_ERROR_SUCCESS; 1496} 1497 1498/** 1499 @brief Apply basis evaluation from nodes to arbitrary points 1500 --- 39 unchanged lines hidden (view full) --- 1540 CeedCheck((x_length >= num_points * dim) || (eval_mode == CEED_EVAL_WEIGHT), ceed, CEED_ERROR_DIMENSION, 1541 "Length of reference coordinate vector incompatible with basis dimension and number of points"); 1542 1543 // Check CEED_EVAL_WEIGHT only on CEED_NOTRANSPOSE 1544 CeedCheck(eval_mode != CEED_EVAL_WEIGHT || t_mode == CEED_NOTRANSPOSE, ceed, CEED_ERROR_UNSUPPORTED, 1545 "CEED_EVAL_WEIGHT only supported with CEED_NOTRANSPOSE"); 1546 1547 // Check vector lengths to prevent out of bounds issues | 1493 1494 CeedCall(basis->Apply(basis, num_elem, t_mode, eval_mode, u, v)); 1495 return CEED_ERROR_SUCCESS; 1496} 1497 1498/** 1499 @brief Apply basis evaluation from nodes to arbitrary points 1500 --- 39 unchanged lines hidden (view full) --- 1540 CeedCheck((x_length >= num_points * dim) || (eval_mode == CEED_EVAL_WEIGHT), ceed, CEED_ERROR_DIMENSION, 1541 "Length of reference coordinate vector incompatible with basis dimension and number of points"); 1542 1543 // Check CEED_EVAL_WEIGHT only on CEED_NOTRANSPOSE 1544 CeedCheck(eval_mode != CEED_EVAL_WEIGHT || t_mode == CEED_NOTRANSPOSE, ceed, CEED_ERROR_UNSUPPORTED, 1545 "CEED_EVAL_WEIGHT only supported with CEED_NOTRANSPOSE"); 1546 1547 // Check vector lengths to prevent out of bounds issues |
| 1548 bool good_dims = false; | 1548 bool has_good_dims = true; |
| 1549 switch (eval_mode) { 1550 case CEED_EVAL_INTERP: | 1549 switch (eval_mode) { 1550 case CEED_EVAL_INTERP: |
| 1551 good_dims = ((t_mode == CEED_TRANSPOSE && (u_length >= num_points * num_q_comp || v_length >= num_nodes * num_comp)) || 1552 (t_mode == CEED_NOTRANSPOSE && (v_length >= num_points * num_q_comp || u_length >= num_nodes * num_comp))); | 1551 has_good_dims = ((t_mode == CEED_TRANSPOSE && (u_length >= num_points * num_q_comp || v_length >= num_nodes * num_comp)) || 1552 (t_mode == CEED_NOTRANSPOSE && (v_length >= num_points * num_q_comp || u_length >= num_nodes * num_comp))); |
| 1553 break; 1554 case CEED_EVAL_GRAD: | 1553 break; 1554 case CEED_EVAL_GRAD: |
| 1555 good_dims = ((t_mode == CEED_TRANSPOSE && (u_length >= num_points * num_q_comp * dim || v_length >= num_nodes * num_comp)) || 1556 (t_mode == CEED_NOTRANSPOSE && (v_length >= num_points * num_q_comp * dim || u_length >= num_nodes * num_comp))); | 1555 has_good_dims = ((t_mode == CEED_TRANSPOSE && (u_length >= num_points * num_q_comp * dim || v_length >= num_nodes * num_comp)) || 1556 (t_mode == CEED_NOTRANSPOSE && (v_length >= num_points * num_q_comp * dim || u_length >= num_nodes * num_comp))); |
| 1557 break; 1558 case CEED_EVAL_WEIGHT: | 1557 break; 1558 case CEED_EVAL_WEIGHT: |
| 1559 good_dims = t_mode == CEED_NOTRANSPOSE && (v_length >= num_points); | 1559 has_good_dims = t_mode == CEED_NOTRANSPOSE && (v_length >= num_points); |
| 1560 break; | 1560 break; |
| 1561 // LCOV_EXCL_START |
|
| 1561 case CEED_EVAL_NONE: 1562 case CEED_EVAL_DIV: 1563 case CEED_EVAL_CURL: | 1562 case CEED_EVAL_NONE: 1563 case CEED_EVAL_DIV: 1564 case CEED_EVAL_CURL: |
| 1564 // LCOV_EXCL_START | |
| 1565 return CeedError(ceed, CEED_ERROR_UNSUPPORTED, "Evaluation at arbitrary points not supported for %s", CeedEvalModes[eval_mode]); 1566 // LCOV_EXCL_STOP 1567 } | 1565 return CeedError(ceed, CEED_ERROR_UNSUPPORTED, "Evaluation at arbitrary points not supported for %s", CeedEvalModes[eval_mode]); 1566 // LCOV_EXCL_STOP 1567 } |
| 1568 CeedCheck(good_dims, ceed, CEED_ERROR_DIMENSION, "Input/output vectors too short for basis and evaluation mode"); | 1568 CeedCheck(has_good_dims, ceed, CEED_ERROR_DIMENSION, "Input/output vectors too short for basis and evaluation mode"); |
| 1569 1570 // Backend method 1571 if (basis->ApplyAtPoints) { 1572 CeedCall(basis->ApplyAtPoints(basis, num_points, t_mode, eval_mode, x_ref, u, v)); 1573 return CEED_ERROR_SUCCESS; 1574 } 1575 1576 // Default implementation --- 648 unchanged lines hidden --- | 1569 1570 // Backend method 1571 if (basis->ApplyAtPoints) { 1572 CeedCall(basis->ApplyAtPoints(basis, num_points, t_mode, eval_mode, x_ref, u, v)); 1573 return CEED_ERROR_SUCCESS; 1574 } 1575 1576 // Default implementation --- 648 unchanged lines hidden --- |