Added bbox calculation on the fem part for #312

This concludes #312 for now. Wellpaths are now shown in the Geomech
views
This commit is contained in:
Jacob Støren 2015-06-11 19:13:04 +02:00
parent b59695f352
commit ceeb38d13a
6 changed files with 42 additions and 8 deletions

View File

@ -20,6 +20,7 @@
#include "RigFemPart.h"
#include "RigFemPartGrid.h"
#include "cvfBoundingBox.h"
//--------------------------------------------------------------------------------------------------
///
@ -321,3 +322,19 @@ float RigFemPart::characteristicElementSize()
return m_characteristicElementSize;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RigFemPart::boundingBox()
{
if (m_boundingBox.isValid()) return m_boundingBox;
size_t nodeCount = nodes().coordinates.size();
for (size_t nIdx = 0; nIdx < nodeCount; ++nIdx)
{
m_boundingBox.add(nodes().coordinates[nIdx]);
}
return m_boundingBox;
}

View File

@ -24,7 +24,7 @@
#include "RigFemTypes.h"
#include "cvfObject.h"
#include "cvfAssert.h"
#include "cvfBoundingBox.h"
#include "cvfVector3.h"
#include <vector>
@ -71,6 +71,7 @@ public:
int neighborFace(int elementIndex, int faceIndex) const
{ return m_elmNeighbors[elementIndex].faceInNeighborElm[faceIndex]; }
cvf::BoundingBox boundingBox();
float characteristicElementSize();
const std::vector<int>& possibleGridCornerElements() const { return m_possibleGridCornerElements; }
@ -99,5 +100,6 @@ private:
std::vector<int> m_possibleGridCornerElements;
float m_characteristicElementSize;
cvf::BoundingBox m_boundingBox;
};

View File

@ -19,6 +19,7 @@
#include "RigFemPartCollection.h"
#include "cvfBoundingBox.h"
//--------------------------------------------------------------------------------------------------
@ -98,3 +99,16 @@ float RigFemPartCollection::characteristicElementSize()
return 0;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RigFemPartCollection::boundingBox()
{
cvf::BoundingBox bBox;
for (int i = 0; i < partCount(); i++)
{
bBox.add(part(i)->boundingBox());
}
return bBox;
}

View File

@ -37,6 +37,7 @@ public:
size_t totalElementCount() const;
float characteristicElementSize();
cvf::BoundingBox boundingBox();
private:

View File

@ -58,5 +58,4 @@ public:
private:
caf::PdmPointer<RimWellPathCollection> m_wellPathCollection;
cvf::ref<cvf::Transform> m_scaleTransform;
};

View File

@ -244,9 +244,10 @@ void RimGeoMechView::createDisplayModel()
else
m_viewer->addFrame(scene.p());
// !! TODO: Compute characteristic cell size
double characteristicCellSize_HARDCODED = 300;
addWellPathsToScene(scene.p(), cvf::Vec3d(0, 0, 0), characteristicCellSize_HARDCODED, m_viewer->mainScene()->boundingBox(), scaleTransform());
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
addWellPathsToScene(scene.p(), cvf::Vec3d(0, 0, 0), characteristicCellSize, femBBox, scaleTransform());
}
// If the animation was active before recreating everything, make viewer view current frame
@ -283,9 +284,9 @@ void RimGeoMechView::updateCurrentTimeStep()
frameScene->removeAllModels();
frameScene->addModel(frameParts.p());
// !! TODO: Compute characteristic cell size
double characteristicCellSize_HARDCODED = 300;
addWellPathsToScene(frameScene, cvf::Vec3d(0, 0, 0), characteristicCellSize_HARDCODED, m_viewer->mainScene()->boundingBox(), scaleTransform());
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
addWellPathsToScene(frameScene, cvf::Vec3d(0, 0, 0), characteristicCellSize, femBBox, scaleTransform());
}
}