mirror of
https://github.com/cosmo-sims/monofonIC.git
synced 2024-09-19 17:03:45 +02:00
Merged in clang-fixes (pull request #36)
fix compiler error and warnings in clang Approved-by: Oliver Hahn
This commit is contained in:
commit
303ec60530
11 changed files with 29 additions and 25 deletions
|
@ -226,7 +226,7 @@ template<typename T >
|
||||||
inline void HDFReadSelect( const std::string Filename, const std::string ObjName, const std::vector<unsigned>& ii, std::vector<T> &Data ){
|
inline void HDFReadSelect( const std::string Filename, const std::string ObjName, const std::vector<unsigned>& ii, std::vector<T> &Data ){
|
||||||
|
|
||||||
hid_t HDF_Type, HDF_FileID, HDF_DatasetID, HDF_DataspaceID, HDF_MemspaceID;
|
hid_t HDF_Type, HDF_FileID, HDF_DatasetID, HDF_DataspaceID, HDF_MemspaceID;
|
||||||
hsize_t HDF_StorageSize;
|
// hsize_t HDF_StorageSize;
|
||||||
|
|
||||||
HDF_Type = GetDataType<T>();
|
HDF_Type = GetDataType<T>();
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ public:
|
||||||
music::ilog << "Linear growth factors: D+_target = " << Dplus_target_ << ", D+_start = " << Dplus_start_ << std::endl;
|
music::ilog << "Linear growth factors: D+_target = " << Dplus_target_ << ", D+_start = " << Dplus_start_ << std::endl;
|
||||||
|
|
||||||
// set up transfer functions and compute normalisation
|
// set up transfer functions and compute normalisation
|
||||||
transfer_function_ = std::move(select_TransferFunction_plugin(cf, cosmo_param_));
|
transfer_function_ = select_TransferFunction_plugin(cf, cosmo_param_);
|
||||||
transfer_function_->intialise();
|
transfer_function_->intialise();
|
||||||
if( !transfer_function_->tf_isnormalised_ ){
|
if( !transfer_function_->tf_isnormalised_ ){
|
||||||
cosmo_param_.set("pnorm", this->compute_pnorm_from_sigma8() );
|
cosmo_param_.set("pnorm", this->compute_pnorm_from_sigma8() );
|
||||||
|
@ -449,4 +449,4 @@ public:
|
||||||
// return pow(6.0 * mass / M_PI * std::sqrt(rho) * std::pow(G, 1.5), 1.0 / 3.0);
|
// return pow(6.0 * mass / M_PI * std::sqrt(rho) * std::pow(G, 1.5), 1.0 / 3.0);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} // namespace cosmology
|
} // namespace cosmology
|
||||||
|
|
|
@ -175,13 +175,14 @@ struct grid_interpolate
|
||||||
|
|
||||||
MPI_Alltoall(&sendcounts[0], 1, MPI_INT, &recvcounts[0], 1, MPI_INT, MPI_COMM_WORLD);
|
MPI_Alltoall(&sendcounts[0], 1, MPI_INT, &recvcounts[0], 1, MPI_INT, MPI_COMM_WORLD);
|
||||||
|
|
||||||
size_t tot_receive = recvcounts[0], tot_send = sendcounts[0];
|
size_t tot_receive = recvcounts[0];
|
||||||
|
// size_t tot_send = sendcounts[0];
|
||||||
for (int i = 1; i < MPI::get_size(); ++i)
|
for (int i = 1; i < MPI::get_size(); ++i)
|
||||||
{
|
{
|
||||||
sendoffsets[i] = sendcounts[i - 1] + sendoffsets[i - 1];
|
sendoffsets[i] = sendcounts[i - 1] + sendoffsets[i - 1];
|
||||||
recvoffsets[i] = recvcounts[i - 1] + recvoffsets[i - 1];
|
recvoffsets[i] = recvcounts[i - 1] + recvoffsets[i - 1];
|
||||||
tot_receive += recvcounts[i];
|
tot_receive += recvcounts[i];
|
||||||
tot_send += sendcounts[i];
|
// tot_send += sendcounts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<vec3> recvbuf(tot_receive/3,{0.,0.,0.});
|
std::vector<vec3> recvbuf(tot_receive/3,{0.,0.,0.});
|
||||||
|
|
|
@ -45,12 +45,15 @@ public:
|
||||||
: data_(std::move(v.data_)), x(data_[0]), y(data_[1]), z(data_[2]){}
|
: data_(std::move(v.data_)), x(data_[0]), y(data_[1]), z(data_[2]){}
|
||||||
|
|
||||||
//! construct vec3_t from initializer list
|
//! construct vec3_t from initializer list
|
||||||
template<typename ...E>
|
// template<typename ...E>
|
||||||
vec3_t(E&&...e)
|
// vec3_t(E&&...e)
|
||||||
: data_{{std::forward<E>(e)...}}, x{data_[0]}, y{data_[1]}, z{data_[2]}
|
// : data_{{std::forward<E>(e)...}}, x{data_[0]}, y{data_[1]}, z{data_[2]}
|
||||||
{}
|
// {}
|
||||||
// vec3_t( T a, T b, T c )
|
vec3_t( T a, T b, T c )
|
||||||
// : data_{{a,b,c}}, x(data_[0]), y(data_[1]), z(data_[2]){}
|
: data_{{a,b,c}}, x(data_[0]), y(data_[1]), z(data_[2]){}
|
||||||
|
|
||||||
|
explicit vec3_t( T a)
|
||||||
|
: data_{{a,a,a}}, x(data_[0]), y(data_[1]), z(data_[2]){}
|
||||||
|
|
||||||
//! bracket index access to vector components
|
//! bracket index access to vector components
|
||||||
T &operator[](size_t i) noexcept{ return data_[i];}
|
T &operator[](size_t i) noexcept{ return data_[i];}
|
||||||
|
|
|
@ -421,7 +421,7 @@ private:
|
||||||
|
|
||||||
if( !is_in(i,j,k,mat_invrecip) ){
|
if( !is_in(i,j,k,mat_invrecip) ){
|
||||||
auto average_lv = [&]( const auto& t1, const auto& t2, const auto& t3, vec3_t<real_t>& v, vec3_t<real_t>& l ) {
|
auto average_lv = [&]( const auto& t1, const auto& t2, const auto& t3, vec3_t<real_t>& v, vec3_t<real_t>& l ) {
|
||||||
v = real_t(0.0); l = real_t(0.0);
|
v = vec3_t<real_t>(0.0); l = vec3_t<real_t>(0.0);
|
||||||
int count(0);
|
int count(0);
|
||||||
|
|
||||||
auto add_lv = [&]( auto it ) -> void {
|
auto add_lv = [&]( auto it ) -> void {
|
||||||
|
@ -586,4 +586,4 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,9 +62,9 @@ std::unique_ptr<cosmology::calculator> the_cosmo_calc;
|
||||||
*/
|
*/
|
||||||
int initialise( config_file& the_config )
|
int initialise( config_file& the_config )
|
||||||
{
|
{
|
||||||
the_random_number_generator = std::move(select_RNG_plugin(the_config));
|
the_random_number_generator = select_RNG_plugin(the_config);
|
||||||
the_cosmo_calc = std::make_unique<cosmology::calculator>(the_config);
|
the_cosmo_calc = std::make_unique<cosmology::calculator>(the_config);
|
||||||
the_output_plugin = std::move(select_output_plugin(the_config, the_cosmo_calc));
|
the_output_plugin = select_output_plugin(the_config, the_cosmo_calc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -150,12 +150,12 @@ int run( config_file& the_config )
|
||||||
//--------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------
|
||||||
//! add beyond box tidal field modes following Schmidt et al. (2018) [https://arxiv.org/abs/1803.03274]
|
//! add beyond box tidal field modes following Schmidt et al. (2018) [https://arxiv.org/abs/1803.03274]
|
||||||
bool bAddExternalTides = the_config.contains_key("cosmology", "LSS_aniso_lx")
|
bool bAddExternalTides = the_config.contains_key("cosmology", "LSS_aniso_lx")
|
||||||
& the_config.contains_key("cosmology", "LSS_aniso_ly")
|
&& the_config.contains_key("cosmology", "LSS_aniso_ly")
|
||||||
& the_config.contains_key("cosmology", "LSS_aniso_lz");
|
&& the_config.contains_key("cosmology", "LSS_aniso_lz");
|
||||||
|
|
||||||
if( bAddExternalTides && !( the_config.contains_key("cosmology", "LSS_aniso_lx")
|
if( bAddExternalTides && !( the_config.contains_key("cosmology", "LSS_aniso_lx")
|
||||||
| the_config.contains_key("cosmology", "LSS_aniso_ly")
|
|| the_config.contains_key("cosmology", "LSS_aniso_ly")
|
||||||
| the_config.contains_key("cosmology", "LSS_aniso_lz") ))
|
|| the_config.contains_key("cosmology", "LSS_aniso_lz") ))
|
||||||
{
|
{
|
||||||
music::elog << "Not all dimensions of LSS_aniso_l{x,y,z} specified! Will ignore external tidal field!" << std::endl;
|
music::elog << "Not all dimensions of LSS_aniso_l{x,y,z} specified! Will ignore external tidal field!" << std::endl;
|
||||||
bAddExternalTides = false;
|
bAddExternalTides = false;
|
||||||
|
|
|
@ -74,7 +74,7 @@ std::unique_ptr<output_plugin> select_output_plugin( config_file& cf, std::uniqu
|
||||||
music::ilog << std::setw(32) << std::left << "Output plugin" << " : " << formatname << std::endl;
|
music::ilog << std::setw(32) << std::left << "Output plugin" << " : " << formatname << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(the_output_plugin_creator->create( cf, pcc ));
|
return the_output_plugin_creator->create( cf, pcc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ void RNG_music::parse_random_parameters(void)
|
||||||
//... generate some dummy seed which only depends on the level, negative so we know it's not
|
//... generate some dummy seed which only depends on the level, negative so we know it's not
|
||||||
//... an actual seed and thus should not be used as a constraint for coarse levels
|
//... an actual seed and thus should not be used as a constraint for coarse levels
|
||||||
// rngseeds_.push_back( -abs((unsigned)(ltemp-i)%123+(unsigned)(ltemp+827342523521*i)%123456789) );
|
// rngseeds_.push_back( -abs((unsigned)(ltemp-i)%123+(unsigned)(ltemp+827342523521*i)%123456789) );
|
||||||
rngseeds_.push_back(-abs((long)(ltemp - i) % 123 + (long)(ltemp + 7342523521 * i) % 123456789));
|
rngseeds_.push_back(-std::abs((long)(ltemp - i) % 123 + (long)(ltemp + 7342523521 * i) % 123456789));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ltemp <= 0)
|
if (ltemp <= 0)
|
||||||
|
@ -357,4 +357,4 @@ void RNG_music::compute_random_numbers(void)
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
RNG_plugin_creator_concrete<RNG_music> creator("MUSIC1");
|
RNG_plugin_creator_concrete<RNG_music> creator("MUSIC1");
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ private:
|
||||||
music::ilog << "Computing transfer function via ClassEngine..." << std::endl;
|
music::ilog << "Computing transfer function via ClassEngine..." << std::endl;
|
||||||
double wtime = get_wtime();
|
double wtime = get_wtime();
|
||||||
|
|
||||||
the_ClassEngine_ = std::move(std::make_unique<ClassEngine>(pars_, false));
|
the_ClassEngine_ = std::make_unique<ClassEngine>(pars_, false);
|
||||||
|
|
||||||
wtime = get_wtime() - wtime;
|
wtime = get_wtime() - wtime;
|
||||||
music::ilog << "CLASS took " << wtime << " s." << std::endl;
|
music::ilog << "CLASS took " << wtime << " s." << std::endl;
|
||||||
|
|
|
@ -77,5 +77,5 @@ std::unique_ptr<RNG_plugin> select_RNG_plugin(config_file &cf)
|
||||||
music::ilog << std::setw(32) << std::left << "Random number generator plugin" << " : " << rngname << std::endl;
|
music::ilog << std::setw(32) << std::left << "Random number generator plugin" << " : " << rngname << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(the_RNG_plugin_creator->Create(cf));
|
return the_RNG_plugin_creator->Create(cf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,5 +75,5 @@ std::unique_ptr<TransferFunction_plugin> select_TransferFunction_plugin(config_f
|
||||||
music::ilog << std::setw(32) << std::left << "Transfer function plugin" << " : " << tfname << std::endl;
|
music::ilog << std::setw(32) << std::left << "Transfer function plugin" << " : " << tfname << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(the_TransferFunction_plugin_creator->create(cf, cosmo_param));
|
return the_TransferFunction_plugin_creator->create(cf, cosmo_param);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue