/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 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 .
Description
Functionality of IjkField
\*---------------------------------------------------------------------------*/
#include "point.H"
#include "IjkField.H"
#include "IOstreams.H"
using namespace Foam;
template
Ostream& print(const IjkField& fld)
{
Info<< static_cast&>(fld).size()
<< " addr:" << name(fld.cdata()) << ' ' << fld.sizes() << ' '
<< flatOutput(fld);
return Info;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
// Basic addressing checks
#if 0
{
ijkAddressing addr1(3, 4, 5);
Info<< "addressing: " << addr1.sizes() << nl;
Info<< "index of (2,2,2) " << addr1.index(2,2,2) << nl;
for (const label idx : labelRange(addr1.size()))
{
Info<< "index of " << idx << " => " << addr1.index(idx) << nl;
}
for (label k=0; k < addr1.sizes().z(); ++k)
{
for (label j=0; j < addr1.sizes().y(); ++j)
{
for (label i=0; i < addr1.sizes().x(); ++i)
{
labelVector ijk(i,j,k);
Info<< "index of " << addr1.index(ijk)
<< " <= " << ijk << nl;
}
}
}
}
#endif
// Create with inconsistent sizes
IjkField