Loading src/functions/CMakeLists.txt +0 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ SET( headers tnlConstantFunction.h tnlMeshFunctionVTKWriter_impl.h tnlMeshFunctionNormGetter.h tnlOperatorFunction.h tnlOperatorFunction_impl.h tnlSinBumpsFunction.h tnlSinBumpsFunction_impl.h tnlSinWaveFunction.h Loading src/functions/tnlMeshFunctionGnuplotWriter_impl.h +22 −14 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ tnlMeshFunctionGnuplotWriter< MeshFunction >:: write( const MeshFunction& function, ostream& str ) { std::cerr << "Gnuplot writer for mesh functions defined on mesh type " << MeshFunction::Mesh::getType() << " is not (yet) implmeneted." << std::endl; std::cerr << "Gnuplot writer for mesh functions defined on mesh type " << MeshFunction::MeshType::getType() << " is not (yet) implemented." << std::endl; return false; } Loading @@ -46,9 +46,10 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() < mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } } Loading @@ -70,9 +71,10 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() <= mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } } Loading @@ -99,9 +101,10 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() < mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } str << std::endl; } Loading @@ -121,7 +124,7 @@ write( const MeshFunctionType& function, { const MeshType& mesh = function.getMesh(); typedef typename MeshType::Face EntityType; typedef typename EntityType::EntityOrientation EntityOrientation; typedef typename EntityType::EntityOrientationType EntityOrientation; EntityType entity( mesh ); entity.setOrientation( EntityOrientation( 1.0, 0.0 ) ); Loading @@ -133,25 +136,29 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() <= mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } str << std::endl; } entity.setOrientation( EntityOrientation( 0.0, 1.0 ) ); for( entity.getCoordinates().y() = 0; entity.getCoordinates().y() <= mesh.getDimensions().y(); entity.getCoordinates().y() ++ ) { for( entity.getCoordinates().x() = 0; entity.getCoordinates().x() < mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { for( entity.getCoordinates().y() = 0; entity.getCoordinates().y() <= mesh.getDimensions().y(); entity.getCoordinates().y() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } str << std::endl; } Loading Loading @@ -180,9 +187,10 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() <= mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } str << std::endl; } Loading src/functions/tnlMeshFunctionVTKWriter.h +3 −3 Original line number Diff line number Diff line Loading @@ -23,10 +23,10 @@ class tnlMeshFunctionVTKWriter { public: bool write( const MeshFunction& function, static bool write( const MeshFunction& function, ostream& str ) { std::cerr << "VTK writer for mesh functions defined on mesh type " << MeshFunction::Mesh::getType() << " is not (yet) implmeneted." << std::endl; std::cerr << "VTK writer for mesh functions defined on mesh type " << MeshFunction::MeshType::getType() << " is not (yet) implmeneted." << std::endl; return false; } }; Loading src/functions/tnlMeshFunction_impl.h +3 −2 Original line number Diff line number Diff line Loading @@ -362,8 +362,9 @@ tnlMeshFunction< Mesh, MeshEntityDimensions, Real >:: write( const tnlString& fileName, const tnlString& format ) const { fstream file; if( file.open( fileName.getString(), ios::out ) ) std::fstream file; file.open( fileName.getString(), std::ios::out ); if( ! file ) { std::cerr << "Unbable to open a file " << fileName << "." << std::endl; return false; Loading tests/unit-tests/tnlApproximationError_impl.h +14 −6 Original line number Diff line number Diff line Loading @@ -59,30 +59,38 @@ getError( const ExactOperator& exactOperator, BoundaryOperatorFunction boundaryOperatorFunction( boundaryConditions, u ); tnlString meshSizeString( mesh.getDimensions().x() ); tnlString dimensionsString; if( MeshType::getDimensionsCount() == 1 ) dimensionsString = "1D-"; if( MeshType::getDimensionsCount() == 2 ) dimensionsString = "2D-"; if( MeshType::getDimensionsCount() == 3 ) dimensionsString = "3D-"; if( writeFunctions ) mesh.save( "mesh-" + meshSizeString + ".tnl" ); mesh.save( "mesh-" + dimensionsString + meshSizeString + ".tnl" ); //cerr << "Evaluating exact u... " << endl; exactU = exactOperatorFunction; if( writeFunctions ) exactU.save( "exact-result-" + meshSizeString + ".tnl" ); exactU.save( "exact-result-" + dimensionsString + meshSizeString + ".tnl" ); //cerr << "Projecting test function ..." << endl; v = function; if( writeFunctions ) v.save( "test-function-" + meshSizeString + ".tnl" ) ; v.save( "test-function-" + dimensionsString + meshSizeString + ".tnl" ) ; //cerr << "Evaluating approximate u ... " << endl; u = operatorFunction; tnlBoundaryConditionsSetter< MeshFunction, DirichletBoundaryConditions >::template apply< MeshEntity >( boundaryConditions, 0.0, u ); if( writeFunctions ) u.save( "approximate-result-" + meshSizeString + ".tnl" ) ; u.save( "approximate-result-" + dimensionsString + meshSizeString + ".tnl" ) ; //cerr << "Evaluate difference ... " << endl; u -= exactU; tnlBoundaryConditionsSetter< MeshFunction, DirichletBoundaryConditions >::template apply< MeshEntity >( boundaryConditions, 0.0, u ); if( writeFunctions ) u.save( "difference-" + meshSizeString + ".tnl" ) ; u.save( "difference-" + dimensionsString + meshSizeString + ".tnl" ) ; l1Err = u.getLpNorm( 1.0 ); l2Err = u.getLpNorm( 2.0 ); maxErr = u.getMaxNorm(); Loading Loading
src/functions/CMakeLists.txt +0 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ SET( headers tnlConstantFunction.h tnlMeshFunctionVTKWriter_impl.h tnlMeshFunctionNormGetter.h tnlOperatorFunction.h tnlOperatorFunction_impl.h tnlSinBumpsFunction.h tnlSinBumpsFunction_impl.h tnlSinWaveFunction.h Loading
src/functions/tnlMeshFunctionGnuplotWriter_impl.h +22 −14 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ tnlMeshFunctionGnuplotWriter< MeshFunction >:: write( const MeshFunction& function, ostream& str ) { std::cerr << "Gnuplot writer for mesh functions defined on mesh type " << MeshFunction::Mesh::getType() << " is not (yet) implmeneted." << std::endl; std::cerr << "Gnuplot writer for mesh functions defined on mesh type " << MeshFunction::MeshType::getType() << " is not (yet) implemented." << std::endl; return false; } Loading @@ -46,9 +46,10 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() < mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } } Loading @@ -70,9 +71,10 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() <= mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } } Loading @@ -99,9 +101,10 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() < mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } str << std::endl; } Loading @@ -121,7 +124,7 @@ write( const MeshFunctionType& function, { const MeshType& mesh = function.getMesh(); typedef typename MeshType::Face EntityType; typedef typename EntityType::EntityOrientation EntityOrientation; typedef typename EntityType::EntityOrientationType EntityOrientation; EntityType entity( mesh ); entity.setOrientation( EntityOrientation( 1.0, 0.0 ) ); Loading @@ -133,25 +136,29 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() <= mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } str << std::endl; } entity.setOrientation( EntityOrientation( 0.0, 1.0 ) ); for( entity.getCoordinates().y() = 0; entity.getCoordinates().y() <= mesh.getDimensions().y(); entity.getCoordinates().y() ++ ) { for( entity.getCoordinates().x() = 0; entity.getCoordinates().x() < mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { for( entity.getCoordinates().y() = 0; entity.getCoordinates().y() <= mesh.getDimensions().y(); entity.getCoordinates().y() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } str << std::endl; } Loading Loading @@ -180,9 +187,10 @@ write( const MeshFunctionType& function, entity.getCoordinates().x() <= mesh.getDimensions().x(); entity.getCoordinates().x() ++ ) { entity.refresh(); typename MeshType::VertexType v = entity.getCenter(); str << v.x() << " " << v.y() << " " << function.getElement( entity.getIndex() ) << std::endl; << function.getData().getElement( entity.getIndex() ) << std::endl; } str << std::endl; } Loading
src/functions/tnlMeshFunctionVTKWriter.h +3 −3 Original line number Diff line number Diff line Loading @@ -23,10 +23,10 @@ class tnlMeshFunctionVTKWriter { public: bool write( const MeshFunction& function, static bool write( const MeshFunction& function, ostream& str ) { std::cerr << "VTK writer for mesh functions defined on mesh type " << MeshFunction::Mesh::getType() << " is not (yet) implmeneted." << std::endl; std::cerr << "VTK writer for mesh functions defined on mesh type " << MeshFunction::MeshType::getType() << " is not (yet) implmeneted." << std::endl; return false; } }; Loading
src/functions/tnlMeshFunction_impl.h +3 −2 Original line number Diff line number Diff line Loading @@ -362,8 +362,9 @@ tnlMeshFunction< Mesh, MeshEntityDimensions, Real >:: write( const tnlString& fileName, const tnlString& format ) const { fstream file; if( file.open( fileName.getString(), ios::out ) ) std::fstream file; file.open( fileName.getString(), std::ios::out ); if( ! file ) { std::cerr << "Unbable to open a file " << fileName << "." << std::endl; return false; Loading
tests/unit-tests/tnlApproximationError_impl.h +14 −6 Original line number Diff line number Diff line Loading @@ -59,30 +59,38 @@ getError( const ExactOperator& exactOperator, BoundaryOperatorFunction boundaryOperatorFunction( boundaryConditions, u ); tnlString meshSizeString( mesh.getDimensions().x() ); tnlString dimensionsString; if( MeshType::getDimensionsCount() == 1 ) dimensionsString = "1D-"; if( MeshType::getDimensionsCount() == 2 ) dimensionsString = "2D-"; if( MeshType::getDimensionsCount() == 3 ) dimensionsString = "3D-"; if( writeFunctions ) mesh.save( "mesh-" + meshSizeString + ".tnl" ); mesh.save( "mesh-" + dimensionsString + meshSizeString + ".tnl" ); //cerr << "Evaluating exact u... " << endl; exactU = exactOperatorFunction; if( writeFunctions ) exactU.save( "exact-result-" + meshSizeString + ".tnl" ); exactU.save( "exact-result-" + dimensionsString + meshSizeString + ".tnl" ); //cerr << "Projecting test function ..." << endl; v = function; if( writeFunctions ) v.save( "test-function-" + meshSizeString + ".tnl" ) ; v.save( "test-function-" + dimensionsString + meshSizeString + ".tnl" ) ; //cerr << "Evaluating approximate u ... " << endl; u = operatorFunction; tnlBoundaryConditionsSetter< MeshFunction, DirichletBoundaryConditions >::template apply< MeshEntity >( boundaryConditions, 0.0, u ); if( writeFunctions ) u.save( "approximate-result-" + meshSizeString + ".tnl" ) ; u.save( "approximate-result-" + dimensionsString + meshSizeString + ".tnl" ) ; //cerr << "Evaluate difference ... " << endl; u -= exactU; tnlBoundaryConditionsSetter< MeshFunction, DirichletBoundaryConditions >::template apply< MeshEntity >( boundaryConditions, 0.0, u ); if( writeFunctions ) u.save( "difference-" + meshSizeString + ".tnl" ) ; u.save( "difference-" + dimensionsString + meshSizeString + ".tnl" ) ; l1Err = u.getLpNorm( 1.0 ); l2Err = u.getLpNorm( 2.0 ); maxErr = u.getMaxNorm(); Loading