Enum Grid2

Source
pub enum Grid2 {
    Regular {
        size: [f64; 2],
        count: [u32; 2],
    },
    Tensor {
        u: Array<Scalar>,
        v: Array<Scalar>,
    },
}
Expand description

Defines a 2D grid spacing and size.

Variants§

§

Regular

Regularly spaced cells.

<sodipodi:namedview id=“namedview7” pagecolor=“#ffffff” bordercolor=“#000000” borderopacity=“0.25” inkscape:pageshadow=“2” inkscape:pageopacity=“0.0” inkscape:pagecheckerboard=“0” inkscape:deskcolor=“#d1d1d1” inkscape:document-units=“mm” showgrid=“false” inkscape:zoom=“2.0000001” inkscape:cx=“263.24999” inkscape:cy=“214.49999” inkscape:window-width=“2481” inkscape:window-height=“1417” inkscape:window-x=“71” inkscape:window-y=“-8” inkscape:window-maximized=“1” inkscape:current-layer=“layer4” /> u v A 2D regular grid with size [a, b] and count [5, 4] a b b b b a a a a

Fields

§size: [f64; 2]

The cell size in the U and V axes. Both must be greater than zero.

§count: [u32; 2]

The number of cells in the U and V axes. Both must be greater than zero.

§

Tensor

Tensor cells, where each row and column can have a different size.

<sodipodi:namedview id=“namedview7” pagecolor=“#ffffff” bordercolor=“#000000” borderopacity=“0.25” inkscape:pageshadow=“2” inkscape:pageopacity=“0.0” inkscape:pagecheckerboard=“0” inkscape:deskcolor=“#d1d1d1” inkscape:document-units=“mm” showgrid=“false” inkscape:zoom=“2.0000001” inkscape:cx=“313.74999” inkscape:cy=“233.49999” inkscape:window-width=“2481” inkscape:window-height=“1417” inkscape:window-x=“71” inkscape:window-y=“-8” inkscape:window-maximized=“1” inkscape:current-layer=“layer4” /> u v A 2D tensor grid a₀ b₃ b₂ b₁ b₀ a₁ a₂ a₃ a₄ v = [ b₀ b₁ b₃ b₃ ] u = [ a₀ a₁ a₂ a₃ a₄ ]

Fields

§u: Array<Scalar>

Array with Scalar type storing the size of each cell along the U axis. These sizes must be greater than zero.

§v: Array<Scalar>

Array with Scalar type storing the size of each cell along the V axis. These sizes must be greater than zero.

Implementations§

Source§

impl Grid2

Source

pub fn from_size_and_count(size: [f64; 2], count: [u32; 2]) -> Self

Create a 2D regular grid from the cell size and count.

Source

pub fn from_arrays(u: Array<Scalar>, v: Array<Scalar>) -> Self

Create a 2D tensor grid from the size arrays.

Source

pub fn count(&self) -> [u32; 2]

Returns the number of cells in each axis.

Source

pub fn flat_count(&self) -> u64

Returns the total number of cells.

Source

pub fn flat_corner_count(&self) -> u64

Returns the total number of cell corners.

Trait Implementations§

Source§

impl Clone for Grid2

Source§

fn clone(&self) -> Grid2

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Grid2

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Grid2

Source§

fn default() -> Self

Creates a regular grid with size [1.0, 1.0] and count [1, 1].

Source§

impl<'de> Deserialize<'de> for Grid2

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Grid2

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Grid2

Source§

fn eq(&self, other: &Grid2) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Grid2

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Validate for Grid2

Source§

fn validate(&mut self) -> Result<Problems, Problems>

Call to validate the object, returning errors and warnings. Read more
Source§

impl StructuralPartialEq for Grid2

Auto Trait Implementations§

§

impl Freeze for Grid2

§

impl RefUnwindSafe for Grid2

§

impl Send for Grid2

§

impl Sync for Grid2

§

impl Unpin for Grid2

§

impl UnwindSafe for Grid2

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,