mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
#6106 Apply clang-format on AppFwk
This commit is contained in:
1 parent
e2ef6a910b
commit
bdc536dfc4
407 files changed
+88976
-42309
No files matched your search
@@ -34,33 +34,28 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfStructGrid.h"
|
||||
#include "cvfBase.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void cvf::StructGridInterface::FaceEnum::setUp()
|
||||
{
|
||||
addItem(cvf::StructGridInterface::POS_I, "POS I", "");
|
||||
addItem(cvf::StructGridInterface::NEG_I, "NEG I", "");
|
||||
addItem(cvf::StructGridInterface::POS_J, "POS J", "");
|
||||
addItem(cvf::StructGridInterface::NEG_J, "NEG J", "");
|
||||
addItem(cvf::StructGridInterface::POS_K, "POS K", "");
|
||||
addItem(cvf::StructGridInterface::NEG_K, "NEG K", "");
|
||||
addItem(cvf::StructGridInterface::NO_FACE, "UnDef", "");
|
||||
}
|
||||
template <>
|
||||
void cvf::StructGridInterface::FaceEnum::setUp()
|
||||
{
|
||||
addItem( cvf::StructGridInterface::POS_I, "POS I", "" );
|
||||
addItem( cvf::StructGridInterface::NEG_I, "NEG I", "" );
|
||||
addItem( cvf::StructGridInterface::POS_J, "POS J", "" );
|
||||
addItem( cvf::StructGridInterface::NEG_J, "NEG J", "" );
|
||||
addItem( cvf::StructGridInterface::POS_K, "POS K", "" );
|
||||
addItem( cvf::StructGridInterface::NEG_K, "NEG K", "" );
|
||||
addItem( cvf::StructGridInterface::NO_FACE, "UnDef", "" );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
|
||||
namespace cvf {
|
||||
|
||||
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
StructGridInterface::StructGridInterface()
|
||||
{
|
||||
@@ -70,86 +65,86 @@ StructGridInterface::StructGridInterface()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t StructGridInterface::cellCountI() const
|
||||
{
|
||||
if (gridPointCountI() == 0) return 0;
|
||||
|
||||
if ( gridPointCountI() == 0 ) return 0;
|
||||
|
||||
return gridPointCountI() - 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t StructGridInterface::cellCountJ() const
|
||||
{
|
||||
if (gridPointCountJ() == 0) return 0;
|
||||
|
||||
if ( gridPointCountJ() == 0 ) return 0;
|
||||
|
||||
return gridPointCountJ() - 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t StructGridInterface::cellCountK() const
|
||||
{
|
||||
if (gridPointCountK() == 0) return 0;
|
||||
|
||||
if ( gridPointCountK() == 0 ) return 0;
|
||||
|
||||
return gridPointCountK() - 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void StructGridInterface::cellFaceVertexIndices(FaceType face, cvf::ubyte vertexIndices[4])
|
||||
void StructGridInterface::cellFaceVertexIndices( FaceType face, cvf::ubyte vertexIndices[4] )
|
||||
{
|
||||
//
|
||||
// 7---------6
|
||||
// /| /| |k
|
||||
// / | / | | /j
|
||||
// 4---------5 | |/
|
||||
// | 3------|--2 *---i
|
||||
// | / | /
|
||||
// |/ |/
|
||||
// 0---------1
|
||||
// 7---------6
|
||||
// /| /| |k
|
||||
// / | / | | /j
|
||||
// 4---------5 | |/
|
||||
// | 3------|--2 *---i
|
||||
// | / | /
|
||||
// |/ |/
|
||||
// 0---------1
|
||||
|
||||
if (face == NEG_K)
|
||||
if ( face == NEG_K )
|
||||
{
|
||||
vertexIndices[0] = 0;
|
||||
vertexIndices[1] = 3;
|
||||
vertexIndices[2] = 2;
|
||||
vertexIndices[3] = 1;
|
||||
}
|
||||
else if (face == POS_K)
|
||||
else if ( face == POS_K )
|
||||
{
|
||||
vertexIndices[0] = 4;
|
||||
vertexIndices[1] = 5;
|
||||
vertexIndices[2] = 6;
|
||||
vertexIndices[3] = 7;
|
||||
}
|
||||
else if (face == NEG_J)
|
||||
else if ( face == NEG_J )
|
||||
{
|
||||
vertexIndices[0] = 0;
|
||||
vertexIndices[1] = 1;
|
||||
vertexIndices[2] = 5;
|
||||
vertexIndices[3] = 4;
|
||||
}
|
||||
else if (face == POS_I)
|
||||
else if ( face == POS_I )
|
||||
{
|
||||
vertexIndices[0] = 1;
|
||||
vertexIndices[1] = 2;
|
||||
vertexIndices[2] = 6;
|
||||
vertexIndices[3] = 5;
|
||||
}
|
||||
else if (face == POS_J)
|
||||
else if ( face == POS_J )
|
||||
{
|
||||
vertexIndices[0] = 3;
|
||||
vertexIndices[1] = 7;
|
||||
vertexIndices[2] = 6;
|
||||
vertexIndices[3] = 2;
|
||||
}
|
||||
else if (face == NEG_I)
|
||||
else if ( face == NEG_I )
|
||||
{
|
||||
vertexIndices[0] = 0;
|
||||
vertexIndices[1] = 4;
|
||||
@@ -159,23 +154,35 @@ void StructGridInterface::cellFaceVertexIndices(FaceType face, cvf::ubyte vertex
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
StructGridInterface::FaceType StructGridInterface::oppositeFace(FaceType face)
|
||||
StructGridInterface::FaceType StructGridInterface::oppositeFace( FaceType face )
|
||||
{
|
||||
FaceType opposite;
|
||||
|
||||
switch (face)
|
||||
|
||||
switch ( face )
|
||||
{
|
||||
case NEG_I : opposite = POS_I; break;
|
||||
case POS_I : opposite = NEG_I; break;
|
||||
case NEG_J : opposite = POS_J; break;
|
||||
case POS_J : opposite = NEG_J; break;
|
||||
case NEG_K : opposite = POS_K; break;
|
||||
case POS_K : opposite = NEG_K; break;
|
||||
default:
|
||||
opposite = POS_I;
|
||||
CVF_ASSERT(false);
|
||||
case NEG_I:
|
||||
opposite = POS_I;
|
||||
break;
|
||||
case POS_I:
|
||||
opposite = NEG_I;
|
||||
break;
|
||||
case NEG_J:
|
||||
opposite = POS_J;
|
||||
break;
|
||||
case POS_J:
|
||||
opposite = NEG_J;
|
||||
break;
|
||||
case NEG_K:
|
||||
opposite = POS_K;
|
||||
break;
|
||||
case POS_K:
|
||||
opposite = NEG_K;
|
||||
break;
|
||||
default:
|
||||
opposite = POS_I;
|
||||
CVF_ASSERT( false );
|
||||
}
|
||||
|
||||
return opposite;
|
||||
@@ -184,42 +191,62 @@ StructGridInterface::FaceType StructGridInterface::oppositeFace(FaceType face)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Return values are set to cvf::UNDEFINED_SIZE_T if the neighbor is in the negative area
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void StructGridInterface::neighborIJKAtCellFace(size_t i, size_t j, size_t k, FaceType face, size_t* ni, size_t* nj, size_t* nk)
|
||||
void StructGridInterface::neighborIJKAtCellFace( size_t i, size_t j, size_t k, FaceType face, size_t* ni, size_t* nj, size_t* nk )
|
||||
{
|
||||
*ni = i;
|
||||
*nj = j;
|
||||
*nk = k;
|
||||
|
||||
switch (face)
|
||||
switch ( face )
|
||||
{
|
||||
case POS_I : (*ni)++; break;
|
||||
case NEG_I : if (i > 0) (*ni)--; else (*ni) = cvf::UNDEFINED_SIZE_T; break;
|
||||
case POS_J : (*nj)++; break;
|
||||
case NEG_J : if (j > 0) (*nj)--; else (*nj) = cvf::UNDEFINED_SIZE_T; break;
|
||||
case POS_K : (*nk)++; break;
|
||||
case NEG_K : if (k > 0) (*nk)--; else (*nk) = cvf::UNDEFINED_SIZE_T; break;
|
||||
default:
|
||||
break;
|
||||
case POS_I:
|
||||
( *ni )++;
|
||||
break;
|
||||
case NEG_I:
|
||||
if ( i > 0 )
|
||||
( *ni )--;
|
||||
else
|
||||
( *ni ) = cvf::UNDEFINED_SIZE_T;
|
||||
break;
|
||||
case POS_J:
|
||||
( *nj )++;
|
||||
break;
|
||||
case NEG_J:
|
||||
if ( j > 0 )
|
||||
( *nj )--;
|
||||
else
|
||||
( *nj ) = cvf::UNDEFINED_SIZE_T;
|
||||
break;
|
||||
case POS_K:
|
||||
( *nk )++;
|
||||
break;
|
||||
case NEG_K:
|
||||
if ( k > 0 )
|
||||
( *nk )--;
|
||||
else
|
||||
( *nk ) = cvf::UNDEFINED_SIZE_T;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
StructGridInterface::GridAxisType StructGridInterface::gridAxisFromFace(FaceType face)
|
||||
StructGridInterface::GridAxisType StructGridInterface::gridAxisFromFace( FaceType face )
|
||||
{
|
||||
GridAxisType axis = GridAxisType::NO_AXIS;
|
||||
|
||||
if (face == cvf::StructGridInterface::POS_I || face == cvf::StructGridInterface::NEG_I)
|
||||
if ( face == cvf::StructGridInterface::POS_I || face == cvf::StructGridInterface::NEG_I )
|
||||
{
|
||||
axis = GridAxisType::AXIS_I;
|
||||
}
|
||||
else if (face == cvf::StructGridInterface::POS_J || face == cvf::StructGridInterface::NEG_J)
|
||||
else if ( face == cvf::StructGridInterface::POS_J || face == cvf::StructGridInterface::NEG_J )
|
||||
{
|
||||
axis = GridAxisType::AXIS_J;
|
||||
}
|
||||
else if (face == cvf::StructGridInterface::POS_K || face == cvf::StructGridInterface::NEG_K)
|
||||
else if ( face == cvf::StructGridInterface::POS_K || face == cvf::StructGridInterface::NEG_K )
|
||||
{
|
||||
axis = GridAxisType::AXIS_K;
|
||||
}
|
||||
@@ -243,70 +270,80 @@ cvf::Vec3d StructGridInterface::displayModelOffset() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void StructGridInterface::characteristicCellSizes(double* iSize, double* jSize, double* kSize) const
|
||||
void StructGridInterface::characteristicCellSizes( double* iSize, double* jSize, double* kSize ) const
|
||||
{
|
||||
CVF_ASSERT(iSize && jSize && kSize);
|
||||
CVF_ASSERT( iSize && jSize && kSize );
|
||||
|
||||
if (m_characteristicCellSizeI == cvf::UNDEFINED_DOUBLE
|
||||
|| m_characteristicCellSizeJ == cvf::UNDEFINED_DOUBLE
|
||||
|| m_characteristicCellSizeK == cvf::UNDEFINED_DOUBLE)
|
||||
if ( m_characteristicCellSizeI == cvf::UNDEFINED_DOUBLE || m_characteristicCellSizeJ == cvf::UNDEFINED_DOUBLE ||
|
||||
m_characteristicCellSizeK == cvf::UNDEFINED_DOUBLE )
|
||||
{
|
||||
|
||||
ubyte faceConnPosI[4];
|
||||
cellFaceVertexIndices(StructGridInterface::POS_I, faceConnPosI);
|
||||
cellFaceVertexIndices( StructGridInterface::POS_I, faceConnPosI );
|
||||
|
||||
ubyte faceConnNegI[4];
|
||||
cellFaceVertexIndices(StructGridInterface::NEG_I, faceConnNegI);
|
||||
|
||||
cellFaceVertexIndices( StructGridInterface::NEG_I, faceConnNegI );
|
||||
|
||||
ubyte faceConnPosJ[4];
|
||||
cellFaceVertexIndices(StructGridInterface::POS_J, faceConnPosJ);
|
||||
cellFaceVertexIndices( StructGridInterface::POS_J, faceConnPosJ );
|
||||
|
||||
ubyte faceConnNegJ[4];
|
||||
cellFaceVertexIndices(StructGridInterface::NEG_J, faceConnNegJ);
|
||||
cellFaceVertexIndices( StructGridInterface::NEG_J, faceConnNegJ );
|
||||
|
||||
ubyte faceConnPosK[4];
|
||||
cellFaceVertexIndices(StructGridInterface::POS_K, faceConnPosK);
|
||||
cellFaceVertexIndices( StructGridInterface::POS_K, faceConnPosK );
|
||||
|
||||
ubyte faceConnNegK[4];
|
||||
cellFaceVertexIndices(StructGridInterface::NEG_K, faceConnNegK);
|
||||
cellFaceVertexIndices( StructGridInterface::NEG_K, faceConnNegK );
|
||||
|
||||
double iLengthAccumulated = 0.0;
|
||||
double jLengthAccumulated = 0.0;
|
||||
double kLengthAccumulated = 0.0;
|
||||
|
||||
cvf::Vec3d cornerVerts[8];
|
||||
size_t cellCount = 0;
|
||||
size_t cellCount = 0;
|
||||
|
||||
size_t k;
|
||||
for (k = 0; k < cellCountK(); k++)
|
||||
for ( k = 0; k < cellCountK(); k++ )
|
||||
{
|
||||
size_t j;
|
||||
for (j = 0; j < cellCountJ(); j++)
|
||||
for ( j = 0; j < cellCountJ(); j++ )
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < cellCountI(); i += 10) // NB! Evaluate every n-th cell
|
||||
for ( i = 0; i < cellCountI(); i += 10 ) // NB! Evaluate every n-th cell
|
||||
{
|
||||
if (isCellValid(i, j, k))
|
||||
if ( isCellValid( i, j, k ) )
|
||||
{
|
||||
size_t cellIndex = cellIndexFromIJK(i, j, k);
|
||||
cellCornerVertices(cellIndex, cornerVerts);
|
||||
size_t cellIndex = cellIndexFromIJK( i, j, k );
|
||||
cellCornerVertices( cellIndex, cornerVerts );
|
||||
|
||||
iLengthAccumulated += (cornerVerts[faceConnPosI[0]] - cornerVerts[faceConnNegI[0]]).lengthSquared();
|
||||
iLengthAccumulated += (cornerVerts[faceConnPosI[1]] - cornerVerts[faceConnNegI[3]]).lengthSquared();
|
||||
iLengthAccumulated += (cornerVerts[faceConnPosI[2]] - cornerVerts[faceConnNegI[2]]).lengthSquared();
|
||||
iLengthAccumulated += (cornerVerts[faceConnPosI[3]] - cornerVerts[faceConnNegI[1]]).lengthSquared();
|
||||
iLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosI[0]] - cornerVerts[faceConnNegI[0]] ).lengthSquared();
|
||||
iLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosI[1]] - cornerVerts[faceConnNegI[3]] ).lengthSquared();
|
||||
iLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosI[2]] - cornerVerts[faceConnNegI[2]] ).lengthSquared();
|
||||
iLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosI[3]] - cornerVerts[faceConnNegI[1]] ).lengthSquared();
|
||||
|
||||
jLengthAccumulated += (cornerVerts[faceConnPosJ[0]] - cornerVerts[faceConnNegJ[0]]).lengthSquared();
|
||||
jLengthAccumulated += (cornerVerts[faceConnPosJ[1]] - cornerVerts[faceConnNegJ[3]]).lengthSquared();
|
||||
jLengthAccumulated += (cornerVerts[faceConnPosJ[2]] - cornerVerts[faceConnNegJ[2]]).lengthSquared();
|
||||
jLengthAccumulated += (cornerVerts[faceConnPosJ[3]] - cornerVerts[faceConnNegJ[1]]).lengthSquared();
|
||||
jLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosJ[0]] - cornerVerts[faceConnNegJ[0]] ).lengthSquared();
|
||||
jLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosJ[1]] - cornerVerts[faceConnNegJ[3]] ).lengthSquared();
|
||||
jLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosJ[2]] - cornerVerts[faceConnNegJ[2]] ).lengthSquared();
|
||||
jLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosJ[3]] - cornerVerts[faceConnNegJ[1]] ).lengthSquared();
|
||||
|
||||
kLengthAccumulated += (cornerVerts[faceConnPosK[0]] - cornerVerts[faceConnNegK[0]]).lengthSquared();
|
||||
kLengthAccumulated += (cornerVerts[faceConnPosK[1]] - cornerVerts[faceConnNegK[3]]).lengthSquared();
|
||||
kLengthAccumulated += (cornerVerts[faceConnPosK[2]] - cornerVerts[faceConnNegK[2]]).lengthSquared();
|
||||
kLengthAccumulated += (cornerVerts[faceConnPosK[3]] - cornerVerts[faceConnNegK[1]]).lengthSquared();
|
||||
kLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosK[0]] - cornerVerts[faceConnNegK[0]] ).lengthSquared();
|
||||
kLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosK[1]] - cornerVerts[faceConnNegK[3]] ).lengthSquared();
|
||||
kLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosK[2]] - cornerVerts[faceConnNegK[2]] ).lengthSquared();
|
||||
kLengthAccumulated +=
|
||||
( cornerVerts[faceConnPosK[3]] - cornerVerts[faceConnNegK[1]] ).lengthSquared();
|
||||
|
||||
cellCount++;
|
||||
}
|
||||
@@ -316,11 +353,11 @@ void StructGridInterface::characteristicCellSizes(double* iSize, double* jSize,
|
||||
|
||||
double divisor = cellCount * 4.0;
|
||||
|
||||
if (divisor > 0.0)
|
||||
if ( divisor > 0.0 )
|
||||
{
|
||||
m_characteristicCellSizeI = cvf::Math::sqrt(iLengthAccumulated / divisor);
|
||||
m_characteristicCellSizeJ = cvf::Math::sqrt(jLengthAccumulated / divisor);
|
||||
m_characteristicCellSizeK = cvf::Math::sqrt(kLengthAccumulated / divisor);
|
||||
m_characteristicCellSizeI = cvf::Math::sqrt( iLengthAccumulated / divisor );
|
||||
m_characteristicCellSizeJ = cvf::Math::sqrt( jLengthAccumulated / divisor );
|
||||
m_characteristicCellSizeK = cvf::Math::sqrt( kLengthAccumulated / divisor );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,5 +366,4 @@ void StructGridInterface::characteristicCellSizes(double* iSize, double* jSize,
|
||||
*kSize = m_characteristicCellSizeK;
|
||||
}
|
||||
|
||||
|
||||
} // namespace cvf
|
||||
Reference in new issue
Block a user