/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
Description
Specialisation of Field\ for complex and complexVector.
\*---------------------------------------------------------------------------*/
#include "complexFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineCompoundTypeName(List, complexList);
addCompoundToRunTimeSelectionTable(List, complexList);
complexField ComplexField(const UList& re, const UList& im)
{
complexField cf(re.size());
forAll(cf, i)
{
cf[i].Re() = re[i];
cf[i].Im() = im[i];
}
return cf;
}
complexField ReComplexField(const UList& sf)
{
complexField cf(sf.size());
forAll(cf, i)
{
cf[i].Re() = sf[i];
cf[i].Im() = 0.0;
}
return cf;
}
complexField ImComplexField(const UList& sf)
{
complexField cf(sf.size());
forAll(cf, i)
{
cf[i].Re() = 0.0;
cf[i].Im() = sf[i];
}
return cf;
}
scalarField ReImSum(const UList& cf)
{
scalarField sf(cf.size());
forAll(sf, i)
{
sf[i] = cf[i].Re() + cf[i].Im();
}
return sf;
}
scalarField Re(const UList& cf)
{
scalarField sf(cf.size());
forAll(sf, i)
{
sf[i] = cf[i].Re();
}
return sf;
}
scalarField Im(const UList& cf)
{
scalarField sf(cf.size());
forAll(sf, i)
{
sf[i] = cf[i].Im();
}
return sf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineCompoundTypeName(List, complexVectorList);
addCompoundToRunTimeSelectionTable(List, complexVectorList);
complexVectorField ComplexField
(
const UList& re,
const UList& im
)
{
complexVectorField cvf(re.size());
for (direction cmpt=0; cmpt& vf)
{
complexVectorField cvf(vf.size());
for (direction cmpt=0; cmpt& vf)
{
complexVectorField cvf(vf.size());
for (direction cmpt=0; cmpt& cvf)
{
vectorField vf(cvf.size());
for (direction cmpt=0; cmpt& cvf)
{
vectorField vf(cvf.size());
for (direction cmpt=0; cmpt& cvf)
{
vectorField vf(cvf.size());
for (direction cmpt=0; cmpt