| ceed-elemrestriction.c (fa9eac48825b2c0339cddc576d44c186940d4520) | ceed-elemrestriction.c (95bb1877d9b2fcda84fdb8cecd2747929a23a65b) |
|---|---|
| 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. --- 21 unchanged lines hidden (view full) --- 30 @param nelem Number of elements described in the @a indices array 31 @param elemsize Size (number of "nodes") per element 32 @param nnodes The number of nodes in the L-vector. The input CeedVector 33 to which the restriction will be applied is of size 34 @a nnodes * @a ncomp. This size may include data 35 used by other CeedElemRestriction objects describing 36 different types of elements. 37 @param ncomp Number of field components per interpolation node | 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. --- 21 unchanged lines hidden (view full) --- 30 @param nelem Number of elements described in the @a indices array 31 @param elemsize Size (number of "nodes") per element 32 @param nnodes The number of nodes in the L-vector. The input CeedVector 33 to which the restriction will be applied is of size 34 @a nnodes * @a ncomp. This size may include data 35 used by other CeedElemRestriction objects describing 36 different types of elements. 37 @param ncomp Number of field components per interpolation node |
| 38 (1 for scalar fields) |
|
| 38 @param mtype Memory type of the @a indices array, see CeedMemType 39 @param cmode Copy mode for the @a indices array, see CeedCopyMode 40 @param indices Array of shape [@a nelem, @a elemsize]. Row i holds the 41 ordered list of the indices (into the input CeedVector) 42 for the unknowns corresponding to element i, where 43 0 <= i < @a nelem. All indices must be in the range 44 [0, @a nnodes - 1]. 45 @param[out] rstr Address of the variable where the newly created --- 46 unchanged lines hidden (view full) --- 92 @param nelem Number of elements described in the @a indices array 93 @param elemsize Size (number of "nodes") per element 94 @param nnodes The number of nodes in the L-vector. The input CeedVector 95 to which the restriction will be applied is of size 96 @a nnodes * @a ncomp. This size may include data 97 used by other CeedElemRestriction objects describing 98 different types of elements. 99 @param ncomp Number of field components per interpolation node | 39 @param mtype Memory type of the @a indices array, see CeedMemType 40 @param cmode Copy mode for the @a indices array, see CeedCopyMode 41 @param indices Array of shape [@a nelem, @a elemsize]. Row i holds the 42 ordered list of the indices (into the input CeedVector) 43 for the unknowns corresponding to element i, where 44 0 <= i < @a nelem. All indices must be in the range 45 [0, @a nnodes - 1]. 46 @param[out] rstr Address of the variable where the newly created --- 46 unchanged lines hidden (view full) --- 93 @param nelem Number of elements described in the @a indices array 94 @param elemsize Size (number of "nodes") per element 95 @param nnodes The number of nodes in the L-vector. The input CeedVector 96 to which the restriction will be applied is of size 97 @a nnodes * @a ncomp. This size may include data 98 used by other CeedElemRestriction objects describing 99 different types of elements. 100 @param ncomp Number of field components per interpolation node |
| 101 (1 for scalar fields) |
|
| 100 @param rstr Address of the variable where the newly created 101 CeedElemRestriction will be stored 102 103 @return An error code: 0 - success, otherwise - failure 104 105 @ref Basic 106**/ 107int CeedElemRestrictionCreateIdentity(Ceed ceed, CeedInt nelem, --- 70 unchanged lines hidden (view full) --- 178 @param nelem Number of elements described in the @a indices array. 179 @param elemsize Size (number of unknowns) per element 180 @param blksize Number of elements in a block 181 @param nnodes The number of nodes in the L-vector. The input CeedVector 182 to which the restriction will be applied is of size 183 @a nnodes * @a ncomp. This size may include data 184 used by other CeedElemRestriction objects describing 185 different types of elements. | 102 @param rstr Address of the variable where the newly created 103 CeedElemRestriction will be stored 104 105 @return An error code: 0 - success, otherwise - failure 106 107 @ref Basic 108**/ 109int CeedElemRestrictionCreateIdentity(Ceed ceed, CeedInt nelem, --- 70 unchanged lines hidden (view full) --- 180 @param nelem Number of elements described in the @a indices array. 181 @param elemsize Size (number of unknowns) per element 182 @param blksize Number of elements in a block 183 @param nnodes The number of nodes in the L-vector. The input CeedVector 184 to which the restriction will be applied is of size 185 @a nnodes * @a ncomp. This size may include data 186 used by other CeedElemRestriction objects describing 187 different types of elements. |
| 186 @param ncomp Number of components stored at each node | 188 @param ncomp Number of field components per interpolation node 189 (1 for scalar fields) |
| 187 @param mtype Memory type of the @a indices array, see CeedMemType 188 @param cmode Copy mode for the @a indices array, see CeedCopyMode 189 @param indices Array of shape [@a nelem, @a elemsize]. Row i holds the 190 ordered list of the indices (into the input CeedVector) 191 for the unknowns corresponding to element i, where 192 0 <= i < @a nelem. All indices must be in the range 193 [0, @a nnodes). The backend will permute and pad this 194 array to the desired ordering for the blocksize, which is --- 147 unchanged lines hidden (view full) --- 342 [3*blksize : 4*blksize] 343 @param tmode Apply restriction or transpose 344 @param lmode Ordering of the ncomp components, i.e. it specifies 345 the ordering of the components of the l-vector used 346 by this CeedElemRestriction. CEED_NOTRANSPOSE indicates 347 the component is the outermost index and CEED_TRANSPOSE 348 indicates the component is the innermost index in 349 ordering of the l-vector | 190 @param mtype Memory type of the @a indices array, see CeedMemType 191 @param cmode Copy mode for the @a indices array, see CeedCopyMode 192 @param indices Array of shape [@a nelem, @a elemsize]. Row i holds the 193 ordered list of the indices (into the input CeedVector) 194 for the unknowns corresponding to element i, where 195 0 <= i < @a nelem. All indices must be in the range 196 [0, @a nnodes). The backend will permute and pad this 197 array to the desired ordering for the blocksize, which is --- 147 unchanged lines hidden (view full) --- 345 [3*blksize : 4*blksize] 346 @param tmode Apply restriction or transpose 347 @param lmode Ordering of the ncomp components, i.e. it specifies 348 the ordering of the components of the l-vector used 349 by this CeedElemRestriction. CEED_NOTRANSPOSE indicates 350 the component is the outermost index and CEED_TRANSPOSE 351 indicates the component is the innermost index in 352 ordering of the l-vector |
| 350 tmode=CEED_NOTRANSPOSE) | |
| 351 @param u Input vector (of shape [@a nnodes, @a ncomp] when 352 tmode=CEED_NOTRANSPOSE, lmode=CEED_TRANSPOSE) 353 @param v Output vector (of shape [@a blksize * @a elemsize] when 354 tmode=CEED_NOTRANSPOSE). Ordering of the e-vector is decided 355 by the backend. 356 @param request Request or CEED_REQUEST_IMMEDIATE 357 358 @return An error code: 0 - success, otherwise - failure --- 34 unchanged lines hidden (view full) --- 393 CeedChk(ierr); 394 395 return 0; 396} 397 398/** 399 @brief Get the multiplicity of nodes in a CeedElemRestriction 400 | 353 @param u Input vector (of shape [@a nnodes, @a ncomp] when 354 tmode=CEED_NOTRANSPOSE, lmode=CEED_TRANSPOSE) 355 @param v Output vector (of shape [@a blksize * @a elemsize] when 356 tmode=CEED_NOTRANSPOSE). Ordering of the e-vector is decided 357 by the backend. 358 @param request Request or CEED_REQUEST_IMMEDIATE 359 360 @return An error code: 0 - success, otherwise - failure --- 34 unchanged lines hidden (view full) --- 395 CeedChk(ierr); 396 397 return 0; 398} 399 400/** 401 @brief Get the multiplicity of nodes in a CeedElemRestriction 402 |
| 401 @param rstr CeedElemRestriction 402 @param[in] tmode Order the components of the output vector as interlaced (CEED_TRANSPOSE) 403 or blocked (CEED_NOTRANSPOSE) 404 @param[out] mult Vector to store multiplicity (of size ndof) | 403 @param rstr CeedElemRestriction 404 @param[out] mult Vector to store multiplicity (of size nnodes) |
| 405 406 @return An error code: 0 - success, otherwise - failure 407 408 @ref Advanced 409**/ 410int CeedElemRestrictionGetMultiplicity(CeedElemRestriction rstr, | 405 406 @return An error code: 0 - success, otherwise - failure 407 408 @ref Advanced 409**/ 410int CeedElemRestrictionGetMultiplicity(CeedElemRestriction rstr, |
| 411 CeedTransposeMode tmode, | |
| 412 CeedVector mult) { 413 int ierr; 414 CeedVector evec; 415 416 // Create and set evec 417 ierr = CeedElemRestrictionCreateVector(rstr, NULL, &evec); CeedChk(ierr); 418 ierr = CeedVectorSetValue(evec, 1.0); CeedChk(ierr); | 411 CeedVector mult) { 412 int ierr; 413 CeedVector evec; 414 415 // Create and set evec 416 ierr = CeedElemRestrictionCreateVector(rstr, NULL, &evec); CeedChk(ierr); 417 ierr = CeedVectorSetValue(evec, 1.0); CeedChk(ierr); |
| 419 ierr = CeedVectorSetValue(mult, 0.0); CeedChk(ierr); | |
| 420 421 // Apply to get multiplicity | 418 419 // Apply to get multiplicity |
| 422 ierr = CeedElemRestrictionApply(rstr, CEED_TRANSPOSE, tmode, evec, | 420 ierr = CeedElemRestrictionApply(rstr, CEED_TRANSPOSE, CEED_NOTRANSPOSE, evec, |
| 423 mult, CEED_REQUEST_IMMEDIATE); CeedChk(ierr); 424 425 // Cleanup 426 ierr = CeedVectorDestroy(&evec); CeedChk(ierr); 427 428 return 0; 429} 430 --- 138 unchanged lines hidden (view full) --- 569int CeedElemRestrictionSetData(CeedElemRestriction rstr, void **data) { 570 rstr->data = *data; 571 return 0; 572} 573 574/** 575 @brief View a CeedElemRestriction 576 | 421 mult, CEED_REQUEST_IMMEDIATE); CeedChk(ierr); 422 423 // Cleanup 424 ierr = CeedVectorDestroy(&evec); CeedChk(ierr); 425 426 return 0; 427} 428 --- 138 unchanged lines hidden (view full) --- 567int CeedElemRestrictionSetData(CeedElemRestriction rstr, void **data) { 568 rstr->data = *data; 569 return 0; 570} 571 572/** 573 @brief View a CeedElemRestriction 574 |
| 577 @param[in] rstr CeedElemRestriction to view 578 @param[in] stream Stream to write; typically stdout/stderr or a file | 575 @param[in] rstr CeedElemRestriction to view 576 @param[in] stream Stream to write; typically stdout/stderr or a file |
| 579 580 @return Error code: 0 - success, otherwise - failure 581 582 @ref Utility 583**/ 584int CeedElemRestrictionView(CeedElemRestriction rstr, FILE *stream) { 585 fprintf(stream, "CeedElemRestriction from (%d, %d) to %d elements with %d " 586 "nodes each\n", rstr->nnodes, rstr->ncomp, rstr->nelem, 587 rstr->elemsize); 588 return 0; 589} 590 591/** 592 @brief Destroy a CeedElemRestriction 593 | 577 578 @return Error code: 0 - success, otherwise - failure 579 580 @ref Utility 581**/ 582int CeedElemRestrictionView(CeedElemRestriction rstr, FILE *stream) { 583 fprintf(stream, "CeedElemRestriction from (%d, %d) to %d elements with %d " 584 "nodes each\n", rstr->nnodes, rstr->ncomp, rstr->nelem, 585 rstr->elemsize); 586 return 0; 587} 588 589/** 590 @brief Destroy a CeedElemRestriction 591 |
| 594 @param rstr CeedElemRestriction to destroy | 592 @param rstr CeedElemRestriction to destroy |
| 595 596 @return An error code: 0 - success, otherwise - failure 597 598 @ref Basic 599**/ 600int CeedElemRestrictionDestroy(CeedElemRestriction *rstr) { 601 int ierr; 602 603 if (!*rstr || --(*rstr)->refcount > 0) 604 return 0; 605 if ((*rstr)->Destroy) { 606 ierr = (*rstr)->Destroy(*rstr); CeedChk(ierr); 607 } 608 ierr = CeedDestroy(&(*rstr)->ceed); CeedChk(ierr); 609 ierr = CeedFree(rstr); CeedChk(ierr); 610 return 0; 611} 612 613/// @} | 593 594 @return An error code: 0 - success, otherwise - failure 595 596 @ref Basic 597**/ 598int CeedElemRestrictionDestroy(CeedElemRestriction *rstr) { 599 int ierr; 600 601 if (!*rstr || --(*rstr)->refcount > 0) 602 return 0; 603 if ((*rstr)->Destroy) { 604 ierr = (*rstr)->Destroy(*rstr); CeedChk(ierr); 605 } 606 ierr = CeedDestroy(&(*rstr)->ceed); CeedChk(ierr); 607 ierr = CeedFree(rstr); CeedChk(ierr); 608 return 0; 609} 610 611/// @} |