Commit 5af719d2 authored by Andreas Nüßing's avatar Andreas Nüßing Committed by Steffen Müthing

do not require the node indices to be ordered

The gmsh ascii file format explicitly allows for unordered node
indices. Therefore we use the specified id instead of the
running index for the node lookup. If the provided sequence of
node indices is not dense (which is also allowed), an IOError is thrown.

(cherry picked from commit b24b1d3d)
Signed-off-by: Steffen Müthing's avatarSteffen Müthing <muething@dune-project.org>
parent df405258
......@@ -318,12 +318,16 @@ namespace Dune
for( int i = 1; i <= number_of_nodes; ++i )
{
readfile(file,4, "%d %lg %lg %lg\n", &id, &x[ 0 ], &x[ 1 ], &x[ 2 ] );
if( id != i )
DUNE_THROW( Dune::IOError, "Expected id " << i << "(got id " << id << "." );
if (id > number_of_nodes) {
DUNE_THROW(Dune::IOError,
"Only dense sequences of node indices are currently supported (node index "
<< id << " is invalid).");
}
// just store node position
for( int j = 0; j < dimWorld; ++j )
nodes[ i ][ j ] = x[ j ];
nodes[ id ][ j ] = x[ j ];
}
readfile(file,1,"%s\n",buf);
if (strcmp(buf,"$EndNodes")!=0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment