Struct FoamMesh

Source
pub struct FoamMesh {
    pub path: PathBuf,
    pub boundary: HashMap<String, Boundary>,
    pub points: Vec<Point3<f64>>,
    pub faces: Vec<Vec<usize>>,
    pub cell_faces: Vec<Vec<usize>>,
    pub owners: Vec<usize>,
    pub neighbors: Vec<i64>,
    pub cell_neighbors: Vec<Vec<i64>>,
    pub cell_centers: Option<Vec<Point3<f64>>>,
    /* private fields */
}

Fields§

§path: PathBuf§boundary: HashMap<String, Boundary>§points: Vec<Point3<f64>>§faces: Vec<Vec<usize>>

A face is defined as a list of point indices. Each face also is represented in the list of owners and neighbors.

§cell_faces: Vec<Vec<usize>>§owners: Vec<usize>

Indices of the cell that is the owner of the respective face.

§neighbors: Vec<i64>

Indices of neighboring cells for each internal face.

§cell_neighbors: Vec<Vec<i64>>§cell_centers: Option<Vec<Point3<f64>>>

Implementations§

Source§

impl FoamMesh

Source

pub fn new<P: AsRef<Path>>(path: P) -> Result<FoamMesh, Error>

Source

pub fn read_cell_centers<P: AsRef<Path>>( &mut self, filename: P, ) -> Result<(), Error>

Read cell center coordinates from the given file (e.g., 0/C).

Such a file can be generated by running postProcess -func 'writeCellCentres' -time 0.

Source

pub fn num_inner_faces(&self) -> usize

Source

pub fn num_cells(&self) -> usize

Source

pub fn cell_neighbor_cells(&self, cell_id: usize) -> Option<&Vec<i64>>

Return the indices of neighbor cells of the cell with index cell_id.

Source

pub fn is_cell_on_boundary( &self, cell_id: usize, bd_name: Option<String>, ) -> bool

Check if a cell is on a boundary.

Run-time complexity is in O(n), where n is the maximum number of neighbors of a cell.

Source

pub fn is_face_on_boundary( &self, face_id: usize, bd_name: Option<String>, ) -> bool

Check if a face is a boundary face (in O(1)).

Source

pub fn boundary_cells(&self, bd_name: &str) -> Vec<usize>

Get cell IDs of cells on a given boundary. Returns an empty vector if the named boundary does not exist.

Source

pub fn parse_scalars<P: AsRef<Path>, T: FromStr>( filename: P, skip: usize, ) -> Result<Vec<T>, Error>

Parse scalar values from a given ASCII file.

Expects a file in the following format:

// …

11360
(
42
0
3
// …
)
Source

pub fn parse_faces<P: AsRef<Path>>( filename: P, skip: usize, ) -> Result<Vec<Vec<usize>>, Error>

Parse faces from a given ASCII file. Each face is a list of point indices.

Expects a file in the following format:

// …

11360
(
4(1 42 1723 1682)
3(2 3 4)
// …
)
Source

pub fn parse_points<P: AsRef<Path>>( filename: P, skip: usize, ) -> Result<Vec<Point3<f64>>, Error>

Parse mesh point data from a given ASCII file.

Expects a file in the following format:

// …

5043
(
(42 0 1)
(3 2.001 13.37)
// …
)
Source

pub fn parse_boundary<P: AsRef<Path>>( filename: P, skip: usize, ) -> Result<HashMap<String, Boundary>, Error>

Parse an OpenFOAM boundary definition file.

Expects a file in the following format:

// …

3
(
    inlet
    {
        type            patch;
        nFaces          605;
        startFace       971201;
    }
    outlet
    {
        type            patch;
        nFaces          605;
        startFace       971806;
    }
    walls
    {
        type            patch;
        nFaces          23848;
        startFace       972411;
    }
)

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V