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