densifyCluster: Densify clusters

Description Usage Arguments Details Value Author(s) Examples

Description

Densification of objects within a predefined ball

Usage

1
2
densifyCluster(F, CL, ctrl, weight = 10, info = FALSE,
  cores = getOption("simLife.mc", 1L), cl = NULL)

Arguments

F

non-overlapping particle system

CL

cluster list, defining the different cluster regions

ctrl

control arguments passed to function GenSA

weight

optional, weight factor weight=10 (default)

info

optional, logical, if TRUE return result from GenSA call

cores

optional, number of cores for mulicore parallization with cores=1L (default) by mclapply which also can be set by a global option "simLife.mc"

cl

optional, parallel cluster object

Details

This densification method requires packageGenSA to be installed. Additionally for performance reasons it is recommended to make use of parallization by package 'parallel' installed and available or some 'cluster' object derived from it.

Parts of the (reinforcement) geometry system are densified in order to account for regions where some objects stick together more close than in other regions of the simulation box. These so-called clusters are generated by a densification algorithm minimizing some energy of object positions and their (overlap) distances within an enclosing ball of objects with a predefined cluster radius. In order to prevent overlaps between objects one possibly has to increase the weight factor iteratively and run it again if some objects happen to overlap.

Value

a list of all objects (including newly densified regions) named S and a named list of clustered regions cluster

Author(s)

M. Baaske

Examples

 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
## Not run: 

## Simulate and densify particle system
## densify and include a secondary phase

library(unfoldr)

## Unless MS-Windows platform	
# library(parallel)
# options(simLife.mc=2L)
 
# simulation box either this kind of list
# or use object spatstat::box3 
box <- list("xrange"=c(0,3),"yrange"=c(0,3),"zrange"=c(0,9))

# parameter for spheroids simulation 
theta <- list("size"=list(0.25),"shape"=list("s"=0.25), "orientation"=list("kappa"=1))

# for ease of use: constant size particles
S <- simPoissonSystem(theta,lam=15,size="const",type="prolate",
			orientation="rbetaiso",box=box,mu=c(0,1,0),pl=1,label="P")
	
## 2nd. phase (ferrit)	
param <- list("size"=list(0.075), "shape"=list("s"=0.75))
F <- simPoissonSystem(param,lam=2,size="const",type="prolate",
		box=box,mu=c(0,1,0),pl=1,label="P")

# apply RSA, this may take some 
RSA <- rsa(S,F,verbose=TRUE)

## show 3D spheroids (non-overlapping)
# library(rgl)
# cols <- c("#0000FF","#00FF00","#FF0000","#FF00FF","#FFFF00","#00FFFF")
# spheroids3d(RSA[1:length(S)], box, col=cols)	
# spheroids3d(RSA[length(S):(length(S)+length(F))], box, col="gray")

## construct clusters
CL <- simPoissonSystem(list("size"=list(0.35)), lam=0.1, size="const",
			type="spheres", box=box, pl=1, label="F")

CLUST <- simCluster(RSA, CL, verbose=TRUE)
cat("cluster length: ",length(CLUST),"\n")

## show cluster regions
# library(rgl)
# open3d()
# X <- do.call(rbind,lapply(CLUST, function(x) c(x$center,x$r)))
# invisible(lapply(CLUST, function(x) rgl::spheres3d(X[,1:3],radius=X[,4],col="gray",alpha=0.2)))
# cols <- c("#0000FF","#00FF00","#FF0000","#FF00FF","#FFFF00","#00FFFF")
# invisible(lapply(CLUST, function(x) spheroids3d(RSA[x$id],box,col=cols)))

# some controls for 'GenSA'
ctrl <- list(threshold.stop=0.01,max.call=10000)
# densify region to clustered particles
RET <- densifyCluster(RSA, CLUST, ctrl, weight=100, cores = 1L, cl = NULL)	

S <- RET$S
CL <- RET$cluster

## show densified clusters 
# library(rgl)
# open3d()
# X <- do.call(rbind,lapply(CLUST, function(x) c(x$center,x$r)))
# invisible(lapply(CLUST, function(x)
# rgl::spheres3d(x=X[,1:3],radius=X[,4],col="gray",alpha=0.2)))
# invisible(lapply(CL, function(x) { spheroids3d(x, box, col=cols) }))
	

## End(Not run)	

simLife documentation built on May 2, 2019, 6:36 a.m.