Struct libceed::qfunction::QFunctionByName [−][src]
pub struct QFunctionByName<'a> { /* fields omitted */ }
Implementations
impl<'a> QFunctionByName<'a>
[src]
impl<'a> QFunctionByName<'a>
[src]pub fn create(ceed: &'a Ceed, name: &str) -> Result<Self, CeedError>
[src]
pub fn apply(
&self,
Q: usize,
u: &[Vector<'_>],
v: &[Vector<'_>]
) -> Result<i32, CeedError>
[src]
pub fn apply(
&self,
Q: usize,
u: &[Vector<'_>],
v: &[Vector<'_>]
) -> Result<i32, CeedError>
[src]Apply the action of a QFunction
Q
- The number of quadrature pointsinput
- Array of input Vectorsoutput
- Array of output Vectors
const Q: usize = 8; let qf_build = ceed.q_function_interior_by_name("Mass1DBuild").unwrap(); let qf_mass = ceed.q_function_interior_by_name("MassApply").unwrap(); let mut j = [0.; Q]; let mut w = [0.; Q]; let mut u = [0.; Q]; let mut v = [0.; Q]; for i in 0..Q { let x = 2. * (i as f64) / ((Q as f64) - 1.) - 1.; j[i] = 1.; w[i] = 1. - x * x; u[i] = 2. + 3. * x + 5. * x * x; v[i] = w[i] * u[i]; } let jj = ceed.vector_from_slice(&j).unwrap(); let ww = ceed.vector_from_slice(&w).unwrap(); let uu = ceed.vector_from_slice(&u).unwrap(); let mut vv = ceed.vector(Q).unwrap(); vv.set_value(0.0); let mut qdata = ceed.vector(Q).unwrap(); qdata.set_value(0.0); { let mut input = vec![jj, ww]; let mut output = vec![qdata]; qf_build.apply(Q, &input, &output).unwrap(); qdata = output.remove(0); } { let mut input = vec![qdata, uu]; let mut output = vec![vv]; qf_mass.apply(Q, &input, &output).unwrap(); vv = output.remove(0); } vv.view() .iter() .zip(v.iter()) .for_each(|(computed, actual)| { assert_eq!( *computed, *actual, "Incorrect value in QFunction application" ); });
Trait Implementations
impl<'a> Display for QFunctionByName<'a>
[src]
impl<'a> Display for QFunctionByName<'a>
[src]View a QFunction by Name
let qf = ceed.q_function_interior_by_name("Mass1DBuild").unwrap(); println!("{}", qf);
impl<'a> From<&'a QFunctionByName<'_>> for QFunctionOpt<'a>
[src]
impl<'a> From<&'a QFunctionByName<'_>> for QFunctionOpt<'a>
[src]Construct a QFunctionOpt reference from a QFunction by Name reference
fn from(qfunc: &'a QFunctionByName<'_>) -> Self
[src]
fn from(qfunc: &'a QFunctionByName<'_>) -> Self
[src]Performs the conversion.
Auto Trait Implementations
impl<'a> RefUnwindSafe for QFunctionByName<'a>
impl<'a> !Send for QFunctionByName<'a>
impl<'a> !Sync for QFunctionByName<'a>
impl<'a> Unpin for QFunctionByName<'a>
impl<'a> UnwindSafe for QFunctionByName<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more