mirror of
https://github.com/cosmo-sims/MUSIC.git
synced 2024-09-19 17:03:46 +02:00
merge
This commit is contained in:
commit
d4c0e2b701
2 changed files with 27 additions and 19 deletions
|
@ -764,15 +764,18 @@ public:
|
|||
for( unsigned j=0; j<gh.get_grid(ilevel)->size(1); ++j )
|
||||
for( unsigned k=0; k<gh.get_grid(ilevel)->size(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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
11
random.cc
11
random.cc
|
@ -241,6 +241,7 @@ random_numbers<T>::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<T>::random_numbers( unsigned res, unsigned cubesize, long basesee
|
|||
for( unsigned k=0; k<res_; ++k )
|
||||
mean += (*this)(i,j,k);
|
||||
|
||||
mean *= 1.0/(res_*res_*res_);
|
||||
mean *= 1.0/(double)(res_l*res_l*res_l);
|
||||
|
||||
#pragma omp parallel for
|
||||
for(int i=0; i<(int)res_; ++i )
|
||||
|
@ -389,8 +390,8 @@ random_numbers<T>::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<T>::random_numbers( /*const*/ random_numbers <T>& 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 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue