MEDYAN  3.1
Software for simulating active matter dynamics
GController.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_GController_h
15 #define MEDYAN_GController_h
16 
17 #include <vector>
18 
19 #include "common.h"
20 
21 #include "Parser.h"
22 
24 class OutOfBoundsException : public exception {
25 
26  virtual const char* what() const throw() {
27  return "An element is out of the bounds of the grid. Try adjusting minimization parameters.";
28  }
29 };
30 
32 class NaNCoordinateException : public exception {
33 
34  virtual const char* what() const throw() {
35  return "A element coordinate is NaN. Try adjusting minimization parameters.";
36  }
37 
38 };
39 
40 //FORWARD DECLARATIONS
41 class Boundary;
42 class Compartment;
43 class CompartmentGrid;
44 class SubSystem;
45 
48 
56 class GController {
57 
58 friend class Output;
59 
60 private:
61  static short _nDim;
62  static vector<int> _grid;
63  static vector<double> _compartmentSize;
64  static vector<double> _centerGrid;
65  static vector<double> _size;
66 
68 
70 
72 
74  void generateConnections();
75 
76 public:
78  GController(SubSystem* ps) : _subSystem(ps) {}
79 
82  CompartmentGrid* initializeGrid();
83 
86  Boundary* initializeBoundary(BoundaryType& BType);
87 
90  void setActiveCompartments();
91 
93  const SubSystem* getSubSystem() const {return _subSystem;}
94 
96  static Compartment* getCompartment(const vector<size_t> &indices);
98  static Compartment* getCompartment(const vector<double> &coords);
100 
102  static const vector<double>& getCenter() {return _centerGrid;}
103  static const vector<double>& getSize() {return _size;}
104 
109  static void findCompartments(const vector<double>& coords,
110  Compartment* ccheck, double dist,
111  vector<Compartment*>& compartments);
112 
114  static Compartment* getRandomCompartment();
115 
117  static vector<double> getRandomCoordinates(Compartment* c);
118 
120  static vector<double> getRandomCoordinates();
121 };
122 
123 #endif
static vector< double > _size
The size of the full grid in each dimension.
Definition: GController.h:65
virtual const char * what() const
Definition: GController.h:34
SubSystem * _subSystem
Definition: Output.h:38
An exception to be thrown when an index/coordinate is NaN.
Definition: GController.h:32
A container or holding Species and Reactions.
Definition: Compartment.h:49
virtual const char * what() const
Definition: GController.h:26
static const vector< double > & getCenter()
Get the center of the grid space.
Definition: GController.h:102
static CompartmentGrid * _compartmentGrid
The compartment grid.
Definition: GController.h:67
static short _nDim
Number of dimensions in the system.
Definition: GController.h:61
GController(SubSystem *ps)
Constructor sets SubSystem.
Definition: GController.h:78
To store all BoundarySurfaces that are in the SubSystem.
Definition: Boundary.h:36
To print a specified output into a file.
Definition: Output.h:34
static vector< double > _compartmentSize
Compartment size in each dimension.
Definition: GController.h:63
Struct to hold the parameters of the Boundary.
Definition: Parser.h:199
static const vector< double > & getSize()
Definition: GController.h:103
SubSystem * _subSystem
SubSystem ptr.
Definition: GController.h:71
A simple n-dimensional grid of Compartment objects.
An exception to be thrown when an index/coordinate is out of bounds of the grid.
Definition: GController.h:24
Used to control the geometry of the CompartmentGrid, as well as the geometry of the entire system...
Definition: GController.h:56
static vector< int > _grid
Size of each dimension, in compartment lengths.
Definition: GController.h:62
Manages all Movables and Reactables.
Definition: SubSystem.h:57
const SubSystem * getSubSystem() const
Get the SubSystem ptr.
Definition: GController.h:93
static vector< double > _centerGrid
The center of the grid.
Definition: GController.h:64
Boundary * _boundary
The boundary that this controls.
Definition: GController.h:69