Higher tolerances

This commit is contained in:
Gaute Lindkvist 2020-10-20 15:15:46 +02:00
parent f569d6872b
commit 9401a81097
3 changed files with 34 additions and 14 deletions

View File

@ -658,8 +658,12 @@ void RimWellPathCollection::groupWellPaths( const std::vector<RimWellPath*>& wel
for ( auto wellPath : detachedWellPaths )
{
auto parentWellPathGroup = findOrCreateWellPathGroup( wellPath, allWellPathsToGroupWith );
allWellPathsToGroupWith.push_back( parentWellPathGroup );
auto parentGroup = findOrCreateWellPathGroup( wellPath, allWellPathsToGroupWith );
if ( parentGroup && std::find( allWellPathsToGroupWith.begin(), allWellPathsToGroupWith.end(), parentGroup ) ==
allWellPathsToGroupWith.end() )
{
allWellPathsToGroupWith.push_back( parentGroup );
}
}
this->sortWellsByName();
this->updateAllRequiredEditors();
@ -802,10 +806,14 @@ std::vector<RimWellPathGroup*> RimWellPathCollection::topLevelGroups() const
RimWellPathGroup* RimWellPathCollection::findOrCreateWellPathGroup( gsl::not_null<RimWellPath*> wellPath,
const std::vector<RimWellPath*>& wellPathsToGroupWith )
{
RimWellPathGroup* existingParent = nullptr;
wellPath->firstAncestorOfType( existingParent );
if ( existingParent ) return existingParent;
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry ) return nullptr;
const double eps = 1.0e-4;
const double eps = 1.0e-3;
std::map<RimWellPath*, double> wellPathsWithCommonGeometry;
for ( auto existingWellPath : wellPathsToGroupWith )

View File

@ -263,22 +263,34 @@ void RimWellPathGroup::makeMoreLevelsIfNecessary()
if ( branches.size() <= 1u ) return;
size_t startIndex = 0u;
size_t commonSize = wellPathGeometry()->wellPathPoints().size();
if ( commonSize > 0u ) startIndex = commonSize - 1u;
bool anyNonTrivialBranches = false;
for ( const auto& [firstDeviation, wellPaths] : branches )
{
if ( wellPaths.size() > 1u )
{
RimWellPathGroup* newGroup = new RimWellPathGroup;
for ( auto wellPath : wellPaths )
anyNonTrivialBranches = true;
break;
}
}
if ( anyNonTrivialBranches )
{
size_t startIndex = 0u;
size_t commonSize = wellPathGeometry()->wellPathPoints().size();
if ( commonSize > 0u ) startIndex = commonSize - 1u;
for ( const auto& [firstDeviation, wellPaths] : branches )
{
if ( wellPaths.size() > 1u )
{
m_childWellPaths().removeChildObject( wellPath );
newGroup->addChildWellPath( wellPath );
newGroup->wellPathGeometry()->setUniqueStartIndex( startIndex );
RimWellPathGroup* newGroup = new RimWellPathGroup;
for ( auto wellPath : wellPaths )
{
m_childWellPaths().removeChildObject( wellPath );
newGroup->addChildWellPath( wellPath );
newGroup->wellPathGeometry()->setUniqueStartIndex( startIndex );
}
m_childWellPaths().push_back( newGroup );
}
m_childWellPaths().push_back( newGroup );
}
}
}

View File

@ -380,7 +380,7 @@ double RigWellPath::identicalTubeLength( const RigWellPath& other ) const
//--------------------------------------------------------------------------------------------------
cvf::ref<RigWellPath> RigWellPath::commonGeometry( const std::vector<const RigWellPath*>& allGeometries )
{
const double eps = 1.0e-8;
const double eps = 1.0e-3;
if ( allGeometries.empty() )
return nullptr;