Lines Matching +full:- +full:- +full:ceed
1 # Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors
2 # All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
4 # SPDX-License-Identifier: BSD-2-Clause
6 # This file is part of CEED: http://github.com/ceed
9 # Test Ceed Basis functionality
20 # -------------------------------------------------------------------------------
22 # -------------------------------------------------------------------------------
28 result *= math.tanh(x[d] - center)
40 # -------------------------------------------------------------------------------
42 # -------------------------------------------------------------------------------
46 ceed = libceed.Ceed(ceed_resource)
48 b = ceed.BasisTensorH1Lagrange(1, 1, 4, 4, libceed.GAUSS_LOBATTO)
52 b = ceed.BasisTensorH1Lagrange(1, 1, 4, 4, libceed.GAUSS)
62 # -------------------------------------------------------------------------------
64 # -------------------------------------------------------------------------------
68 ceed = libceed.Ceed(ceed_resource)
70 b = ceed.BasisTensorH1Lagrange(3, 1, 4, 5, libceed.GAUSS_LOBATTO)
78 # -------------------------------------------------------------------------------
80 # -------------------------------------------------------------------------------
84 ceed = libceed.Ceed(ceed_resource)
90 x = np.empty(Xdim * dim, dtype=ceed.scalar_type())
91 uq = np.empty(Qdim, dtype=ceed.scalar_type())
96 (2**(dim - d))) // (2**(dim - d - 1)) else -1
98 X = ceed.Vector(Xdim * dim)
100 Xq = ceed.Vector(Qdim * dim)
102 U = ceed.Vector(Qdim)
104 Uq = ceed.Vector(Qdim)
106 bxl = ceed.BasisTensorH1Lagrange(dim, dim, 2, Q, libceed.GAUSS_LOBATTO)
107 bul = ceed.BasisTensorH1Lagrange(dim, 1, Q, Q, libceed.GAUSS_LOBATTO)
113 xx = np.empty(dim, dtype=ceed.scalar_type())
123 bxg = ceed.BasisTensorH1Lagrange(dim, dim, 2, Q, libceed.GAUSS)
124 bug = ceed.BasisTensorH1Lagrange(dim, 1, Q, Q, libceed.GAUSS)
131 xx = np.empty(dim, dtype=ceed.scalar_type())
135 assert math.fabs(u[i] - fx) < 1E-4
137 # -------------------------------------------------------------------------------
139 # -------------------------------------------------------------------------------
143 ceed = libceed.Ceed(ceed_resource)
151 x = np.empty(Xdim * dim, dtype=ceed.scalar_type())
152 u = np.empty(Pdim, dtype=ceed.scalar_type())
157 (2**(dim - d))) // (2**(dim - d - 1)) else -1
159 X = ceed.Vector(Xdim * dim)
161 Xq = ceed.Vector(Pdim * dim)
163 U = ceed.Vector(Pdim)
164 Uq = ceed.Vector(Qdim * dim)
166 Ones = ceed.Vector(Qdim * dim)
168 Gtposeones = ceed.Vector(Pdim)
172 bxl = ceed.BasisTensorH1Lagrange(dim, dim, 2, P, libceed.GAUSS_LOBATTO)
177 xx = np.empty(dim, dtype=ceed.scalar_type())
185 bug = ceed.BasisTensorH1Lagrange(dim, 1, P, Q, libceed.GAUSS)
196 assert math.fabs(sum1 - sum2) < 10. * TOL
198 # -------------------------------------------------------------------------------
199 # Test creation and destruction of a 2D Simplex non-tensor H1 basis
200 # -------------------------------------------------------------------------------
204 ceed = libceed.Ceed(ceed_resource)
208 in_array = np.empty(P, dtype=ceed.scalar_type())
209 qref = np.empty(dim * Q, dtype=ceed.scalar_type())
210 qweight = np.empty(Q, dtype=ceed.scalar_type())
215 b = ceed.BasisH1(libceed.TRIANGLE, 1, P, Q, interp, grad, qref, qweight)
220 # -------------------------------------------------------------------------------
221 # Test integration with a 2D Simplex non-tensor H1 basis
222 # -------------------------------------------------------------------------------
226 ceed = libceed.Ceed(ceed_resource)
231 0., 0.5, 0.5, 1.], dtype=ceed.scalar_type())
232 in_array = np.empty(P, dtype=ceed.scalar_type())
233 qref = np.empty(dim * Q, dtype=ceed.scalar_type())
234 qweight = np.empty(Q, dtype=ceed.scalar_type())
239 b = ceed.BasisH1(libceed.TRIANGLE, 1, P, Q, interp, grad, qref, qweight)
245 in_vec = ceed.Vector(P)
247 out_vec = ceed.Vector(Q)
249 weights_vec = ceed.Vector(Q)
260 assert math.fabs(sum - 17. / 24.) < 10. * TOL
262 # -------------------------------------------------------------------------------
263 # Test grad with a 2D Simplex non-tensor H1 basis
264 # -------------------------------------------------------------------------------
268 ceed = libceed.Ceed(ceed_resource)
273 1. / 3., 0.6], dtype=ceed.scalar_type())
275 0., 0.5, 0.5, 1.], dtype=ceed.scalar_type())
276 in_array = np.empty(P, dtype=ceed.scalar_type())
277 qref = np.empty(dim * Q, dtype=ceed.scalar_type())
278 qweight = np.empty(Q, dtype=ceed.scalar_type())
283 b = ceed.BasisH1(libceed.TRIANGLE, 1, P, Q, interp, grad, qref, qweight)
289 in_vec = ceed.Vector(P)
291 out_vec = ceed.Vector(Q * dim)
300 assert math.fabs(out_array[0 * Q + i] - value) < 10. * TOL
303 assert math.fabs(out_array[1 * Q + i] - value) < 10. * TOL
305 # -------------------------------------------------------------------------------
306 # Test interpolation with a 2D Quad non-tensor H(div) basis
307 # -------------------------------------------------------------------------------
311 ceed = libceed.Ceed(ceed_resource)
315 in_array = np.ones(P, dtype=ceed.scalar_type())
316 qref = np.empty(dim * Q, dtype=ceed.scalar_type())
317 qweight = np.empty(Q, dtype=ceed.scalar_type())
322 b = ceed.BasisHdiv(libceed.QUAD, 1, P, Q, interp, div, qref, qweight)
325 in_vec = ceed.Vector(P)
327 out_vec = ceed.Vector(Q * dim)
336 assert math.fabs(out_array[1 * Q + i] - 1.) < 10. * TOL
338 # -------------------------------------------------------------------------------
339 # Test interpolation with a 2D Simplex non-tensor H(curl) basis
340 # -------------------------------------------------------------------------------
344 ceed = libceed.Ceed(ceed_resource)
348 in_array = np.empty(P, dtype=ceed.scalar_type())
349 qref = np.empty(dim * Q, dtype=ceed.scalar_type())
350 qweight = np.empty(Q, dtype=ceed.scalar_type())
355 b = ceed.BasisHcurl(libceed.TRIANGLE, 1, P, Q, interp, curl, qref, qweight)
362 in_vec = ceed.Vector(P)
364 out_vec = ceed.Vector(Q * dim)
372 assert math.fabs(out_array[0 * Q + i] - 1.) < 10. * TOL
375 in_array[0] = -1.
386 assert math.fabs(out_array[1 * Q + i] - 1.) < 10. * TOL
388 # -------------------------------------------------------------------------------