-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_largest.R
75 lines (71 loc) · 1.66 KB
/
test_largest.R
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
test_largest<-function(subset)
{
rmax=0
imax=0
ind.range=names(bfobj)[!(names(bfobj) %in% as.character(subset))]
for (i in 1:length(bfobj[ind.range]))
{
if (bfobj[ind.range][[i]]$r>rmax)
{
rmax=bfobj[ind.range][[i]]$r
imax=bfobj[ind.range][[i]]$ind
}
}
return(list(imax,rmax))
}
cal_center_dist<-function(i1,i2)
{
return(Dist(bfobj[[i1]]$posi,bfobj[[i2]]$posi,h,w))
}
#Find number of coalescence for all droplets in bfallobj
#Check if the length of bfallobj[[i]]$abso.drop and
# bfallobj[[i]]$coal match with each other for
# absorbed droplets and existing droplets
drop_num_coal<-function()
{
res=NULL
for (i in 1:length(bfallobj))
{
n1=length(bfallobj[[i]]$abso.drop)
n2=length(bfallobj[[i]]$coal)
#print(c(n1,n2))
stopifnot((n1==n2 & bfallobj[[i]]$deat.t<0)|(n1==n2-1 & bfallobj[[i]]$deat.t>0))
res=c(res,n1)
}
return(res)
}
#Find number of coalescence for all droplets in bfobj
#Check if the length of bfallobj[[i]]$abso.drop and
# bfallobj[[i]]$coal match with each other for
# absorbed droplets and existing droplets
drop_num_coal_exis<-function()
{
res=NULL
for (i in 1:length(bfobj))
{
n1=length(bfobj[[i]]$abso.drop)
n2=length(bfobj[[i]]$coal)
#print(c(n1,n2))
if(!((n1==n2 & bfobj[[i]]$deat.t<0)|(n1==n2-1 & bfobj[[i]]$deat.t>0)))
{
print(c(bfobj[[i]]$ind,n1,n2))
stop("error")
}
res=c(res,n1)
}
return(res)
}
for (i in 1:length(bfallobj))
{
if (length(bfallobj[[i]]$coal)!=0)
{
for (j in 1:length(bfallobj[[i]]$coal))
{
if (is.null(bfallobj[[i]]$coal[[j]]))
{
print(bfallobj[[i]]$ind)
break
}
}
}
}