ceed-elemrestriction.c (fe335c1370cad8af1bbeb21c48b138394229db22) ceed-elemrestriction.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>

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

849 n = rstr->l_size;
850 } else {
851 m = rstr->l_size;
852 n = rstr->num_blk * rstr->blk_size * rstr->elem_size * rstr->num_comp;
853 }
854 if (n != u->length)
855 // LCOV_EXCL_START
856 return CeedError(rstr->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>

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

849 n = rstr->l_size;
850 } else {
851 m = rstr->l_size;
852 n = rstr->num_blk * rstr->blk_size * rstr->elem_size * rstr->num_comp;
853 }
854 if (n != u->length)
855 // LCOV_EXCL_START
856 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
857 "Input vector size %d not compatible with "
858 "element restriction (%d, %d)", u->length, m, n);
857 "Input vector size %" CeedInt_FMT " not compatible with "
858 "element restriction (%" CeedInt_FMT ", %" CeedInt_FMT ")", u->length, m, n);
859 // LCOV_EXCL_STOP
860 if (m != ru->length)
861 // LCOV_EXCL_START
862 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
859 // LCOV_EXCL_STOP
860 if (m != ru->length)
861 // LCOV_EXCL_START
862 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
863 "Output vector size %d not compatible with "
864 "element restriction (%d, %d)", ru->length, m, n);
863 "Output vector size %" CeedInt_FMT " not compatible with "
864 "element restriction (%" CeedInt_FMT ", %" CeedInt_FMT ")", ru->length, m, n);
865 // LCOV_EXCL_STOP
866 if (rstr->num_elem > 0) {
867 ierr = rstr->Apply(rstr, t_mode, u, ru, request); CeedChk(ierr);
868 }
869 return CEED_ERROR_SUCCESS;
870}
871
872/**

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

898 n = rstr->l_size;
899 } else {
900 m = rstr->l_size;
901 n = rstr->blk_size * rstr->elem_size * rstr->num_comp;
902 }
903 if (n != u->length)
904 // LCOV_EXCL_START
905 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
865 // LCOV_EXCL_STOP
866 if (rstr->num_elem > 0) {
867 ierr = rstr->Apply(rstr, t_mode, u, ru, request); CeedChk(ierr);
868 }
869 return CEED_ERROR_SUCCESS;
870}
871
872/**

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

898 n = rstr->l_size;
899 } else {
900 m = rstr->l_size;
901 n = rstr->blk_size * rstr->elem_size * rstr->num_comp;
902 }
903 if (n != u->length)
904 // LCOV_EXCL_START
905 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
906 "Input vector size %d not compatible with "
907 "element restriction (%d, %d)", u->length, m, n);
906 "Input vector size %" CeedInt_FMT " not compatible with "
907 "element restriction (%" CeedInt_FMT ", %" CeedInt_FMT ")", u->length, m, n);
908 // LCOV_EXCL_STOP
909 if (m != ru->length)
910 // LCOV_EXCL_START
911 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
908 // LCOV_EXCL_STOP
909 if (m != ru->length)
910 // LCOV_EXCL_START
911 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
912 "Output vector size %d not compatible with "
913 "element restriction (%d, %d)", ru->length, m, n);
912 "Output vector size %" CeedInt_FMT " not compatible with "
913 "element restriction (%" CeedInt_FMT ", %" CeedInt_FMT ")", ru->length, m, n);
914 // LCOV_EXCL_STOP
915 if (rstr->blk_size*block > rstr->num_elem)
916 // LCOV_EXCL_START
917 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
914 // LCOV_EXCL_STOP
915 if (rstr->blk_size*block > rstr->num_elem)
916 // LCOV_EXCL_START
917 return CeedError(rstr->ceed, CEED_ERROR_DIMENSION,
918 "Cannot retrieve block %d, element %d > "
919 "total elements %d", block, rstr->blk_size*block,
918 "Cannot retrieve block %" CeedInt_FMT ", element %" CeedInt_FMT " > "
919 "total elements %" CeedInt_FMT "", block, rstr->blk_size*block,
920 rstr->num_elem);
921 // LCOV_EXCL_STOP
922 ierr = rstr->ApplyBlock(rstr, block, t_mode, u, ru, request);
923 CeedChk(ierr);
924 return CEED_ERROR_SUCCESS;
925}
926
927/**

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

1091
1092 @return Error code: 0 - success, otherwise - failure
1093
1094 @ref User
1095**/
1096int CeedElemRestrictionView(CeedElemRestriction rstr, FILE *stream) {
1097 char stridesstr[500];
1098 if (rstr->strides)
920 rstr->num_elem);
921 // LCOV_EXCL_STOP
922 ierr = rstr->ApplyBlock(rstr, block, t_mode, u, ru, request);
923 CeedChk(ierr);
924 return CEED_ERROR_SUCCESS;
925}
926
927/**

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

1091
1092 @return Error code: 0 - success, otherwise - failure
1093
1094 @ref User
1095**/
1096int CeedElemRestrictionView(CeedElemRestriction rstr, FILE *stream) {
1097 char stridesstr[500];
1098 if (rstr->strides)
1099 sprintf(stridesstr, "[%d, %d, %d]", rstr->strides[0], rstr->strides[1],
1099 sprintf(stridesstr, "[%" CeedInt_FMT ", %" CeedInt_FMT ", %" CeedInt_FMT "]",
1100 rstr->strides[0], rstr->strides[1],
1100 rstr->strides[2]);
1101 else
1101 rstr->strides[2]);
1102 else
1102 sprintf(stridesstr, "%d", rstr->comp_stride);
1103 sprintf(stridesstr, "%" CeedInt_FMT, rstr->comp_stride);
1103
1104
1104 fprintf(stream, "%sCeedElemRestriction from (%td, %d) to %d elements with %d "
1105 fprintf(stream, "%sCeedElemRestriction from (%td, %" CeedInt_FMT ") to %"
1106 CeedInt_FMT " elements with %" CeedInt_FMT " "
1105 "nodes each and %s %s\n", rstr->blk_size > 1 ? "Blocked " : "",
1106 rstr->l_size, rstr->num_comp, rstr->num_elem, rstr->elem_size,
1107 rstr->strides ? "strides" : "component stride", stridesstr);
1108 return CEED_ERROR_SUCCESS;
1109}
1110
1111/**
1112 @brief Destroy a CeedElemRestriction

--- 27 unchanged lines hidden ---
1107 "nodes each and %s %s\n", rstr->blk_size > 1 ? "Blocked " : "",
1108 rstr->l_size, rstr->num_comp, rstr->num_elem, rstr->elem_size,
1109 rstr->strides ? "strides" : "component stride", stridesstr);
1110 return CEED_ERROR_SUCCESS;
1111}
1112
1113/**
1114 @brief Destroy a CeedElemRestriction

--- 27 unchanged lines hidden ---