ceed-qfunction.c (25150b89c5deeb636695eb50e0a63f6c36782aaa) ceed-qfunction.c (b9c05c73848caa4a8e85dca1ee63c2e7e70143c4)
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.

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

60
61 @ref Basic
62**/
63int CeedQFunctionCreateInterior(Ceed ceed, CeedInt vlength, CeedQFunctionUser f,
64 const char *source, CeedQFunction *qf) {
65 int ierr;
66 char *source_copy;
67
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.

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

60
61 @ref Basic
62**/
63int CeedQFunctionCreateInterior(Ceed ceed, CeedInt vlength, CeedQFunctionUser f,
64 const char *source, CeedQFunction *qf) {
65 int ierr;
66 char *source_copy;
67
68 if (!f) return CeedError(ceed, 1, "Must pass valid function f");
68 if (!ceed->QFunctionCreate) {
69 Ceed delegate;
70 ierr = CeedGetObjectDelegate(ceed, &delegate, "QFunction"); CeedChk(ierr);
71
72 if (!delegate)
73 // LCOV_EXCL_START
74 return CeedError(ceed, 1, "Backend does not support QFunctionCreate");
75 // LCOV_EXCL_STOP

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

81
82 ierr = CeedCalloc(1, qf); CeedChk(ierr);
83 (*qf)->ceed = ceed;
84 ceed->refcount++;
85 (*qf)->refcount = 1;
86 (*qf)->vlength = vlength;
87 (*qf)->identity = 0;
88 (*qf)->function = f;
69 if (!ceed->QFunctionCreate) {
70 Ceed delegate;
71 ierr = CeedGetObjectDelegate(ceed, &delegate, "QFunction"); CeedChk(ierr);
72
73 if (!delegate)
74 // LCOV_EXCL_START
75 return CeedError(ceed, 1, "Backend does not support QFunctionCreate");
76 // LCOV_EXCL_STOP

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

82
83 ierr = CeedCalloc(1, qf); CeedChk(ierr);
84 (*qf)->ceed = ceed;
85 ceed->refcount++;
86 (*qf)->refcount = 1;
87 (*qf)->vlength = vlength;
88 (*qf)->identity = 0;
89 (*qf)->function = f;
89 size_t slen = strlen(source) + 1;
90 ierr = CeedMalloc(slen, &source_copy); CeedChk(ierr);
91 memcpy(source_copy, source, slen);
92 (*qf)->sourcepath = source_copy;
90 (*qf)->sourcepath = NULL;
91 if (source) {
92 size_t slen = strlen(source) + 1;
93 ierr = CeedMalloc(slen, &source_copy); CeedChk(ierr);
94 memcpy(source_copy, source, slen);
95 (*qf)->sourcepath = source_copy;
96 }
93 ierr = CeedCalloc(16, &(*qf)->inputfields); CeedChk(ierr);
94 ierr = CeedCalloc(16, &(*qf)->outputfields); CeedChk(ierr);
95 ierr = ceed->QFunctionCreate(*qf); CeedChk(ierr);
96 return 0;
97}
98
99/**
100 @brief Register a gallery QFunction

--- 641 unchanged lines hidden ---
97 ierr = CeedCalloc(16, &(*qf)->inputfields); CeedChk(ierr);
98 ierr = CeedCalloc(16, &(*qf)->outputfields); CeedChk(ierr);
99 ierr = ceed->QFunctionCreate(*qf); CeedChk(ierr);
100 return 0;
101}
102
103/**
104 @brief Register a gallery QFunction

--- 641 unchanged lines hidden ---