44 using boost::optional;
56 bool is_intersecting(
const array<double, 3>& v1,
const array<double, 3>& v2,
57 const array<double, 3>& v3,
const array<double, 3>& v4)
59 double const denominator = (v4[1] - v3[1]) * (v2[0] - v1[0]) - (v4[0] - v3[0]) * (v2[1] - v1[1]);
60 double const ua = ((v4[0] - v3[0]) * (v1[1] - v3[1]) - (v4[1] - v3[1]) * (v1[0] - v3[0]))
62 double const ub = ((v2[0] - v1[0]) * (v1[1] - v3[1]) - (v2[1] - v1[1]) * (v1[0] - v3[0]))
65 return (0.0 < ua) && (ua < 1.0) && (0.0 < ub) && (ub < 1.0);
72 Cell::Cell(
int index,
unsigned int chem_count)
74 m_dirty_area(true), m_dirty_centroid(true), m_dirty_geo_data(true)
78 void Cell::AddWall(
Wall* w)
84 void Cell::CalculateArea()
const
90 const double i_x = (*(*cit))[0];
91 const double i_y = (*(*cit))[1];
92 const double n_x = (*(*
next(cit)))[0];
93 const double n_y = (*(*
next(cit)))[1];
95 a += i_x * n_y - n_x * i_y;
96 }
while (++cit != m_nodes.begin());
98 m_geo_data.m_area = abs(a) / 2.0;
102 void Cell::CalculateCentroid()
const
110 const double i_x = (*(*cit))[0];
111 const double i_y = (*(*cit))[1];
112 const double n_x = (*(*
next(cit)))[0];
113 const double n_y = (*(*
next(cit)))[1];
115 a += i_x * n_y - n_x * i_y;
116 x += (n_x + i_x) * (i_x * n_y - n_x * i_y);
117 y += (n_y + i_y) * (i_x * n_y - n_x * i_y);
119 }
while (++cit != m_nodes.begin());
121 m_geo_data.m_area = 0.5 * abs(a);
122 m_geo_data.m_centroid = array<double, 3> {{ x / (3.0 * a), y / (3.0 * a), 0.0}};
123 m_dirty_area =
false;
124 m_dirty_centroid =
false;
127 void Cell::CalculateGeoData()
const
138 const double i_x = (*(*cit))[0];
139 const double i_y = (*(*cit))[1];
140 const double n_x = (*(*
next(cit)))[0];
141 const double n_y = (*(*
next(cit)))[1];
143 a += i_x * n_y - n_x * i_y;
144 x += (n_x + i_x) * (i_x * n_y - n_x * i_y);
145 y += (n_y + i_y) * (i_x * n_y - n_x * i_y);
146 xx += (i_x * i_x + n_x * i_x + n_x * n_x) * (i_x * n_y - n_x * i_y);
147 xy += (n_x * i_y - i_x * n_y) * (i_x * (2 * i_y + n_y) + n_x * (i_y + 2 * n_y));
148 yy += (i_x * n_y - n_x * i_y) * (i_y * i_y + n_y * i_y + n_y * n_y);
150 }
while (++cit != m_nodes.begin());
152 m_geo_data.m_area = abs(a) / 2.0;
153 m_geo_data.m_centroid = array<double, 3> {{ x / (3.0 * a), y / (3.0 * a), 0.0}};
154 m_geo_data.m_area_moment =
AreaMoment(xx / 12.0, xy / 24.0, yy / 12.0);
156 m_dirty_area =
false;
157 m_dirty_centroid =
false;
158 m_dirty_geo_data =
false;
164 ret.put(
"id", m_index);
166 ret.put(
"at_boundary", HasBoundaryWall());
168 for (
const auto& node : m_nodes) {
169 ret.add(
"node_array.node", node->GetIndex());
171 for (
const auto& wall : m_walls) {
172 ret.add(
"wall_array.wall", wall->GetIndex());
183 return m_geo_data.m_area;
194 const double i_x = (*(*cit))[0];
195 const double i_y = (*(*cit))[1];
196 const double n_x = (*(*
next(cit)))[0];
197 const double n_y = (*(*
next(cit)))[1];
199 a += i_x * n_y - n_x * i_y;
200 }
while (++cit != m_nodes.begin());
207 if (m_dirty_centroid) {
210 return m_geo_data.m_centroid;
215 double circumference = 0.0;
218 const double dx = (*(*
next(cit)))[0] - (*(*cit))[0];
219 const double dy = (*(*
next(cit)))[1] - (*(*cit))[1];
220 circumference += sqrt(dx * dx + dy * dy);
221 }
while (++cit != m_nodes.begin());
222 return circumference;
227 if (m_dirty_geo_data) {
236 for (
const auto& wall : m_walls) {
237 assert( (wall->GetC1() ==
this || wall->GetC2() ==
this) &&
"Error in cell <-> wall!" );
238 sum += (wall->GetC1() ==
this) ? wall->GetTransporters1(ch) : wall->GetTransporters2(ch);
243 bool Cell::HasEdge(
const Edge& edge)
const
248 if (
Edge(*cit, *
next(cit)) == edge) {
252 }
while(++cit != m_nodes.begin());
256 bool Cell::HasBoundaryWall()
const
259 for (
const auto& wall : m_walls) {
260 if (wall->IsAtBoundary()) {
268 bool Cell::HasNeighborOfTypeZero()
const
271 for (
const auto& wall : m_walls) {
277 if ( wall->GetC1()->GetIndex() != this->
GetIndex() ) {
278 if ( wall->GetC1()->GetIndex() != -1 ) {
279 prod *= wall->GetC1()->GetCellType();
282 if ( wall->GetC2()->GetIndex() != -1 ) {
283 prod *= wall->GetC2()->GetCellType();
287 return ( prod == 0 );
293 for (
const auto& wall : m_walls) {
294 if ((cell !=
this) && (wall->GetC1() == cell || wall->GetC2() == cell)) {
304 for (
auto& node : m_nodes) {
311 const auto moving_node_it = find(m_nodes.begin(), m_nodes.end(), moving_node);
314 if (!m_nodes.empty() && moving_node_it != m_nodes.end()) {
316 array<double, 3> neighbor_of_moving[2];
318 neighbor_of_moving[0] = *(*
next(moving_it));
319 neighbor_of_moving[1] = *(*
prev(moving_it));
326 for (
int j = 0; j < 2; j++) {
328 if (*it == moving_node || *
next(it) == moving_node) {
331 array<double, 3> v3 = *(*it);
332 array<double, 3> v4 = *(*
next(it));
333 if (is_intersecting(new_pos, neighbor_of_moving[j], v3, v4)) {
337 }
while(++it != m_nodes.begin());
342 ostream& Cell::Print(ostream& os)
const
344 os <<
"Cell: [ index = " << m_index <<
" ]" << endl;
346 os <<
"Nodes: { " << endl <<
"\t ";
347 for (
auto const& node : m_nodes) {
348 os << node->GetIndex() <<
" && ";
350 os << endl <<
"} " << endl;
351 os <<
"Walls: { " << endl <<
"\t ";
352 for (
auto const& wall : m_walls) {
356 os << endl <<
"} " << endl;
358 CellAttributes::Print(os);
363 void Cell::ReadPtree(
const ptree& cell_pt)
365 if ( !IsBoundaryPolygon() ) {
366 const ptree& attributes_pt = cell_pt.get_child(
"attributes");
367 CellAttributes::ReadPtree(attributes_pt);
371 void Cell::ReassignWall(
Wall* w,
Cell* to)
376 to->m_walls.push_back(w);
379 void Cell::SetGeoDirty()
382 m_dirty_centroid =
true;
383 m_dirty_geo_data =
true;
386 void Cell::SetTransporters(
unsigned int ch,
double conc)
388 for (
auto const& wall : m_walls) {
389 assert( (wall->GetC1() ==
this || wall->GetC2() ==
this) &&
"Error in cell <-> wall!" );
391 if (wall->GetC1() ==
this) {
392 wall->SetTransporters1(ch,conc);
394 wall->SetTransporters2(ch, conc);
399 void Cell::SetTransporters(
unsigned int ch,
double ,
double lat)
403 std::array<double, 3> ref{{1., 0., 0.}};
404 std::array<double, 3> wa = *((*w)->GetN2()) - *((*w)->GetN1());
405 double t2 = SignedAngle(wa, ref);
407 if (this->GetCellType() == 1)
409 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
411 (*w)->SetTransporters1(ch, 1.);
412 (*w)->SetTransporters2(ch, 0.);
414 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
416 (*w)->SetTransporters1(ch, 0.);
417 (*w)->SetTransporters2(ch, 1.);
419 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
421 if ((*w)->GetC1() ==
this)
423 (*w)->SetTransporters1(ch, 0.);
424 (*w)->SetTransporters2(ch, 0.);
428 (*w)->SetTransporters1(ch, 0.);
429 (*w)->SetTransporters2(ch, lat);
432 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
434 if ((*w)->GetC1() ==
this)
436 (*w)->SetTransporters1(ch, lat);
437 (*w)->SetTransporters2(ch, 0.);
441 (*w)->SetTransporters1(ch, 0.);
442 (*w)->SetTransporters2(ch, 0.);
445 }
else if (this->GetCellType() == 2) {
447 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
449 (*w)->SetTransporters1(ch, 1.);
450 (*w)->SetTransporters2(ch, 0.);
452 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
454 (*w)->SetTransporters1(ch, 0.);
455 (*w)->SetTransporters2(ch, 1.);
457 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
459 if ((*w)->GetC1() ==
this)
461 (*w)->SetTransporters1(ch, 0.);
462 (*w)->SetTransporters2(ch, lat);
466 (*w)->SetTransporters1(ch, 0.);
467 (*w)->SetTransporters2(ch, lat);
470 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
472 if ((*w)->GetC1() ==
this)
474 (*w)->SetTransporters1(ch, lat);
475 (*w)->SetTransporters2(ch, 0.);
479 (*w)->SetTransporters1(ch, lat);
480 (*w)->SetTransporters2(ch, 0.);
483 }
else if (this->GetCellType() == 3) {
485 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
487 (*w)->SetTransporters1(ch, 0.);
488 (*w)->SetTransporters2(ch, 1.);
490 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
492 if (this->HasNeighborOfTypeZero())
494 (*w)->SetTransporters1(ch, 1.);
495 (*w)->SetTransporters2(ch, 1.);
499 (*w)->SetTransporters1(ch, 1.);
500 (*w)->SetTransporters2(ch, 0.);
503 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
505 if ((*w)->GetC1() ==
this)
507 (*w)->SetTransporters1(ch, 0.);
508 (*w)->SetTransporters2(ch, lat);
512 (*w)->SetTransporters1(ch, 0.);
513 (*w)->SetTransporters2(ch, lat);
516 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
518 if ((*w)->GetC1() ==
this)
520 (*w)->SetTransporters1(ch, lat);
521 (*w)->SetTransporters2(ch, 0.);
525 (*w)->SetTransporters1(ch, lat);
526 (*w)->SetTransporters2(ch, 0.);
529 }
else if (this->GetCellType() == 4) {
531 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
533 (*w)->SetTransporters1(ch, 0.);
534 (*w)->SetTransporters2(ch, 1.);
536 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
538 if (this->HasNeighborOfTypeZero())
540 (*w)->SetTransporters1(ch, 1.);
541 (*w)->SetTransporters2(ch, 1.);
545 (*w)->SetTransporters1(ch, 1.);
546 (*w)->SetTransporters2(ch, 0.);
549 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
551 if ((*w)->GetC1() ==
this)
553 (*w)->SetTransporters1(ch, 0.);
554 (*w)->SetTransporters2(ch, lat);
558 (*w)->SetTransporters1(ch, 0.);
559 (*w)->SetTransporters2(ch, 0.);
562 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
564 if ((*w)->GetC1() ==
this)
566 (*w)->SetTransporters1(ch, 0.);
567 (*w)->SetTransporters2(ch, 0.);
571 (*w)->SetTransporters1(ch, lat);
572 (*w)->SetTransporters2(ch, 0.);
575 }
else if (this->GetCellType() == 5) {
577 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
579 (*w)->SetTransporters1(ch, 0.);
580 (*w)->SetTransporters2(ch, 1.);
582 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
584 if (this->HasNeighborOfTypeZero())
586 (*w)->SetTransporters1(ch, 1.);
587 (*w)->SetTransporters2(ch, 1.);
591 (*w)->SetTransporters1(ch, 1.);
592 (*w)->SetTransporters2(ch, 0.);
595 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
597 if ((*w)->GetC1() ==
this)
599 (*w)->SetTransporters1(ch, 0.);
600 (*w)->SetTransporters2(ch, 0.);
604 (*w)->SetTransporters1(ch, 0.);
605 (*w)->SetTransporters2(ch, 0.);
608 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
610 if ((*w)->GetC1() ==
this)
612 (*w)->SetTransporters1(ch, 0.);
613 (*w)->SetTransporters2(ch, 0.);
617 (*w)->SetTransporters1(ch, 0.);
618 (*w)->SetTransporters2(ch, 0.);
621 }
else if (this->GetCellType() == 6) {
622 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
624 (*w)->SetTransporters1(ch, 0.);
625 (*w)->SetTransporters2(ch, 1.);
627 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
629 if (this->HasNeighborOfTypeZero())
631 (*w)->SetTransporters1(ch, 1.);
632 (*w)->SetTransporters2(ch, 1.);
636 (*w)->SetTransporters1(ch, 1.);
637 (*w)->SetTransporters2(ch, 0.);
640 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
642 if ((*w)->GetC1() ==
this)
644 (*w)->SetTransporters1(ch, 0.);
645 (*w)->SetTransporters2(ch, 0.);
649 (*w)->SetTransporters1(ch, lat);
650 (*w)->SetTransporters2(ch, 0.);
653 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
655 if ((*w)->GetC1() ==
this)
657 (*w)->SetTransporters1(ch, 0.);
658 (*w)->SetTransporters2(ch, lat);
662 (*w)->SetTransporters1(ch, 0.);
663 (*w)->SetTransporters2(ch, 0.);
666 }
else if (this->GetCellType() == 7) {
668 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
670 (*w)->SetTransporters1(ch, 0.);
671 (*w)->SetTransporters2(ch, 1.);
673 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
675 if (this->HasNeighborOfTypeZero())
677 (*w)->SetTransporters1(ch, 1.);
678 (*w)->SetTransporters2(ch, 1.);
682 (*w)->SetTransporters1(ch, 1.);
683 (*w)->SetTransporters2(ch, 0.);
686 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
688 if ((*w)->GetC1() ==
this)
690 (*w)->SetTransporters1(ch, lat);
691 (*w)->SetTransporters2(ch, 0.);
695 (*w)->SetTransporters1(ch, lat);
696 (*w)->SetTransporters2(ch, 0.);
699 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
701 if ((*w)->GetC1() ==
this)
703 (*w)->SetTransporters1(ch, 0.);
704 (*w)->SetTransporters2(ch, lat);
708 (*w)->SetTransporters1(ch, 0.);
709 (*w)->SetTransporters2(ch, lat);
712 }
else if (this->GetCellType() == 8) {
714 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
716 (*w)->SetTransporters1(ch, 1.);
717 (*w)->SetTransporters2(ch, 0.);
719 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
721 (*w)->SetTransporters1(ch, 0.);
722 (*w)->SetTransporters2(ch, 1.);
724 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
726 if ((*w)->GetC1() ==
this)
728 (*w)->SetTransporters1(ch, lat);
729 (*w)->SetTransporters2(ch, 0.);
733 (*w)->SetTransporters1(ch, lat);
734 (*w)->SetTransporters2(ch, 0.);
737 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
739 if ((*w)->GetC1() ==
this)
741 (*w)->SetTransporters1(ch, 0.);
742 (*w)->SetTransporters2(ch, lat);
746 (*w)->SetTransporters1(ch, 0.);
747 (*w)->SetTransporters2(ch, lat);
750 }
else if (this->GetCellType() == 9) {
752 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
754 (*w)->SetTransporters1(ch, 1.);
755 (*w)->SetTransporters2(ch, 0.);
757 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
759 (*w)->SetTransporters1(ch, 0.);
760 (*w)->SetTransporters2(ch, 1.);
763 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
765 if ((*w)->GetC1() ==
this)
767 (*w)->SetTransporters1(ch, lat);
768 (*w)->SetTransporters2(ch, 0.);
772 (*w)->SetTransporters1(ch, 0.);
773 (*w)->SetTransporters2(ch, 0.);
776 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
778 if ((*w)->GetC1() ==
this)
780 (*w)->SetTransporters1(ch, 0.);
781 (*w)->SetTransporters2(ch, 0.);
785 (*w)->SetTransporters1(ch, 0.);
786 (*w)->SetTransporters2(ch, lat);
793 void Cell::SetTransportersLight(
unsigned int ch,
double ,
double lat)
795 for (list<Wall *>::iterator w =
GetWalls().begin(); w !=
GetWalls().end(); w++) {
797 std::array<double, 3> ref{{1., 0., 0.}};
798 std::array<double, 3> wa = *((*w)->GetN2()) - *((*w)->GetN1());
799 double t2 = SignedAngle(wa, ref);
801 if (this->GetCellType() == 1)
803 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
805 (*w)->SetTransporters1(ch, 1.);
806 (*w)->SetTransporters2(ch, 0.);
808 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
810 (*w)->SetTransporters1(ch, 0.);
811 (*w)->SetTransporters2(ch, 1.);
813 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
815 if ((*w)->GetC1() ==
this)
817 (*w)->SetTransporters1(ch, 0.);
818 (*w)->SetTransporters2(ch, 0.);
822 (*w)->SetTransporters1(ch, 0.);
823 (*w)->SetTransporters2(ch, lat);
826 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
828 if ((*w)->GetC1() ==
this)
830 (*w)->SetTransporters1(ch, lat);
831 (*w)->SetTransporters2(ch, 0.);
835 (*w)->SetTransporters1(ch, 0.);
836 (*w)->SetTransporters2(ch, 0.);
840 else if (this->GetCellType() == 2) {
842 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
844 (*w)->SetTransporters1(ch, 0.);
845 (*w)->SetTransporters2(ch, 1.);
847 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
849 if (this->HasNeighborOfTypeZero())
851 (*w)->SetTransporters1(ch, 1.);
852 (*w)->SetTransporters2(ch, 1.);
856 (*w)->SetTransporters1(ch, 1.);
857 (*w)->SetTransporters2(ch, 0.);
860 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
862 if ((*w)->GetC1() ==
this)
864 (*w)->SetTransporters1(ch, 0.);
865 (*w)->SetTransporters2(ch, lat);
869 (*w)->SetTransporters1(ch, 0.);
870 (*w)->SetTransporters2(ch, 0.);
873 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
875 if ((*w)->GetC1() ==
this)
877 (*w)->SetTransporters1(ch, 0.);
878 (*w)->SetTransporters2(ch, 0.);
882 (*w)->SetTransporters1(ch, lat);
883 (*w)->SetTransporters2(ch, 0.);
887 else if (this->GetCellType() == 3) {
888 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
890 (*w)->SetTransporters1(ch, 0.);
891 (*w)->SetTransporters2(ch, 1.);
893 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
895 if (this->HasNeighborOfTypeZero())
897 (*w)->SetTransporters1(ch, 1.);
898 (*w)->SetTransporters2(ch, 1.);
902 (*w)->SetTransporters1(ch, 1.);
903 (*w)->SetTransporters2(ch, 0.);
906 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
908 if ((*w)->GetC1() ==
this)
910 (*w)->SetTransporters1(ch, 0.);
911 (*w)->SetTransporters2(ch, 0.);
915 (*w)->SetTransporters1(ch, lat);
916 (*w)->SetTransporters2(ch, 0.);
919 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
921 if ((*w)->GetC1() ==
this)
923 (*w)->SetTransporters1(ch, 0.);
924 (*w)->SetTransporters2(ch, lat);
928 (*w)->SetTransporters1(ch, 0.);
929 (*w)->SetTransporters2(ch, 0.);
932 else if (this->GetCellType() == 4) {
934 if ((t2 > (-
pi() / 4)) && (t2 <= (
pi() / 4)))
936 (*w)->SetTransporters1(ch, 1.);
937 (*w)->SetTransporters2(ch, 0.);
939 else if ((t2 <= (-
pi() * 3 / 4)) || (t2 > (
pi() * 3 / 4)))
941 (*w)->SetTransporters1(ch, 0.);
942 (*w)->SetTransporters2(ch, 1.);
945 else if ((t2 > (-
pi() * 3 / 4)) && (t2 <= (-
pi() / 4)))
947 if ((*w)->GetC1() ==
this)
949 (*w)->SetTransporters1(ch, lat);
950 (*w)->SetTransporters2(ch, 0.);
954 (*w)->SetTransporters1(ch, 0.);
955 (*w)->SetTransporters2(ch, 0.);
958 else if ((t2 > (
pi() / 4)) && (t2 <= (
pi() * 3 / 4)))
960 if ((*w)->GetC1() ==
this)
962 (*w)->SetTransporters1(ch, 0.);
963 (*w)->SetTransporters2(ch, 0.);
967 (*w)->SetTransporters1(ch, 0.);
968 (*w)->SetTransporters2(ch, lat);
979 if ( !IsBoundaryPolygon()) {
986 ostream& operator<<(ostream& os,
const Cell& c)
A cell contains walls and nodes.
Namespace for miscellaneous utilities.
Plain data structure with cell geometric data (such as area).
Interface/Implementation for AreaMoment.
const std::list< Wall * > & GetWalls() const
Access the cell's walls.
Interface/Implementation for GeoData.
Namespace for the core simulator.
An Edge connects two nodes and is ambidextrous.
Namespace for container related classes.
double GetCircumference() const
Return the circumference along the edges.
ptree GeometryToPtree() const
Convert the cell geometry to a ptree.
bool IsWallNeighbor(Cell *cell) const
Strict neighbor (you're never your own neighbor)
double GetSignedArea() const
Return the signed area of the cell.
ConstCircularIterator class and helper functions.
int GetIndex() const
Return the index.
Structure with functionality for calculations of the area moment of inertia.
std::array< double, 3 > GetCentroid() const
Return the centroid position.
virtual boost::property_tree::ptree ToPtree() const
Convert the cell attributes to a ptree.
Extending std with arithmetic for std::array.
virtual ptree ToPtree() const
Convert the cell (geometry and attributes) to a ptree.
GeoData GetGeoData() const
Return GeData (area, centroid, area moment of inertia).
CircularIterator< T > next(CircularIterator< T > i)
Helper yields the position the iterator would have if moved forward (in circular fashion) by 1 positi...
Interface for CellAttributes.
double GetSumTransporters(unsigned int ch) const
Sum transporters at this cell's side of the walls.
ConstCircularIterator< typename T::const_iterator > make_const_circular(const T &c)
Helper produces const circular iterator whose range corresponds to the begin and end iterators of a c...
void Move(const std::array< double, 3 > &a)
Strict neighbor (you're never your own neighbor)
CircularIterator< T > prev(CircularIterator< T > i)
Helper yields the position the iterator would have if moved backward (in circular fashion) by 1 posit...
CircularIterator class and helper functions.
bool MoveSelfIntersects(Node *moving_node, std::array< double, 3 > new_pos)
Check for self-intersection when moving_node gets displaced.
double GetArea() const
Return the area of the cell.
constexpr double pi()
Math constant pi.
A cell wall, runs between cell corner points and consists of wall elements.