Chaste Commit::f2ff7ee04e70ac9d06c57344df8d017dbb12b97b
AbstractSrnModel.cpp
1/*
2
3Copyright (c) 2005-2024, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#include "AbstractSrnModel.hpp"
37
39 : mSimulatedToTime(SimulationTime::Instance()->GetTime()),
40 mEdgeLocalIndex(UNSIGNED_UNSET),
41 mIsEdgeBasedModel(false)
42{
43}
44
48
52
56
58 : mSimulatedToTime(rModel.GetSimulatedToTime()), mIsEdgeBasedModel(rModel.mIsEdgeBasedModel)
59{
60 /*
61 * Set each member variable of the new SRN model that inherits
62 * its value from the parent.
63 *
64 * Note 1: some of the new SRN model's member variables
65 * will already have been correctly initialized in its constructor.
66 *
67 * Note 2: one or more of the new SRN model's member variables
68 * may be set/overwritten as soon as InitialiseDaughterCell() is called on
69 * the new SRN model.
70 *
71 * Note 3: Only set the variables defined in this class. Variables defined
72 * in parent classes will be defined there.
73 */
74}
75
77{
78 // Make sure we're at the current time
80 assert(mSimulatedToTime == SimulationTime::Instance()->GetTime());
81}
82
83void AbstractSrnModel::SetCell(CellPtr pCell)
84{
85 mpCell = pCell;
86}
87
89{
90 assert(mpCell != nullptr);
91 return mpCell;
92}
93
94void AbstractSrnModel::SetSimulatedToTime(double simulatedToTime)
95{
96 mSimulatedToTime = simulatedToTime;
97}
98
100{
101 return mSimulatedToTime;
102}
103
104void AbstractSrnModel::OutputSrnModelInfo(out_stream& rParamsFile)
105{
106 std::string srn_model_type = GetIdentifier();
107
108 *rParamsFile << "\t\t<" << srn_model_type << ">\n";
109 OutputSrnModelParameters(rParamsFile);
110 *rParamsFile << "\t\t</" << srn_model_type << ">\n";
111}
112
114{
115}
116
118{
119 this->mEdgeLocalIndex = index;
120}
121
123{
124 return this->mEdgeLocalIndex;
125}
126
128{
129 return this->mIsEdgeBasedModel;
130}
131
132void AbstractSrnModel::SetEdgeModelIndicator(const bool isEdgeModel)
133{
134 this->mIsEdgeBasedModel = isEdgeModel;
135}
136
137/*
138 * We exclude the following from coverage, as these methods are implemented elsewhere and tested accordingly
139 * \todo These should have been declared abstract/virtual with void ScaleSrnVariables(const double theta) = 0; or similar
140 * ALERT: not all concrete class implement these methods!
141 */
142// LCOV_EXCL_START
144{
145}
146
148 const double scale)
149{
150}
151
155
158
161
162void AbstractSrnModel::SplitEdgeSrn(const double relativePosition)
163{}
164// LCOV_EXCL_STOP
165
const unsigned UNSIGNED_UNSET
Definition Exception.hpp:53
void SetSimulatedToTime(double simulatedToTime)
virtual void OutputSrnModelParameters(out_stream &rParamsFile)
void OutputSrnModelInfo(out_stream &rParamsFile)
virtual void SimulateToCurrentTime()=0
void SetEdgeLocalIndex(unsigned index)
void SetEdgeModelIndicator(const bool isEdgeModel)
virtual void AddSrnQuantities(AbstractSrnModel *pOtherSrn, const double scale=1.0)
virtual void AddShrunkEdgeToInterior(AbstractSrnModel *pShrunkEdgeSrn)
virtual void ScaleSrnVariables(const double theta)
virtual void SplitEdgeSrn(const double relativePosition)
virtual void SetCell(CellPtr pCell)
virtual void ResetForDivision()
double GetSimulatedToTime() const
bool HasEdgeModel() const
virtual void Initialise()
virtual void InitialiseDaughterCell()
virtual void AddMergedEdgeSrn(AbstractSrnModel *pMergedEdgeSrn)
virtual void AddShrunkEdgeSrn(AbstractSrnModel *pShrunkEdgeSrn)
std::string GetIdentifier() const
static SimulationTime * Instance()