Lines Matching +full:- +full:a
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
10 // This example illustrates a simple usage of libCEED to compute the surface
11 // area of a 3D body using matrix-free application of a diffusion operator.
13 // same code. This calculation is executed in triplicate with a 3 component
16 // The example has no dependencies, and is designed to be self-contained. For
20 // All libCEED objects use a Ceed device object constructed based on a command
21 // line argument (-ceed).
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
33 fn main() -> libceed::Result<()> { in main()
40 fn example_2_vector(options: opt::Opt) -> libceed::Result<()> { in example_2_vector()
72 println!(" Ceed specification [-c] : {}", ceed_spec); in example_2_vector()
73 println!(" Mesh dimension [-d] : {}", dim); in example_2_vector()
74 println!(" Mesh degree [-m] : {}", mesh_degree); in example_2_vector()
75 println!(" Solution degree [-p] : {}", solution_degree); in example_2_vector()
76 println!(" Num. 1D quadr. pts [-q] : {}", num_qpts); in example_2_vector()
77 println!(" Approx. # unknowns [-s] : {}", problem_size); in example_2_vector()
79 " QFunction source [-g] : {}", in example_2_vector()
138 // Create a Vector with the mesh coordinates in example_2_vector()
141 // Apply a transformation to the mesh coordinates in example_2_vector()
145 // -- QFunction from user closure in example_2_vector()
161 let qw = weights[i] / (j11 * j22 - j21 * j12); in example_2_vector()
164 qdata[i + q * 2] = -qw * (j11 * j12 + j21 * j22); in example_2_vector()
170 let mut a = [0.0; 9]; in example_2_vector() localVariable
173 a[k * 3 + j] = jacobian[i + q * ((j + 1) % 3 + 3 * ((k + 1) % 3))] in example_2_vector()
175 - jacobian[i + q * ((j + 1) % 3 + 3 * ((k + 2) % 3))] in example_2_vector()
180 / (jacobian[i + q * 0] * a[0 * 3 + 0] in example_2_vector()
181 + jacobian[i + q * 1] * a[0 * 3 + 1] in example_2_vector()
182 + jacobian[i + q * 2] * a[0 * 3 + 2]); in example_2_vector()
184 * (a[0 * 3 + 0] * a[0 * 3 + 0] in example_2_vector()
185 + a[0 * 3 + 1] * a[0 * 3 + 1] in example_2_vector()
186 + a[0 * 3 + 2] * a[0 * 3 + 2]); in example_2_vector()
188 * (a[1 * 3 + 0] * a[1 * 3 + 0] in example_2_vector()
189 + a[1 * 3 + 1] * a[1 * 3 + 1] in example_2_vector()
190 + a[1 * 3 + 2] * a[1 * 3 + 2]); in example_2_vector()
192 * (a[2 * 3 + 0] * a[2 * 3 + 0] in example_2_vector()
193 + a[2 * 3 + 1] * a[2 * 3 + 1] in example_2_vector()
194 + a[2 * 3 + 2] * a[2 * 3 + 2]); in example_2_vector()
196 * (a[1 * 3 + 0] * a[2 * 3 + 0] in example_2_vector()
197 + a[1 * 3 + 1] * a[2 * 3 + 1] in example_2_vector()
198 + a[1 * 3 + 2] * a[2 * 3 + 2]); in example_2_vector()
200 * (a[0 * 3 + 0] * a[2 * 3 + 0] in example_2_vector()
201 + a[0 * 3 + 1] * a[2 * 3 + 1] in example_2_vector()
202 + a[0 * 3 + 2] * a[2 * 3 + 2]); in example_2_vector()
204 * (a[0 * 3 + 0] * a[1 * 3 + 0] in example_2_vector()
205 + a[0 * 3 + 1] * a[1 * 3 + 1] in example_2_vector()
206 + a[0 * 3 + 2] * a[1 * 3 + 2]); in example_2_vector()
220 // -- QFunction from gallery in example_2_vector()
225 // -- QFunction for use with Operator in example_2_vector()
253 // -- QFunction from user closure in example_2_vector()
315 // -- QFunction from gallery in example_2_vector()
320 // -- QFunction for use with Operator in example_2_vector()
371 println!("Surface area error : {:.12e}", area - exact_area); in example_2_vector()
374 1 => 1E-5, in example_2_vector()
375 _ => 1E-1, in example_2_vector()
377 let error = (area - exact_area).abs(); in example_2_vector()
382 "Volume error too large - expected: {:.12e}, actual: {:.12e}", in example_2_vector()
390 // ----------------------------------------------------------------------------
392 // ----------------------------------------------------------------------------
405 problem_size_requested: -1, in example_2_vector_1d()
421 problem_size_requested: -1, in example_2_vector_2d()
437 problem_size_requested: -1, in example_2_vector_3d()
453 problem_size_requested: -1, in example_2_vector_1d_gallery()
469 problem_size_requested: -1, in example_2_vector_2d_gallery()
485 problem_size_requested: -1, in example_2_vector_3d_gallery()
494 // ----------------------------------------------------------------------------