VPTissue Reference Manual
cell_color/Meinhardt.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 "Meinhardt.h"
21 
22 #include "bio/Cell.h"
23 
24 #include <boost/property_tree/ptree.hpp>
25 #include <array>
26 #include <cmath>
27 #include <stdexcept>
28 
29 namespace SimPT_Default {
30 namespace CellColor {
31 
32 using namespace std;
33 
34 Meinhardt::Meinhardt(const boost::property_tree::ptree&)
35 {
36 }
37 
38 array<double, 3> Meinhardt::operator()(SimPT_Sim::Cell* cell)
39 {
40  array<double, 3> ret_val {{1.0, 1.0, 1.0}};
41 
42  if (cell->GetChemicals().size() >= 4) {
43  const double x0 = cell->GetChemical(0);
44  const double x1 = cell->GetChemical(1);
45  const double x3 = cell->GetChemical(3);
46  if ((fpclassify(x0) == FP_NAN) || (x0 < 0.0)) {
47  throw runtime_error("Meinhardt::CellColor> Numerical instability !");
48  }
49  ret_val = {{x1/(1.0+x1), x0/(1.0+x0), x3/(1.0+x3)}};
50  }
51 
52  return ret_val;
53 }
54 
55 } // namespace
56 } // namespace
57 
58 
STL namespace.
A cell contains walls and nodes.
Definition: Cell.h:48
CellColor::Meinhardt header file.
Meinhardt(const boost::property_tree::ptree &pt)
Straight initialization.
Namespace for components of the Default model group.
Interface for Cell.
std::array< double, 3 > operator()(SimPT_Sim::Cell *cell)
Return colr value.