mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -14,10 +14,15 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// #include "codeStreamDefaults"
|
||||
// values from outer-scope
|
||||
begIter 0;
|
||||
endIter 200;
|
||||
|
||||
writeInterval #codeStream
|
||||
{
|
||||
// values from inner-scope
|
||||
nDumps 5;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
#include "fvCFD.H"
|
||||
@ -30,14 +35,15 @@ writeInterval #codeStream
|
||||
|
||||
code
|
||||
#{
|
||||
scalar start = 0;
|
||||
scalar end = 100;
|
||||
label nDumps = 5;
|
||||
label interval = end - start;
|
||||
Info<<"on-the-fly: " << ((interval)/nDumps) << endl;
|
||||
os << ((interval)/nDumps);
|
||||
label interval = ($endIter - $begIter);
|
||||
label nDumps = $nDumps;
|
||||
os << (interval / nDumps);
|
||||
#};
|
||||
};
|
||||
|
||||
|
||||
// play with cleanup
|
||||
#remove begIter
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: Any |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object testDictCalc;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
flowRatePerHour 720;
|
||||
|
||||
x 10;
|
||||
y 20;
|
||||
z t s v;
|
||||
p #calc{ 1 + 2 + 10 * 15 + $x - $y };
|
||||
|
||||
// this calculation is in-place, but does not work inside a string:
|
||||
flowRate "The flow rate " #calc{ $flowRatePerHour / 3600 } "kg/s";
|
||||
|
||||
// this is also okay
|
||||
x #calc{ $x * 1E-3 };
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -1,46 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: Any |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object testDictCalcError;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
flowRatePerHour 720;
|
||||
|
||||
x 10;
|
||||
y 20;
|
||||
z t s v;
|
||||
// z #test{ // this
|
||||
// 123 - 456
|
||||
// // comments // are
|
||||
// /* stripped
|
||||
// * 10
|
||||
// * {}
|
||||
// */
|
||||
// + 1 /*100 */ 10
|
||||
// };
|
||||
|
||||
p this calculation #calc{
|
||||
1xxx1 + 2 + 10 * 15 +
|
||||
$x - $y
|
||||
// $x + $y
|
||||
}
|
||||
is done inplace;
|
||||
|
||||
|
||||
flowRate #calc{ $flowRatePerHour / 3600};
|
||||
|
||||
xxx yyy;
|
||||
foo 30;
|
||||
bar 15;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -22,11 +22,13 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Test some string functionality
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "string.H"
|
||||
#include "stringOps.H"
|
||||
#include "dictionary.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -38,9 +40,19 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
string test
|
||||
(
|
||||
" $HOME kjhkjhkjh \" \\$HOME/tyetyery ${FOAM_RUN} \n ; hkjh ;$ "
|
||||
" $HOME kjhkjhkjh \" \\$HOME/tyetyery ${FOAM_RUN} \n ; hkjh ;$ with "
|
||||
" $(DONOTSUBST) some other ${USER} entries "
|
||||
);
|
||||
|
||||
dictionary dict;
|
||||
dict.add("HOME", "myHome");
|
||||
|
||||
dictionary subDict;
|
||||
subDict.add("value1", "test1");
|
||||
subDict.add("value2", "test2");
|
||||
dict.add("FOAM_RUN", subDict);
|
||||
|
||||
|
||||
Info<< "string:" << test << nl << "hash:"
|
||||
<< unsigned(string::hash()(test)) << endl;
|
||||
|
||||
@ -73,7 +85,10 @@ int main(int argc, char *argv[])
|
||||
Info<< string(test).replaceAll("kj", "zzz") << endl;
|
||||
Info<< string(test).replaceAll("kj", "z") << endl;
|
||||
|
||||
Info<< string(test).expand() << endl;
|
||||
Info<< "expanded: " << string(test).expand() << endl;
|
||||
|
||||
Info<<"dictionary-based substitution: " << dict << endl;
|
||||
Info<< "expandDict: " << stringOps::expandDict(test, dict) << endl;
|
||||
|
||||
string test2("~OpenFOAM/controlDict");
|
||||
Info<< test2 << " => " << test2.expand() << endl;
|
||||
|
||||
Reference in New Issue
Block a user