VPTissue Reference Manual
cell2cell_transport/WrapperModel.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "WrapperModel.h"
21 
22 #include "bio/Cell.h"
23 #include "bio/Wall.h"
24 #include "sim/CoreData.h"
25 
26 #include <boost/property_tree/ptree.hpp>
27 
28 namespace SimPT_Default {
29 namespace CellToCellTransport {
30 
31 using namespace std;
32 using namespace boost::property_tree;
33 
35 {
36  Initialize(cd);
37 }
38 
40 {
41  m_cd = cd;
42 
43  auto& p = m_cd.m_parameters;
44  m_chemical_count = p->get<unsigned int>("model.cell_chemical_count");
45 
46  // m_d = p->get<double>("test_coupling.D[0]");
47  ptree const& arr_D = p->get_child("wrapper_model.D.value_array");
48  unsigned int c = 0;
49  for (auto it = arr_D.begin(); it != arr_D.end(); it++) {
50  if (c == m_chemical_count) {
51  break;
52  }
53  m_D.push_back(it->second.get_value<double>());
54  c++;
55  }
56  // Defensive: if fewer than chemical_count parameters were specified, fill up.
57  for (unsigned int i = c; i < m_chemical_count; i++) {
58  m_D.push_back(0.0);
59  }
60 }
61 
62 void WrapperModel::operator()(Wall* w, double* dchem_c1, double* dchem_c2)
63 {
64  if ( !(w->GetC1()->IsBoundaryPolygon()) && !(w->GetC2()->IsBoundaryPolygon()) )
65  {
66  const double apoplast_thickness = 1.;
67 
68  const double phi = (w->GetLength() / apoplast_thickness) * m_D[0] * ( ( w->GetC2()->GetChemical(0) / (w->GetC2()->GetArea()) )
69  - ( w->GetC1()->GetChemical(0) / (w->GetC1()->GetArea()) ) ); //LEVELS!
70 
71  dchem_c1[0] += phi; //LEVELS!
72  dchem_c2[0] -= phi; //LEVELS!
73 
74  //DDV2012: diffusive hormone - chemical '1'
75  const double phi2 = (w->GetLength() / apoplast_thickness) * m_D[1] * ( ( w->GetC2()->GetChemical(1) / (w->GetC2()->GetArea()) )
76  - ( w->GetC1()->GetChemical(1) / (w->GetC1()->GetArea()) ) ); //LEVELS!
77 
78  dchem_c1[1] += phi2 ; //LEVELS!
79  dchem_c2[1] -= phi2 ; //LEVELS!
80 
81  if (w->GetC1()->GetIndex() < 4) {dchem_c1[0] = 0.0; dchem_c1[1] = 0.0;}
82  if (w->GetC2()->GetIndex() < 4) {dchem_c2[0] = 0.0; dchem_c2[1] = 0.0;}
83  }
84 }
85 
86 } // namespace
87 } // namespace
88 
Core data with mesh, parameters, random engine and time data.
Definition: CoreData.h:38
STL namespace.
Core data used during model execution.
Namespace for components of the Default model group.
Interface for Cell.
int GetIndex() const
Return the index.
Definition: Cell.h:76
double GetLength() const
Returns (and calculates, if length marked as dirty) the length along all nodes.
Definition: Wall.cpp:97
WrapperModel(const CoreData &cd)
Initializing constructor.
void Initialize(const CoreData &cd)
Initialize or re-initialize.
CellToCellTransport for Wrapper model.
void operator()(Wall *w, double *dchem_c1, double *dchem_c2)
Execute.
double GetArea() const
Return the area of the cell.
Definition: Cell.cpp:178
A cell wall, runs between cell corner points and consists of wall elements.
Definition: Wall.h:48
Interface for Wall.