Better speed test with indirect addressing.

This commit is contained in:
henry
2009-06-23 20:44:27 +01:00
parent 0bb012d0c2
commit fc608c0594
9 changed files with 237 additions and 103 deletions

View File

@ -0,0 +1,39 @@
#include "primitiveFields.H"
#include "cpuTime.H"
#include "IOstreams.H"
#include "OFstream.H"
using namespace Foam;
int main()
{
const label nIter = 100;
const label size = 1000000;
Info<< "Initialising fields" << endl;
vectorField
vf1(size, vector::one),
vf2(size, vector::one),
vf3(size, vector::one),
vf4(size);
Info<< "Done\n" << endl;
{
cpuTime executionTime;
Info<< "vectorField algebra" << endl;
for (register int j=0; j<nIter; j++)
{
vf4 = vf1 + vf2 - vf3;
}
Info<< "ExecutionTime = "
<< executionTime.elapsedCpuTime()
<< " s\n" << endl;
Snull<< vf4[1] << endl << endl;
}
}