MorphoGraphX  2.0-1-227
DynamXProcessUniformGrowth.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2016 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 
12 // Surface class
13 #ifndef DYNAMX_PROCESS_UNIFORM_GROWTH_HPP
14 #define DYNAMX_PROCESS_UNIFORM_GROWTH_HPP
15 
16 #include <Process.hpp>
17 
18 namespace mgx
19 {
20  class mgxBase_EXPORT UniformGrowth : public Process
21  {
22  public:
23  UniformGrowth(const Process &process) : Process(process) {}
24 
25  // Initialize the surface
26  bool initialize(QStringList &parms, QWidget *parent);
27 
28  // Run a step of the growth
29  bool step(const QStringList &parms);
30 
31  // Rewind the surface
32  bool rewind(QStringList &parms, QWidget *parent);
33 
34  // Process long description
35  QString description() const { return "Uniform growth"; }
36 
37  // Parameters
38  enum ParmNames { pDt, pDrawSteps, pXGrowth, pYGrowth, pZGrowth, pTissueParmsProc, pNumParms };
39 
40  QStringList parmNames() const
41  {
42  QVector <QString> vec(pNumParms);
43 
44  vec[pDt] = "Dt";
45  vec[pDrawSteps] = "DrawSteps";
46  vec[pXGrowth] = "X Growth";
47  vec[pYGrowth] = "Y Growth";
48  vec[pZGrowth] = "Z Growth";
49  vec[pTissueParmsProc] = "Tissue Parms Process";
50 
51  return vec.toList();
52  }
53 
54  QStringList parmDescs() const
55  {
56  QVector <QString> vec(pNumParms);
57 
58  vec[pDt] = "Growth timestep";
59  vec[pDrawSteps] = "Steps between drawn frames";
60  vec[pXGrowth] = "Growth in X direction";
61  vec[pYGrowth] = "Growth in Y direction";
62  vec[pZGrowth] = "Growth in Z direction";
63  vec[pTissueParmsProc] = "Process to hold tissue parameters";
64 
65  return vec.toList();
66  }
67 
68  QStringList parmDefaults() const
69  {
70  QVector <QString> vec(pNumParms);
71 
72  vec[pDt] = "0.001";
73  vec[pDrawSteps] = "1";
74  vec[pXGrowth] = "2.0";
75  vec[pYGrowth] = "1.0";
76  vec[pZGrowth] = "0.0";
77  vec[pTissueParmsProc] = "TissueParms";
78 
79  return vec.toList();
80  }
81 
82  ParmChoiceMap parmChoice() const
83  {
84  ParmChoiceMap map;
85  return map;
86  }
87 
88  // Plug-in icon
89  QIcon icon() const { return QIcon(":/images/Closing.png"); }
90 
91  private:
92  // Read parameters
93  void processParms(const QStringList &parms);
94 
95  // Model parameters from GUI
96  double dt; // Timestep
97  int drawSteps; // Steps per GUI update
98  Point3d growthRate; // Growth Rate
99 
100  // Mesh object
101  Mesh *mesh; // Current mesh
102  CellTissue *T; // Cellular tissue
103 
104  // Define all global data you want to save in the mesh in the attributes
105  double &time()
106  {
107  return mesh->attributes().attrMap<QString, double>("UniformGrowth Time")["Time"];
108  }
109  };
110 
118  class mgxBase_EXPORT UniformInitialCell : public Process
119  {
120  public:
121  UniformInitialCell(const Process &process) : Process(process) {}
122 
124  bool run(const QStringList &parms)
125  {
126  Mesh *mesh = currentMesh();
127  if(not mesh)
128  throw(QString("No current mesh"));
129  return run(mesh, parms[0].toDouble(), parms[1].toInt());
130  }
131  bool run(Mesh* mesh, double size, int walls);
132 
133  // Functions for Gui
134  QString description() const { return "Create an initial cell."; }
135  QStringList parmNames() const { return QStringList() << "Size" << "Walls"; }
136  QStringList parmDescs() const { return QStringList()
137  << "Size of the cell" << "Number of walls"; }
138  QStringList parmDefaults() const { return QStringList() << "5.0" << "7"; }
139 
140  // Icon file
141  QIcon icon() const { return QIcon(":/images/InitialCell.png"); }
142  };
143 }
144 #endif
mgx::UniformInitialCell::parmNames
QStringList parmNames() const
Definition: DynamXProcessUniformGrowth.hpp:135
Process.hpp
mgx::Mesh::attributes
const Attributes & attributes() const
Get the mesh attributes.
Definition: Mesh.hpp:187
mgx::UniformGrowth::UniformGrowth
UniformGrowth(const Process &process)
Definition: DynamXProcessUniformGrowth.hpp:23
mgx::UniformInitialCell::icon
QIcon icon() const
Definition: DynamXProcessUniformGrowth.hpp:141
mgx::UniformInitialCell::description
QString description() const
Definition: DynamXProcessUniformGrowth.hpp:134
mgx::CellTissue
Definition: CellTissue.hpp:46
mgx::UniformGrowth::ParmNames
ParmNames
Definition: DynamXProcessUniformGrowth.hpp:38
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::UniformInitialCell::UniformInitialCell
UniformInitialCell(const Process &process)
Definition: DynamXProcessUniformGrowth.hpp:121
mgx::Process
Definition: Process.hpp:219
mgx::UniformGrowth::icon
QIcon icon() const
Definition: DynamXProcessUniformGrowth.hpp:89
mgx::UniformInitialCell::parmDefaults
QStringList parmDefaults() const
Definition: DynamXProcessUniformGrowth.hpp:138
mgx::Attributes::attrMap
AttrMap< KeyT, ValueT > & attrMap(const QString &name, bool saveRequired=true)
Get the attribute, if it does not exist create it and add to the set If it exists,...
Definition: Attributes.hpp:1116
mgx::UniformGrowth::pZGrowth
@ pZGrowth
Definition: DynamXProcessUniformGrowth.hpp:38
mgx::UniformGrowth::parmChoice
ParmChoiceMap parmChoice() const
Definition: DynamXProcessUniformGrowth.hpp:82
mgx::UniformInitialCell::parmDescs
QStringList parmDescs() const
Definition: DynamXProcessUniformGrowth.hpp:136
mgx::UniformGrowth::parmDefaults
QStringList parmDefaults() const
Definition: DynamXProcessUniformGrowth.hpp:68
mgx::Mesh
Definition: Mesh.hpp:54
mgx::Vector< 3, double >
mgx::UniformGrowth::parmDescs
QStringList parmDescs() const
Definition: DynamXProcessUniformGrowth.hpp:54
mgx::UniformInitialCell::run
bool run(const QStringList &parms)
Make the initial cell.
Definition: DynamXProcessUniformGrowth.hpp:124
mgx::UniformGrowth
Definition: DynamXProcessUniformGrowth.hpp:20
mgx::UniformGrowth::parmNames
QStringList parmNames() const
Definition: DynamXProcessUniformGrowth.hpp:40
mgx::UniformGrowth::description
QString description() const
Definition: DynamXProcessUniformGrowth.hpp:35
mgx::UniformInitialCell
Definition: DynamXProcessUniformGrowth.hpp:118
mgx::map
CU_HOST_DEVICE Vector< dim, T > map(const T &(*fct)(const T1 &), const Vector< dim, T1 > &v)
Definition: Vector.hpp:1380