Reformat and add some adjoint gradient

This commit is contained in:
Guilhem Lavaux 2022-11-17 21:50:06 +01:00
parent fe06434619
commit 046e9a1447
3 changed files with 61 additions and 17 deletions

View file

@ -79,14 +79,30 @@ namespace CosmoTool {
return internal.currentCenter;
}
/** This is the pure SPH smoothing function. It does not reweight by the
* value computed at each grid site.
*/
template <typename FuncT>
ComputePrecision computeSmoothedValue(
const typename SPHTree::coords &c, FuncT fun, SPHState *state = 0);
/** This is the weighted SPH smoothing function. It does reweight by the
* value computed at each grid site. This ensures the total sum of the interpolated
* quantity is preserved by interpolating to the target mesh.
*/
template <typename FuncT>
ComputePrecision computeInterpolatedValue(
const typename SPHTree::coords &c, FuncT fun, SPHState *state = 0);
/** This is the adjoint gradient of computeInterpolatedValue w.r.t. to the value
* array. FuncT is expected to have the following prototype:
* void((CellValue defined by the user), ComputePrecision weighted_ag_value)
*/
template <typename FuncT>
void computeAdjointGradientSmoothedValue(
const typename SPHTree::coords &c, ComputePrecision ag_value, FuncT fun,
SPHState *state = 0);
ComputePrecision
getMaxDistance(const typename SPHTree::coords &c, SPHNode *node) const;