/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
-------------------------------------------------------------------------------
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-FixedList
Description
Simple tests and examples for FixedList
See also
Foam::FixedList
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "FixedList.H"
#include "Fstream.H"
#include "List.H"
#include "IPstream.H"
#include "OPstream.H"
#include
using namespace Foam;
template
Ostream& printInfo(const FixedList, N>& list)
{
Info<< list << " addresses:";
for (unsigned i = 0; i < N; ++i)
{
Info<< " " << long(list[i].cdata());
}
Info<< nl;
return Info;
}
template
Ostream& printInfo
(
const FixedList, N>& list1,
const FixedList, N>& list2
)
{
Info<< "llist1:"; printInfo(list1);
Info<< "llist2:"; printInfo(list2);
return Info;
}
template
void compileInfo()
{
// Info<< typeid(decltype(FixedList)).name() << nl;
// Info<< " holds: "
// << typeid(decltype(FixedList::value_type())).name() << nl;
Info<< "max_size:"
<< FixedList::max_size() << nl;
}
template
typename std::enable_if
<(FixedListType::max_size() == 2), bool>::type
is_pair()
{
return true;
}
template
typename std::enable_if<(FixedListType::max_size() != 2), std::string>::type
is_pair()
{
return "not really at all";
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::addBoolOption("assign");
argList::addBoolOption("iter");
argList::addBoolOption("swap");
argList::addBoolOption("default", "reinstate default tests");
argList::addNote("runs default tests or specified ones only");
#include "setRootCase.H"
// Run default tests, unless only specific tests are requested
const bool defaultTests =
args.found("default") || args.options().empty();
typedef FixedList scalar2Type;
typedef FixedList