Skip to main content

FlatMesh

Struct FlatMesh 

Source
pub struct FlatMesh {
Show 17 fields pub n_cells: usize, pub cell_volume: Vec<Float>, pub cell_center_x: Vec<Float>, pub cell_center_y: Vec<Float>, pub cell_center_z: Vec<Float>, pub n_faces: usize, pub face_owner: Vec<u32>, pub face_neighbor: Vec<i32>, pub face_area_x: Vec<Float>, pub face_area_y: Vec<Float>, pub face_area_z: Vec<Float>, pub face_centroid_x: Vec<Float>, pub face_centroid_y: Vec<Float>, pub face_centroid_z: Vec<Float>, pub face_surface_id: Vec<i32>, pub cell_block_id: Vec<u32>, pub cell_local_id: Vec<u32>,
}
Expand description

Flat mesh representation for finite-volume GPU solvers.

All arrays are contiguous and indexed by a single integer ID. Cell arrays have length n_cells; face arrays have length n_faces.

This layout eliminates all structured (i,j,k) indexing and multi-block pointer chains. The data is designed for coalesced GPU memory access: a warp of threads processing consecutive face IDs will read consecutive memory locations.

Fields§

§n_cells: usize

Total number of cells across all blocks.

§cell_volume: Vec<Float>

Cell volume computed via the divergence-theorem method. Units: length^3. Must be positive for valid meshes.

§cell_center_x: Vec<Float>

X-coordinate of cell centroid (arithmetic mean of 8 corner nodes).

§cell_center_y: Vec<Float>

Y-coordinate of cell centroid.

§cell_center_z: Vec<Float>

Z-coordinate of cell centroid.

§n_faces: usize

Total number of faces (interior + cross-block + boundary).

§face_owner: Vec<u32>

Owner cell for each face. The face area vector points away from the owner toward the neighbor. Always a valid cell index in [0, n_cells).

§face_neighbor: Vec<i32>

Neighbor cell for each face. For interior and cross-block faces this is a valid cell index. For boundary faces this is -1.

§face_area_x: Vec<Float>

X-component of face area vector (outward normal * area magnitude).

§face_area_y: Vec<Float>

Y-component of face area vector.

§face_area_z: Vec<Float>

Z-component of face area vector.

§face_centroid_x: Vec<Float>

X-coordinate of face centroid (arithmetic mean of the 4 corner nodes). Matches Fortran’s ccCoord face-centroid formula (M_ccMBMesh.F:2528-2530), used by the solver to place ghost cell centers via exact plane reflection rather than a cuboid V/|A| approximation.

§face_centroid_y: Vec<Float>

Y-coordinate of face centroid.

§face_centroid_z: Vec<Float>

Z-coordinate of face centroid.

§face_surface_id: Vec<i32>

Surface ID for boundary faces (used for BC assignment). -1 for interior and cross-block faces.

§cell_block_id: Vec<u32>

Which original block each cell came from. Length = n_cells.

§cell_local_id: Vec<u32>

Local cell index within the original block. Length = n_cells. To recover (i,j,k): use the block’s cell dimensions from the CellGraph.

Implementations§

Source§

impl FlatMesh

Source

pub fn stats(&self) -> String

Produce a human-readable summary of the mesh statistics.

Reports cell count, face count, boundary face count, and volume extremes. Useful for quick sanity checks after mesh conversion.

Trait Implementations§

Source§

impl Clone for FlatMesh

Source§

fn clone(&self) -> FlatMesh

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FlatMesh

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.