Loading tools/src/tnl-diff.h +21 −19 Original line number Diff line number Diff line Loading @@ -42,11 +42,14 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter return false; } outputFile << "#"; //if( tau != 0 ) outputFile << std::setw( 5 ) << "Time"; outputFile << std::setw( 16 ) << "L1 diff." << std::setw( 16 ) << "L2 diff." << std::setw( 16 ) << "Max. diff." << endl; outputFile << std::setw( 6 ) << "Time"; outputFile << std::setw( 18 ) << "L1 diff." << std::setw( 18 ) << "L2 diff." << std::setw( 18 ) << "Max. diff." << std::setw( 18 ) << "Total L1 diff." << std::setw( 18 ) << "Total L2 diff." << std::setw( 18 ) << "Total Max. diff." << endl; if( verbose ) cout << endl; Loading @@ -71,7 +74,6 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter outputFile.close(); return false; } //if( snapshotPeriod != 0.0 ) outputFile << std::setw( 6 ) << i/2 * snapshotPeriod << " "; i++; } Loading @@ -96,7 +98,6 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter outputFile.close(); return false; } //if( snapshotPeriod != 0.0 ) outputFile << std::setw( 6 ) << ( i - 1 ) * snapshotPeriod << " "; } if( mode == "halves" ) Loading @@ -119,15 +120,24 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter Real l1Diff = mesh.getDifferenceLpNorm( v1, v2, 1.0 ); Real l2Diff = mesh.getDifferenceLpNorm( v1, v2, 2.0 ); Real maxDiff = mesh.getDifferenceAbsMax( v1, v2 ); outputFile << std::setw( 16 ) << l1Diff << std::setw( 16 ) << l2Diff << std::setw( 16 ) << maxDiff << endl; if( snapshotPeriod != 0.0 ) { totalL1Diff += snapshotPeriod * l1Diff; totalL2Diff += snapshotPeriod * l2Diff * l2Diff; totalMaxDiff = Max( totalMaxDiff, maxDiff ); } else { totalL1Diff += l1Diff; totalL2Diff += l2Diff * l2Diff; } totalMaxDiff = Max( totalMaxDiff, maxDiff ); outputFile << std::setw( 18 ) << l1Diff << std::setw( 18 ) << l2Diff << std::setw( 18 ) << maxDiff << std::setw( 18 ) << totalL1Diff << std::setw( 18 ) << sqrt( totalL2Diff ) << std::setw( 18 ) << totalMaxDiff << endl; if( writeDifference ) { tnlString differenceFileName; Loading @@ -141,14 +151,6 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter diff.save( differenceFileName ); } } if( snapshotPeriod != 0 ) { outputFile << "----------------------------------------------------------" << endl; outputFile << std::setw( 8 ) << " " << std::setw( 16 ) << totalL1Diff << std::setw( 16 ) << sqrt( totalL2Diff ) << std::setw( 16 ) << totalMaxDiff << endl; } outputFile.close(); if( verbose ) Loading tools/src/tnl-err2eoc.py +20 −15 Original line number Diff line number Diff line Loading @@ -7,9 +7,14 @@ format = "txt" output_file_name = "eoc-table.txt" input_files = [] verbose = 1 refinement = 2 i = 0 while i < len( arguments ): if arguments[ i ] == "--refinement": refinement = arguments[ i + 1 ] i = i + 2 continue if arguments[ i ] == "--format": format = arguments[ i + 1 ] i = i + 2 Loading @@ -28,27 +33,27 @@ while i < len( arguments ): if not verbose == 0: print "Writing to " + output_file_name + " in " + format + "." h_list = [] l1_norm_list = [] l2_norm_list = [] max_norm_list = [] items = 0 errors = {} snapshots = [] fileIdx = 1 for file_name in input_files: if not verbose == 0: print "Processing file " + file_name file = open( file_name, "r" ) snapshotIdx = 1 l1_max = 0.0 l_max_max = 0.0 for line in file. readlines(): if line[ 0:8 ] == " Total:": if line[ 0:1 ] != "#": data = string. split( line ) h_list. append( float( data[ 1 ] ) ) l1_norm_list. append( float( data[ 2 ] ) ) l2_norm_list. append( float( data[ 3 ] ) ) max_norm_list. append( float( data[ 4 ] ) ) items = items + 1 if fileIdx == 1: snapshots.append( float( data[ 1 ] ) ) errors[ fileIdx, snapshotIdx, "L1" ] = float( data[ 2 ] ) errors[ fileIdx, snapshotIdx, "L2" ] = float( data[ 3 ] ) errors[ fileIdx, snapshotIdx, "max" ] = float( data[ 4 ] ) snapshotIdx = snapshotIdx + 1; if not verbose == 0: print line file. close() Loading Loading
tools/src/tnl-diff.h +21 −19 Original line number Diff line number Diff line Loading @@ -42,11 +42,14 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter return false; } outputFile << "#"; //if( tau != 0 ) outputFile << std::setw( 5 ) << "Time"; outputFile << std::setw( 16 ) << "L1 diff." << std::setw( 16 ) << "L2 diff." << std::setw( 16 ) << "Max. diff." << endl; outputFile << std::setw( 6 ) << "Time"; outputFile << std::setw( 18 ) << "L1 diff." << std::setw( 18 ) << "L2 diff." << std::setw( 18 ) << "Max. diff." << std::setw( 18 ) << "Total L1 diff." << std::setw( 18 ) << "Total L2 diff." << std::setw( 18 ) << "Total Max. diff." << endl; if( verbose ) cout << endl; Loading @@ -71,7 +74,6 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter outputFile.close(); return false; } //if( snapshotPeriod != 0.0 ) outputFile << std::setw( 6 ) << i/2 * snapshotPeriod << " "; i++; } Loading @@ -96,7 +98,6 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter outputFile.close(); return false; } //if( snapshotPeriod != 0.0 ) outputFile << std::setw( 6 ) << ( i - 1 ) * snapshotPeriod << " "; } if( mode == "halves" ) Loading @@ -119,15 +120,24 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter Real l1Diff = mesh.getDifferenceLpNorm( v1, v2, 1.0 ); Real l2Diff = mesh.getDifferenceLpNorm( v1, v2, 2.0 ); Real maxDiff = mesh.getDifferenceAbsMax( v1, v2 ); outputFile << std::setw( 16 ) << l1Diff << std::setw( 16 ) << l2Diff << std::setw( 16 ) << maxDiff << endl; if( snapshotPeriod != 0.0 ) { totalL1Diff += snapshotPeriod * l1Diff; totalL2Diff += snapshotPeriod * l2Diff * l2Diff; totalMaxDiff = Max( totalMaxDiff, maxDiff ); } else { totalL1Diff += l1Diff; totalL2Diff += l2Diff * l2Diff; } totalMaxDiff = Max( totalMaxDiff, maxDiff ); outputFile << std::setw( 18 ) << l1Diff << std::setw( 18 ) << l2Diff << std::setw( 18 ) << maxDiff << std::setw( 18 ) << totalL1Diff << std::setw( 18 ) << sqrt( totalL2Diff ) << std::setw( 18 ) << totalMaxDiff << endl; if( writeDifference ) { tnlString differenceFileName; Loading @@ -141,14 +151,6 @@ bool computeDifference( const Mesh& mesh, const tnlParameterContainer& parameter diff.save( differenceFileName ); } } if( snapshotPeriod != 0 ) { outputFile << "----------------------------------------------------------" << endl; outputFile << std::setw( 8 ) << " " << std::setw( 16 ) << totalL1Diff << std::setw( 16 ) << sqrt( totalL2Diff ) << std::setw( 16 ) << totalMaxDiff << endl; } outputFile.close(); if( verbose ) Loading
tools/src/tnl-err2eoc.py +20 −15 Original line number Diff line number Diff line Loading @@ -7,9 +7,14 @@ format = "txt" output_file_name = "eoc-table.txt" input_files = [] verbose = 1 refinement = 2 i = 0 while i < len( arguments ): if arguments[ i ] == "--refinement": refinement = arguments[ i + 1 ] i = i + 2 continue if arguments[ i ] == "--format": format = arguments[ i + 1 ] i = i + 2 Loading @@ -28,27 +33,27 @@ while i < len( arguments ): if not verbose == 0: print "Writing to " + output_file_name + " in " + format + "." h_list = [] l1_norm_list = [] l2_norm_list = [] max_norm_list = [] items = 0 errors = {} snapshots = [] fileIdx = 1 for file_name in input_files: if not verbose == 0: print "Processing file " + file_name file = open( file_name, "r" ) snapshotIdx = 1 l1_max = 0.0 l_max_max = 0.0 for line in file. readlines(): if line[ 0:8 ] == " Total:": if line[ 0:1 ] != "#": data = string. split( line ) h_list. append( float( data[ 1 ] ) ) l1_norm_list. append( float( data[ 2 ] ) ) l2_norm_list. append( float( data[ 3 ] ) ) max_norm_list. append( float( data[ 4 ] ) ) items = items + 1 if fileIdx == 1: snapshots.append( float( data[ 1 ] ) ) errors[ fileIdx, snapshotIdx, "L1" ] = float( data[ 2 ] ) errors[ fileIdx, snapshotIdx, "L2" ] = float( data[ 3 ] ) errors[ fileIdx, snapshotIdx, "max" ] = float( data[ 4 ] ) snapshotIdx = snapshotIdx + 1; if not verbose == 0: print line file. close() Loading