mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -2,17 +2,17 @@
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,19 +21,19 @@
|
||||
#include <cmath>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
struct RigWellLogExtractionTools
|
||||
{
|
||||
static bool isEqualDepth(double d1, double d2)
|
||||
static bool isEqualDepth( double d1, double d2 )
|
||||
{
|
||||
double depthDiff = d1 - d2;
|
||||
|
||||
const double tolerance = 0.1;// Meters To handle inaccuracies across faults
|
||||
const double tolerance = 0.1; // Meters To handle inaccuracies across faults
|
||||
|
||||
return (fabs(depthDiff) < tolerance); // Equal depth
|
||||
return ( fabs( depthDiff ) < tolerance ); // Equal depth
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,25 +45,28 @@ struct RigWellLogExtractionTools
|
||||
|
||||
struct RigMDCellIdxEnterLeaveKey
|
||||
{
|
||||
RigMDCellIdxEnterLeaveKey(double md, size_t cellIdx, bool entering)
|
||||
: measuredDepth(md)
|
||||
, hexIndex(cellIdx)
|
||||
, isEnteringCell(entering)
|
||||
RigMDCellIdxEnterLeaveKey( double md, size_t cellIdx, bool entering )
|
||||
: measuredDepth( md )
|
||||
, hexIndex( cellIdx )
|
||||
, isEnteringCell( entering )
|
||||
{
|
||||
}
|
||||
|
||||
double measuredDepth;
|
||||
size_t hexIndex;
|
||||
bool isEnteringCell; // As opposed to leaving.
|
||||
bool isLeavingCell() const { return !isEnteringCell;}
|
||||
|
||||
bool operator < (const RigMDCellIdxEnterLeaveKey& other) const
|
||||
bool isLeavingCell() const
|
||||
{
|
||||
if (RigWellLogExtractionTools::isEqualDepth(measuredDepth, other.measuredDepth))
|
||||
return !isEnteringCell;
|
||||
}
|
||||
|
||||
bool operator<( const RigMDCellIdxEnterLeaveKey& other ) const
|
||||
{
|
||||
if ( RigWellLogExtractionTools::isEqualDepth( measuredDepth, other.measuredDepth ) )
|
||||
{
|
||||
if (hexIndex == other.hexIndex)
|
||||
if ( hexIndex == other.hexIndex )
|
||||
{
|
||||
if (isEnteringCell == other.isEnteringCell)
|
||||
if ( isEnteringCell == other.isEnteringCell )
|
||||
{
|
||||
// Completely equal: intersections at cell edges or corners or edges of the face triangles
|
||||
return false;
|
||||
@@ -72,49 +75,51 @@ struct RigMDCellIdxEnterLeaveKey
|
||||
return !isEnteringCell; // Sort Leaving cell before (less than) entering cell
|
||||
}
|
||||
|
||||
return (hexIndex < other.hexIndex);
|
||||
return ( hexIndex < other.hexIndex );
|
||||
}
|
||||
|
||||
// The depths are not equal
|
||||
|
||||
return (measuredDepth < other.measuredDepth);
|
||||
return ( measuredDepth < other.measuredDepth );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
/// Class used to sort the intersections along the wellpath,
|
||||
/// Use as key in a map
|
||||
/// Sorting according to MD first,then Leaving before entering cell, then Cell Idx,
|
||||
/// Sorting according to MD first,then Leaving before entering cell, then Cell Idx,
|
||||
//==================================================================================================
|
||||
|
||||
struct RigMDEnterLeaveCellIdxKey
|
||||
{
|
||||
RigMDEnterLeaveCellIdxKey(double md, bool entering, size_t cellIdx)
|
||||
: measuredDepth(md)
|
||||
, isEnteringCell(entering)
|
||||
, hexIndex(cellIdx)
|
||||
RigMDEnterLeaveCellIdxKey( double md, bool entering, size_t cellIdx )
|
||||
: measuredDepth( md )
|
||||
, isEnteringCell( entering )
|
||||
, hexIndex( cellIdx )
|
||||
{
|
||||
}
|
||||
|
||||
double measuredDepth;
|
||||
bool isEnteringCell; // As opposed to leaving.
|
||||
bool isLeavingCell() const { return !isEnteringCell;}
|
||||
bool isLeavingCell() const
|
||||
{
|
||||
return !isEnteringCell;
|
||||
}
|
||||
size_t hexIndex;
|
||||
|
||||
bool operator < (const RigMDEnterLeaveCellIdxKey& other) const
|
||||
bool operator<( const RigMDEnterLeaveCellIdxKey& other ) const
|
||||
{
|
||||
if (RigWellLogExtractionTools::isEqualDepth(measuredDepth, other.measuredDepth))
|
||||
if ( RigWellLogExtractionTools::isEqualDepth( measuredDepth, other.measuredDepth ) )
|
||||
{
|
||||
if (isEnteringCell == other.isEnteringCell)
|
||||
if ( isEnteringCell == other.isEnteringCell )
|
||||
{
|
||||
if (hexIndex == other.hexIndex)
|
||||
if ( hexIndex == other.hexIndex )
|
||||
{
|
||||
// Completely equal: intersections at cell edges or corners or edges of the face triangles
|
||||
return false;
|
||||
}
|
||||
|
||||
return (hexIndex < other.hexIndex);
|
||||
return ( hexIndex < other.hexIndex );
|
||||
}
|
||||
|
||||
return isLeavingCell(); // Sort Leaving cell before (less than) entering cell
|
||||
@@ -122,15 +127,12 @@ struct RigMDEnterLeaveCellIdxKey
|
||||
|
||||
// The depths are not equal
|
||||
|
||||
return (measuredDepth < other.measuredDepth);
|
||||
return ( measuredDepth < other.measuredDepth );
|
||||
}
|
||||
|
||||
static bool isProperCellEnterLeavePair(const RigMDEnterLeaveCellIdxKey& key1, const RigMDEnterLeaveCellIdxKey& key2 )
|
||||
static bool isProperCellEnterLeavePair( const RigMDEnterLeaveCellIdxKey& key1, const RigMDEnterLeaveCellIdxKey& key2 )
|
||||
{
|
||||
return ( key1.hexIndex == key2.hexIndex
|
||||
&& key1.isEnteringCell && key2.isLeavingCell()
|
||||
&& !RigWellLogExtractionTools::isEqualDepth(key1.measuredDepth, key2.measuredDepth));
|
||||
return ( key1.hexIndex == key2.hexIndex && key1.isEnteringCell && key2.isLeavingCell() &&
|
||||
!RigWellLogExtractionTools::isEqualDepth( key1.measuredDepth, key2.measuredDepth ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user