MEDYAN  3.1
Software for simulating active matter dynamics
Linker.h
Go to the documentation of this file.
1 
2 //------------------------------------------------------------------
3 // **MEDYAN** - Simulation Package for the Mechanochemical
4 // Dynamics of Active Networks, v3.1
5 //
6 // Copyright (2015-2016) Papoian Lab, University of Maryland
7 //
8 // ALL RIGHTS RESERVED
9 //
10 // See the MEDYAN web page for more information:
11 // http://www.medyan.org
12 //------------------------------------------------------------------
13 
14 #ifndef MEDYAN_Linker_h
15 #define MEDYAN_Linker_h
16 
17 #include "common.h"
18 
19 #include "Composite.h"
20 #include "CLinker.h"
21 #include "MLinker.h"
22 
23 #include "Database.h"
24 #include "Histogram.h"
25 #include "Trackable.h"
26 #include "Movable.h"
27 #include "Reactable.h"
28 #include "RateChangerImpl.h"
29 
30 //FORWARD DECLARATIONS
31 class Cylinder;
32 class Controller;
33 class DRController;
34 
36 
46 class Linker : public Component, public Trackable, public Movable, public Reactable {
47 
48 friend class Controller;
49 friend class DRController;
50 
51 private:
52  unique_ptr<MLinker> _mLinker;
53  unique_ptr<CLinker> _cLinker;
54 
57 
58  double _position1;
59  double _position2;
60 
61  short _linkerType;
62  int _linkerID;
63 
64  float _birthTime;
65 
67 
70 
72  static Histogram* _lifetimes;
75 
77  static vector<LinkerRateChanger*> _unbindingChangers;
78 
80  void updateCoordinate();
81 
82 public:
83  vector<double> coordinate;
85 
86  Linker(Cylinder* c1, Cylinder* c2, short linkerType,
87  double position1 = 0.5, double position2 = 0.5);
88 
89  virtual ~Linker() noexcept;
90 
92  Cylinder* getFirstCylinder() {return _c1;}
96 
98  void setCLinker(CLinker* cLinker) {_cLinker = unique_ptr<CLinker>(cLinker);}
100  CLinker* getCLinker() {return _cLinker.get();}
101 
103  MLinker* getMLinker() {return _mLinker.get();}
104 
106  double getFirstPosition() {return _position1;}
108  void setFirstPosition(double position1) {_position1 = position1;}
109 
110  double getSecondPosition() {return _position2;}
111  void setSecondPosition(double position2) {_position2 = position2;}
113 
115  virtual int getType() {return _linkerType;}
117  int getID() {return _linkerID;}
119 
121  float getBirthTime() {return _birthTime;}
122 
124  virtual void addToSubSystem() { _linkers.addElement(this);}
126  virtual void removeFromSubSystem() {_linkers.removeElement(this);}
128 
130  static const vector<Linker*>& getLinkers() {
131  return _linkers.getElements();
132  }
134  static int numLinkers() {
135  return _linkers.countElements();
136  }
137 
139  static Histogram* getLifetimes() {return _lifetimes;}
140 
143  virtual void updatePosition();
144 
146  virtual void updateReactionRates();
147 
148  virtual void printSelf();
149 
151  static species_copy_t countSpecies(const string& name);
152 };
153 
154 
155 #endif
vector< T > & getElements()
Get all items in database.
Definition: Database.h:69
double _position2
Position on second cylinder.
Definition: Linker.h:59
Used to initialize, manage, and run an entire simulation.
Definition: Controller.h:40
int getID()
Get linker parameter.
Definition: Linker.h:117
unsigned int species_copy_t
Species constants.
Definition: common.h:24
virtual void removeFromSubSystem()
SubSystem management, inherited from Trackable.
Definition: Linker.h:126
virtual void printSelf()
Prints information about this node. Useful for debugging.
Definition: Linker.cpp:167
static const vector< Linker * > & getLinkers()
Get all instances of this class from the SubSystem.
Definition: Linker.h:130
int _linkerID
Integer ID of this specific linker, managed by Database.
Definition: Linker.h:62
A container or holding Species and Reactions.
Definition: Compartment.h:49
static Histogram * getLifetimes()
Get the lifetimes.
Definition: Linker.h:139
Cylinder * getSecondCylinder()
Get attached cylinder.
Definition: Linker.h:94
An abstract base class for a movable element in the SubSystem.
Definition: Movable.h:25
A collection class to hold instances of a given class.
Definition: Database.h:38
virtual void addToSubSystem()
SubSystem management, inherited from Trackable.
Definition: Linker.h:125
double _position1
Position on first cylinder.
Definition: Linker.h:58
An abstract base class for a trackable object in the SubSystem.
Definition: Trackable.h:33
virtual size_t countSpecies() const
Return the number of Species contained under this node&#39;s hieararchy.
Definition: Component.h:122
void setSecondPosition(double position2)
Position management.
Definition: Linker.h:111
float _birthTime
Definition: Linker.h:64
CLinker * getCLinker()
Get chem linker.
Definition: Linker.h:100
A container to store a MCylinder and CCylinder.
Definition: Cylinder.h:50
unique_ptr< CLinker > _cLinker
Pointer to chem linker.
Definition: Linker.h:53
An abstract base class for a reactable element in the SubSystem.
Definition: Reactable.h:25
unique_ptr< MLinker > _mLinker
Pointer to mech linker.
Definition: Linker.h:52
static Histogram * _lifetimes
Histogram data.
Definition: Linker.h:73
Used to initialize the dynamic rate components of a simulation.
Definition: DRController.h:30
void updateCoordinate()
Helper to get coordinate.
Definition: Linker.cpp:29
A container to store a MLinker and CLinker.
Definition: Linker.h:46
virtual int getType()
Get linker parameter.
Definition: Linker.h:116
double getFirstPosition()
Position management.
Definition: Linker.h:107
To represent the chemical component of a Linker.
Definition: CLinker.h:35
Represents the mechanical component of a Linker.
Definition: MLinker.h:33
Cylinder * getFirstCylinder()
Get attached cylinder.
Definition: Linker.h:93
double getSecondPosition()
Position management.
Definition: Linker.h:110
void setCLinker(CLinker *cLinker)
Set chem linker.
Definition: Linker.h:98
void setFirstPosition(double position1)
Position management.
Definition: Linker.h:108
virtual void updatePosition()
Update the position, inherited from Movable.
Definition: Linker.cpp:94
The base class for the Composite pattern hieararchy.
Definition: Component.h:37
void removeElement(T elem)
Remove an element from the collection.
Definition: Database.h:58
short _linkerType
Integer specifying the type.
Definition: Linker.h:61
static int numLinkers()
Get the number of linkers in this system.
Definition: Linker.h:134
Compartment * _compartment
Birth time.
Definition: Linker.h:66
Cylinder * _c1
First cylinder the linker is bound to.
Definition: Linker.h:55
A class to hold frequency of occurences in a general set of data.
Definition: Histogram.h:30
Cylinder * _c2
Second cylinder the linker is bound to.
Definition: Linker.h:56
virtual void updateReactionRates()
Update the reaction rates, inherited from Reactable.
Definition: Linker.cpp:147
virtual ~Linker() noexcept
Definition: Linker.cpp:83
float getBirthTime()
Get the birth time.
Definition: Linker.h:121
int countElements()
Count the number of objects in the collection.
Definition: Database.h:72
Linker(Cylinder *c1, Cylinder *c2, short linkerType, double position1=0.5, double position2=0.5)
Definition: Linker.cpp:42
static vector< LinkerRateChanger * > _unbindingChangers
For dynamic rate unbinding.
Definition: Linker.h:77
void addElement(T elem)
Add an element to the collection.
Definition: Database.h:52
vector< double > coordinate
coordinate of midpoint, updated with updatePosition()
Definition: Linker.h:83
MLinker * getMLinker()
Get mech linker.
Definition: Linker.h:103
static Database< Linker * > _linkers
Collection in SubSystem.
Definition: Linker.h:68