Skip to content

Commit 457719d

Browse files
committed
Changed: Let IntegrandBase::setMode() allocate primsol for RECOVERY mode
1 parent 52190da commit 457719d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/ASM/IntegrandBase.C

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@
2525
#include <cstdio>
2626

2727

28+
/*!
29+
The default implementation of this method allocates for one solution vector
30+
in \ref primsol when the \a mode is set to SIM::RECOVERY or SIM::NORMS.
31+
This is sufficient for most linear problems with a single right-hand side.
32+
*/
33+
34+
void IntegrandBase::setMode (SIM::SolutionMode mode)
35+
{
36+
primsol.resize((m_mode = mode) >= SIM::RECOVERY ? 1 : 0);
37+
}
38+
39+
2840
/*!
2941
Override this method if the integrand needs some patch-specific data
3042
to be initialized before performing the numerical integration.

src/ASM/IntegrandBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class IntegrandBase : public Integrand
5757
// ===============================
5858

5959
//! \brief Defines the solution mode before the element assembly is started.
60-
virtual void setMode(SIM::SolutionMode mode) { m_mode = mode; }
60+
virtual void setMode(SIM::SolutionMode mode);
6161
//! \brief Returns current solution mode.
6262
SIM::SolutionMode getMode() const override { return m_mode; }
6363
//! \brief Initializes an integration parameter for the integrand.

0 commit comments

Comments
 (0)