Skip to content

Commit

Permalink
User functions for poisson circle demo
Browse files Browse the repository at this point in the history
  • Loading branch information
millerta committed Jan 15, 2025
1 parent f4fe902 commit cda65bc
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/pages/docs/demos/input/user_resolution_1.mlgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
define / MO_H_FIELD / mo_poi_h_field
define / H_ATTRIBUTE / h_field_att

# Y = Ax + B
#
# Slope
# 0.1 works
# 0.2 works
# 0.25 works
# 0.29 works
# 0.295 crashes
# 0.299 crashes
# 0.3 crashes
#
define / SLOPE / 0.29
# Intersect
define / INTERCEPT / 0.0
#
# Create some points and then use the distance from the points to define the user
# defined resolution field h(x,y)
#
cmo / create / mo_pts / / / tet
createpts/xyz/ 1,1,1 /0.1 0.1 0.0/0.1 0.1 0.0/1,1,1/
createpts/xyz/ 1,1,1 /-0.5 -0.7 0.0/-0.5 -0.7 0.0/1,1,1/

compute / distance_field / MO_H_FIELD / mo_pts / dfield

math/multiply/MO_H_FIELD/H_ATTRIBUTE/1,0,0/MO_H_FIELD/dfield/SLOPE/
math/add/MO_H_FIELD/H_ATTRIBUTE/1,0,0/MO_H_FIELD/H_ATTRIBUTE/INTERCEPT/

math / floor / MO_H_FIELD / H_ATTRIBUTE / 1 0 0 / &
MO_H_FIELD / H_ATTRIBUTE / H_SCALE
math / ceiling / MO_H_FIELD / H_ATTRIBUTE / 1 0 0 / &
MO_H_FIELD / H_ATTRIBUTE / 10H_SCALE

cmo / printatt / MO_H_FIELD / H_ATTRIBUTE / minmax
#
# In order to visualize the h(x,y) field, the user can output
# mo_poi_h_field and look at the attribute h_field_att.
# Output will slow things down so output should be commented out
# in production runs.
#
# This is the only place where the user has access to out MO_H_FIELD because it
# will be deleted when createpts / poisson_disk exits.
#
dump / avs / output_h_of_x_y_1.inp / MO_H_FIELD
cmo / delete / mo_pts
finish
51 changes: 51 additions & 0 deletions docs/pages/docs/demos/input/user_resolution_2.mlgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
define / MO_H_FIELD / mo_poi_h_field
define / H_ATTRIBUTE / h_field_att

# Y = Ax + B
#
# Slope
# 0.2 works
# 0.25 works
# 0.29 works
# 0.295 crashes
# 0.299 crashes
# 0.3 crashes
#
define / SLOPE / 0.1
# Intersect
define / INTERCEPT / 0.0
#
# Create some points and then use the distance from the points to define the user
# defined resolution field h(x,y)
#
cmo / create / mo_pts / / / tet
createpts / line / npoints / / / xmin,ymin,zmin / xmax,ymax,zmax / iiz,ijz,ikz /
createpts / line / 400 / / / -3.95 0.0 0.0 / 3.95 0.0 0.0 / 1 1 1
math / sin / mo_pts / yic / 1 0 0 / mo_pts / xic
math / multiply / mo_pts / yic / 1 0 0 / mo_pts / yic / 0.25
math / multiply / mo_pts / xic / 1 0 0 / mo_pts / xic / 0.25

compute / distance_field / MO_H_FIELD / mo_pts / dfield

math/multiply/MO_H_FIELD/H_ATTRIBUTE/1,0,0/MO_H_FIELD/dfield/SLOPE/
math/add/MO_H_FIELD/H_ATTRIBUTE/1,0,0/MO_H_FIELD/H_ATTRIBUTE/INTERCEPT/

math / floor / MO_H_FIELD / H_ATTRIBUTE / 1 0 0 / &
MO_H_FIELD / H_ATTRIBUTE / H_SCALE
math / ceiling / MO_H_FIELD / H_ATTRIBUTE / 1 0 0 / &
MO_H_FIELD / H_ATTRIBUTE / 10H_SCALE

cmo / printatt / MO_H_FIELD / H_ATTRIBUTE / minmax
#
# In order to visualize the h(x,y) field, the user can output
# mo_poi_h_field and look at the attribute h_field_att.
# Output will slow things down so output should be commented out
# in production runs.
#
#
# This is the only place where the user has access to out MO_H_FIELD because it
# will be deleted when createpts / poisson_disk exits.
#
dump / avs / output_h_of_x_y_2.inp / MO_H_FIELD
cmo / delete / mo_pts
finish

0 comments on commit cda65bc

Please sign in to comment.