File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -56,14 +56,14 @@ namespace geode
5656 std::vector< Point< dimension > > unique_points;
5757 /* !
5858 * This list has the size of the number of points in the tree.
59- * Each index is pointing to its old point index as given in input
60- * vector.
59+ * Each index is pointing to its new unique point stored in the
60+ * unique_points vector.
6161 */
6262 std::vector< index_t > colocated_mapping;
6363 /* !
6464 * This list has the size of the number of points in the tree.
65- * Each index is pointing to its new unique point stored in the
66- * unique_points vector.
65+ * Each index is pointing to its old point index as given in input
66+ * vector.
6767 */
6868 std::vector< index_t > colocated_input_points;
6969 };
Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ namespace
132132 geode::Vector< Mesh::dim > computed_gradient;
133133 const auto vertices_around =
134134 mesh_.vertices_around_vertex ( vertex_id );
135+ bool value_set{ false };
135136 for ( const auto d : geode::LRange{ Mesh::dim } )
136137 {
137138 double contribution_sum{ 0 };
@@ -164,16 +165,18 @@ namespace
164165 inverse_dist_sum +=
165166 diff_sign * position_diff.value ( d ) / dist2;
166167 }
167- OPENGEODE_EXCEPTION (
168- std::fabs ( inverse_dist_sum ) > geode::GLOBAL_EPSILON,
169- " [compute_scalar_function_gradient] Couldn't compute "
170- " gradient on vertex " ,
171- vertex_id,
172- " : No vertex around it allows computation of the "
173- " derivative along axis " ,
174- d );
168+ if ( std::fabs ( inverse_dist_sum ) <= geode::GLOBAL_EPSILON )
169+ {
170+ computed_gradient.set_value ( d, 0 );
171+ continue ;
172+ }
175173 computed_gradient.set_value (
176174 d, contribution_sum / inverse_dist_sum );
175+ value_set = true ;
176+ }
177+ if ( !value_set )
178+ {
179+ return false ;
177180 }
178181 gradient_function.set_value ( vertex_id, computed_gradient );
179182 return true ;
You can’t perform that action at this time.
0 commit comments