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 ex3_volume -c /cpu/self
15 # python ex3_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'}")
58 # Check - Gallery not supported
61 sys.exit(1)
64 ceed = libceed.Ceed(args.ceed)
67 # Tensor-product Lagrange basis for mesh coordinates
69 dim, ncomp_x, mesh_degree + 1, num_qpts, libceed.GAUSS)
71 # Tensor-product Lagrange basis for solution
73 dim, 1, sol_degree + 1, num_qpts, libceed.GAUSS)
114 os.path.join(file_dir, "ex3-volume.h:build_mass_diff"))
115 qf_build.add_input("dx", dim * dim, libceed.EVAL_GRAD)
116 qf_build.add_input("weights", 1, libceed.EVAL_WEIGHT)
117 qf_build.add_output("qdata", num_q_comp, libceed.EVAL_NONE)
122 op_build.set_field("dx", mesh_restriction, mesh_basis, libceed.VECTOR_ACTIVE)
123 op_build.set_field("weights", libceed.ELEMRESTRICTION_NONE, mesh_basis, libceed.VECTOR_NONE)
124 op_build.set_field("qdata", q_data_restriction, libceed.BASIS_NONE, libceed.VECTOR_ACTIVE)
132 os.path.join(file_dir, "ex3-volume.h:apply_mass_diff"))
133 qf_apply.add_input("u", 1, libceed.EVAL_INTERP)
134 qf_apply.add_input("du", dim, libceed.EVAL_GRAD)
135 qf_apply.add_input("qdata", num_q_comp, libceed.EVAL_NONE)
136 qf_apply.add_output("v", 1, libceed.EVAL_INTERP)
137 qf_apply.add_output("dv", dim, libceed.EVAL_GRAD)
142 op_apply.set_field("u", solution_restriction, solution_basis, libceed.VECTOR_ACTIVE)
143 op_apply.set_field("du", solution_restriction, solution_basis, libceed.VECTOR_ACTIVE)
144 op_apply.set_field("qdata", q_data_restriction, libceed.BASIS_NONE, q_data)
145 op_apply.set_field("v", solution_restriction, solution_basis, libceed.VECTOR_ACTIVE)
146 op_apply.set_field("dv", solution_restriction, solution_basis, libceed.VECTOR_ACTIVE)
166 print(f"Volume error : {volume - exact_volume:.14g}")
168 # Test mode - check if error is within tolerance
169 tol = 200 * libceed.EPSILON if dim == 1 else 1e-5
170 if abs(volume - exact_volume) > tol:
171 print(f"Volume error : {volume - exact_volume:.14g}")
172 sys.exit(1)