32 using boost::optional;
35 CellAttributes::CellAttributes(
unsigned int chem_count)
37 m_chem(chem_count), m_dead(false), m_div_counter(0), m_div_time(10000), m_fixed(false),
38 m_solute(0.0), m_stiffness(0.0), m_target_area(1.0), m_target_length(0.0)
42 double CellAttributes::GetChemical(
unsigned int c)
const
44 assert( (c < m_chem.size()) &&
"CellAttributes::GetChemical> chemical index out of bounds!");
48 ostream& CellAttributes::Print(ostream& os)
const
50 os <<
"CellAttributes: {" << endl;
51 os <<
"\t chemicals: [ ";
52 for (
auto const& c : m_chem) {
57 os <<
"\t cell_type = " << m_cell_type << endl;
62 void CellAttributes::ReadPtree(
const ptree& cell_pt)
65 m_boundary_type = FromString<BoundaryType>(cell_pt.get<
string>(
"boundary",
"None"));
66 m_cell_type = cell_pt.get<
unsigned int>(
"type");
67 m_dead = cell_pt.get<
bool>(
"dead");
68 m_div_counter = cell_pt.get<
unsigned int>(
"division_count", 0U);
69 m_fixed = cell_pt.get<
bool>(
"fixed");
70 m_solute = cell_pt.get<
double>(
"solute");
72 m_target_area = cell_pt.get<
double>(
"target_area");
73 m_target_length = cell_pt.get<
double>(
"target_length");
75 optional<ptree const&> chemical_array_pt = cell_pt.get_child_optional(
"chemical_array");
76 if (chemical_array_pt) {
77 assert( (m_chem.size() == chemical_array_pt->size())
78 &&
"size of chemical_array in xml file does not match chemical_count");
79 unsigned int chem_i = 0;
80 for (
auto const& chem_v : *chemical_array_pt) {
81 m_chem[chem_i++] = chem_v.second.get_value<
double>();
86 const string here = string(VL_HERE) +
" exception:\n";
91 void CellAttributes::SetChemical(
unsigned int c,
double conc)
93 assert( (c < m_chem.size()) &&
"CellAttributes::SetChemical> chemical index out of bounds!");
97 void CellAttributes::SetChemicals(vector<double>
const& chem)
99 assert((chem.size() == m_chem.size()) &&
"CellAttributes::SetChemicals> vector size inconsistent!");
106 ret.put(
"boundary",
ToString(m_boundary_type));
107 ret.put(
"dead", m_dead);
108 ret.put(
"division_count", m_div_counter);
109 ret.put(
"fixed", m_fixed);
110 ret.put(
"solute", m_solute);
111 ret.put(
"stiffness", m_stiffness);
112 ret.put(
"target_area", m_target_area);
113 ret.put(
"target_length", m_target_length);
114 ret.put(
"type", m_cell_type);
116 for (
const auto& chem : m_chem) {
117 ret.add(
"chemical_array.chemical", chem);
double m_stiffness
Stiffness like in Hogeweg (2000).
Namespace for miscellaneous utilities.
string ToString(Type w)
Converts a WallType::Type value to corresponding name.
bool m_dead
For future use, when apoptosis gets set up.
Extremely simple Exception root class.
Namespace for the core simulator.
int m_div_counter
Keep track of divisions in the cell ancestry.
Macro defs for debug and logging.
BoundaryType
Enumerates cell boundary types.
BoundaryType enumeration class.
virtual boost::property_tree::ptree ToPtree() const
Convert the cell attributes to a ptree.
Interface for CellAttributes.
Header file for Exception class.