Skip to content

Commit

Permalink
#10574 opm-common: Add support for map axes import
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Sep 4, 2023
1 parent 7a782ce commit 7af3080
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ApplicationLibCode/FileInterface/RifOpmGridTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,32 @@ bool RifOpmGridTools::importGrid( const std::string& gridFilePath, RigMainGrid*

transferCoordinatesCartesian( opmGrid, opmGrid, mainGrid, mainGrid, caseData );

auto opmMapAxes = opmGrid.get_mapaxes();
if ( opmMapAxes.size() == 6 )
{
std::array<double, 6> mapAxes;
for ( size_t i = 0; i < opmMapAxes.size(); ++i )
{
mapAxes[i] = opmMapAxes[i];
}

// Set the map axes transformation matrix on the main grid
mainGrid->setMapAxes( mapAxes );
mainGrid->setUseMapAxes( true );

auto transform = mainGrid->mapAxisTransform();

// Invert the transformation matrix to convert from file coordinates to domain coordinates
transform.invert();

#pragma omp parallel for
for ( long i = 0; i < mainGrid->nodes().size(); i++ )
{
auto& n = mainGrid->nodes()[i];
n.transformPoint( transform );
}
}

return true;
}

Expand Down

0 comments on commit 7af3080

Please sign in to comment.