| main.rs (5d1e906964b04cb5161d672bdc4191311737c811) | main.rs (edb2538e3dd6743c029967fc4e89c6fcafedb8c2) |
|---|---|
| 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7// 8// libCEED Example 2 --- 89 unchanged lines hidden (view full) --- 98 if dim > 2 { 99 print!(", nz = {}", num_xyz[2]); 100 } 101 print!("\n"); 102 } 103 104 // Build ElemRestriction objects describing the mesh and solution discrete 105 // representations | 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7// 8// libCEED Example 2 --- 89 unchanged lines hidden (view full) --- 98 if dim > 2 { 99 print!(", nz = {}", num_xyz[2]); 100 } 101 print!("\n"); 102 } 103 104 // Build ElemRestriction objects describing the mesh and solution discrete 105 // representations |
| 106 let (restr_mesh, _) = | 106 let (rstr_mesh, _) = |
| 107 mesh::build_cartesian_restriction(&ceed, dim, num_xyz, mesh_degree, ncomp_x, num_qpts)?; | 107 mesh::build_cartesian_restriction(&ceed, dim, num_xyz, mesh_degree, ncomp_x, num_qpts)?; |
| 108 let (_, restr_qdata) = mesh::build_cartesian_restriction( | 108 let (_, rstr_qdata) = mesh::build_cartesian_restriction( |
| 109 &ceed, 110 dim, 111 num_xyz, 112 solution_degree, 113 dim * (dim + 1) / 2, 114 num_qpts, 115 )?; 116 | 109 &ceed, 110 dim, 111 num_xyz, 112 solution_degree, 113 dim * (dim + 1) / 2, 114 num_qpts, 115 )?; 116 |
| 117 let (restr_solution, _) = | 117 let (rstr_solution, _) = |
| 118 mesh::build_cartesian_restriction(&ceed, dim, num_xyz, solution_degree, 1, num_qpts)?; | 118 mesh::build_cartesian_restriction(&ceed, dim, num_xyz, solution_degree, 1, num_qpts)?; |
| 119 let mesh_size = restr_mesh.lvector_size(); 120 let solution_size = restr_solution.lvector_size(); | 119 let mesh_size = rstr_mesh.lvector_size(); 120 let solution_size = rstr_solution.lvector_size(); |
| 121 if !quiet { 122 println!("Number of mesh nodes : {}", mesh_size / dim); 123 println!("Number of solution nodes : {}", solution_size); 124 } 125 126 // Create a Vector with the mesh coordinates 127 let mut mesh_coords = mesh::cartesian_mesh_coords(&ceed, dim, num_xyz, mesh_degree, mesh_size)?; 128 --- 87 unchanged lines hidden (view full) --- 216 } else { 217 QFunctionOpt::SomeQFunction(&qf_build_closure) 218 }; 219 220 // Operator that build the quadrature data for the diff operator 221 let op_build = ceed 222 .operator(qf_build, QFunctionOpt::None, QFunctionOpt::None)? 223 .name("build qdata")? | 121 if !quiet { 122 println!("Number of mesh nodes : {}", mesh_size / dim); 123 println!("Number of solution nodes : {}", solution_size); 124 } 125 126 // Create a Vector with the mesh coordinates 127 let mut mesh_coords = mesh::cartesian_mesh_coords(&ceed, dim, num_xyz, mesh_degree, mesh_size)?; 128 --- 87 unchanged lines hidden (view full) --- 216 } else { 217 QFunctionOpt::SomeQFunction(&qf_build_closure) 218 }; 219 220 // Operator that build the quadrature data for the diff operator 221 let op_build = ceed 222 .operator(qf_build, QFunctionOpt::None, QFunctionOpt::None)? 223 .name("build qdata")? |
| 224 .field("dx", &restr_mesh, &basis_mesh, VectorOpt::Active)? | 224 .field("dx", &rstr_mesh, &basis_mesh, VectorOpt::Active)? |
| 225 .field( 226 "weights", 227 ElemRestrictionOpt::None, 228 &basis_mesh, 229 VectorOpt::None, 230 )? | 225 .field( 226 "weights", 227 ElemRestrictionOpt::None, 228 &basis_mesh, 229 VectorOpt::None, 230 )? |
| 231 .field("qdata", &restr_qdata, BasisOpt::None, VectorOpt::Active)? | 231 .field("qdata", &rstr_qdata, BasisOpt::None, VectorOpt::Active)? |
| 232 .check()?; 233 234 // Compute the quadrature data for the diff operator 235 let elem_qpts = num_qpts.pow(dim as u32); 236 let num_elem: usize = num_xyz.iter().take(dim).product(); 237 let mut qdata = ceed.vector(num_elem * elem_qpts * dim * (dim + 1) / 2)?; 238 op_build.apply(&mesh_coords, &mut qdata)?; 239 --- 57 unchanged lines hidden (view full) --- 297 } else { 298 QFunctionOpt::SomeQFunction(&qf_diff_closure) 299 }; 300 301 // Diff Operator 302 let op_diff = ceed 303 .operator(qf_diff, QFunctionOpt::None, QFunctionOpt::None)? 304 .name("Poisson")? | 232 .check()?; 233 234 // Compute the quadrature data for the diff operator 235 let elem_qpts = num_qpts.pow(dim as u32); 236 let num_elem: usize = num_xyz.iter().take(dim).product(); 237 let mut qdata = ceed.vector(num_elem * elem_qpts * dim * (dim + 1) / 2)?; 238 op_build.apply(&mesh_coords, &mut qdata)?; 239 --- 57 unchanged lines hidden (view full) --- 297 } else { 298 QFunctionOpt::SomeQFunction(&qf_diff_closure) 299 }; 300 301 // Diff Operator 302 let op_diff = ceed 303 .operator(qf_diff, QFunctionOpt::None, QFunctionOpt::None)? 304 .name("Poisson")? |
| 305 .field("du", &restr_solution, &basis_solution, VectorOpt::Active)? 306 .field("qdata", &restr_qdata, BasisOpt::None, &qdata)? 307 .field("dv", &restr_solution, &basis_solution, VectorOpt::Active)? | 305 .field("du", &rstr_solution, &basis_solution, VectorOpt::Active)? 306 .field("qdata", &rstr_qdata, BasisOpt::None, &qdata)? 307 .field("dv", &rstr_solution, &basis_solution, VectorOpt::Active)? |
| 308 .check()?; 309 310 // Solution vectors 311 let mut u = ceed.vector(solution_size)?; 312 let mut v = ceed.vector(solution_size)?; 313 314 // Initialize u with sum of node coordinates 315 let coords = mesh_coords.view()?; --- 139 unchanged lines hidden --- | 308 .check()?; 309 310 // Solution vectors 311 let mut u = ceed.vector(solution_size)?; 312 let mut v = ceed.vector(solution_size)?; 313 314 // Initialize u with sum of node coordinates 315 let coords = mesh_coords.view()?; --- 139 unchanged lines hidden --- |