Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82303370
deltaNotchCell2.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Sep 10, 16:12
Size
2 KB
Mime Type
text/x-c
Expires
Thu, Sep 12, 16:12 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
20677275
Attached To
R9411 tisue modeling
deltaNotchCell2.cpp
View Options
#include "deltaNotchCell.hpp"
void
DeltaNotchCell
::
operator
()
(
const
state_type
&
y
,
state_type
&
dydt
,
const
double
t
)
{
uint
nbcells
=
lattice
->
getNbCells
();
double
a
=
0.1
;
// diffusion length scale
for
(
uint
c
=
0
;
c
<
nbcells
;
c
++
){
Cell
&
ce
=
lattice
->
getCell
(
c
);
uint
sind
=
ce
.
stateVectorIndex
();
double
no
=
y
[
sind
];
double
del
=
y
[
sind
+
1
];
BoundaryIterator
it
(
&
ce
);
double
dout
=
0
;
double
totper
=
0
;
for
(
Boundary
*
b
=
it
.
first
();
!
it
.
isLast
();
b
=
it
.
next
()){
if
(
b
->
opposite
()
!=
NULL
){
uint
ind
=
b
->
neighbor
()
->
stateVectorIndex
();
// index for cell state
// double len = b->length();
double
len
=
b
->
scaledLength
(
lattice
->
getScale
());
// len = max(len,0.1);
if
(
len
>
0.000001
){
len
=
a
/
(
1
-
exp
(
-
a
/
len
));}
else
{
len
=
a
;}
dout
+=
len
*
y
[
ind
+
1
];
totper
+=
len
;
}
}
// if(dout>0.0000001){dout = 1+1/(1-exp(-1/dout));}else{dout=1;};
double
bn
=
notchProduction
(
dout
);
double
bd
=
getDeltaProduction
(
no
);
double
dn
=
bn
-
gn
*
no
;
double
dd
=
bd
-
gd
*
del
;
//-kcm*si
// cout<<del<<": "<<bd<<" "<<gd<<" "<<endl;
double
fac
=
1e13
;
//=exp(30)
dydt
[
sind
]
=
dn
;
dydt
[
sind
+
1
]
=
dd
;
//*fac/(exp(del)+fac);
}
}
// void DeltaNotchCell::writeState(){//const state_type y,const double t){
// cout<<"state "<<state_dim<<": ";
// for(uint i=0;i<state_dim;i++){
// cout<<i<<": "<<state[i]<<"; ";
// }
// cout<<endl;
// }
void
DeltaNotchCell
::
initState
(){
void
*
pt
=
(
void
*
)
&
state
;
lattice
->
forAllCellsAndBoundaries
(
DeltaNotchCell
::
initCellState
,
pt
,
NULL
,
NULL
);
}
void
DeltaNotchCell
::
initState
(
double
*
s
){
int
n
=
lattice
->
getNbCells
();
for
(
int
c
=
0
;
c
<
n
;
c
++
){
uint
idx
=
lattice
->
getCell
(
c
).
stateVectorIndex
();
state
[
idx
]
=
s
[
c
*
2
+
1
];
state
[
idx
+
1
]
=
s
[
c
*
2
];
}
}
uint
DeltaNotchCell
::
setStateVectorIndex
(){
uint
cnt
=
0
;
visitorParams
vp
(
&
cnt
,
this
);
lattice
->
forAllCellsAndBoundaries
(
DeltaNotchCell
::
setCellIndex
,
(
void
*
)
&
vp
,
NULL
,
NULL
);
return
cnt
;
}
void
DeltaNotchCell
::
initCellState
(
Cell
*
ce
,
void
*
pt
){
state_type
*
y
=
(
state_type
*
)
pt
;
uint
ind
=
ce
->
stateVectorIndex
();
(
*
y
)[
ind
]
=
0.9
+
0.2
*
(
rand
()
/
(
double
)
RAND_MAX
);
(
*
y
)[
ind
+
1
]
=
0.9
+
0.2
*
(
rand
()
/
(
double
)
RAND_MAX
);;
}
void
DeltaNotchCell
::
setCellIndex
(
Cell
*
ce
,
void
*
pt
){
visitorParams
*
vp
=
(
visitorParams
*
)
pt
;
uint
*
idx
=
vp
->
cnt
;
ce
->
setStateVectorIndex
(
*
idx
);
*
idx
+=
vp
->
dn
->
cellStateDim
();
}
Event Timeline
Log In to Comment