src/fe_model/base.rs

Wed, 07 Dec 2022 07:00:27 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Wed, 07 Dec 2022 07:00:27 +0200
changeset 18
2b75e98df693
parent 5
59dc4c5883f4
permissions
-rw-r--r--

Added tag v0.1.0 for changeset 51bfde513cfa

/*!
Base types for simple (finite) element models.
*/

/// A local function model that can be evaluated for value and differential.
pub trait LocalModel<Domain, Codomain> {
    /// Get the value of the model at `x`
    fn value(&self, x : &Domain) -> Codomain;
    /// Get the differential of the model at `x`
    fn differential(&self, x : &Domain) -> Domain;
}

/// A real local model is a minimisable [`LocalModel`].
pub trait RealLocalModel<S, Domain, Codomain> : LocalModel<Domain, Codomain> {
    /// Find a (minimum, minimiser) pair for he model within `el`, which is
    /// typically a simplex subset of `Domain`.
    fn minimise(&self, el : &S) -> (Domain, Codomain);
}

mercurial