SCIInstitute / ShapeWorks

ShapeWorks
http://sciinstitute.github.io/ShapeWorks/
Other
100 stars 32 forks source link

Bug fix Mesh::interpolateFieldAtPoint() and add Python binding. #2187

Closed ben2k closed 5 months ago

ben2k commented 5 months ago

return (bary * values.transpose()).mean(); is the mean of the OUTER product so the values returned by interpolateFieldAtPoint() are wrong.

We could use (values.transpose()bary)(0) but it is more clear using: values[0] bary[0] + values[1] bary[1] + values[2] bary[2]; for the interpolation

akenmorris commented 5 months ago

We're seeing this failure on Linux, not sure why it would be different on Windows/Mac:

2024-01-22T16:59:01.2469526Z 4: VIOLATION: Shape# 2 domain# 0 point# 8 free form constraint 0 of magnitude 0.518687 by point [68.4274, 73.0617, 44.6666]
2024-01-22T16:59:01.2473091Z 4: /__w/ShapeWorks/ShapeWorks/Testing/OptimizeTests/OptimizeTests.cpp:575: Failure
2024-01-22T16:59:01.2474508Z 4: Value of: good
2024-01-22T16:59:01.2479807Z 4:   Actual: false
2024-01-22T16:59:01.2480783Z 4: Expected: true
2024-01-22T16:59:01.2483372Z 4: [  FAILED  ] OptimizeTests.ffc_test (24572 ms)
ben2k commented 5 months ago

We're seeing this failure on Linux, not sure why it would be different on Windows/Mac:

2024-01-22T16:59:01.2469526Z 4: VIOLATION: Shape# 2 domain# 0 point# 8 free form constraint 0 of magnitude 0.518687 by point [68.4274, 73.0617, 44.6666]
2024-01-22T16:59:01.2473091Z 4: /__w/ShapeWorks/ShapeWorks/Testing/OptimizeTests/OptimizeTests.cpp:575: Failure
2024-01-22T16:59:01.2474508Z 4: Value of: good
2024-01-22T16:59:01.2479807Z 4:   Actual: false
2024-01-22T16:59:01.2480783Z 4: Expected: true
2024-01-22T16:59:01.2483372Z 4: [  FAILED  ] OptimizeTests.ffc_test (24572 ms)

Strange because I get also the failure with Windows:

[ RUN      ] OptimizeTests.ffc_test
[2024-01-22 17:04:03.992] [warning] Unknown Optimization parameter: domain_type
[2024-01-22 17:04:04.448] [info] Initializing FFCs for domain 0 / 4
[2024-01-22 17:04:04.574] [info] Initializing FFCs for domain 1 / 4
[2024-01-22 17:04:05.463] [info] Initializing FFCs for domain 2 / 4
[2024-01-22 17:04:08.814] [info] Initializing FFCs for domain 3 / 4
VIOLATION: Shape# 2 domain# 0 point# 8 free form constraint 0 of magnitude 0.507377 by point [68.4767, 73.0163, 44.7693]
E:\EOS\SCI\ShapeWorks\Testing\OptimizeTests\OptimizeTests.cpp(575): error: Value of: good
  Actual: false
Expected: true
[  FAILED  ] OptimizeTests.ffc_test (23398 ms)

Moreover this test uses segmentation domain not mesh, it would be not affected by Mesh::interpolateFieldAtPoint()

akenmorris commented 5 months ago

Moreover this test uses segmentation domain not mesh, it would be not affected by Mesh::interpolateFieldAtPoint()

Oddly enough, it's only the segmentation based runs that use this function for FFCs. In the case of meshes, we simply clip the mesh at the constraint boundary.

We discussed this as a group at our meeting today and I will take care of fixing it.