mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: unroll loops for complexVector functions
STYLE: prefer STL naming real(), imag() instead of Re(), Im()
This commit is contained in:
@ -145,6 +145,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
complexField cmplx(4);
|
||||
|
||||
zip(cmplx, reals, zero{});
|
||||
zip(cmplx, 1, imags);
|
||||
zip(cmplx, reals, imags);
|
||||
Info<< nl
|
||||
<< "zip " << reals << nl
|
||||
@ -360,6 +362,24 @@ int main(int argc, char *argv[])
|
||||
// MinMax fails since there is no less comparison operator
|
||||
// Info<< "min/max = " << MinMax<complex>(fld1) << nl;
|
||||
|
||||
|
||||
// Cross-product
|
||||
{
|
||||
const vector vec(1, 2, 3);
|
||||
const vector realValue(4, 5, 6);
|
||||
const vector imagValue(7, 8, 9);
|
||||
|
||||
complexVector cmplxVec(zip(realValue, imagValue));
|
||||
|
||||
Info<< "complexVector: " << cmplxVec << nl;
|
||||
Info<< "cross: " << (vec ^ cmplxVec) << nl;
|
||||
|
||||
Info<< "cross real: " << (vec ^ realValue) << nl
|
||||
<< "cross imag: " << (vec ^ imagValue) << nl
|
||||
<< "cross : "
|
||||
<< zip((vec ^ realValue), (vec ^ imagValue)) << nl;
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -468,13 +468,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (auto& val : A)
|
||||
{
|
||||
val.Re() = rndGen.GaussNormal<scalar>();
|
||||
val.Im() = rndGen.GaussNormal<scalar>();
|
||||
val.real(rndGen.GaussNormal<scalar>());
|
||||
val.imag(rndGen.GaussNormal<scalar>());
|
||||
}
|
||||
for (auto& val : B)
|
||||
{
|
||||
val.Re() = rndGen.GaussNormal<scalar>();
|
||||
val.Im() = rndGen.GaussNormal<scalar>();
|
||||
val.real(rndGen.GaussNormal<scalar>());
|
||||
val.imag(rndGen.GaussNormal<scalar>());
|
||||
}
|
||||
|
||||
Info<< nl << "# (A.T()).T() = A:" << nl;
|
||||
@ -893,8 +893,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (auto& val : A)
|
||||
{
|
||||
val.Re() = rndGen.GaussNormal<scalar>();
|
||||
val.Im() = rndGen.GaussNormal<scalar>();
|
||||
val.real(rndGen.GaussNormal<scalar>());
|
||||
val.imag(rndGen.GaussNormal<scalar>());
|
||||
}
|
||||
|
||||
Info<< "# SquareMatrix<complex>.symmetric():" << nl
|
||||
|
||||
Reference in New Issue
Block a user