From c02050cfc70ee7b312f8b10ab781239b7eea817a Mon Sep 17 00:00:00 2001 From: Michael Kuron <mkuron@icp.uni-stuttgart.de> Date: Thu, 14 Feb 2019 14:42:48 +0100 Subject: [PATCH] Fix VTK output for bodies with infinite mass --- src/pe/vtk/EllipsoidVtkOutput.h | 18 ++++++++++++++++-- src/pe/vtk/SphereVtkOutput.h | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/pe/vtk/SphereVtkOutput.h diff --git a/src/pe/vtk/EllipsoidVtkOutput.h b/src/pe/vtk/EllipsoidVtkOutput.h index 680410dce..767c1b978 100644 --- a/src/pe/vtk/EllipsoidVtkOutput.h +++ b/src/pe/vtk/EllipsoidVtkOutput.h @@ -72,7 +72,14 @@ void EllipsoidVtkOutput::push( std::ostream& os, const uint_t data, const uint_t switch( data ) { case 0: - vtk::toStream( os, numeric_cast< float >(bodies_.at( point )->getMass()) ); + if( bodies_.at( point )->hasInfiniteMass() ) + { + vtk::toStream( os, std::numeric_limits< float >::infinity() ); + } + else + { + vtk::toStream( os, numeric_cast< float >(bodies_.at( point )->getMass()) ); + } break; case 1: vtk::toStream( os, numeric_cast< float >(tensorGlyphs_.at(point)[component]) ); @@ -103,7 +110,14 @@ void EllipsoidVtkOutput::push( vtk::Base64Writer& b64, const uint_t data, const switch( data ) { case 0: - b64 << numeric_cast< float >(bodies_.at( point )->getMass()); + if( bodies_.at( point )->hasInfiniteMass() ) + { + b64 << std::numeric_limits< float >::infinity(); + } + else + { + b64 << numeric_cast< float >(bodies_.at( point )->getMass()); + } break; case 1: b64 << numeric_cast< float >(tensorGlyphs_.at(point)[component]); diff --git a/src/pe/vtk/SphereVtkOutput.h b/src/pe/vtk/SphereVtkOutput.h old mode 100644 new mode 100755 index 1878795f3..25290f226 --- a/src/pe/vtk/SphereVtkOutput.h +++ b/src/pe/vtk/SphereVtkOutput.h @@ -73,7 +73,14 @@ void SphereVtkOutput::push( std::ostream& os, const uint_t data, const uint_t po switch( data ) { case 0: - vtk::toStream( os, numeric_cast< float >(bodies_.at( point )->getMass()) ); + if( bodies_.at( point )->hasInfiniteMass() ) + { + vtk::toStream( os, std::numeric_limits< float >::infinity() ); + } + else + { + vtk::toStream( os, numeric_cast< float >(bodies_.at( point )->getMass()) ); + } break; case 1: vtk::toStream( os, numeric_cast< float >(bodies_.at( point )->getRadius()) ); @@ -107,7 +114,14 @@ void SphereVtkOutput::push( vtk::Base64Writer& b64, const uint_t data, const uin switch( data ) { case 0: - b64 << numeric_cast< float >(bodies_.at( point )->getMass()); + if( bodies_.at( point )->hasInfiniteMass() ) + { + b64 << std::numeric_limits< float >::infinity(); + } + else + { + b64 << numeric_cast< float >(bodies_.at( point )->getMass()); + } break; case 1: b64 << numeric_cast< float >(bodies_.at( point )->getRadius()); -- GitLab