Files
@ 25054d6d05c9
Branch filter:
Location: EI/VirtualLeaf/src/wallbase.h
25054d6d05c9
5.6 KiB
text/x-chdr
Corrected citation text. Resolves issue #4.
--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'
changed src/ChangeLog
changed src/canvas.cpp
--
user: Michael Guravage <michael.guravage@cwi.nl>
branch 'default'
changed src/ChangeLog
changed src/canvas.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | /*
*
* $Id$
*
* This file is part of the Virtual Leaf.
*
* VirtualLeaf is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VirtualLeaf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Virtual Leaf. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2010 Roeland Merks.
*
*/
#ifndef _WALLBASE_H_
#define _WALLBASE_H_
#include <list>
#include <iostream>
#include "vector.h"
class Node;
class CellBase;
using namespace std;
// warning, touches original sequence
template<class In, class Out> Out duplicates_copy(In first, In last, Out res) {
In i = adjacent_find(first, last);
while (i!=last) {
res++ = *i;
i = adjacent_find(++i, last);
}
return res;
}
/*! \class WallBase. A cell wall, which runs between cell "corner points",
and consists of wall elements. */
class WallBase {
protected:
friend class CellBase;
friend class Cell;
friend class Mesh;
//! Cells to which the wall belongs
CellBase *c1, *c2;
//! A list of transporter protein concentrations associated with the wall
double *transporters1, *transporters2;
double *new_transporters1, *new_transporters2;
bool IllegalP(void) { return c1 == c2; }
//! The chemicals in the apoplast at this position
//double *apoplast;
//! Pointers to the wall's corner nodes
Node *n1, *n2;
double length;
double viz_flux;
// bool aux_source;
bool dead;
// disallow usage of empty constructor
WallBase(void) {}
enum WallType {Normal, AuxSource, AuxSink};
static int nwalls;
protected:
int wall_index;
WallType wall_type;
public:
WallBase(Node *sn1, Node *sn2, CellBase *sc1, CellBase *sc2);
// shallow copy
WallBase(const WallBase &src) {
c1 = src.c1;
c2 = src.c2;
transporters1 = src.transporters1;
transporters2 = src.transporters2;
new_transporters1 = src.new_transporters1;
new_transporters2 = src.new_transporters2;
//apoplast = src.apoplast;
n1 = src.n1;
n2 = src.n2;
length = src.length;
viz_flux = src.viz_flux;
dead = src.dead;
wall_index = src.wall_index;
}
inline int Index(void) const { return wall_index;}
inline bool DeadP(void) const { return dead; }
inline void Kill(void) { dead = true; }
// deep copying of chemicals and transporters
void CopyWallContents(const WallBase &src);
void SwapWallContents(WallBase *src);
bool is_wall_of_cell_p ( const CellBase *c ) {
return (c1==c || c2==c);
}
inline CellBase *C1(void) const { return c1; }
inline CellBase *C2(void) const { return c2; }
inline Node *N1(void) const { return n1; }
inline Node *N2(void) const { return n2; }
inline void setTransporters1(int ch, double val) { transporters1[ch]=val; }
inline void setTransporters2(int ch, double val) { transporters2[ch]=val; }
inline void setNewTransporters1(int ch, double val) { new_transporters1[ch]=val; }
inline void setNewTransporters2(int ch, double val) { new_transporters2[ch]=val; }
inline double Transporters1(int ch) { return transporters1[ch]; }
inline double Transporters2(int ch) { return transporters2[ch]; }
//! Return true if the WallBase adheres to the SAM (shoot apical meristem)
bool SAM_P(void);
// NB. Not checked. If cell is not found, it returns transporters2[ch]!!
//inline double getTransporter(int ch, Cell *c) { return c1 == c ? transporters1[ch] : transporters2[ch]; }
//! Return true if the WallBase is a source of auxin
inline bool AuxinSource(void) const { return wall_type == AuxSource; }
inline bool AuxinSink(void) const { return wall_type == AuxSink; }
inline void cycleWallType(void) {
if (wall_type == Normal)
wall_type = AuxSource;
else
if (wall_type == AuxSource)
wall_type = AuxSink;
else
if (wall_type == AuxSink) {
wall_type = Normal;
}
}
// checked version. Use during debugging stage.
inline double getTransporter(CellBase *c, int ch) const
{
return c1 == c ? transporters1[ch] : ( c2 == c ? transporters2[ch] : throw "WallBase::getTransporter called with wrong cell") ; }
inline void setTransporter(CellBase *c, int ch, double val) {
if ( c1 == c ) {
transporters1[ch]=val;
} else
if (c2 == c ) {
transporters2[ch]=val;
} else {
throw "WallBase::setTransporter called with wrong cell";
}
}
//inline double getApoplast(int ch) const { return apoplast[ch]; }
//inline void setApoplast(int ch, double val) { apoplast[ch] = val; }
inline CellBase *getOtherCell(CellBase *c) { return c1 == c ? c2 : c1; }
Vector getInfluxVector(CellBase *c);
Vector getWallVector(CellBase *c);
void CorrectTransporters(double orig_length);
inline double Length(void) { return length; }
//double Length(void);
ostream &print(ostream &os) const;
void SetLength(void);
void Transport(void);
inline void setVizFlux( double value ) { viz_flux = value; }
/*! Return vector containing the directional flux through the wall.
as defined by the value "viz_flux" which is supplied by the end-user
in the TransportFunction.
*/
Vector VizFlux(void);
bool IntersectsWithDivisionPlaneP(const Vector &p1, const Vector &p2);
void SetTransToNewTrans( void );
private:
};
ostream &operator<<(ostream &os, const WallBase &w);
#endif
/* finis */
|