1d275d636SJeremy L Thompson // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and other CEED contributors. 23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3ded9b81dSJeremy L Thompson // 43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5ded9b81dSJeremy L Thompson // 63d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7ded9b81dSJeremy L Thompson 8ded9b81dSJeremy L Thompson // ---------------------------------------------------------------------------- 9ded9b81dSJeremy L Thompson // Transform mesh coordinates 10ded9b81dSJeremy L Thompson // ---------------------------------------------------------------------------- 114d27c890SJeremy L Thompson pub(crate) fn transform_mesh_coordinates( 124d27c890SJeremy L Thompson dim: usize, 13*eb07d68fSJeremy L Thompson mesh_coords: &mut libceed::Vector, 14*eb07d68fSJeremy L Thompson ) -> libceed::Result<libceed::Scalar> { 15ded9b81dSJeremy L Thompson // Transform coordinates 16d3677ae8SJeremy L Thompson for coord in mesh_coords.view_mut()?.iter_mut() { 17ded9b81dSJeremy L Thompson // map [0,1] to [0,1] varying the mesh density 18ded9b81dSJeremy L Thompson *coord = 0.5 19*eb07d68fSJeremy L Thompson + 1.0 / (3.0 as libceed::Scalar).sqrt() 20*eb07d68fSJeremy L Thompson * ((2.0 / 3.0) * std::f64::consts::PI as libceed::Scalar * (*coord - 0.5)).sin() 21d3677ae8SJeremy L Thompson } 22ded9b81dSJeremy L Thompson 23ded9b81dSJeremy L Thompson // Exact surface area of transformed region 24ded9b81dSJeremy L Thompson let exact_area = match dim { 25ded9b81dSJeremy L Thompson 1 => 2.0, 26ded9b81dSJeremy L Thompson 2 => 4.0, 27ded9b81dSJeremy L Thompson _ => 6.0, 28ded9b81dSJeremy L Thompson }; 29e78171edSJeremy L Thompson Ok(exact_area) 30ded9b81dSJeremy L Thompson } 31ded9b81dSJeremy L Thompson 32ded9b81dSJeremy L Thompson // ---------------------------------------------------------------------------- 33