Internal:Adaptive CDT3D - Smoothing

From crtc.cs.odu.edu
Jump to navigation Jump to search

NASA/refine

Pseudocode

1. Evaluate the degree of the node and collect adajcent cells
2. For each attached cell evaluate quality and gradient of quality as well as min quality of set.
3. activate tets that (quals[i]-quals[worst]) < 1e-12
4. If number of active elements >= 4 exit
   4.1 else if number of active elements ==1 set dir=grad[worst]
   4.2 else use Charalambous and Conn approach [1] to find best dir
5. set m0 = dot(dir,grad[worst])
6. find stepsize alpha:
//for our initial step size, we use the distance
//to the next intersection with another quality funtion.
//this is the point at which the other quality function
///becomes the worst. we use a single-term taylor expansion
///to approximate all of the quality functions as lines,
//so we will have to do a line search to find our ultimate
//step size. [2]
7. compute the approximation of when this funnction will become the objective /
8. for each non active incident : alpha = (quals[worst] - quals[i]) / (m1 - m0); min(min_alpha,alpha)
9. if min_alpha didn’t change min_alpha = (1.0 - quals[0]) / ref_math_dot(dir, &(grads[3 * 0]))
10. for (i = 1; i < degree; i++) min_alpha = MIN(min_alpha, (1.0 - quals[i]) / ref_math_dot(dir, &(grads[3 * i])));
11. line serach as descriped above :
  11.1 find smallest dot product between dir and grad of active elements (m0 in refine)
  11.2 Do at most 8 loops of linear walk to optimize quality of cavity

Code  : https://github.com/nasa/refine/blob/master/src/ref_smooth.c#L1258