From b1db9baf3a0519ab912866cfe4a008c6c79a7ec8 Mon Sep 17 00:00:00 2001 From: "jonathan.froehlich" <jonathan.froehlich@kit.edu> Date: Thu, 26 Jan 2023 15:10:00 +0100 Subject: [PATCH] Renamed elphy solver methods --- src/coupled/solvers/CellModelSolver.cpp | 2 +- src/coupled/solvers/SegregatedSolver.cpp | 2 +- src/electrophysiology/MainMonodomain.cpp | 2 +- src/electrophysiology/MainOneCell.cpp | 2 +- .../solvers/DiffusionSolver.cpp | 4 ++-- .../solvers/DiffusionSolver.hpp | 4 ++-- src/electrophysiology/solvers/ElphySolver.cpp | 6 +++--- src/electrophysiology/solvers/ElphySolver.hpp | 8 ++++---- .../solvers/LinearImplicitSolver.cpp | 16 ++++++++-------- .../solvers/LinearImplicitSolver.hpp | 10 +++++----- .../solvers/SplittingSolver.hpp | 2 +- test/coupled/TestCoupledConsistency.cpp | 6 +++--- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/coupled/solvers/CellModelSolver.cpp b/src/coupled/solvers/CellModelSolver.cpp index ec0f46e0b..e2af47122 100644 --- a/src/coupled/solvers/CellModelSolver.cpp +++ b/src/coupled/solvers/CellModelSolver.cpp @@ -19,7 +19,7 @@ void CellModelSolver::Solve(Vector &potential, Vector &stretch) { int step=elphyA.Step()+1; //if (verbose == 1) mout << "Solving Step " << step << " at time " << elphyA.Time() << "." << endl; - elphySolver.SolveStep(elphyA, uNew); + elphySolver.Step(elphyA, uNew); if (verbose > 0) { PlotValues(uNew, step); diff --git a/src/coupled/solvers/SegregatedSolver.cpp b/src/coupled/solvers/SegregatedSolver.cpp index 83c0f78c5..84363b3cd 100644 --- a/src/coupled/solvers/SegregatedSolver.cpp +++ b/src/coupled/solvers/SegregatedSolver.cpp @@ -181,7 +181,7 @@ void SegregatedSolver::Step(IElphyAssemble &elphyAssemble, IElasticity &mechAsse << elphyAssemble.LastTStep() << "] - step " << elphyAssemble.Step() + 1 << " at time " << elphyAssemble.Time() << "." << endl; - elphySolver->SolveStep(elphyAssemble, elphyValues); + elphySolver->Step(elphyAssemble, elphyValues); } // Projects stretch from elphy to mech diff --git a/src/electrophysiology/MainMonodomain.cpp b/src/electrophysiology/MainMonodomain.cpp index be66533d3..c77729dbb 100644 --- a/src/electrophysiology/MainMonodomain.cpp +++ b/src/electrophysiology/MainMonodomain.cpp @@ -53,7 +53,7 @@ void MainMonodomain::Initialize() { Vector &MainMonodomain::Run() { auto elphySolver = GetElphySolver(modelName, *cellModel, elphyA->ExcitationData()); - elphySolver->Solve(*elphyA, *potential); + elphySolver->Method(*elphyA, *potential); elphyA->PrintActivationTime(); diff --git a/src/electrophysiology/MainOneCell.cpp b/src/electrophysiology/MainOneCell.cpp index 83989471e..58a5811d8 100644 --- a/src/electrophysiology/MainOneCell.cpp +++ b/src/electrophysiology/MainOneCell.cpp @@ -37,7 +37,7 @@ Vector &MainOneCell::Run() { } else { elphyA = std::make_unique<MonodomainSplitting>(*problem, 0); IBTSplittingSolver eSolver(ONLYODE); - eSolver.Solve(*elphyA, *potential); + eSolver.Method(*elphyA, *potential); } diff --git a/src/electrophysiology/solvers/DiffusionSolver.cpp b/src/electrophysiology/solvers/DiffusionSolver.cpp index 01b9d4eb6..b27b848e2 100644 --- a/src/electrophysiology/solvers/DiffusionSolver.cpp +++ b/src/electrophysiology/solvers/DiffusionSolver.cpp @@ -26,7 +26,7 @@ void DiffusionSolver::Initialize(IElphyAssemble &A, Vector &v) { A.SetInitialValue(v); } -void DiffusionSolver::Solve(IElphyAssemble &A, Vector &potential) { +void DiffusionSolver::Method(IElphyAssemble &A, Vector &potential) { //mout.StartBlock("Elphy"); Initialize(A, potential); @@ -103,6 +103,6 @@ bool DiffusionSolver::AssemblesOnce() const { return assembleOnce; } -void DiffusionSolver::SolveStep(IElphyAssemble &A, Vectors &values) { +void DiffusionSolver::Step(IElphyAssemble &A, Vectors &values) { SolveStep(A, values[0]); } diff --git a/src/electrophysiology/solvers/DiffusionSolver.hpp b/src/electrophysiology/solvers/DiffusionSolver.hpp index 110a6a9cb..2dc37c60e 100644 --- a/src/electrophysiology/solvers/DiffusionSolver.hpp +++ b/src/electrophysiology/solvers/DiffusionSolver.hpp @@ -21,9 +21,9 @@ public: void SolveStep(IElphyAssemble &A, Vector &potential); - void SolveStep(IElphyAssemble &A, Vectors &values) override; + void Step(IElphyAssemble &A, Vectors &values) override; - void Solve(IElphyAssemble &A, Vector &potential); + void Method(IElphyAssemble &A, Vector &potential); void assembleStep(IElphyAssemble &A, Vector &v); diff --git a/src/electrophysiology/solvers/ElphySolver.cpp b/src/electrophysiology/solvers/ElphySolver.cpp index bb2b687a4..3bb8e6069 100644 --- a/src/electrophysiology/solvers/ElphySolver.cpp +++ b/src/electrophysiology/solvers/ElphySolver.cpp @@ -8,7 +8,7 @@ ElphySolver::ElphySolver() { Config::Get("IextInPDE", iextInPDE); } -void ElphySolver::Solve(IElphyAssemble &A, Vector &potential) { +void ElphySolver::Method(IElphyAssemble &A, Vector &potential) { //mout.StartBlock("Elphy"); Initialize(A, potential); Vectors uNew(1, potential); @@ -17,10 +17,10 @@ void ElphySolver::Solve(IElphyAssemble &A, Vector &potential) { A.PlotIteration(uNew[0]); A.PrintIteration(uNew[0]); - vout(1) << "Solving Step " << A.Step() + 1 << " at time " << A.Time() << "." << endl; + vout(1) << "Solving Step " << A.Step() + 1 << " at time " << A.Time() << "." << endl; vout(10).StartBlock("Godunov Splitting Step"); - SolveStep(A, uNew); + Step(A, uNew); A.NextTimeStep(); diff --git a/src/electrophysiology/solvers/ElphySolver.hpp b/src/electrophysiology/solvers/ElphySolver.hpp index 1605e4d22..214612e62 100644 --- a/src/electrophysiology/solvers/ElphySolver.hpp +++ b/src/electrophysiology/solvers/ElphySolver.hpp @@ -14,13 +14,15 @@ protected: public: explicit ElphySolver(); + virtual void Initialize(IElphyAssemble &A, Vector &potential) {}; + /** * Solves purely electrophysiolical problem over the course of the timeSeries * @param potential * @param timeSeries * The solution is stored in potential */ - virtual void Solve(IElphyAssemble &A, Vector &potential); + virtual void Method(IElphyAssemble &A, Vector &potential); /** * Solves a single electrophysiolgical time step with the given parameters @@ -29,9 +31,7 @@ public: * @param t * @param dt */ - virtual void SolveStep(IElphyAssemble &A, Vectors &values) = 0; - - virtual void Initialize(IElphyAssemble &A, Vector &potential) {}; + virtual void Step(IElphyAssemble &A, Vectors &values) = 0; virtual void Finalize(Vectors &values) {}; }; diff --git a/src/electrophysiology/solvers/LinearImplicitSolver.cpp b/src/electrophysiology/solvers/LinearImplicitSolver.cpp index e702d82ff..3429cdbd8 100644 --- a/src/electrophysiology/solvers/LinearImplicitSolver.cpp +++ b/src/electrophysiology/solvers/LinearImplicitSolver.cpp @@ -20,7 +20,7 @@ void LinearImplicitSolver::Initialize(IElphyAssemble &A, Vector &V) { A.SetInitialValue(V); } -void LinearImplicitSolver::Solve(IElphyAssemble &A, Vector &V) { +void LinearImplicitSolver::Method(IElphyAssemble &A, Vector &V) { Vectors vNew(M.Type() == TENSION ? 3 : 1, V); Initialize(A, vNew[0]); if (M.Type() == TENSION) { @@ -35,7 +35,7 @@ void LinearImplicitSolver::Solve(IElphyAssemble &A, Vector &V) { << A.NextTimeStep(false) << " (" << A.StepSize() << ")" << endl; vout(10).StartBlock("LinearImplicit Step"); - SolveStep(A, vNew); + Step(A, vNew); vout(10).EndBlock(); @@ -47,7 +47,7 @@ void LinearImplicitSolver::Solve(IElphyAssemble &A, Vector &V) { A.PrintIteration(V); } -void LinearImplicitSolver::SolveStep(IElphyAssemble &A, Vectors &values) { +void LinearImplicitSolver::Step(IElphyAssemble &A, Vectors &values) { A.Initialize(values[0]); A.updateExternalCurrent(values[0]); A.updateIionVecs(*gating); @@ -173,7 +173,7 @@ void LinearImplicitSolver::PrintMaxMinGating() { } -void ImplicitSolver::Solve(IElphyAssemble &A, Vector &V) { +void ImplicitSolver::Method(IElphyAssemble &A, Vector &V) { Vectors vNew(M.Type() == TENSION ? 3 : 1, V); Initialize(A, vNew[0]); if (M.Type() == TENSION) { @@ -191,7 +191,7 @@ void ImplicitSolver::Solve(IElphyAssemble &A, Vector &V) { << A.NextTimeStep(false) << " (" << A.StepSize() << ")" << endl; vout(10).StartBlock("Implicit step"); - SolveStep(A, vNew); + Step(A, vNew); vout(10).EndBlock(); @@ -204,7 +204,7 @@ void ImplicitSolver::Solve(IElphyAssemble &A, Vector &V) { } -void ImplicitSolver::SolveStep(IElphyAssemble &A, Vectors &values) { +void ImplicitSolver::Step(IElphyAssemble &A, Vectors &values) { A.NextTimeStep(); A.Initialize(values[0]); A.updateExternalCurrent(values[0]); @@ -230,7 +230,7 @@ bool ImplicitSolver::SolvePDE(IElphyAssemble &A, Vectors &values) { } -void SemiImplicitSolver::Solve(IElphyAssemble &A, Vector &V) { +void SemiImplicitSolver::Method(IElphyAssemble &A, Vector &V) { Vectors vNew(M.Type() == TENSION ? 3 : 1, V); Initialize(A, vNew[0]); if (M.Type() == TENSION) { @@ -246,7 +246,7 @@ void SemiImplicitSolver::Solve(IElphyAssemble &A, Vector &V) { << A.NextTimeStep(false) << " (" << A.StepSize() << ")" << endl; vout(10).StartBlock("Semi Implicit Step"); - SolveStep(A, vNew); + Step(A, vNew); vout(10).EndBlock(); } diff --git a/src/electrophysiology/solvers/LinearImplicitSolver.hpp b/src/electrophysiology/solvers/LinearImplicitSolver.hpp index e2474cfbd..85e0f463c 100644 --- a/src/electrophysiology/solvers/LinearImplicitSolver.hpp +++ b/src/electrophysiology/solvers/LinearImplicitSolver.hpp @@ -76,7 +76,7 @@ public: virtual void Initialize(IElphyAssemble &A, Vector &potential); - virtual void Solve(IElphyAssemble &A, Vector &V); + virtual void Method(IElphyAssemble &A, Vector &V); void SolveConcentration(double t, double dt, const Vectors &values); @@ -84,7 +84,7 @@ public: virtual void SolvePDE(IElphyAssemble &A); - void SolveStep(IElphyAssemble &A, Vectors &values) override; + void Step(IElphyAssemble &A, Vectors &values) override; std::function<void(IElphyAssemble &A, const Vectors &values)> StaggeredStep; @@ -112,9 +112,9 @@ public: std::unique_ptr<LinearSolver>(GetLinearSolverByPrefix("Elphy")) ) {}; - void Solve(IElphyAssemble &A, Vector &V) override; + void Method(IElphyAssemble &A, Vector &V) override; - void SolveStep(IElphyAssemble &A, Vectors &values) override; + void Step(IElphyAssemble &A, Vectors &values) override; bool SolvePDE(IElphyAssemble &A, Vectors &values); }; @@ -124,7 +124,7 @@ class SemiImplicitSolver : public LinearImplicitSolver { public: SemiImplicitSolver(MCellModel &cellModel) : LinearImplicitSolver(cellModel) {}; - void Solve(IElphyAssemble &A, Vector &V) override; + void Method(IElphyAssemble &A, Vector &V) override; void SolvePDE(IElphyAssemble &A) override; }; diff --git a/src/electrophysiology/solvers/SplittingSolver.hpp b/src/electrophysiology/solvers/SplittingSolver.hpp index 48a73e095..2d085d6cd 100644 --- a/src/electrophysiology/solvers/SplittingSolver.hpp +++ b/src/electrophysiology/solvers/SplittingSolver.hpp @@ -118,7 +118,7 @@ public: selectScheme(splitting); } - void SolveStep(IElphyAssemble &A, Vectors &values) override { + void Step(IElphyAssemble &A, Vectors &values) override { solveSplittingStep(A, values); } diff --git a/test/coupled/TestCoupledConsistency.cpp b/test/coupled/TestCoupledConsistency.cpp index 5fa53997b..e1ec4e592 100644 --- a/test/coupled/TestCoupledConsistency.cpp +++ b/test/coupled/TestCoupledConsistency.cpp @@ -120,8 +120,8 @@ TEST_P(CoupledConsistencyTest, CompareCellModels) { tensionV[2] = 1.0; // Iota4 while (!elphyA->IsFinished()) { - elphySolver->SolveStep(*elphyA, elphyV); - tensionSolver->SolveStep(*coupledA, tensionV); + elphySolver->Step(*elphyA, elphyV); + tensionSolver->Step(*coupledA, tensionV); EXPECT_EQ(elphyA->Time(), coupledA->Time()); ASSERT_MPPVECTOR_EQ(elphyV[0], tensionV[0]); @@ -162,7 +162,7 @@ TEST_P(CoupledConsistencyTest, CompareSolvers) { ASSERT_MPPVECTOR_EQ(elphyA->ExternalCurrent(), coupledA->ExternalCurrent()); while (!mechA->IsFinished()) { - elphySolver->SolveStep(*elphyA, elphyV); + elphySolver->Step(*elphyA, elphyV); coupledSolver.Step(*coupledA, *mechA, coupledV, coupledU); EXPECT_EQ(elphyA->Time(), mechA->Time()); -- GitLab