#3114 compdat export. Improve performance

This commit is contained in:
Bjørn Erik Jensen
2018-08-20 11:47:05 +02:00
parent 56bf2ede7d
commit 7369ce56ba
6 changed files with 88 additions and 29 deletions

View File

@@ -19,6 +19,8 @@
#include "gtest/gtest.h"
#include "RigHexIntersectionTools.h"
#include "QDateTime"
#include "QDebug"
//--------------------------------------------------------------------------------------------------
///
@@ -48,3 +50,48 @@ TEST(RigHexIntersectionTools, planeHexCellIntersectionTest)
EXPECT_FALSE(isCellIntersected);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RigHexIntersectionTools, DISABLED_planeHexCellIntersectionPerformanceTest)
{
cvf::Vec3d hexCorners[8];
hexCorners[0] = cvf::Vec3d(0, 0, 0);
hexCorners[1] = cvf::Vec3d(1, 0, 0);
hexCorners[2] = cvf::Vec3d(0, 1, 0);
hexCorners[3] = cvf::Vec3d(0, 0, 1);
hexCorners[4] = cvf::Vec3d(0, 1, 1);
hexCorners[5] = cvf::Vec3d(1, 1, 0);
hexCorners[6] = cvf::Vec3d(1, 0, 1);
hexCorners[7] = cvf::Vec3d(1, 1, 1);
bool isCellIntersected = false;
cvf::Plane fracturePlaneIntersecting;
cvf::Plane fracturePlaneNotIntersecting;
fracturePlaneNotIntersecting.setFromPointAndNormal(cvf::Vec3d(1.5, 1.5, 1.5), cvf::Vec3d(1, 0, 0));
fracturePlaneIntersecting.setFromPointAndNormal(cvf::Vec3d(0.5, 0.5, 0.5), cvf::Vec3d(1, 0, 0));
QTime timeTotal;
timeTotal.start();
for (int run = 0; run < 5; run++)
{
QTime timeLocal;
timeLocal.start();
for (int i = 0; i < 2000000; i++)
{
std::list<std::pair<cvf::Vec3d, cvf::Vec3d > > intersectionLineSegments;
isCellIntersected = RigHexIntersectionTools::planeHexCellIntersection(hexCorners, fracturePlaneIntersecting, intersectionLineSegments);
isCellIntersected = RigHexIntersectionTools::planeHexCellIntersection(hexCorners, fracturePlaneNotIntersecting, intersectionLineSegments);
}
qDebug() << "Time rim elapsed: " << timeLocal.elapsed();
}
qDebug() << "Time total elapsed: " << timeTotal.elapsed();
}