Skip to content

Commit

Permalink
Make INP reader a bit more generic, do not require steps defined in f…
Browse files Browse the repository at this point in the history
…ile and allow multiple element types (all types must be 8 nodes)
  • Loading branch information
jonjenssen committed Jan 22, 2024
1 parent 6260995 commit 210f037
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ApplicationLibCode/GeoMech/GeoMechFileInterface/RifInpReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ bool RifInpReader::readFemParts( RigFemPartCollection* femParts )
m_includeEntries[i].fileName = ( m_inputPath / m_includeEntries[i].fileName ).string();
}

if ( m_stepNames.empty() ) m_stepNames.push_back( "Geostatic" );

RiaLogging::debug( QString( "Read FEM parts: %1, steps: %2, element type: %3" )
.arg( parts.size() )
.arg( m_stepNames.size() )
Expand Down Expand Up @@ -260,7 +262,14 @@ RigElementType RifInpReader::read( std::istream&
auto nodeType = parseLabel( line, "type" );
elementType = RigFemTypes::toRigElementType( nodeType );
skipComments( stream );
elements[partId] = readElements( stream );

if ( !elements.contains( partId ) ) elements[partId] = {};

auto newElements = readElements( stream );
for ( const auto& e : newElements )
{
elements[partId].push_back( e );
}
}
else if ( uppercasedLine.starts_with( "*ELSET," ) )
{
Expand Down Expand Up @@ -385,7 +394,7 @@ std::vector<std::pair<int, std::vector<int>>> RifInpReader::readElements( std::i
{
std::vector<std::pair<int, std::vector<int>>> partElements;

// TODO: maybe support more element types
// only support C3D8* element type
unsigned numNodesPerElement = 8;

// Read until we find a new section (which should start with a '*').
Expand Down

0 comments on commit 210f037

Please sign in to comment.