Lines Matching +full:libceed +full:- +full:sys

2 # Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
3 # All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
5 # SPDX-License-Identifier: BSD-2-Clause
9 # libCEED example using diffusion operator to compute surface area
14 # python ex2_surface.py -c /cpu/self
15 # python ex2_surface.py -c /gpu/cuda
17 import sys
20 import libceed
51 print(f" Ceed specification [-c] : {args.ceed}")
52 print(f" Mesh dimension [-d] : {dim}")
53 print(f" Mesh degree [-m] : {mesh_degree}")
54 print(f" Solution degree [-p] : {sol_degree}")
55 print(f" Num. 1D quadr. pts [-q] : {num_qpts}")
56 print(f" Approx. # unknowns [-s] : {problem_size}")
57 print(f" QFunction source [-g] : {'gallery' if args.gallery else 'user'}")
60 ceed = libceed.Ceed(args.ceed)
63 # Tensor-product Lagrange basis for mesh coordinates
65 dim, ncomp_x, mesh_degree + 1, num_qpts, libceed.GAUSS)
67 # Tensor-product Lagrange basis for solution
69 dim, 1, sol_degree + 1, num_qpts, libceed.GAUSS)
112 os.path.join(file_dir, "ex2-surface.h:build_diff"))
113 qf_build.add_input("dx", dim * dim, libceed.EVAL_GRAD)
114 qf_build.add_input("weights", 1, libceed.EVAL_WEIGHT)
115 qf_build.add_output("qdata", num_q_comp, libceed.EVAL_NONE)
120 op_build.set_field("dx", mesh_restriction, mesh_basis, libceed.VECTOR_ACTIVE)
121 op_build.set_field("weights", libceed.ELEMRESTRICTION_NONE, mesh_basis, libceed.VECTOR_NONE)
122 op_build.set_field("qdata", q_data_restriction, libceed.BASIS_NONE, libceed.VECTOR_ACTIVE)
141 os.path.join(file_dir, "ex2-surface.h:apply_diff"))
142 qf_diff.add_input("du", dim, libceed.EVAL_GRAD)
143 qf_diff.add_input("qdata", num_q_comp, libceed.EVAL_NONE)
144 qf_diff.add_output("dv", dim, libceed.EVAL_GRAD)
149 op_diff.set_field("du", solution_restriction, solution_basis, libceed.VECTOR_ACTIVE)
150 op_diff.set_field("qdata", q_data_restriction, libceed.BASIS_NONE, q_data)
151 op_diff.set_field("dv", solution_restriction, solution_basis, libceed.VECTOR_ACTIVE)
174 print(f"Surface area error : {surface_area - exact_surface_area:.14g}")
176 # Test mode - check if error is within tolerance
177 tol = 10000 * libceed.EPSILON if dim == 1 else 1e-1
178 if abs(surface_area - exact_surface_area) > tol:
179 print(f"Surface area error : {surface_area - exact_surface_area:.14g}")
180 sys.exit(1)
186 sys.exit(main())