| ceed-vector.c (9c774eddf8c0b4f5416196d32c5355c9591a7190) | ceed-vector.c (706efda32ea467a11ddceea40dd85d82235bf3f8) |
|---|---|
| 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. --- 550 unchanged lines hidden (view full) --- 559 560 @return An error code: 0 - success, otherwise - failure 561 562 @ref User 563**/ 564int CeedVectorRestoreArray(CeedVector vec, CeedScalar **array) { 565 int ierr; 566 | 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. --- 550 unchanged lines hidden (view full) --- 559 560 @return An error code: 0 - success, otherwise - failure 561 562 @ref User 563**/ 564int CeedVectorRestoreArray(CeedVector vec, CeedScalar **array) { 565 int ierr; 566 |
| 567 if (!vec->RestoreArray) 568 // LCOV_EXCL_START 569 return CeedError(vec->ceed, CEED_ERROR_UNSUPPORTED, 570 "Backend does not support RestoreArray"); 571 // LCOV_EXCL_STOP 572 | |
| 573 if (vec->state % 2 != 1) 574 return CeedError(vec->ceed, CEED_ERROR_ACCESS, 575 "Cannot restore CeedVector array access, " 576 "access was not granted"); | 567 if (vec->state % 2 != 1) 568 return CeedError(vec->ceed, CEED_ERROR_ACCESS, 569 "Cannot restore CeedVector array access, " 570 "access was not granted"); |
| 577 578 ierr = vec->RestoreArray(vec); CeedChk(ierr); | 571 if (vec->RestoreArray) { 572 ierr = vec->RestoreArray(vec); CeedChk(ierr); 573 } |
| 579 *array = NULL; 580 vec->state += 1; 581 return CEED_ERROR_SUCCESS; 582} 583 584/** 585 @brief Restore an array obtained using @ref CeedVectorGetArrayRead() 586 587 @param vec CeedVector to restore 588 @param array Array of vector data 589 590 @return An error code: 0 - success, otherwise - failure 591 592 @ref User 593**/ 594int CeedVectorRestoreArrayRead(CeedVector vec, const CeedScalar **array) { 595 int ierr; 596 | 574 *array = NULL; 575 vec->state += 1; 576 return CEED_ERROR_SUCCESS; 577} 578 579/** 580 @brief Restore an array obtained using @ref CeedVectorGetArrayRead() 581 582 @param vec CeedVector to restore 583 @param array Array of vector data 584 585 @return An error code: 0 - success, otherwise - failure 586 587 @ref User 588**/ 589int CeedVectorRestoreArrayRead(CeedVector vec, const CeedScalar **array) { 590 int ierr; 591 |
| 597 if (!vec->RestoreArrayRead) 598 // LCOV_EXCL_START 599 return CeedError(vec->ceed, CEED_ERROR_UNSUPPORTED, 600 "Backend does not support RestoreArrayRead"); 601 // LCOV_EXCL_STOP 602 | |
| 603 if (vec->num_readers == 0) 604 // LCOV_EXCL_START 605 return CeedError(vec->ceed, CEED_ERROR_ACCESS, 606 "Cannot restore CeedVector array read access, " 607 "access was not granted"); 608 // LCOV_EXCL_STOP 609 | 592 if (vec->num_readers == 0) 593 // LCOV_EXCL_START 594 return CeedError(vec->ceed, CEED_ERROR_ACCESS, 595 "Cannot restore CeedVector array read access, " 596 "access was not granted"); 597 // LCOV_EXCL_STOP 598 |
| 610 ierr = vec->RestoreArrayRead(vec); CeedChk(ierr); | 599 if (vec->RestoreArrayRead) { 600 ierr = vec->RestoreArrayRead(vec); CeedChk(ierr); 601 } |
| 611 *array = NULL; 612 vec->num_readers--; 613 return CEED_ERROR_SUCCESS; 614} 615 616/** 617 @brief Get the norm of a CeedVector. 618 --- 397 unchanged lines hidden --- | 602 *array = NULL; 603 vec->num_readers--; 604 return CEED_ERROR_SUCCESS; 605} 606 607/** 608 @brief Get the norm of a CeedVector. 609 --- 397 unchanged lines hidden --- |