Add the OpenFOAM source tree
This commit is contained in:
3
applications/test/codeStream/Make/files
Normal file
3
applications/test/codeStream/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-codeStream.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-codeStream
|
||||
1
applications/test/codeStream/Make/options
Normal file
1
applications/test/codeStream/Make/options
Normal file
@ -0,0 +1 @@
|
||||
EXE_INC =
|
||||
75
applications/test/codeStream/Test-codeStream.C
Normal file
75
applications/test/codeStream/Test-codeStream.C
Normal file
@ -0,0 +1,75 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
Application
|
||||
Test-codeStream
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "IOstreams.H"
|
||||
#include "IOobject.H"
|
||||
#include "IFstream.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noParallel();
|
||||
argList::validArgs.insert("dict .. dictN");
|
||||
argList args(argc, argv, false, true);
|
||||
|
||||
Info<< nl
|
||||
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
|
||||
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
|
||||
<< endl;
|
||||
|
||||
if (args.size() <= 1)
|
||||
{
|
||||
Info<<"specify dictionaries to test\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
IOobject::writeDivider(Info);
|
||||
for (label argI=1; argI < args.size(); ++argI)
|
||||
{
|
||||
const string& dictFile = args[argI];
|
||||
IFstream is(dictFile);
|
||||
|
||||
dictionary dict(is);
|
||||
|
||||
Info<< dict << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
57
applications/test/codeStream/codeStreamDict1
Normal file
57
applications/test/codeStream/codeStreamDict1
Normal file
@ -0,0 +1,57 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object testDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// values from outer-scope
|
||||
begIter 0;
|
||||
endIter 200;
|
||||
|
||||
writeInterval #codeStream
|
||||
{
|
||||
// values from inner-scope
|
||||
nDumps 5;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
#include "fvCFD.H"
|
||||
#};
|
||||
|
||||
codeOptions
|
||||
#{
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
#};
|
||||
|
||||
localCode
|
||||
#{
|
||||
static int someCode()
|
||||
{
|
||||
Info<<"called someCode\n";
|
||||
return 10;
|
||||
}
|
||||
#};
|
||||
|
||||
code
|
||||
#{
|
||||
label interval = ($endIter - $begIter);
|
||||
// label nDumps = $nDumps;
|
||||
label nDumps = someCode();
|
||||
os << (interval / nDumps);
|
||||
#};
|
||||
};
|
||||
|
||||
// play with cleanup
|
||||
#remove begIter
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Reference in New Issue
Block a user