|
[Sponsors] |
May 28, 2014, 13:44 |
Calculating polynomials in OF source
|
#1 |
Member
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17 |
I noticed that the class member Foam:: polynomial::value() seems to calculate a polynomial by actually calculating the powers:
Code:
167 forAll(coeffs_, i) 168 { 169 y += coeffs_[i].first()*pow(x, coeffs_[i].second()); 170 } Code:
168 // avoid costly pow() in calculation 169 scalar powX = x; 170 for (label i=1; i<coeffs.size(); ++i) 171 { 172 val += coeffs[i]*powX; 173 powX *= x; 174 } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
wmake compiling new solver | mksca | OpenFOAM Programming & Development | 14 | June 22, 2018 06:29 |
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc | ofslcm | OpenFOAM Community Contributions | 25 | March 6, 2017 10:03 |
[swak4Foam] problem on installing swak4Foam | navid2 | OpenFOAM Community Contributions | 2 | May 30, 2012 04:32 |
pisoFoam compiling error with OF 1.7.1 on MAC OSX | Greg Givogue | OpenFOAM Programming & Development | 3 | March 4, 2011 17:18 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 10:23 |