[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 4a28bc2 10/14: Replace 'EePmt' (antediluvian)
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 4a28bc2 10/14: Replace 'EePmt' (antediluvian) |
Date: |
Sat, 29 Aug 2020 19:34:49 -0400 (EDT) |
branch: master
commit 4a28bc24702ad7572e6a34d9bbf47e2f1781b9ed
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Replace 'EePmt' (antediluvian)
Replaced LedgerInvariant::EePmt with AccountValue::stored_pmts. It is
better to keep mutable state in the class that mutates it.
---
account_value.hpp | 1 +
accountvalue.cpp | 18 ++++++++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/account_value.hpp b/account_value.hpp
index a0a11b7..6c1f1c3 100644
--- a/account_value.hpp
+++ b/account_value.hpp
@@ -595,6 +595,7 @@ class LMI_SO AccountValue final
// other bases.
std::vector<double> OverridingPmts; // Antediluvian.
+ std::vector<double> stored_pmts; // Antediluvian.
std::vector<double> OverridingEePmts;
std::vector<double> OverridingErPmts;
diff --git a/accountvalue.cpp b/accountvalue.cpp
index 366285f..abdb9b9 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -118,6 +118,7 @@ AccountValue::AccountValue(Input const& input)
,pmt_mode {mce_annual}
,OldDBOpt {mce_option1}
,YearsDBOpt {mce_option1}
+ ,stored_pmts {Outlay_->ee_modal_premiums()}
{
GrossPmts .resize(12);
NetPmts .resize(12);
@@ -134,7 +135,7 @@ std::shared_ptr<Ledger const>
AccountValue::ledger_from_av() const
double AccountValue::RunAV()
{
InvariantValues().Init(this);
- OverridingPmts = InvariantValues().EePmt;
+ OverridingPmts = stored_pmts;
Solving = mce_solve_none != yare_input_.SolveType;
return RunAllApplicableBases();
}
@@ -180,7 +181,7 @@ double AccountValue::RunAllApplicableBases()
if(Solving)
{
z = Solve();
- OverridingPmts = InvariantValues().EePmt;
+ OverridingPmts = stored_pmts;
ledger_->SetOneLedgerVariant(run_basis, VariantValues());
Solving = false;
}
@@ -206,6 +207,7 @@ double AccountValue::RunOneCell(mcenum_run_basis TheBasis)
{
if(Solving)
{
+ stored_pmts = Outlay_->ee_modal_premiums();
// IHS !! This seems wasteful. Track down the reason for doing it.
InvariantValues().Init(this);
}
@@ -279,7 +281,7 @@ void AccountValue::DoYear
)[Year]
;
- pmt = InvariantValues().EePmt[Year];
+ pmt = stored_pmts[Year];
YearsPremLoadTgt = Loads_->target_premium_load(GenBasis_)[Year];
YearsMonthlyPolicyFee = Loads_->monthly_policy_fee(GenBasis_)[Year];
ActualSpecAmt = InvariantValues().SpecAmt[Year];
@@ -443,12 +445,12 @@ void AccountValue::PerformSpecAmtStrategy()
break;
case mce_sa_maximum:
{
- SA = GetModalMaxSpecAmt(Outlay_->ee_premium_modes()[0],
InvariantValues().EePmt[0]);
+ SA = GetModalMaxSpecAmt(Outlay_->ee_premium_modes()[0],
stored_pmts[0]);
}
break;
case mce_sa_target:
{
- SA = GetModalTgtSpecAmt(Outlay_->ee_premium_modes()[0],
InvariantValues().EePmt[0]);
+ SA = GetModalTgtSpecAmt(Outlay_->ee_premium_modes()[0],
stored_pmts[0]);
}
break;
case mce_sa_mep:
@@ -607,7 +609,7 @@ void AccountValue::PerformPmtStrategy(double* a_Pmt)
{
case mce_pmt_input_scalar:
{
- *a_Pmt = InvariantValues().EePmt[Year];
+ *a_Pmt = stored_pmts[Year];
}
break;
case mce_pmt_minimum:
@@ -635,7 +637,7 @@ void AccountValue::PerformPmtStrategy(double* a_Pmt)
<< " Payment set to scalar input value."
<< LMI_FLUSH
;
- *a_Pmt = InvariantValues().EePmt[Year];
+ *a_Pmt = stored_pmts[Year];
}
break;
case mce_pmt_glp:
@@ -645,7 +647,7 @@ void AccountValue::PerformPmtStrategy(double* a_Pmt)
<< " Payment set to scalar input value."
<< LMI_FLUSH
;
- *a_Pmt = InvariantValues().EePmt[Year];
+ *a_Pmt = stored_pmts[Year];
}
break;
case mce_pmt_gsp: // fall through
- [lmi-commits] [lmi] master c2f6854 03/14: Self test: print more timings, (continued)
- [lmi-commits] [lmi] master c2f6854 03/14: Self test: print more timings, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master ccb70ce 04/14: Self test: measure speed for 'finra' as well as 'ill_reg', Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master f6dfcf1 05/14: Filter out self-test timings, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 19be5c7 07/14: Don't initialize what's already been initialized, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 5dec884 01/14: Include appropriate headers, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master fa15960 06/14: Don't touch a ledger object before calling its Init(), Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 520bb97 14/14: Call ledger Init() less repeatedly [340], Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 74927c6 13/14: Eradicate 'EePmt' and 'ErPmt', Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master c017212 08/14: Make 'daily_interest_accounting' harder to overlook, Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 80f3ab4 09/14: Don't touch a ledger object before calling its Init() (bis), Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 4a28bc2 10/14: Replace 'EePmt' (antediluvian),
Greg Chicares <=
- [lmi-commits] [lmi] master 9ba754c 11/14: Replace 'EePmt' and 'ErPmt' (production), Greg Chicares, 2020/08/29
- [lmi-commits] [lmi] master 5827c93 12/14: No longer assign to 'EePmt' and 'ErPmt', Greg Chicares, 2020/08/29