View Issue Details

IDProjectCategoryView StatusLast Update
0001987OpenFOAMBugpublic2016-02-04 17:30
Reporteruser369Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSOpenSuSEOS Version12.3
Summary0001987: DataEntry<label> interpolation issue
DescriptionUsing DataEntry with type "label" and a input method that uses interpolation will result in an incorrect return value.

For linear interpolation for example the interpolated value is calculated as:

t = weight[0] * table[i].second()
t += weight[1] * table[i+1].second()

Since t is a label and table[] returns a label, the result for "t" will typically be 1 less than it should. For example, consider a scenario with

table[0] = 2
table[1] = 2
weight[0] = 0.33
weight[1] = 0.67

t0 = 0.33 * 2 = 0
t1 = 0 + 0.67 * 2 = 1

Where in fact it should be t = 2

A simple solution is a bit tricky due to the nature of the templating. I guess specialization would do the trick.
Steps To ReproduceConstruct DataEntry<label> and check value(x) function return against expected value.
TagsNo tags attached.

Activities

henry

2016-02-04 17:30

manager   ~0005921

Resolved in OpenFOAM-dev by commit 7265d90d0ddff5eb0753b77d0f9dd2e8e50919e2

Issue History

Date Modified Username Field Change
2016-02-04 16:09 user369 New Issue
2016-02-04 17:30 henry Note Added: 0005921
2016-02-04 17:30 henry Status new => resolved
2016-02-04 17:30 henry Resolution open => fixed
2016-02-04 17:30 henry Assigned To => henry