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 ex1_volume -c /cpu/self
15 # python ex1_volume -c /gpu/cuda
17 import sys
20 import libceed
50 print(f" Ceed specification [-c] : {args.ceed}")
51 print(f" Mesh dimension [-d] : {dim}")
52 print(f" Mesh degree [-m] : {mesh_degree}")
53 print(f" Solution degree [-p] : {sol_degree}")
54 print(f" Num. 1D quadr. pts [-q] : {num_qpts}")
55 print(f" Approx. # unknowns [-s] : {problem_size}")
56 print(f" QFunction source [-g] : {'gallery' if args.gallery else 'user'}")
59 ceed = libceed.Ceed(args.ceed)
62 # Tensor-product Lagrange basis for mesh coordinates
64 dim, ncomp_x, mesh_degree + 1, num_qpts, libceed.GAUSS)
66 # Tensor-product Lagrange basis for solution
68 dim, 1, sol_degree + 1, num_qpts, libceed.GAUSS)
110 os.path.join(file_dir, "ex1-volume.h:build_mass"))
111 qf_build.add_input("dx", dim * dim, libceed.EVAL_GRAD)
112 qf_build.add_input("weights", 1, libceed.EVAL_WEIGHT)
113 qf_build.add_output("qdata", num_q_comp, libceed.EVAL_NONE)
118 op_build.set_field("dx", mesh_restriction, mesh_basis, libceed.VECTOR_ACTIVE)
119 op_build.set_field("weights", libceed.ELEMRESTRICTION_NONE, mesh_basis, libceed.VECTOR_NONE)
120 op_build.set_field("qdata", q_data_restriction, libceed.BASIS_NONE, libceed.VECTOR_ACTIVE)
139 os.path.join(file_dir, "ex1-volume.h:apply_mass"))
140 qf_mass.add_input("u", 1, libceed.EVAL_INTERP)
141 qf_mass.add_input("qdata", num_q_comp, libceed.EVAL_NONE)
142 qf_mass.add_output("v", 1, libceed.EVAL_INTERP)
147 op_mass.set_field("u", solution_restriction, solution_basis, libceed.VECTOR_ACTIVE)
148 op_mass.set_field("qdata", q_data_restriction, libceed.BASIS_NONE, q_data)
149 op_mass.set_field("v", solution_restriction, solution_basis, libceed.VECTOR_ACTIVE)
169 print(f"Volume error : {volume - exact_volume:.14g}")
171 # Test mode - check if error is within tolerance
172 tol = 200 * libceed.EPSILON if dim == 1 else 1e-5
173 if abs(volume - exact_volume) > tol:
174 print(f"Volume error : {volume - exact_volume:.14g}")
175 sys.exit(1)
181 sys.exit(main())