Struct ohsl::mesh2d::Mesh2D

source ·
pub struct Mesh2D<T> { /* private fields */ }

Implementations§

source§

impl<T: Clone + Number> Mesh2D<T>

source

pub fn new(x_nodes: Vector<f64>, y_nodes: Vector<f64>, nvars: usize) -> Self

Create a new 2D mesh

source

pub fn nvars(&self) -> usize

Return the number of variables stored at each node in the mesh

source

pub fn nnodes(&self) -> (usize, usize)

Return the number of nodal points in each direction

source

pub fn coord(&self, nodex: usize, nodey: usize) -> (f64, f64)

Return the spatial position of a specfied nodes as a tuple

source

pub fn xnodes(&self) -> Vector<f64>

Return the vector of x-nodal positions

source

pub fn ynodes(&self) -> Vector<f64>

Return the vector of y-nodal positions

source

pub fn set_nodes_vars(&mut self, nodex: usize, nodey: usize, vec: Vector<T>)

Set the variables stored at a specified node

source

pub fn get_nodes_vars(&self, nodex: usize, nodey: usize) -> Vector<T>

Get the vector of variables stored at a specified node

source

pub fn assign(&mut self, element: T)

Assign an element to all entries in the mesh

source

pub fn cross_section_xnode(&self, nodex: usize) -> Mesh1D<T, f64>

Return a cross section of the 2D mesh at a specified x node

source

pub fn cross_section_ynode(&self, nodey: usize) -> Mesh1D<T, f64>

Return a cross section of the 2D mesh at a specified y node

source

pub fn var_as_matrix(&self, var: usize) -> Matrix<T>

Return a matrix for a variable corresponding to each nodal point

source

pub fn apply(&mut self, func: &dyn Fn(f64, f64) -> T, var: usize)

Apply a function to the a specified variable in the mesh

source§

impl Mesh2D<f64>

source

pub fn trapezium(&self, var: usize) -> f64

Integrate a given variable over the domain (trapezium rule)

source

pub fn square_trapezium(&self, var: usize) -> f64

Integrate the square of a given variable over the domain (trapezium rule)

source§

impl<T: Display> Mesh2D<T>

source

pub fn output(&self, filename: &str, precision: usize)

Print the mesh to a file

source

pub fn output_var(&self, filename: &str, var: usize, precision: usize)

Print the mesh of a single variable to a file

Trait Implementations§

source§

impl<T> Index<(usize, usize)> for Mesh2D<T>

source§

fn index<'a>(&'a self, node: (usize, usize)) -> &'a Vector<T>

Indexing operator [] (read only) - returns the vector of variables stored at the node specified by a tuple.

§

type Output = Vector<T>

The returned type after indexing.
source§

impl<T> IndexMut<(usize, usize)> for Mesh2D<T>

source§

fn index_mut(&mut self, node: (usize, usize)) -> &mut Vector<T>

Indexing operator [] (read/write) - returns the vector of variables stored at the node specified by a tuple.

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Mesh2D<T>where T: RefUnwindSafe,

§

impl<T> Send for Mesh2D<T>where T: Send,

§

impl<T> Sync for Mesh2D<T>where T: Sync,

§

impl<T> Unpin for Mesh2D<T>where T: Unpin,

§

impl<T> UnwindSafe for Mesh2D<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V