sparse upwind operators
This commit is contained in:
parent
9e22f239c2
commit
ad6564eeb1
|
@ -94,12 +94,18 @@ impl<SBP: SbpOperator1d + Copy> SbpOperator2d for SBP {
|
|||
pub trait UpwindOperator1d: SbpOperator1d + Send + Sync {
|
||||
fn diss(&self, prev: ArrayView1<Float>, fut: ArrayViewMut1<Float>);
|
||||
fn as_sbp(&self) -> &dyn SbpOperator1d;
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diss_matrix(&self, n: usize) -> sprs::CsMat<Float>;
|
||||
}
|
||||
|
||||
pub trait UpwindOperator2d: SbpOperator2d + Send + Sync {
|
||||
fn dissxi(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>);
|
||||
fn disseta(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>);
|
||||
fn as_sbp(&self) -> &dyn SbpOperator2d;
|
||||
|
||||
fn op_xi(&self) -> &dyn UpwindOperator1d;
|
||||
fn op_eta(&self) -> &dyn UpwindOperator1d;
|
||||
}
|
||||
|
||||
impl<UOeta: UpwindOperator1d, UOxi: UpwindOperator1d> UpwindOperator2d for (&UOeta, &UOxi) {
|
||||
|
@ -116,6 +122,13 @@ impl<UOeta: UpwindOperator1d, UOxi: UpwindOperator1d> UpwindOperator2d for (&UOe
|
|||
fn as_sbp(&self) -> &dyn SbpOperator2d {
|
||||
self
|
||||
}
|
||||
|
||||
fn op_xi(&self) -> &dyn UpwindOperator1d {
|
||||
self.1
|
||||
}
|
||||
fn op_eta(&self) -> &dyn UpwindOperator1d {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<UO: UpwindOperator1d + Copy> UpwindOperator2d for UO {
|
||||
|
@ -128,6 +141,13 @@ impl<UO: UpwindOperator1d + Copy> UpwindOperator2d for UO {
|
|||
fn as_sbp(&self) -> &dyn SbpOperator2d {
|
||||
self
|
||||
}
|
||||
|
||||
fn op_xi(&self) -> &dyn UpwindOperator1d {
|
||||
self
|
||||
}
|
||||
fn op_eta(&self) -> &dyn UpwindOperator1d {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub trait InterpolationOperator: Send + Sync {
|
||||
|
|
|
@ -354,6 +354,17 @@ impl UpwindOperator1d for Upwind4 {
|
|||
fn as_sbp(&self) -> &dyn SbpOperator1d {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diss_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::DISS_BLOCK,
|
||||
Self::DISS_DIAG,
|
||||
super::Symmetry::Symmetric,
|
||||
super::OperatorType::Normal,
|
||||
n,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<UO: UpwindOperator1d> UpwindOperator2d for (&UO, &Upwind4) {
|
||||
|
|
|
@ -175,4 +175,15 @@ impl UpwindOperator1d for Upwind4h2 {
|
|||
fn as_sbp(&self) -> &dyn SbpOperator1d {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diss_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::DISS_BLOCK,
|
||||
Self::DISS_DIAG,
|
||||
super::Symmetry::Symmetric,
|
||||
super::OperatorType::H2,
|
||||
n,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,17 @@ impl UpwindOperator1d for Upwind9 {
|
|||
fn as_sbp(&self) -> &dyn SbpOperator1d {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diss_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::DISS_BLOCK,
|
||||
Self::DISS_DIAG,
|
||||
super::Symmetry::Symmetric,
|
||||
super::OperatorType::Normal,
|
||||
n,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<UO: UpwindOperator1d> UpwindOperator2d for (&UO, &Upwind9) {
|
||||
|
|
|
@ -146,6 +146,17 @@ impl UpwindOperator1d for Upwind9h2 {
|
|||
fn as_sbp(&self) -> &dyn SbpOperator1d {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diss_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::DISS_BLOCK,
|
||||
Self::DISS_DIAG,
|
||||
super::Symmetry::Symmetric,
|
||||
super::OperatorType::H2,
|
||||
n,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<UO: UpwindOperator1d> UpwindOperator2d for (&UO, &Upwind9h2) {
|
||||
|
|
Loading…
Reference in New Issue