MorphoGraphX  2.0-1-227
DynamXProcessPolarSurface.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_POLAR_SURFACE_HPP
14 #define DYNAMX_PROCESS_POLAR_SURFACE_HPP
15 
16 #include <Process.hpp>
17 #include <PolarSurface.hpp>
18 #include <Function.hpp>
19 
20 namespace mgx
21 {
22  // Process to hold polar surface parameters
23  class mgxBase_EXPORT PolarSurfaceParms : public Process
24  {
25  public:
26  PolarSurfaceParms(const Process &process) : Process(process) {}
27 
28  // Don't do anything, process is only for parms
29  bool run(const QStringList &) { return true; }
30 
31  // Functions for Gui
32  QString description() const { return "Parameters for Polar Surface"; }
33 
34  QStringList parmNames() const
35  {
36  // make a vector of size pNumParms containing the names of parameters for the GUI
37  QVector <QString> vec(PolarSurface::pNumParms);
38 
39  vec[PolarSurface::pGrowthType] = "GrowthType";
40  vec[PolarSurface::pSurfaceContour] = "SurfaceContour";
41  vec[PolarSurface::pArcLengthGrowth] = "ArcLengthGrowth";
42  vec[PolarSurface::pSurfaceScale] = "SurfaceScale";
43  vec[PolarSurface::pGrowthScaleInMult] = "GrowthScaleInMult";
44  vec[PolarSurface::pGrowthScaleOutMult] = "GrowthScaleOutMult";
45  vec[PolarSurface::pGrowthScaleFunc] = "GrowthScaleFunc";
46  vec[PolarSurface::pRootSearchMaxSteps] = "RootSearchMaxSteps";
47 
48  return vec.toList();
49  }
50  QStringList parmDescs() const
51  {
52  QVector <QString> vec(PolarSurface::pNumParms);
53 
54  vec[PolarSurface::pGrowthType] = "Arclength surface of revolution";
55  vec[PolarSurface::pSurfaceContour] = "Surface contour definition file";
56  vec[PolarSurface::pArcLengthGrowth] = "Arclength growth function";
57  vec[PolarSurface::pSurfaceScale] = "Contour function Multiplier";
58  vec[PolarSurface::pGrowthScaleInMult] = "Growth function Multiplier";
59  vec[PolarSurface::pGrowthScaleOutMult] = "Growth function Multiplier";
60  vec[PolarSurface::pGrowthScaleFunc] = "Growth scale function";
61  vec[PolarSurface::pRootSearchMaxSteps] = "Max number of iterations for point inversion";
62 
63  return vec.toList();
64  }
65  QStringList parmDefaults() const
66  {
67  QVector <QString> vec(PolarSurface::pNumParms);
68 
69  vec[PolarSurface::pGrowthType] = "0";
70  vec[PolarSurface::pSurfaceContour] = "Surface.con";
71  vec[PolarSurface::pArcLengthGrowth] = "Growth.func";
72  vec[PolarSurface::pSurfaceScale] = "100";
75  vec[PolarSurface::pGrowthScaleFunc] = "GrowthScale.func";
77 
78  return vec.toList();
79  }
80  // Icon file
81  QIcon icon() const { return QIcon(":/images/Parameters.png"); }
82  };
83 
84  class mgxBase_EXPORT PolarSurfaceGrowth : public Process
85  {
86  public:
87  PolarSurfaceGrowth(const Process &process) : Process(process) {}
88 
89  // Initialize the surface
90  bool initialize(QStringList &parms, QWidget *parent);
91 
92  // Run a step of the growth
93  bool step(const QStringList &parms);
94 
95  // Rewind the surface
96  bool rewind(QStringList &parms, QWidget *parent);
97 
98  // Process long description
99  QString description() const { return "Growing polar surface"; }
100 
101  // Parameters
102  enum ParmNames { pDt, pDrawSteps, pCellInitWalls, pCellInitSize, pCellKill,
103  pTissueParmsProc, pSurfaceParmsProc, pNumParms };
104 
105  QStringList parmNames() const
106  {
107  QVector <QString> vec(pNumParms);
108 
109  vec[pDt] = "Dt";
110  vec[pDrawSteps] = "DrawSteps";
111  vec[pCellInitWalls] = "CellInitWalls";
112  vec[pCellInitSize] = "CellInitSize";
113  vec[pCellKill] = "CellKill";
114  vec[pTissueParmsProc] = "Tissue Parms Process";
115  vec[pSurfaceParmsProc] = "Surface Parms Process";
116 
117  return vec.toList();
118  }
119 
120  QStringList parmDescs() const
121  {
122  QVector <QString> vec(pNumParms);
123 
124  vec[pDt] = "Growth timestep";
125  vec[pDrawSteps] = "Steps between drawn frames";
126  vec[pCellInitWalls] = "Initial cell walls";
127  vec[pCellInitSize] = "Size of initial cell";
128  vec[pCellKill] = "Distance from the tip to kill cell";
129  vec[pTissueParmsProc] = "Process to hold tissue parameters";
130  vec[pSurfaceParmsProc] = "Process to hold surface parameters";
131 
132  return vec.toList();
133  }
134 
135  QStringList parmDefaults() const
136  {
137  QVector <QString> vec(pNumParms);
138 
139  vec[pDt] = "0.1";
140  vec[pDrawSteps] = "3";
141  vec[pCellInitWalls] = "6";
142  vec[pCellInitSize] = "10";
143  vec[pCellKill] = "80";
144  vec[pTissueParmsProc] = "TissueParms";
145  vec[pSurfaceParmsProc] = "SurfaceParms";
146 
147  return vec.toList();
148  }
149 
150  ParmChoiceMap parmChoice() const
151  {
152  ParmChoiceMap map;
153  return map;
154  }
155 
156  // Plug-in icon
157  QIcon icon() const { return QIcon(":/images/CellApex.png"); }
158 
159  // Apex surface
161 
162  private:
163  // Read parameters
164  bool processParms(const QStringList &parms);
165 
166  // Model parameters from GUI
167  double dt; // Timestep
168  int drawSteps; // Steps per GUI update
169  double cellKill; // Arclength to kill cells at
170  int cellInitWalls; // Initial cell number of walls
171  double cellInitSize; // Initial cell size
172 
173  // Mesh object
174  Mesh *mesh; // Current mesh
175  CellTissue *T; // Cellular tissue
176 
177  // Polar vertex atttributes
178  PolarSurface::VertexAttr *vertexAttr;
179 
180  // Define all global data you want to save in the mesh in the attributes
181  double &time()
182  {
183  return mesh->attributes().attrMap<QString, double>("PolarSurface Time")["Time"];
184  }
185  };
186 }
187 #endif
188 
mgx::PolarSurfaceGrowth::parmChoice
ParmChoiceMap parmChoice() const
Definition: DynamXProcessPolarSurface.hpp:150
mgx::PolarSurfaceGrowth::parmNames
QStringList parmNames() const
Definition: DynamXProcessPolarSurface.hpp:105
mgx::PolarSurfaceGrowth::pTissueParmsProc
@ pTissueParmsProc
Definition: DynamXProcessPolarSurface.hpp:103
Process.hpp
mgx::PolarSurface::pGrowthScaleFunc
@ pGrowthScaleFunc
Definition: PolarSurface.hpp:37
mgx::Mesh::attributes
const Attributes & attributes() const
Get the mesh attributes.
Definition: Mesh.hpp:187
mgx::PolarSurface::pSurfaceScale
@ pSurfaceScale
Definition: PolarSurface.hpp:36
PolarSurface.hpp
mgx::PolarSurfaceGrowth
Definition: DynamXProcessPolarSurface.hpp:84
mgx::PolarSurfaceParms::description
QString description() const
Definition: DynamXProcessPolarSurface.hpp:32
mgx::CellTissue
Definition: CellTissue.hpp:46
mgx::PolarSurface::pGrowthType
@ pGrowthType
Definition: PolarSurface.hpp:36
mgx::PolarSurfaceParms::run
bool run(const QStringList &)
Definition: DynamXProcessPolarSurface.hpp:29
mgx::PolarSurfaceGrowth::ParmNames
ParmNames
Definition: DynamXProcessPolarSurface.hpp:102
mgx::PolarSurfaceParms::icon
QIcon icon() const
Definition: DynamXProcessPolarSurface.hpp:81
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::PolarSurfaceGrowth::icon
QIcon icon() const
Definition: DynamXProcessPolarSurface.hpp:157
mgx::PolarSurfaceGrowth::description
QString description() const
Definition: DynamXProcessPolarSurface.hpp:99
mgx::PolarSurface::pGrowthScaleInMult
@ pGrowthScaleInMult
Definition: PolarSurface.hpp:37
mgx::PolarSurface::pArcLengthGrowth
@ pArcLengthGrowth
Definition: PolarSurface.hpp:36
mgx::PolarSurface
Definition: PolarSurface.hpp:32
mgx::PolarSurface::pRootSearchMaxSteps
@ pRootSearchMaxSteps
Definition: PolarSurface.hpp:37
mgx::Process
Definition: Process.hpp:219
mgx::PolarSurfaceGrowth::PolarSurfaceGrowth
PolarSurfaceGrowth(const Process &process)
Definition: DynamXProcessPolarSurface.hpp:87
mgx::PolarSurfaceParms::parmDescs
QStringList parmDescs() const
Definition: DynamXProcessPolarSurface.hpp:50
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::PolarSurfaceGrowth::parmDefaults
QStringList parmDefaults() const
Definition: DynamXProcessPolarSurface.hpp:135
mgx::PolarSurfaceParms
Definition: DynamXProcessPolarSurface.hpp:23
mgx::Mesh
Definition: Mesh.hpp:54
mgx::PolarSurfaceParms::PolarSurfaceParms
PolarSurfaceParms(const Process &process)
Definition: DynamXProcessPolarSurface.hpp:26
mgx::PolarSurfaceGrowth::pDt
@ pDt
Definition: DynamXProcessPolarSurface.hpp:102
mgx::PolarSurfaceGrowth::parmDescs
QStringList parmDescs() const
Definition: DynamXProcessPolarSurface.hpp:120
mgx::PolarSurface::pGrowthScaleOutMult
@ pGrowthScaleOutMult
Definition: PolarSurface.hpp:37
Function.hpp
mgx::PolarSurfaceParms::parmNames
QStringList parmNames() const
Definition: DynamXProcessPolarSurface.hpp:34
mgx::PolarSurface::pNumParms
@ pNumParms
Definition: PolarSurface.hpp:37
mgx::PolarSurface::pSurfaceContour
@ pSurfaceContour
Definition: PolarSurface.hpp:36
mgx::PolarSurfaceParms::parmDefaults
QStringList parmDefaults() const
Definition: DynamXProcessPolarSurface.hpp:65
mgx::AttrMap
Attribute map wraps std::map.
Definition: Attributes.hpp:686
mgx::PolarSurfaceGrowth::polarSurface
PolarSurface polarSurface
Definition: DynamXProcessPolarSurface.hpp:160
mgx::map
CU_HOST_DEVICE Vector< dim, T > map(const T &(*fct)(const T1 &), const Vector< dim, T1 > &v)
Definition: Vector.hpp:1380