Small clippy lint fixes
This commit is contained in:
parent
6ebb173847
commit
cfeb30fac0
|
@ -203,7 +203,7 @@ impl Clone for Field {
|
||||||
pub struct Diff(pub(crate) Array3<Float>);
|
pub struct Diff(pub(crate) Array3<Float>);
|
||||||
|
|
||||||
impl integrate::Integrable for Field {
|
impl integrate::Integrable for Field {
|
||||||
type State = Field;
|
type State = Self;
|
||||||
type Diff = Diff;
|
type Diff = Diff;
|
||||||
|
|
||||||
fn scaled_add(s: &mut Self::State, o: &Self::Diff, scale: Float) {
|
fn scaled_add(s: &mut Self::State, o: &Self::Diff, scale: Float) {
|
||||||
|
|
|
@ -621,7 +621,7 @@ impl SingleThreadedSystem {
|
||||||
let mut fvort = fmod.clone();
|
let mut fvort = fmod.clone();
|
||||||
match &self.initial_conditions {
|
match &self.initial_conditions {
|
||||||
parsing::InitialConditions::Vortex(vortexparams) => {
|
parsing::InitialConditions::Vortex(vortexparams) => {
|
||||||
fvort.vortex(grid.x(), grid.y(), self.time, &vortexparams);
|
fvort.vortex(grid.x(), grid.y(), self.time, vortexparams);
|
||||||
}
|
}
|
||||||
parsing::InitialConditions::Expressions(expr) => {
|
parsing::InitialConditions::Expressions(expr) => {
|
||||||
let (rho, rhou, rhov, e) = fvort.components_mut();
|
let (rho, rhou, rhov, e) = fvort.components_mut();
|
||||||
|
@ -1179,7 +1179,7 @@ impl DistributedSystemPart {
|
||||||
let mut fvort = self.current.clone();
|
let mut fvort = self.current.clone();
|
||||||
match &self.initial_conditions {
|
match &self.initial_conditions {
|
||||||
parsing::InitialConditions::Vortex(vortexparams) => {
|
parsing::InitialConditions::Vortex(vortexparams) => {
|
||||||
fvort.vortex(self.grid.0.x(), self.grid.0.y(), self.t, &vortexparams);
|
fvort.vortex(self.grid.0.x(), self.grid.0.y(), self.t, vortexparams);
|
||||||
}
|
}
|
||||||
parsing::InitialConditions::Expressions(expr) => {
|
parsing::InitialConditions::Expressions(expr) => {
|
||||||
let (rho, rhou, rhov, e) = fvort.components_mut();
|
let (rho, rhou, rhov, e) = fvort.components_mut();
|
||||||
|
|
|
@ -55,6 +55,7 @@ impl<T> Direction<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Flips all direction through origo
|
/// Flips all direction through origo
|
||||||
|
#[must_use]
|
||||||
pub fn opposite(self) -> Self {
|
pub fn opposite(self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
north: self.south,
|
north: self.south,
|
||||||
|
@ -92,25 +93,25 @@ impl<T> Direction<Option<T>> {
|
||||||
|
|
||||||
/// Methods for borrowing
|
/// Methods for borrowing
|
||||||
impl<T> Direction<T> {
|
impl<T> Direction<T> {
|
||||||
pub fn north(&self) -> &T {
|
pub const fn north(&self) -> &T {
|
||||||
&self.north
|
&self.north
|
||||||
}
|
}
|
||||||
pub fn north_mut(&mut self) -> &mut T {
|
pub fn north_mut(&mut self) -> &mut T {
|
||||||
&mut self.north
|
&mut self.north
|
||||||
}
|
}
|
||||||
pub fn south(&self) -> &T {
|
pub const fn south(&self) -> &T {
|
||||||
&self.south
|
&self.south
|
||||||
}
|
}
|
||||||
pub fn south_mut(&mut self) -> &mut T {
|
pub fn south_mut(&mut self) -> &mut T {
|
||||||
&mut self.south
|
&mut self.south
|
||||||
}
|
}
|
||||||
pub fn east(&self) -> &T {
|
pub const fn east(&self) -> &T {
|
||||||
&self.east
|
&self.east
|
||||||
}
|
}
|
||||||
pub fn east_mut(&mut self) -> &mut T {
|
pub fn east_mut(&mut self) -> &mut T {
|
||||||
&mut self.east
|
&mut self.east
|
||||||
}
|
}
|
||||||
pub fn west(&self) -> &T {
|
pub const fn west(&self) -> &T {
|
||||||
&self.west
|
&self.west
|
||||||
}
|
}
|
||||||
pub fn west_mut(&mut self) -> &mut T {
|
pub fn west_mut(&mut self) -> &mut T {
|
||||||
|
@ -119,10 +120,10 @@ impl<T> Direction<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Direction<bool> {
|
impl Direction<bool> {
|
||||||
pub fn all(&self) -> bool {
|
pub const fn all(&self) -> bool {
|
||||||
self.north && self.south && self.east && self.west
|
self.north && self.south && self.east && self.west
|
||||||
}
|
}
|
||||||
pub fn any(&self) -> bool {
|
pub const fn any(&self) -> bool {
|
||||||
self.north || self.south || self.east || self.west
|
self.north || self.south || self.east || self.west
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ impl Clone for Field {
|
||||||
Self(self.0.clone())
|
Self(self.0.clone())
|
||||||
}
|
}
|
||||||
fn clone_from(&mut self, source: &Self) {
|
fn clone_from(&mut self, source: &Self) {
|
||||||
self.0.clone_from(&source.0)
|
self.0.clone_from(&source.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,9 +130,7 @@ impl System {
|
||||||
let eta = now.eta();
|
let eta = now.eta();
|
||||||
for j in 0..ny {
|
for j in 0..ny {
|
||||||
for i in 0..nx {
|
for i in 0..nx {
|
||||||
if eta[(j, i)] <= 0.0 {
|
assert!(eta[(j, i)] > 0.0, "eta: {} at ({},{})", eta[(j, i)], i, j);
|
||||||
panic!("{} {}", j, i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,13 +146,13 @@ impl System {
|
||||||
next_eta.scaled_add(-1.0, &temp_dx);
|
next_eta.scaled_add(-1.0, &temp_dx);
|
||||||
|
|
||||||
azip!((dest in &mut temp, eta in now.eta(), etau in now.etau()) {
|
azip!((dest in &mut temp, eta in now.eta(), etau in now.etau()) {
|
||||||
*dest = etau.powi(2)/eta + G*eta.powi(2)/2.0
|
*dest = etau.powi(2)/eta + G*eta.powi(2)/2.0;
|
||||||
});
|
});
|
||||||
op.diffxi(temp.view(), temp_dx.view_mut());
|
op.diffxi(temp.view(), temp_dx.view_mut());
|
||||||
next_etau.scaled_add(-1.0, &temp_dx);
|
next_etau.scaled_add(-1.0, &temp_dx);
|
||||||
|
|
||||||
azip!((dest in &mut temp, eta in now.eta(), etau in now.etau(), etav in now.etav()) {
|
azip!((dest in &mut temp, eta in now.eta(), etau in now.etau(), etav in now.etav()) {
|
||||||
*dest = etau*etav/eta
|
*dest = etau*etav/eta;
|
||||||
});
|
});
|
||||||
op.diffxi(temp.view(), temp_dx.view_mut());
|
op.diffxi(temp.view(), temp_dx.view_mut());
|
||||||
next_etav.scaled_add(-1.0, &temp_dx);
|
next_etav.scaled_add(-1.0, &temp_dx);
|
||||||
|
@ -174,7 +172,7 @@ impl System {
|
||||||
next_etau.scaled_add(-1.0, &temp_dy);
|
next_etau.scaled_add(-1.0, &temp_dy);
|
||||||
|
|
||||||
azip!((dest in &mut temp, eta in now.eta(), etav in now.etav()) {
|
azip!((dest in &mut temp, eta in now.eta(), etav in now.etav()) {
|
||||||
*dest = etav.powi(2)/eta + G*eta.powi(2)/2.0
|
*dest = etav.powi(2)/eta + G*eta.powi(2)/2.0;
|
||||||
});
|
});
|
||||||
op.diffeta(temp.view(), temp_dy.view_mut());
|
op.diffeta(temp.view(), temp_dy.view_mut());
|
||||||
next_etav.scaled_add(-1.0, &temp_dy);
|
next_etav.scaled_add(-1.0, &temp_dy);
|
||||||
|
@ -184,7 +182,7 @@ impl System {
|
||||||
if let Some(op) = op.upwind() {
|
if let Some(op) = op.upwind() {
|
||||||
let mut temp_dx = temp_dy;
|
let mut temp_dx = temp_dy;
|
||||||
azip!((dest in &mut temp, eta in now.eta(), etau in now.etau()) {
|
azip!((dest in &mut temp, eta in now.eta(), etau in now.etau()) {
|
||||||
*dest = -(eta.powf(3.0/2.0)*G.sqrt() + etau.abs())/eta
|
*dest = -(eta.powf(3.0/2.0)*G.sqrt() + etau.abs())/eta;
|
||||||
});
|
});
|
||||||
op.dissxi(temp.view(), temp_dx.view_mut());
|
op.dissxi(temp.view(), temp_dx.view_mut());
|
||||||
azip!((dest in &mut next_eta, eta in now.eta(), diss in &temp_dx) {
|
azip!((dest in &mut next_eta, eta in now.eta(), diss in &temp_dx) {
|
||||||
|
@ -199,7 +197,7 @@ impl System {
|
||||||
|
|
||||||
let mut temp_dy = temp_dx;
|
let mut temp_dy = temp_dx;
|
||||||
azip!((dest in &mut temp, eta in now.eta(), etav in now.etav()) {
|
azip!((dest in &mut temp, eta in now.eta(), etav in now.etav()) {
|
||||||
*dest = -(eta.powf(3.0/2.0)*G.sqrt() + etav.abs())/eta
|
*dest = -(eta.powf(3.0/2.0)*G.sqrt() + etav.abs())/eta;
|
||||||
});
|
});
|
||||||
op.disseta(temp.view(), temp_dy.view_mut());
|
op.disseta(temp.view(), temp_dy.view_mut());
|
||||||
azip!((dest in &mut next_eta, eta in now.eta(), diss in &temp_dy) {
|
azip!((dest in &mut next_eta, eta in now.eta(), diss in &temp_dy) {
|
||||||
|
@ -259,10 +257,8 @@ impl System {
|
||||||
.zip(other.axis_iter(Axis(1)))
|
.zip(other.axis_iter(Axis(1)))
|
||||||
{
|
{
|
||||||
let tau = match dir {
|
let tau = match dir {
|
||||||
Direction::North => 1.0,
|
Direction::North | Direction::East => 1.0,
|
||||||
Direction::South => -1.0,
|
Direction::South | Direction::West => -1.0,
|
||||||
Direction::East => 1.0,
|
|
||||||
Direction::West => -1.0,
|
|
||||||
};
|
};
|
||||||
let hinv = match dir {
|
let hinv = match dir {
|
||||||
Direction::North | Direction::South => {
|
Direction::North | Direction::South => {
|
||||||
|
@ -316,7 +312,7 @@ impl System {
|
||||||
&mut self.k[..],
|
&mut self.k[..],
|
||||||
);
|
);
|
||||||
|
|
||||||
std::mem::swap(&mut self.fnow, &mut self.fnext)
|
std::mem::swap(&mut self.fnow, &mut self.fnext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![feature(const_fn_floating_point_arithmetic)]
|
#![feature(const_fn_floating_point_arithmetic)]
|
||||||
|
#![allow(clippy::inline_always)]
|
||||||
|
|
||||||
use float::Float;
|
use float::Float;
|
||||||
use num_traits::identities::Zero;
|
use num_traits::identities::Zero;
|
||||||
|
@ -28,7 +29,7 @@ impl<T: Copy + Zero + PartialEq, const M: usize, const N: usize> Zero for Matrix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn is_zero(&self) -> bool {
|
fn is_zero(&self) -> bool {
|
||||||
self.iter().all(|x| x.is_zero())
|
self.iter().all(Zero::is_zero)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,17 +97,17 @@ impl<T, const M: usize, const N: usize> Matrix<T, M, N> {
|
||||||
|
|
||||||
impl<T, const N: usize> ColVector<T, N> {
|
impl<T, const N: usize> ColVector<T, N> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn map_to_col(slice: &[T; N]) -> &ColVector<T, N> {
|
pub const fn map_to_col(slice: &[T; N]) -> &Self {
|
||||||
unsafe { &*(slice.as_ptr().cast()) }
|
unsafe { &*(slice.as_ptr().cast()) }
|
||||||
}
|
}
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn map_to_col_mut(slice: &mut [T; N]) -> &mut ColVector<T, N> {
|
pub fn map_to_col_mut(slice: &mut [T; N]) -> &mut Self {
|
||||||
unsafe { &mut *(slice.as_mut_ptr().cast()) }
|
unsafe { &mut *(slice.as_mut_ptr().cast()) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, const N: usize> RowVector<T, N> {
|
impl<T, const N: usize> RowVector<T, N> {
|
||||||
pub fn map_to_row(slice: &[T; N]) -> &Self {
|
pub const fn map_to_row(slice: &[T; N]) -> &Self {
|
||||||
unsafe { &*(slice.as_ptr().cast()) }
|
unsafe { &*(slice.as_ptr().cast()) }
|
||||||
}
|
}
|
||||||
pub fn map_to_row_mut(slice: &mut [T; N]) -> &mut Self {
|
pub fn map_to_row_mut(slice: &mut [T; N]) -> &mut Self {
|
||||||
|
@ -191,17 +192,17 @@ where
|
||||||
{
|
{
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn mul_assign(&mut self, other: T) {
|
fn mul_assign(&mut self, other: T) {
|
||||||
self.iter_mut().for_each(|x| *x *= other)
|
self.iter_mut().for_each(|x| *x *= other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, const N: usize, const M: usize> core::ops::Add<Matrix<T, M, N>> for Matrix<T, M, N>
|
impl<T, const N: usize, const M: usize> core::ops::Add<Self> for Matrix<T, M, N>
|
||||||
where
|
where
|
||||||
T: Copy + Zero + core::ops::Add<Output = T> + PartialEq,
|
T: Copy + Zero + core::ops::Add<Output = T> + PartialEq,
|
||||||
{
|
{
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
fn add(self, lhs: Self) -> Self::Output {
|
fn add(self, lhs: Self) -> Self::Output {
|
||||||
let mut out = Matrix::zero();
|
let mut out = Self::zero();
|
||||||
for i in 0..M {
|
for i in 0..M {
|
||||||
for j in 0..N {
|
for j in 0..N {
|
||||||
out[(i, j)] = self[(i, j)] + lhs[(i, j)];
|
out[(i, j)] = self[(i, j)] + lhs[(i, j)];
|
||||||
|
@ -299,6 +300,7 @@ mod approx {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const M: usize, const N: usize> Matrix<Float, M, N> {
|
impl<const M: usize, const N: usize> Matrix<Float, M, N> {
|
||||||
|
#[must_use]
|
||||||
pub const fn flip_ud(&self) -> Self {
|
pub const fn flip_ud(&self) -> Self {
|
||||||
let mut m = Self::new([[0.0; N]; M]);
|
let mut m = Self::new([[0.0; N]; M]);
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
@ -309,6 +311,7 @@ impl<const M: usize, const N: usize> Matrix<Float, M, N> {
|
||||||
m
|
m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub const fn flip_lr(&self) -> Self {
|
pub const fn flip_lr(&self) -> Self {
|
||||||
let mut m = Self::new([[0.0; N]; M]);
|
let mut m = Self::new([[0.0; N]; M]);
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
@ -324,6 +327,7 @@ impl<const M: usize, const N: usize> Matrix<Float, M, N> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Flip all sign bits
|
/// Flip all sign bits
|
||||||
|
#[must_use]
|
||||||
pub const fn flip_sign(&self) -> Self {
|
pub const fn flip_sign(&self) -> Self {
|
||||||
let mut m = Self::new([[0.0; N]; M]);
|
let mut m = Self::new([[0.0; N]; M]);
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
@ -339,6 +343,7 @@ impl<const M: usize, const N: usize> Matrix<Float, M, N> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Zero extends if larger than self
|
/// Zero extends if larger than self
|
||||||
|
#[must_use]
|
||||||
pub const fn resize<const M2: usize, const N2: usize>(&self) -> Matrix<Float, M2, N2> {
|
pub const fn resize<const M2: usize, const N2: usize>(&self) -> Matrix<Float, M2, N2> {
|
||||||
let mut m = Matrix::new([[0.0; N2]; M2]);
|
let mut m = Matrix::new([[0.0; N2]; M2]);
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ pub trait Integrable {
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
/// Integrates using the [`ButcherTableau`] specified. `rhs` should be the result
|
/// Integrates using the [`ButcherTableau`] specified. `rhs` should be the result
|
||||||
/// of the right hand side of $u_t = rhs$
|
/// of the right hand side of `$u_t = rhs$`
|
||||||
///
|
///
|
||||||
/// rhs takes the old state and the current time, and outputs the state difference
|
/// rhs takes the old state and the current time, and outputs the state difference
|
||||||
/// in the first parameter
|
/// in the first parameter
|
||||||
|
@ -170,6 +170,9 @@ pub trait Integrable {
|
||||||
/// ```rust,ignore
|
/// ```rust,ignore
|
||||||
/// integrate::<Rk4, System, _>(...)
|
/// integrate::<Rk4, System, _>(...)
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// # Panics
|
||||||
|
/// `k` must have enough elements for the given tableau
|
||||||
pub fn integrate<BTableau: ButcherTableau, F: Integrable, RHS>(
|
pub fn integrate<BTableau: ButcherTableau, F: Integrable, RHS>(
|
||||||
mut rhs: RHS,
|
mut rhs: RHS,
|
||||||
prev: &F::State,
|
prev: &F::State,
|
||||||
|
@ -183,11 +186,10 @@ pub fn integrate<BTableau: ButcherTableau, F: Integrable, RHS>(
|
||||||
assert!(k.len() >= BTableau::S);
|
assert!(k.len() >= BTableau::S);
|
||||||
|
|
||||||
for i in 0.. {
|
for i in 0.. {
|
||||||
let simtime;
|
let simtime = match i {
|
||||||
match i {
|
|
||||||
0 => {
|
0 => {
|
||||||
fut.clone_from(prev);
|
fut.clone_from(prev);
|
||||||
simtime = *time;
|
*time
|
||||||
}
|
}
|
||||||
i if i < BTableau::S => {
|
i if i < BTableau::S => {
|
||||||
fut.clone_from(prev);
|
fut.clone_from(prev);
|
||||||
|
@ -197,7 +199,7 @@ pub fn integrate<BTableau: ButcherTableau, F: Integrable, RHS>(
|
||||||
}
|
}
|
||||||
F::scaled_add(fut, k, a * dt);
|
F::scaled_add(fut, k, a * dt);
|
||||||
}
|
}
|
||||||
simtime = *time + dt * BTableau::C[i - 1];
|
*time + dt * BTableau::C[i - 1]
|
||||||
}
|
}
|
||||||
_ if i == BTableau::S => {
|
_ if i == BTableau::S => {
|
||||||
fut.clone_from(prev);
|
fut.clone_from(prev);
|
||||||
|
@ -224,6 +226,9 @@ pub fn integrate<BTableau: ButcherTableau, F: Integrable, RHS>(
|
||||||
///
|
///
|
||||||
/// This produces two results, the most accurate result in `fut`, and the less accurate
|
/// This produces two results, the most accurate result in `fut`, and the less accurate
|
||||||
/// result in `fut2`. This can be used for convergence testing and adaptive timesteps.
|
/// result in `fut2`. This can be used for convergence testing and adaptive timesteps.
|
||||||
|
///
|
||||||
|
/// # Panics
|
||||||
|
/// `k` must have enough elements for the given tableau
|
||||||
pub fn integrate_embedded_rk<BTableau: EmbeddedButcherTableau, F: Integrable, RHS>(
|
pub fn integrate_embedded_rk<BTableau: EmbeddedButcherTableau, F: Integrable, RHS>(
|
||||||
rhs: RHS,
|
rhs: RHS,
|
||||||
prev: &F::State,
|
prev: &F::State,
|
||||||
|
|
|
@ -21,28 +21,28 @@ impl EulerUniverse {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init(&mut self, x0: f32, y0: f32) {
|
pub fn init(&mut self, x0: f32, y0: f32) {
|
||||||
self.0.init_with_vortex(x0, y0)
|
self.0.init_with_vortex(x0, y0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn advance(&mut self, dt: f32) {
|
pub fn advance(&mut self, dt: f32) {
|
||||||
self.0.advance(dt)
|
self.0.advance(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn advance_upwind(&mut self, dt: f32) {
|
pub fn advance_upwind(&mut self, dt: f32) {
|
||||||
self.0.advance_upwind(dt)
|
self.0.advance_upwind(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_rho_ptr(&self) -> *const u8 {
|
pub fn get_rho_ptr(&self) -> *const u8 {
|
||||||
self.0.field().rho().as_ptr() as *const u8
|
self.0.field().rho().as_ptr().cast()
|
||||||
}
|
}
|
||||||
pub fn get_rhou_ptr(&self) -> *const u8 {
|
pub fn get_rhou_ptr(&self) -> *const u8 {
|
||||||
self.0.field().rhou().as_ptr() as *const u8
|
self.0.field().rhou().as_ptr().cast()
|
||||||
}
|
}
|
||||||
pub fn get_rhov_ptr(&self) -> *const u8 {
|
pub fn get_rhov_ptr(&self) -> *const u8 {
|
||||||
self.0.field().rhov().as_ptr() as *const u8
|
self.0.field().rhov().as_ptr().cast()
|
||||||
}
|
}
|
||||||
pub fn get_e_ptr(&self) -> *const u8 {
|
pub fn get_e_ptr(&self) -> *const u8 {
|
||||||
self.0.field().e().as_ptr() as *const u8
|
self.0.field().e().as_ptr().cast()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,27 +18,27 @@ impl MaxwellUniverse {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn advance(&mut self, dt: f32) {
|
pub fn advance(&mut self, dt: f32) {
|
||||||
self.0.advance(dt)
|
self.0.advance(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn advance_upwind(&mut self, dt: f32) {
|
pub fn advance_upwind(&mut self, dt: f32) {
|
||||||
self.0.advance_upwind(dt)
|
self.0.advance_upwind(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "sparse")]
|
#[cfg(feature = "sparse")]
|
||||||
pub fn advance_with_matrix(&mut self, dt: f32) {
|
pub fn advance_with_matrix(&mut self, dt: f32) {
|
||||||
self.0.advance_sparse(dt)
|
self.0.advance_sparse(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_ex_ptr(&self) -> *const u8 {
|
pub fn get_ex_ptr(&self) -> *const u8 {
|
||||||
self.0.field().ex().as_ptr() as *const u8
|
self.0.field().ex().as_ptr().cast()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_ey_ptr(&self) -> *const u8 {
|
pub fn get_ey_ptr(&self) -> *const u8 {
|
||||||
self.0.field().ey().as_ptr() as *const u8
|
self.0.field().ey().as_ptr().cast()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_hz_ptr(&self) -> *const u8 {
|
pub fn get_hz_ptr(&self) -> *const u8 {
|
||||||
self.0.field().hz().as_ptr() as *const u8
|
self.0.field().hz().as_ptr().cast()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,18 +38,18 @@ impl ShallowWaterUniverse {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn advance(&mut self) {
|
pub fn advance(&mut self) {
|
||||||
self.0.advance()
|
self.0.advance();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_eta_ptr(&self) -> *const u8 {
|
pub fn get_eta_ptr(&self) -> *const u8 {
|
||||||
self.0.eta().as_ptr() as *const u8
|
self.0.eta().as_ptr().cast()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_etau_ptr(&self) -> *const u8 {
|
pub fn get_etau_ptr(&self) -> *const u8 {
|
||||||
self.0.etau().as_ptr() as *const u8
|
self.0.etau().as_ptr().cast()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_etav_ptr(&self) -> *const u8 {
|
pub fn get_etav_ptr(&self) -> *const u8 {
|
||||||
self.0.etav().as_ptr() as *const u8
|
self.0.etav().as_ptr().cast()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue