Struct libceed::qfunction::QFunctionByName[][src]

pub struct QFunctionByName<'a> { /* fields omitted */ }

Implementations

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]

Apply the action of a QFunction

  • Q - The number of quadrature points
  • input - Array of input Vectors
  • output - 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]

View a QFunction by Name

let qf = ceed.q_function_interior_by_name("Mass1DBuild").unwrap();
println!("{}", qf);

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

Formats the value using the given formatter. Read more

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]

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> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.