add sparse matrix creating to all diff ops
This commit is contained in:
@@ -38,6 +38,21 @@ impl SbpOperator1d for SBP4 {
|
||||
fn h(&self) -> &'static [Float] {
|
||||
Self::HBLOCK
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diff_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::BLOCK,
|
||||
Self::DIAG,
|
||||
super::Symmetry::AntiSymmetric,
|
||||
super::OperatorType::Normal,
|
||||
n,
|
||||
)
|
||||
}
|
||||
#[cfg(feature = "sparse")]
|
||||
fn h_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::h_matrix(Self::DIAG, n, self.is_h2())
|
||||
}
|
||||
}
|
||||
|
||||
impl<SBP: SbpOperator1d> SbpOperator2d for (&SBP, &SBP4) {
|
||||
|
||||
@@ -42,6 +42,21 @@ impl SbpOperator1d for SBP8 {
|
||||
fn h(&self) -> &'static [Float] {
|
||||
Self::HBLOCK
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diff_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::BLOCK,
|
||||
Self::DIAG,
|
||||
super::Symmetry::AntiSymmetric,
|
||||
super::OperatorType::Normal,
|
||||
n,
|
||||
)
|
||||
}
|
||||
#[cfg(feature = "sparse")]
|
||||
fn h_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::h_matrix(Self::DIAG, n, self.is_h2())
|
||||
}
|
||||
}
|
||||
|
||||
impl<SBP: SbpOperator1d> SbpOperator2d for (&SBP, &SBP8) {
|
||||
|
||||
@@ -56,6 +56,21 @@ impl SbpOperator1d for Upwind4h2 {
|
||||
fn is_h2(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diff_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::BLOCK,
|
||||
Self::DIAG,
|
||||
super::Symmetry::AntiSymmetric,
|
||||
super::OperatorType::H2,
|
||||
n,
|
||||
)
|
||||
}
|
||||
#[cfg(feature = "sparse")]
|
||||
fn h_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::h_matrix(Self::DIAG, n, self.is_h2())
|
||||
}
|
||||
}
|
||||
|
||||
impl<SBP: SbpOperator1d> SbpOperator2d for (&SBP, &Upwind4h2) {
|
||||
|
||||
@@ -61,6 +61,21 @@ impl SbpOperator1d for Upwind9 {
|
||||
fn h(&self) -> &'static [Float] {
|
||||
Self::HBLOCK
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diff_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::BLOCK,
|
||||
Self::DIAG,
|
||||
super::Symmetry::AntiSymmetric,
|
||||
super::OperatorType::Normal,
|
||||
n,
|
||||
)
|
||||
}
|
||||
#[cfg(feature = "sparse")]
|
||||
fn h_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::h_matrix(Self::DIAG, n, self.is_h2())
|
||||
}
|
||||
}
|
||||
|
||||
impl<SBP: SbpOperator1d> SbpOperator2d for (&SBP, &Upwind9) {
|
||||
|
||||
@@ -64,6 +64,21 @@ impl SbpOperator1d for Upwind9h2 {
|
||||
fn is_h2(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg(feature = "sparse")]
|
||||
fn diff_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::sparse_from_block(
|
||||
Self::BLOCK,
|
||||
Self::DIAG,
|
||||
super::Symmetry::AntiSymmetric,
|
||||
super::OperatorType::H2,
|
||||
n,
|
||||
)
|
||||
}
|
||||
#[cfg(feature = "sparse")]
|
||||
fn h_matrix(&self, n: usize) -> sprs::CsMat<Float> {
|
||||
super::h_matrix(Self::DIAG, n, self.is_h2())
|
||||
}
|
||||
}
|
||||
|
||||
impl<SBP: SbpOperator1d> SbpOperator2d for (&SBP, &Upwind9h2) {
|
||||
|
||||
Reference in New Issue
Block a user