mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Better speed test with indirect addressing.
This commit is contained in:
39
applications/test/speed/vectorSpeedTest/vectorSpeedTest.C
Normal file
39
applications/test/speed/vectorSpeedTest/vectorSpeedTest.C
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user