From 417957c0fa982588c5228ecceec64c28c9a00271 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Fri, 7 Jul 2023 22:03:37 +0200 Subject: [PATCH] NGSolve compatibility --- src/petsc_linalg.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/petsc_linalg.cpp b/src/petsc_linalg.cpp index 2fbf184..48ca02a 100644 --- a/src/petsc_linalg.cpp +++ b/src/petsc_linalg.cpp @@ -16,16 +16,16 @@ namespace ngs_petsc_interface void SetPETScMatSeq (PETScMat petsc_mat, shared_ptr> spmat, shared_ptr rss, shared_ptr css) { - static ngs::Timer t(string("SetPETScMatSeq::HEIGHT) + string(">>")); ngs::RegionTimer rt(t); + static ngs::Timer t(string("SetPETScMatSeq()) + string(">>")); ngs::RegionTimer rt(t); PETScInt bs; MatGetBlockSize(petsc_mat, &bs); - if (bs != ngs::mat_traits::WIDTH) { + if (bs != ngs::Width()) { throw Exception(string("Block-Size of petsc-mat (") + to_string(bs) + string(") != block-size of ngs-mat(") - + to_string(ngs::mat_traits::WIDTH) + string(")")); + + to_string(ngs::Width()) + string(")")); } // row map (map for a row) - PETScInt bw = ngs::mat_traits::WIDTH; + PETScInt bw = ngs::Width(); int nbrow = 0; Array row_compress(spmat->Width()); for (auto k : Range(spmat->Width())) @@ -33,7 +33,7 @@ namespace ngs_petsc_interface int ncols = nbrow * bw; // col map (map for a col) - PETScInt bh = ngs::mat_traits::HEIGHT; + PETScInt bh = ngs::Height(); int nbcol = 0; Array col_compress(spmat->Height()); for (auto k : Range(spmat->Height())) @@ -83,9 +83,9 @@ namespace ngs_petsc_interface but petsc_mat is in MATMPIAIJ or MATMPIBAIJ format, which is simply distributed row-wise **/ - static ngs::Timer t(string("SetPETScMatPar::HEIGHT) + string(">>")); ngs::RegionTimer rt(t); + static ngs::Timer t(string("SetPETScMatPar()) + string(">>")); ngs::RegionTimer rt(t); - PETScInt bs = ngs::mat_traits::WIDTH; + PETScInt bs = ngs::Width(); auto row_dm = row_map->GetDOFMap(); auto col_dm = col_map->GetDOFMap(); @@ -128,10 +128,10 @@ namespace ngs_petsc_interface template PETScMat CreatePETScMatSeqBAIJFromSymmetric (shared_ptr> spmat, shared_ptr rss, shared_ptr css) { - static ngs::Timer t(string("CreatePETScMatSeqBAIJFromSymmetric::HEIGHT) + string(">>")); ngs::RegionTimer rt(t); + static ngs::Timer t(string("CreatePETScMatSeqBAIJFromSymmetric()) + string(">>")); ngs::RegionTimer rt(t); // row map (map for a row) - PETScInt bw = ngs::mat_traits::WIDTH; + PETScInt bw = ngs::Width(); int nbrow = 0; Array row_compress(spmat->Width()); for (auto k : Range(spmat->Width())) @@ -139,7 +139,7 @@ namespace ngs_petsc_interface int ncols = nbrow * bw; // col map (map for a col) - PETScInt bh = ngs::mat_traits::HEIGHT; + PETScInt bh = ngs::Height(); int nbcol = 0; Array col_compress(spmat->Height()); for (auto k : Range(spmat->Height())) @@ -218,15 +218,15 @@ namespace ngs_petsc_interface PETScMat CreatePETScMatSeqBAIJ (shared_ptr> spmat, shared_ptr rss, shared_ptr css) { - static_assert(ngs::mat_traits::WIDTH == ngs::mat_traits::HEIGHT, "PETSc can only handle square block entries!"); + static_assert(ngs::Width() == ngs::Height(), "PETSc can only handle square block entries!"); - static ngs::Timer t(string("CreatePETScMatSeqBAIJ::HEIGHT) + string(">>")); ngs::RegionTimer rt(t); + static ngs::Timer t(string("CreatePETScMatSeqBAIJ()) + string(">>")); ngs::RegionTimer rt(t); if (auto sym_spm = dynamic_pointer_cast>(spmat)) { return CreatePETScMatSeqBAIJFromSymmetric (sym_spm, rss, css); } // row map (map for a row) - PETScInt bw = ngs::mat_traits::WIDTH; + PETScInt bw = ngs::Width(); int nbrow = 0; Array row_compress(spmat->Width()); for (auto k : Range(spmat->Width())) @@ -234,7 +234,7 @@ namespace ngs_petsc_interface int ncols = nbrow * bw; // col map (map for a col) - PETScInt bh = ngs::mat_traits::HEIGHT; + PETScInt bh = ngs::Height(); int nbcol = 0; Array col_compress(spmat->Height()); for (auto k : Range(spmat->Height())) @@ -330,16 +330,16 @@ namespace ngs_petsc_interface shared_ptr rss, shared_ptr css) { - static ngs::Timer t(string("DeleteDuplicateValuesTM::HEIGHT) + string(">>")); ngs::RegionTimer rt(t); + static ngs::Timer t(string("DeleteDuplicateValuesTM()) + string(">>")); ngs::RegionTimer rt(t); PETScInt bs; MatGetBlockSize(petsc_mat, &bs); - if (bs != ngs::mat_traits::WIDTH) { + if (bs != ngs::Width()) { throw Exception(string("Block-Size of petsc-mat (") + to_string(bs) + string(") != block-size of ngs-mat(") - + to_string(ngs::mat_traits::WIDTH) + string(")")); + + to_string(ngs::Width()) + string(")")); } // row map (map for a row) - PETScInt bw = ngs::mat_traits::WIDTH; + PETScInt bw = ngs::Width(); int nbrow = 0; Array row_compress(spmat->Width()); for (auto k : Range(spmat->Width())) @@ -347,7 +347,7 @@ namespace ngs_petsc_interface int ncols = nbrow * bw; // col map (map for a col) - PETScInt bh = ngs::mat_traits::HEIGHT; + PETScInt bh = ngs::Height(); int nbcol = 0; Array col_compress(spmat->Height()); for (auto k : Range(spmat->Height()))