| ceed-qfunction.c (572ff09c85e1de07bdd8bed4adbe59486604f1e4) | ceed-qfunction.c (d99fa3c5cd91a1690aedf0679cbf290d44fec74c) |
|---|---|
| 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. --- 565 unchanged lines hidden (view full) --- 574 ierr = CeedQFunctionAddInput(*qf, "input", size, inmode); CeedChk(ierr); 575 ierr = CeedQFunctionAddOutput(*qf, "output", size, outmode); CeedChk(ierr); 576 577 (*qf)->identity = 1; 578 CeedInt *ctx; 579 ierr = CeedCalloc(1, &ctx); CeedChk(ierr); 580 ctx[0] = size; 581 ierr = CeedQFunctionSetContext(*qf, ctx, sizeof(*ctx)); CeedChk(ierr); | 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. --- 565 unchanged lines hidden (view full) --- 574 ierr = CeedQFunctionAddInput(*qf, "input", size, inmode); CeedChk(ierr); 575 ierr = CeedQFunctionAddOutput(*qf, "output", size, outmode); CeedChk(ierr); 576 577 (*qf)->identity = 1; 578 CeedInt *ctx; 579 ierr = CeedCalloc(1, &ctx); CeedChk(ierr); 580 ctx[0] = size; 581 ierr = CeedQFunctionSetContext(*qf, ctx, sizeof(*ctx)); CeedChk(ierr); |
| 582 (*qf)->ctx_allocated = (*qf)->ctx; |
|
| 582 583 return 0; 584} 585 586/** 587 @brief Add a CeedQFunction input 588 589 @param qf CeedQFunction --- 147 unchanged lines hidden (view full) --- 737 ierr = CeedFree(&(*qf)->inputfields[i]); CeedChk(ierr); 738 } 739 for (int i=0; i<(*qf)->numoutputfields; i++) { 740 ierr = CeedFree(&(*(*qf)->outputfields[i]).fieldname); CeedChk(ierr); 741 ierr = CeedFree(&(*qf)->outputfields[i]); CeedChk(ierr); 742 } 743 ierr = CeedFree(&(*qf)->inputfields); CeedChk(ierr); 744 ierr = CeedFree(&(*qf)->outputfields); CeedChk(ierr); | 583 584 return 0; 585} 586 587/** 588 @brief Add a CeedQFunction input 589 590 @param qf CeedQFunction --- 147 unchanged lines hidden (view full) --- 738 ierr = CeedFree(&(*qf)->inputfields[i]); CeedChk(ierr); 739 } 740 for (int i=0; i<(*qf)->numoutputfields; i++) { 741 ierr = CeedFree(&(*(*qf)->outputfields[i]).fieldname); CeedChk(ierr); 742 ierr = CeedFree(&(*qf)->outputfields[i]); CeedChk(ierr); 743 } 744 ierr = CeedFree(&(*qf)->inputfields); CeedChk(ierr); 745 ierr = CeedFree(&(*qf)->outputfields); CeedChk(ierr); |
| 745 // Free ctx if identity 746 if ((*qf)->identity) { 747 ierr = CeedFree(&(*qf)->ctx); CeedChk(ierr); 748 } | 746 // Free ctx if owned by QFunction 747 ierr = CeedFree(&(*qf)->ctx_allocated); CeedChk(ierr); |
| 749 750 ierr = CeedFree(&(*qf)->sourcepath); CeedChk(ierr); 751 ierr = CeedFree(&(*qf)->qfname); CeedChk(ierr); 752 ierr = CeedDestroy(&(*qf)->ceed); CeedChk(ierr); 753 ierr = CeedFree(qf); CeedChk(ierr); 754 return 0; 755} 756 757/// @} | 748 749 ierr = CeedFree(&(*qf)->sourcepath); CeedChk(ierr); 750 ierr = CeedFree(&(*qf)->qfname); CeedChk(ierr); 751 ierr = CeedDestroy(&(*qf)->ceed); CeedChk(ierr); 752 ierr = CeedFree(qf); CeedChk(ierr); 753 return 0; 754} 755 756/// @} |