Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jayant Khatkar
tempaware
Commits
c92134ad
Commit
c92134ad
authored
Aug 21, 2021
by
Jayant Khatkar
Browse files
changed grid interpolation method and tested accuracy
parent
5fe674c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils/planner.py
View file @
c92134ad
...
...
@@ -6,6 +6,7 @@ from math import pi
import
trimesh
as
tm
import
pymeshfix
as
pf
from
scipy.spatial
import
KDTree
from
scipy.interpolate
import
LinearNDInterpolator
class
Planner
:
...
...
@@ -57,11 +58,23 @@ class Planner:
print
(
"Interpolating pointcloud to grid stresses"
)
# get mean stress at each voxel
self
.
centtree
=
KDTree
(
self
.
centers
,
leafsize
=
5
)
#kd tree for mapping grid points to fea mesh
print
(
time
.
time
()
-
gs
)
self
.
gridstresses
=
np
.
zeros
(
self
.
centers
.
shape
[
0
])
dd
,
ii
=
self
.
centtree
.
query
(
self
.
centers
,
k
=
4
)
self
.
gridstress
=
np
.
sum
(
1
/
dd
*
self
.
mesh
[
'StressValues'
][
ii
],
axis
=
1
)
/
np
.
sum
(
1
/
dd
,
axis
=
1
)
# print(time.time()- gs)
self
.
interpolator
=
LinearNDInterpolator
(
self
.
mesh
.
points
,
self
.
mesh
[
'StressValues'
])
print
(
"Completed generating LinearND lookup"
)
print
(
time
.
time
()
-
gs
)
# up to 100s for mesh with 300k points
def
check_interp1s
(
self
,
node_is
):
"""
Works my removing nodes in list node_is from mehs and linear interpolating their stresses
and then comparing to true values
return predicted values and true values
# called with node_is = [i for i in range(0,308539, 1000)]
"""
s
=
time
.
time
()
except_i
=
[
i
for
i
in
np
.
arange
(
self
.
mesh
.
points
.
shape
[
0
])
if
i
not
in
node_is
]
interpolator
=
LinearNDInterpolator
(
self
.
mesh
.
points
[
except_i
,:],
self
.
mesh
[
'StressValues'
][
except_i
])
node_i_pred_stress
=
interpolator
(
self
.
mesh
.
points
[
node_is
,:])
node_i_stress
=
self
.
mesh
[
'StressValues'
][
node_is
]
e
=
time
.
time
()
print
(
e
-
s
)
return
node_i_pred_stress
,
node_i_stress
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment