cmlibs / zinc

Source code repository for OpenCMISS-Zinc
Mozilla Public License 2.0
15 stars 18 forks source link

Integer interpolation is inconsistent #209

Open rchristie opened 2 years ago

rchristie commented 2 years ago

Integer grid values are not interpolated -- the nearest parameter is used like texture mapping.

Time-varying integer values are interpolated in time using the same generic template function as real values

template <typename VALUE_TYPE> int cmzn_node_get_field_component_values(
    cmzn_node *node, FE_field *field, int componentNumber, FE_value time,
    int valuesCount, VALUE_TYPE *valuesOut)

with:

*dest = source[time_index_one]*one_minus_time_xi + source[time_index_two]*time_xi;

i.e. not nearest, not using rounding.

Note: Unemap data formerly used short integer values to compress a range of real values; the short values won't interpolate well. Our current approach of interpolating nodal parameters first may need changing. Alternative is to evaluate at stored times as real values (including at element locations) then interpolate the final values with a time basis. The alternative approach is more amenable to adaptive mesh refinement.