34 m_activationTracker (nullptr),
36 m_ionSolvOpts (
"RL 2"),
37 m_stopAtCompleteActivation (
false),
38 m_stopAtCompleteRepolarization(
false)
42 this->m_scaleSystem = 1.;
43 m_activationTracker = ceps::getNew<ActivationTracker>(
this);
49 m_stopAtCompleteActivation = params->
isActiveOption(
"stop at complete activation");
51 "Cannot enable simulation stop at complete activation since no activation time data\n" <<
52 "has been provided. Simulation will stop at time " << m_timeStepper->getEndTime()
55 m_ionSolvOpts = params->
getString(
"ionic model solver",m_ionSolvOpts);
60 getProfiler()->logMemoryUsage(
"\"PDE solver - before allocation of ionic data arrays\"");
63 m_ionSolvers.push_back(ceps::getNew<IonicSolver>(m_ionSolvOpts,model,m_fe));
67 getProfiler()->logMemoryUsage(
"\"PDE solver - end of initialization\"");
99 return ended or allActiv;
105 return ceps::runtimeCast<CardiacProblem*>(
m_problem);
135 auto vecUs = cpb->getCardiacUnknowns();
#define CEPS_WARNS_IF(condition, message)
If condition is true, writes a warning in the debug log and in the terminal (stderr).
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
float CepsReal
Need single precision floating point.
std::shared_ptr< DistributedHaloVector > DHVecPtr
Typedef for pointer on Distributed Halo CepsVector.
void scaleByField(DistributedVector *vec, ScalarField< _SupportType > &f, CepsReal t=0., CepsBool divide=false)
Multiplies or divides given vector by coeff value. (default behaviour)
DHVecPtr newDofHaloVector() const
Get a new vector from the factory, with halo data.
Represents a ionic model for a group of cells, i.e. multiple systems of ODEs.
CepsVector< Unknown * > getSpatialUnknowns() const
A vector of all unknowns of pb defined on cells or points.
VtkWriter * m_writer
Manages output.
AbstractDiscretization * m_discretization
Link to PDE discretization.
CepsBool m_doOutput
Enables/disables outputs.
AbstractPdeProblem * m_problem
Link to PDE to solve.
TimeStepper * m_timeStepper
Monitors time evolution.
void solve() override
Solves the all PDE (all iterations)
CepsVector< DHVecPtr > m_regSourcesNm
Sources at previous steps (if problem has source terms)
CepsVector< DHVecPtr > m_uNm
Solution vectors at different time steps. Several vectors are needed for multi-step methods....
CepsUInt m_nbIterSnapshot
Output perdiodicity.
virtual void output(DHVecPtr solution, CepsBool immediateWriting=true)
Prints the solution.
DHVecPtr m_uNp1
Vectors of unknowns at time t^n+1.
virtual void fillSourceTermsVector(CepsReal tn)
Adds contributions from all source terms into m_regSourcesNm[0].
Class managing computations from potential to outputs.
CepsBool allPointsHaveBeenActivated() const
Tells if all points have seen AP start (checked with activation threshold)
void writeActivationMap()
Writes activation times and probe points data.
void update(CepsInt iter, CepsReal time, DHVecPtr solution, DHVecPtr prevSolution)
Writes the solution (optionnally currents) every m_nbIterSnapshot steps only. Also updates activation...
A abstract class that regroups common parameters of cardiac problems.
CepsBool m_stopAtCompleteActivation
stop when all points have activation time computed
ActivationTracker * getActivationTracker() const
Link to activation tracker.
void output(DHVecPtr dummy, CepsBool immediatWriting=true) override
Calls the appropriate post-processing and writing methods.
void assembleAndSolve() override
Performs one iteration of the solver.
CardiacProblem * getCardiacProblem() const
Converts own pointer to abstract pde problem to cardiac problem.
void fillSourceTermsVector(CepsReal tn) override
Computes all contributions to source terms (ionic current, stimcurrent, field sources) with a loop on...
virtual ~CardiacSolver()
Destructor.
CepsVector< IonicSolver * > m_ionSolvers
One solver per ionic model in the problem.
void solve() override
Performs all iterations of the PDE solver.
CardiacSolver(CardiacProblem *problem)
Constructor with associated PDE problem.
ActivationTracker * m_activationTracker
Output computation and writing.
CepsBool finished() const override
Tells if simulation reached end time or, if enabled, all points have seen an AP.
Profiler * getProfiler() const
Access to profiler.
void assembleAndSolve() override
Main routine used during solving, assemble the system depending on the scheme and solve the linear sy...
Groups two ODE solvers for ionic variables and interacts with cardiac problem.
void stop(CepsString lbl)
Stops the measure of a labeled chronometer.
void start(CepsString lbl, CepsString dspl="")
Creates or continue a labeled chronometer.
CepsReal getTimeStep() const
Time step.
virtual CepsReal getTime()
current simulation time
CepsBool atEnd()
Whether time stepper has reached the end time or not.
CepsUInt getNbTakenTimeSteps() const
Number of time steps performed until now.
A class used to defined an unknown of a PDE problem The unknown can be defined on a specific region,...
void addScalarData(const DHVecPtr &v, const CepsVector< CepsString > &fieldNames, const CepsVector< Unknown * > &us)
Set multiple scalar fields to be output by this writer. addScalarData for several unknowns.
void write(CepsReal time=0., CepsBool writeXmlEntry=true)
Write all stored data.
constexpr CepsHash get(_Type const &i)
get a hash from a single value
CepsBool contains(const CepsVector< _Type, _Alloc > &vec, const _Type &item)
Tells if vectors contains a given item.
CepsBool isValidPtr(_Type *ptr)
Tells if pointer is not null.
CepsBool isProfiling()
Check if we are currently profiling on the master proc (always false on slave procs).
void destroyObject(_Type &)
Destroy[delete] any type.