ceed-basis.c (80a9ef0545a39c00cdcaab1ca26f8053604f3120) ceed-basis.c (b7c9bbdafc9b91976b65f80ebb2c5357c2efd8bc)
1// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2// the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3// reserved. See files LICENSE and NOTICE for details.
4//
5// This file is part of CEED, a collection of benchmarks, miniapps, software
6// libraries and APIs for efficient high-order finite element and spectral
7// element discretizations for exascale applications. For more information and
8// source code availability see http://github.com/ceed.

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

235
236 ierr = CeedFree(&interp_1d); CeedChk(ierr);
237 ierr = CeedFree(&grad_1d); CeedChk(ierr);
238 ierr = CeedFree(&tau); CeedChk(ierr);
239 return CEED_ERROR_SUCCESS;
240}
241
242/**
1// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2// the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3// reserved. See files LICENSE and NOTICE for details.
4//
5// This file is part of CEED, a collection of benchmarks, miniapps, software
6// libraries and APIs for efficient high-order finite element and spectral
7// element discretizations for exascale applications. For more information and
8// source code availability see http://github.com/ceed.

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

235
236 ierr = CeedFree(&interp_1d); CeedChk(ierr);
237 ierr = CeedFree(&grad_1d); CeedChk(ierr);
238 ierr = CeedFree(&tau); CeedChk(ierr);
239 return CEED_ERROR_SUCCESS;
240}
241
242/**
243 @brief Get Ceed associated with a CeedBasis
244
245 @param basis CeedBasis
246 @param[out] ceed Variable to store Ceed
247
248 @return An error code: 0 - success, otherwise - failure
249
250 @ref Backend
251**/
252int CeedBasisGetCeed(CeedBasis basis, Ceed *ceed) {
253 *ceed = basis->ceed;
254 return CEED_ERROR_SUCCESS;
255}
256
257/**
258 @brief Get tensor status for given CeedBasis
259
260 @param basis CeedBasis
261 @param[out] is_tensor Variable to store tensor status
262
263 @return An error code: 0 - success, otherwise - failure
264
265 @ref Backend

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

791 "Input/output vectors too short for basis and evaluation mode");
792 // LCOV_EXCL_STOP
793
794 ierr = basis->Apply(basis, num_elem, t_mode, eval_mode, u, v); CeedChk(ierr);
795 return CEED_ERROR_SUCCESS;
796}
797
798/**
243 @brief Get tensor status for given CeedBasis
244
245 @param basis CeedBasis
246 @param[out] is_tensor Variable to store tensor status
247
248 @return An error code: 0 - success, otherwise - failure
249
250 @ref Backend

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

776 "Input/output vectors too short for basis and evaluation mode");
777 // LCOV_EXCL_STOP
778
779 ierr = basis->Apply(basis, num_elem, t_mode, eval_mode, u, v); CeedChk(ierr);
780 return CEED_ERROR_SUCCESS;
781}
782
783/**
784 @brief Get Ceed associated with a CeedBasis
785
786 @param basis CeedBasis
787 @param[out] ceed Variable to store Ceed
788
789 @return An error code: 0 - success, otherwise - failure
790
791 @ref Advanced
792**/
793int CeedBasisGetCeed(CeedBasis basis, Ceed *ceed) {
794 *ceed = basis->ceed;
795 return CEED_ERROR_SUCCESS;
796}
797
798/**
799 @brief Get dimension for given CeedBasis
800
801 @param basis CeedBasis
802 @param[out] dim Variable to store dimension of basis
803
804 @return An error code: 0 - success, otherwise - failure
805
799 @brief Get dimension for given CeedBasis
800
801 @param basis CeedBasis
802 @param[out] dim Variable to store dimension of basis
803
804 @return An error code: 0 - success, otherwise - failure
805
806 @ref Backend
806 @ref Advanced
807**/
808int CeedBasisGetDimension(CeedBasis basis, CeedInt *dim) {
809 *dim = basis->dim;
810 return CEED_ERROR_SUCCESS;
811}
812
813/**
814 @brief Get topology for given CeedBasis
815
816 @param basis CeedBasis
817 @param[out] topo Variable to store topology of basis
818
819 @return An error code: 0 - success, otherwise - failure
820
807**/
808int CeedBasisGetDimension(CeedBasis basis, CeedInt *dim) {
809 *dim = basis->dim;
810 return CEED_ERROR_SUCCESS;
811}
812
813/**
814 @brief Get topology for given CeedBasis
815
816 @param basis CeedBasis
817 @param[out] topo Variable to store topology of basis
818
819 @return An error code: 0 - success, otherwise - failure
820
821 @ref Backend
821 @ref Advanced
822**/
823int CeedBasisGetTopology(CeedBasis basis, CeedElemTopology *topo) {
824 *topo = basis->topo;
825 return CEED_ERROR_SUCCESS;
826}
827
828/**
829 @brief Get number of components for given CeedBasis
830
831 @param basis CeedBasis
832 @param[out] num_comp Variable to store number of components of basis
833
834 @return An error code: 0 - success, otherwise - failure
835
822**/
823int CeedBasisGetTopology(CeedBasis basis, CeedElemTopology *topo) {
824 *topo = basis->topo;
825 return CEED_ERROR_SUCCESS;
826}
827
828/**
829 @brief Get number of components for given CeedBasis
830
831 @param basis CeedBasis
832 @param[out] num_comp Variable to store number of components of basis
833
834 @return An error code: 0 - success, otherwise - failure
835
836 @ref Backend
836 @ref Advanced
837**/
838int CeedBasisGetNumComponents(CeedBasis basis, CeedInt *num_comp) {
839 *num_comp = basis->num_comp;
840 return CEED_ERROR_SUCCESS;
841}
842
843/**
844 @brief Get total number of nodes (in dim dimensions) of a CeedBasis

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

858/**
859 @brief Get total number of nodes (in 1 dimension) of a CeedBasis
860
861 @param basis CeedBasis
862 @param[out] P_1d Variable to store number of nodes
863
864 @return An error code: 0 - success, otherwise - failure
865
837**/
838int CeedBasisGetNumComponents(CeedBasis basis, CeedInt *num_comp) {
839 *num_comp = basis->num_comp;
840 return CEED_ERROR_SUCCESS;
841}
842
843/**
844 @brief Get total number of nodes (in dim dimensions) of a CeedBasis

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

858/**
859 @brief Get total number of nodes (in 1 dimension) of a CeedBasis
860
861 @param basis CeedBasis
862 @param[out] P_1d Variable to store number of nodes
863
864 @return An error code: 0 - success, otherwise - failure
865
866 @ref Backend
866 @ref Advanced
867**/
868int CeedBasisGetNumNodes1D(CeedBasis basis, CeedInt *P_1d) {
869 if (!basis->tensor_basis)
870 // LCOV_EXCL_START
871 return CeedError(basis->ceed, CEED_ERROR_MINOR,
872 "Cannot supply P_1d for non-tensor basis");
873 // LCOV_EXCL_STOP
874

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

894/**
895 @brief Get total number of quadrature points (in 1 dimension) of a CeedBasis
896
897 @param basis CeedBasis
898 @param[out] Q_1d Variable to store number of quadrature points
899
900 @return An error code: 0 - success, otherwise - failure
901
867**/
868int CeedBasisGetNumNodes1D(CeedBasis basis, CeedInt *P_1d) {
869 if (!basis->tensor_basis)
870 // LCOV_EXCL_START
871 return CeedError(basis->ceed, CEED_ERROR_MINOR,
872 "Cannot supply P_1d for non-tensor basis");
873 // LCOV_EXCL_STOP
874

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

894/**
895 @brief Get total number of quadrature points (in 1 dimension) of a CeedBasis
896
897 @param basis CeedBasis
898 @param[out] Q_1d Variable to store number of quadrature points
899
900 @return An error code: 0 - success, otherwise - failure
901
902 @ref Backend
902 @ref Advanced
903**/
904int CeedBasisGetNumQuadraturePoints1D(CeedBasis basis, CeedInt *Q_1d) {
905 if (!basis->tensor_basis)
906 // LCOV_EXCL_START
907 return CeedError(basis->ceed, CEED_ERROR_MINOR,
908 "Cannot supply Q_1d for non-tensor basis");
909 // LCOV_EXCL_STOP
910

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

916 @brief Get reference coordinates of quadrature points (in dim dimensions)
917 of a CeedBasis
918
919 @param basis CeedBasis
920 @param[out] q_ref Variable to store reference coordinates of quadrature points
921
922 @return An error code: 0 - success, otherwise - failure
923
903**/
904int CeedBasisGetNumQuadraturePoints1D(CeedBasis basis, CeedInt *Q_1d) {
905 if (!basis->tensor_basis)
906 // LCOV_EXCL_START
907 return CeedError(basis->ceed, CEED_ERROR_MINOR,
908 "Cannot supply Q_1d for non-tensor basis");
909 // LCOV_EXCL_STOP
910

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

916 @brief Get reference coordinates of quadrature points (in dim dimensions)
917 of a CeedBasis
918
919 @param basis CeedBasis
920 @param[out] q_ref Variable to store reference coordinates of quadrature points
921
922 @return An error code: 0 - success, otherwise - failure
923
924 @ref Backend
924 @ref Advanced
925**/
926int CeedBasisGetQRef(CeedBasis basis, const CeedScalar **q_ref) {
927 *q_ref = basis->q_ref_1d;
928 return CEED_ERROR_SUCCESS;
929}
930
931/**
932 @brief Get quadrature weights of quadrature points (in dim dimensions)
933 of a CeedBasis
934
935 @param basis CeedBasis
936 @param[out] q_weight Variable to store quadrature weights
937
938 @return An error code: 0 - success, otherwise - failure
939
925**/
926int CeedBasisGetQRef(CeedBasis basis, const CeedScalar **q_ref) {
927 *q_ref = basis->q_ref_1d;
928 return CEED_ERROR_SUCCESS;
929}
930
931/**
932 @brief Get quadrature weights of quadrature points (in dim dimensions)
933 of a CeedBasis
934
935 @param basis CeedBasis
936 @param[out] q_weight Variable to store quadrature weights
937
938 @return An error code: 0 - success, otherwise - failure
939
940 @ref Backend
940 @ref Advanced
941**/
942int CeedBasisGetQWeights(CeedBasis basis, const CeedScalar **q_weight) {
943 *q_weight = basis->q_weight_1d;
944 return CEED_ERROR_SUCCESS;
945}
946
947/**
948 @brief Get interpolation matrix of a CeedBasis
949
950 @param basis CeedBasis
951 @param[out] interp Variable to store interpolation matrix
952
953 @return An error code: 0 - success, otherwise - failure
954
941**/
942int CeedBasisGetQWeights(CeedBasis basis, const CeedScalar **q_weight) {
943 *q_weight = basis->q_weight_1d;
944 return CEED_ERROR_SUCCESS;
945}
946
947/**
948 @brief Get interpolation matrix of a CeedBasis
949
950 @param basis CeedBasis
951 @param[out] interp Variable to store interpolation matrix
952
953 @return An error code: 0 - success, otherwise - failure
954
955 @ref Backend
955 @ref Advanced
956**/
957int CeedBasisGetInterp(CeedBasis basis, const CeedScalar **interp) {
958 if (!basis->interp && basis->tensor_basis) {
959 // Allocate
960 int ierr;
961 ierr = CeedMalloc(basis->Q*basis->P, &basis->interp); CeedChk(ierr);
962
963 // Initialize

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

1001/**
1002 @brief Get gradient matrix of a CeedBasis
1003
1004 @param basis CeedBasis
1005 @param[out] grad Variable to store gradient matrix
1006
1007 @return An error code: 0 - success, otherwise - failure
1008
956**/
957int CeedBasisGetInterp(CeedBasis basis, const CeedScalar **interp) {
958 if (!basis->interp && basis->tensor_basis) {
959 // Allocate
960 int ierr;
961 ierr = CeedMalloc(basis->Q*basis->P, &basis->interp); CeedChk(ierr);
962
963 // Initialize

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

1001/**
1002 @brief Get gradient matrix of a CeedBasis
1003
1004 @param basis CeedBasis
1005 @param[out] grad Variable to store gradient matrix
1006
1007 @return An error code: 0 - success, otherwise - failure
1008
1009 @ref Backend
1009 @ref Advanced
1010**/
1011int CeedBasisGetGrad(CeedBasis basis, const CeedScalar **grad) {
1012 if (!basis->grad && basis->tensor_basis) {
1013 // Allocate
1014 int ierr;
1015 ierr = CeedMalloc(basis->dim*basis->Q*basis->P, &basis->grad);
1016 CeedChk(ierr);
1017

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

1041/**
1042 @brief Get 1D gradient matrix of a tensor product CeedBasis
1043
1044 @param basis CeedBasis
1045 @param[out] grad_1d Variable to store gradient matrix
1046
1047 @return An error code: 0 - success, otherwise - failure
1048
1010**/
1011int CeedBasisGetGrad(CeedBasis basis, const CeedScalar **grad) {
1012 if (!basis->grad && basis->tensor_basis) {
1013 // Allocate
1014 int ierr;
1015 ierr = CeedMalloc(basis->dim*basis->Q*basis->P, &basis->grad);
1016 CeedChk(ierr);
1017

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

1041/**
1042 @brief Get 1D gradient matrix of a tensor product CeedBasis
1043
1044 @param basis CeedBasis
1045 @param[out] grad_1d Variable to store gradient matrix
1046
1047 @return An error code: 0 - success, otherwise - failure
1048
1049 @ref Backend
1049 @ref Advanced
1050**/
1051int CeedBasisGetGrad1D(CeedBasis basis, const CeedScalar **grad_1d) {
1052 if (!basis->tensor_basis)
1053 // LCOV_EXCL_START
1054 return CeedError(basis->ceed, CEED_ERROR_MINOR,
1055 "CeedBasis is not a tensor product basis.");
1056 // LCOV_EXCL_STOP
1057

--- 463 unchanged lines hidden ---
1050**/
1051int CeedBasisGetGrad1D(CeedBasis basis, const CeedScalar **grad_1d) {
1052 if (!basis->tensor_basis)
1053 // LCOV_EXCL_START
1054 return CeedError(basis->ceed, CEED_ERROR_MINOR,
1055 "CeedBasis is not a tensor product basis.");
1056 // LCOV_EXCL_STOP
1057

--- 463 unchanged lines hidden ---