Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
AbstractSrnModel.hpp
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#ifndef ABSTRACTSRNMODEL_HPP_
37#define ABSTRACTSRNMODEL_HPP_
38
40#include "ClassIsAbstract.hpp"
41#include "Identifiable.hpp"
42
43#include <boost/serialization/base_object.hpp>
44
45#include <vector>
46
47#include "Cell.hpp"
48#include "Exception.hpp"
49#include "OutputFileHandler.hpp"
50#include "SimulationTime.hpp"
51
52class Cell; // Circular definition (cells need to know about SRN models and vice-versa)
53typedef boost::shared_ptr<Cell> CellPtr;
54
62{
63private:
64
73 template<class Archive>
74 void serialize(Archive & archive, const unsigned int version)
75 {
76 // Make sure the SimulationTime singleton gets saved too
78 archive & p_time_wrapper;
79
80 // DO NOT archive & mpCell; -- The SrnModel is only ever archived from the Cell
81 // which knows this and it is handled in the load_construct of Cell.
82 archive & mSimulatedToTime;
83 archive & mEdgeLocalIndex;
84 archive & mIsEdgeBasedModel;
85 }
86
97
98protected:
99
101 CellPtr mpCell;
102
105
108
110 bool mIsEdgeBasedModel = false;
111
129 AbstractSrnModel(const AbstractSrnModel& rModel);
130
131public:
132
138
144 virtual ~AbstractSrnModel();
145
151 virtual void SetCell(CellPtr pCell);
152
164 virtual void Initialise();
165
178 virtual void InitialiseDaughterCell();
179
183 CellPtr GetCell();
184
190 void SetSimulatedToTime(double simulatedToTime);
191
195 double GetSimulatedToTime() const;
196
203 virtual void SimulateToCurrentTime()=0;
204
213 virtual void ResetForDivision();
214
233
240 void OutputSrnModelInfo(out_stream& rParamsFile);
241
250 virtual void OutputSrnModelParameters(out_stream& rParamsFile);
251
256 void SetEdgeLocalIndex(unsigned index);
257
262 unsigned GetEdgeLocalIndex();
263
268 bool HasEdgeModel() const;
269
275 void SetEdgeModelIndicator(const bool isEdgeModel);
276
283 virtual void ScaleSrnVariables(const double theta);
284
293 virtual void AddSrnQuantities(AbstractSrnModel* pOtherSrn,
294 const double scale = 1.0);
295
302 virtual void AddShrunkEdgeSrn(AbstractSrnModel* pShrunkEdgeSrn);
303
310 virtual void AddMergedEdgeSrn(AbstractSrnModel* pMergedEdgeSrn);
311
318 virtual void AddShrunkEdgeToInterior(AbstractSrnModel* pShrunkEdgeSrn);
319
327 virtual void SplitEdgeSrn(const double relativePosition);
328};
329
331
332#endif /* ABSTRACTSRNMODEL_HPP_ */
#define CLASS_IS_ABSTRACT(T)
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
AbstractSrnModel & operator=(const AbstractSrnModel &)
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 AbstractSrnModel * CreateSrnModel()=0
virtual void SetCell(CellPtr pCell)
virtual void ResetForDivision()
void serialize(Archive &archive, const unsigned int version)
double GetSimulatedToTime() const
friend class boost::serialization::access
bool HasEdgeModel() const
virtual void Initialise()
virtual void InitialiseDaughterCell()
virtual void AddMergedEdgeSrn(AbstractSrnModel *pMergedEdgeSrn)
virtual void AddShrunkEdgeSrn(AbstractSrnModel *pShrunkEdgeSrn)
Definition Cell.hpp:92
SerializableSingleton< SINGLETON_CLASS > * GetSerializationWrapper() const
static SimulationTime * Instance()