Add the OpenFOAM source tree
This commit is contained in:
80
applications/test/pTraits/Test-pTraits.C
Normal file
80
applications/test/pTraits/Test-pTraits.C
Normal file
@ -0,0 +1,80 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOstreams.H"
|
||||
#include "pTraits.H"
|
||||
#include "vector.H"
|
||||
#include "tensor.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
template<class T>
|
||||
void printTraits()
|
||||
{
|
||||
Info<< pTraits<T>::typeName
|
||||
<< ": zero=" << pTraits<T>::zero
|
||||
<< " one=" << pTraits<T>::one << endl;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void printTraits(const pTraits<T>& p)
|
||||
{
|
||||
Info<< p.typeName << " == " << p << endl;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
printTraits<bool>();
|
||||
printTraits<label>();
|
||||
printTraits<scalar>();
|
||||
printTraits<vector>();
|
||||
printTraits<tensor>();
|
||||
|
||||
{
|
||||
pTraits<bool> b(true);
|
||||
printTraits(b);
|
||||
}
|
||||
|
||||
{
|
||||
pTraits<label> l(100);
|
||||
printTraits(l);
|
||||
}
|
||||
|
||||
printTraits(pTraits<scalar>(3.14159));
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user