sparse upwind operators

This commit is contained in:
Magnus Ulimoen
2020-06-15 22:01:42 +02:00
parent 9e22f239c2
commit ad6564eeb1
5 changed files with 64 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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,
)
}
}

View File

@@ -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) {

View File

@@ -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) {