diff --git a/applications/test/FieldFields1/Make/files b/applications/test/FieldFields1/Make/files new file mode 100644 index 0000000000..e90b498508 --- /dev/null +++ b/applications/test/FieldFields1/Make/files @@ -0,0 +1,3 @@ +Test-FieldFields1.C + +EXE = $(FOAM_USER_APPBIN)/Test-FieldFields1 diff --git a/applications/test/tensorFieldFields1/Make/options b/applications/test/FieldFields1/Make/options similarity index 100% rename from applications/test/tensorFieldFields1/Make/options rename to applications/test/FieldFields1/Make/options diff --git a/applications/test/FieldFields1/Test-FieldFields1.C b/applications/test/FieldFields1/Test-FieldFields1.C new file mode 100644 index 0000000000..53f3314c35 --- /dev/null +++ b/applications/test/FieldFields1/Test-FieldFields1.C @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2022 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 . + +Application + Test-FieldFields1 + +\*---------------------------------------------------------------------------*/ + +#include "symmTensorField.H" +#include "tensorField.H" +#include "FieldFields.H" +#include "Random.H" + +using namespace Foam; + + +template +void printFieldField(const FieldField& ff) +{ + forAll(ff, i) + { + Info<< i << ": " << flatOutput(ff[i]) << nl; + } + Info<< nl; +} + + +template +tmp> randomField(Random& rnd, label dim) +{ + auto tfld = tmp>::New(dim); + auto& fld = tfld.ref(); + + for (Type& val : fld) + { + for (direction cmpt=0; cmpt < pTraits::nComponents; ++cmpt) + { + setComponent(val, cmpt) = rnd.position