///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2018 Equinor ASA // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RicMswSegment.h" #include "RicMswCompletions.h" #include "RicMswExportInfo.h" #include #include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RicMswSegment::RicMswSegment( const QString& label, double startMD, double endMD, double startTVD, double endTVD, size_t subIndex, int segmentNumber /*= -1*/ ) : RicMswItem( label ) , m_startMD( startMD ) , m_endMD( endMD ) , m_startTVD( startTVD ) , m_endTVD( endTVD ) , m_outputMD( 0.0 ) , m_outputTVD( 0.0 ) , m_equivalentDiameter( 0.15 ) , m_holeDiameter( RicMswExportInfo::defaultDoubleValue() ) , m_openHoleRoughnessFactor( 5.0e-5 ) , m_skinFactor( RicMswExportInfo::defaultDoubleValue() ) , m_subIndex( subIndex ) , m_segmentNumber( segmentNumber ) , m_effectiveDiameter( 0.0 ) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::startMD() const { return m_startMD; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::endMD() const { return m_endMD; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::startTVD() const { return m_startTVD; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::endTVD() const { return m_endTVD; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setOutputMD( double outputMD ) { m_outputMD = outputMD; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::outputMD() const { return m_outputMD; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setOutputTVD( double outputTVD ) { m_outputTVD = outputTVD; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::outputTVD() const { return m_outputTVD; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::equivalentDiameter() const { return m_equivalentDiameter; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::holeDiameter() const { return m_holeDiameter; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::openHoleRoughnessFactor() const { return m_openHoleRoughnessFactor; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::skinFactor() const { return m_skinFactor; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- size_t RicMswSegment::subIndex() const { return m_subIndex; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- int RicMswSegment::segmentNumber() const { return m_segmentNumber; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RicMswSegment::completions() const { std::vector allCompletions; for ( const auto& completion : m_completions ) { allCompletions.push_back( completion.get() ); } return allCompletions; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RicMswSegment::completions() { std::vector allCompletions; for ( auto& completion : m_completions ) { allCompletions.push_back( completion.get() ); } return allCompletions; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setLabel( const QString& label ) { m_label = label; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setEquivalentDiameter( double effectiveDiameter ) { m_equivalentDiameter = effectiveDiameter; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setHoleDiameter( double holeDiameter ) { m_holeDiameter = holeDiameter; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setOpenHoleRoughnessFactor( double roughnessFactor ) { m_openHoleRoughnessFactor = roughnessFactor; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setSkinFactor( double skinFactor ) { m_skinFactor = skinFactor; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setSegmentNumber( int segmentNumber ) { m_segmentNumber = segmentNumber; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicMswSegment::effectiveDiameter() const { return m_effectiveDiameter; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setEffectiveDiameter( double effectiveDiameter ) { m_effectiveDiameter = effectiveDiameter; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::addCompletion( std::unique_ptr completion ) { m_completions.push_back( std::move( completion ) ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::unique_ptr RicMswSegment::removeCompletion( RicMswCompletion* completion ) { std::unique_ptr removedCompletion; for ( auto it = m_completions.begin(); it != m_completions.end(); ++it ) { if ( it->get() == completion ) { removedCompletion = std::move( *it ); m_completions.erase( it ); break; } } return removedCompletion; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::deleteAllCompletions() { m_completions.clear(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::addIntersection( std::shared_ptr intersection ) { m_intersections.push_back( intersection ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- const std::vector>& RicMswSegment::intersections() const { return m_intersections; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector>& RicMswSegment::intersections() { return m_intersections; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::set RicMswSegment::globalCellsIntersected() const { return m_intersectedGlobalCells; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setIntersectedGlobalCells( const std::set& intersectedCells ) { m_intersectedGlobalCells = intersectedCells; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicMswSegment::setSourcePdmObject( const caf::PdmObject* object ) { m_sourcePdmObject = const_cast( object ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- const caf::PdmObject* RicMswSegment::sourcePdmObject() const { return m_sourcePdmObject; }