mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: define linear interpolations for scalar, complex, vector, tensor...
- vector, tensor versions are defined component-wise to avoid intermediates. The base version uses the form "(1-t)*a + t*b" without any bounds checking (ie, will also extrapolate).
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,9 +59,24 @@ int main(int argc, char *argv[])
|
||||
<< "complexVector::one : " << complexVector::one << nl
|
||||
<< nl;
|
||||
|
||||
{
|
||||
const complex a(0, 1);
|
||||
const complex b(20, 100);
|
||||
|
||||
Info<< "lerp of " << a << " : " << b << nl;
|
||||
|
||||
for (const double t : { 0.0, 0.5, 1.0, -0.5, 1.5 })
|
||||
{
|
||||
Info<< " " << t << " = " << lerp(a, b, t) << nl;
|
||||
}
|
||||
}
|
||||
|
||||
for (complex c : { complex{1, 0}, complex{1, 2}} )
|
||||
{
|
||||
Info<< nl << "complex : " << c << nl;
|
||||
Info<< nl << "complex : " << c
|
||||
<< " mag = " << c.magnitude()
|
||||
<< " norm = " << c.magSqr()
|
||||
<< nl;
|
||||
|
||||
Info<< "sin: " << sin(c) << nl
|
||||
<< "pow(3.0f): " << pow(c, 3.0f) << nl
|
||||
|
||||
Reference in New Issue
Block a user