fracture.near

Syntax

frac = fracture.near(vp<,frad><,dfn>)

Find the closest fracture to a point. If frad is specified, then the search radius is limited. If dfn is not given the calculation is undertaken over all fractures of all DFNs.

Returns:

frac - fracture pointer

Arguments:

vp - position

frad - optional search radius

dfn - optional DFN pointer

Usage Example

The following example illustrates how fracture.near can be used.

model new
model random 10000
model domain extent -5 5
;Generate fractures using the default template
fracture generate fracture-count 100 dfn 'first'
fracture generate fracture-count 100 dfn 'second'

; find the closest fracture to the center
fish define find_closest
	local pt1 = vector(0,0,0)
	local f1 = fracture.near(pt1,1e5,dfn.find('first'))
	local f2 = fracture.near(pt1,1e5,dfn.find('second'))
	local fall = fracture.near(pt1,1e5)
	if f1
		io.out("closest frac for dfn first has id " + string(fracture.id(f1)))
	else
		io.out("no closest frac for dfn first found " )
	endif
	if f2
		io.out("closest frac for dfn second has id " + string(fracture.id(f2)))
	else
		io.out("no closest frac for dfn second found " )
	endif
	if fall
		io.out("closest frac for all dfns has id " + string(fracture.id(fall)))
	else
		io.out("no closest frac for all dfns found " )
	endif
end
[find_closest]

program return