xref: /libCEED/gallery/poisson-vector/ceed-vectorpoisson2dapply.c (revision dfb517d7db93183aa0109a86f5ac340e64a692d6)
16a6224a1SJeremy L Thompson // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
26a6224a1SJeremy L Thompson // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
36a6224a1SJeremy L Thompson // All Rights reserved. See files LICENSE and NOTICE for details.
46a6224a1SJeremy L Thompson //
56a6224a1SJeremy L Thompson // This file is part of CEED, a collection of benchmarks, miniapps, software
66a6224a1SJeremy L Thompson // libraries and APIs for efficient high-order finite element and spectral
76a6224a1SJeremy L Thompson // element discretizations for exascale applications. For more information and
86a6224a1SJeremy L Thompson // source code availability see http://github.com/ceed.
96a6224a1SJeremy L Thompson //
106a6224a1SJeremy L Thompson // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
116a6224a1SJeremy L Thompson // a collaborative effort of two U.S. Department of Energy organizations (Office
126a6224a1SJeremy L Thompson // of Science and the National Nuclear Security Administration) responsible for
136a6224a1SJeremy L Thompson // the planning and preparation of a capable exascale ecosystem, including
146a6224a1SJeremy L Thompson // software, applications, hardware, advanced system engineering and early
156a6224a1SJeremy L Thompson // testbed platforms, in support of the nation's exascale computing imperative.
166a6224a1SJeremy L Thompson 
176a6224a1SJeremy L Thompson #include <ceed/ceed.h>
186a6224a1SJeremy L Thompson #include <ceed/backend.h>
196a6224a1SJeremy L Thompson #include <string.h>
206a6224a1SJeremy L Thompson #include "ceed-vectorpoisson2dapply.h"
216a6224a1SJeremy L Thompson 
226a6224a1SJeremy L Thompson /**
236a6224a1SJeremy L Thompson   @brief Set fields for Ceed QFunction applying the 2D Poisson operator
246a6224a1SJeremy L Thompson            on a vector system with three components
256a6224a1SJeremy L Thompson **/
26*dfb517d7SJeremy L Thompson static int CeedQFunctionInit_Vector3Poisson2DApply(Ceed ceed,
276a6224a1SJeremy L Thompson     const char *requested,
286a6224a1SJeremy L Thompson     CeedQFunction qf) {
296a6224a1SJeremy L Thompson   int ierr;
306a6224a1SJeremy L Thompson 
316a6224a1SJeremy L Thompson   // Check QFunction name
32*dfb517d7SJeremy L Thompson   const char *name = "Vector3Poisson2DApply";
336a6224a1SJeremy L Thompson   if (strcmp(name, requested))
346a6224a1SJeremy L Thompson     // LCOV_EXCL_START
356a6224a1SJeremy L Thompson     return CeedError(ceed, CEED_ERROR_UNSUPPORTED,
366a6224a1SJeremy L Thompson                      "QFunction '%s' does not match requested name: %s",
376a6224a1SJeremy L Thompson                      name, requested);
386a6224a1SJeremy L Thompson   // LCOV_EXCL_STOP
396a6224a1SJeremy L Thompson 
406a6224a1SJeremy L Thompson   // Add QFunction fields
416a6224a1SJeremy L Thompson   const CeedInt dim = 2, num_comp = 3;
426a6224a1SJeremy L Thompson   ierr = CeedQFunctionAddInput(qf, "du", num_comp*dim, CEED_EVAL_GRAD);
436a6224a1SJeremy L Thompson   CeedChk(ierr);
446a6224a1SJeremy L Thompson   ierr = CeedQFunctionAddInput(qf, "qdata", dim*(dim+1)/2, CEED_EVAL_NONE);
456a6224a1SJeremy L Thompson   CeedChk(ierr);
466a6224a1SJeremy L Thompson   ierr = CeedQFunctionAddOutput(qf, "dv", num_comp*dim, CEED_EVAL_GRAD);
476a6224a1SJeremy L Thompson   CeedChk(ierr);
486a6224a1SJeremy L Thompson 
496a6224a1SJeremy L Thompson   return CEED_ERROR_SUCCESS;
506a6224a1SJeremy L Thompson }
516a6224a1SJeremy L Thompson 
526a6224a1SJeremy L Thompson /**
536a6224a1SJeremy L Thompson   @brief Register Ceed QFunction for applying the 2D Poisson operator
546a6224a1SJeremy L Thompson            on a vector system with three components
556a6224a1SJeremy L Thompson **/
56*dfb517d7SJeremy L Thompson CEED_INTERN int CeedQFunctionRegister_Vector3Poisson2DApply(void) {
57*dfb517d7SJeremy L Thompson   return CeedQFunctionRegister("Vector3Poisson2DApply", Vector3Poisson2DApply_loc,
58*dfb517d7SJeremy L Thompson                                1, Vector3Poisson2DApply,
59*dfb517d7SJeremy L Thompson                                CeedQFunctionInit_Vector3Poisson2DApply);
606a6224a1SJeremy L Thompson }
61