diff --git a/plugins/output_tipsy.cc b/plugins/output_tipsy.cc index 85e0392..3f1a73d 100644 --- a/plugins/output_tipsy.cc +++ b/plugins/output_tipsy.cc @@ -764,15 +764,18 @@ public: for( unsigned j=0; jsize(1); ++j ) for( unsigned k=0; ksize(2); ++k ) { - if( temp_dat.size() < block_buf_size_ ) - temp_dat.push_back( pmass ); - else - { - ofs_temp.write( (char*)&temp_dat[0], sizeof(T_store)*block_buf_size_ ); - nwritten += block_buf_size_; - temp_dat.clear(); - temp_dat.push_back( pmass ); - } + if( gh.is_in_mask(ilevel,i,j,k) && !gh.is_refined(ilevel,i,j,k) ) + { + if( temp_dat.size() < block_buf_size_ ) + temp_dat.push_back( pmass ); + else + { + ofs_temp.write( (char*)&temp_dat[0], sizeof(T_store)*block_buf_size_ ); + nwritten += block_buf_size_; + temp_dat.clear(); + temp_dat.push_back( pmass ); + } + } } if( temp_dat.size() > 0 ) @@ -781,13 +784,17 @@ public: nwritten+=temp_dat.size(); } - if( nwritten != nptot ) - throw std::runtime_error("Internal consistency error while writing temporary file for baryon masses"); - + if( nwritten != nptot ){ + LOGERR("TIPSY output plugin wrote %ld gas particles, should have %ld", nwritten, nptot); + throw std::runtime_error("Internal consistency error while writing temporary file for baryon masses"); + } + ofs_temp.write( (char *)&blksize, sizeof(size_t) ); - if( ofs_temp.bad() ) - throw std::runtime_error("I/O error while writing temporary file for baryon masses"); + if( ofs_temp.bad() ){ + LOGERR("I/O error while writing temporary file for baryon masse"); + throw std::runtime_error("I/O error while writing temporary file for baryon masses"); + } } } diff --git a/random.cc b/random.cc index d4de057..0d3831c 100644 --- a/random.cc +++ b/random.cc @@ -241,6 +241,7 @@ random_numbers::random_numbers( unsigned res, unsigned cubesize, long basesee LOGINFO("Generating random numbers (2) with seed %ld", baseseed); double mean = 0.0; + size_t res_l = res; bool musicnoise = true; if( !musicnoise ) @@ -271,7 +272,7 @@ random_numbers::random_numbers( unsigned res, unsigned cubesize, long basesee for( unsigned k=0; k::random_numbers( unsigned res, std::string randfname, bool ran LOGINFO("Random number file \'%s\'\n contains %ld numbers. Reading...",randfname.c_str(),nx*ny*nz); - double sum = 0.0, sum2 = 0.0; - unsigned count = 0; + long double sum = 0.0, sum2 = 0.0; + size_t count = 0; //perform actual reading if( vartype == 4 ) @@ -495,8 +496,8 @@ random_numbers::random_numbers( /*const*/ random_numbers & rc, bool kdegra //if( res > rc.m_res || (res/rc.m_res)%2 != 0 ) // throw std::runtime_error("Invalid restriction in random number container copy constructor."); - double sum = 0.0, sum2 = 0.0; - unsigned count = 0; + long double sum = 0.0, sum2 = 0.0; + size_t count = 0; if( kdegrade ) {