<commit_before>#include "initializer3d.h"

//####################################################################
//
// To avoid a float overflow and speed up the calculations.
//
// Convert
//
// 10^10 (m) = 10000000000 (m) = 1 (length here)
// 10^30 (kg) = 1 (mass here)
//
// G constant (m^3 kg^-1 s^-2) : -10-10-10+30 = 0 (not change)
//
// You should choose the right scale for your calculations.
// The "Correct" class help this Conversions.
//
//####################################################################

template class Initializer3D<float>;
template class Initializer3D<double>;

template <typename T>
void Initializer3D<T>::initRandomCube()
{
    Correct correct(m_sim.scale);
    m_engine->changeModelScale(correct.m);

    quint64 num = m_engine->numberOfParticle();
    T* masses = m_engine->masses();
    T* coordinates = m_engine->coordinates();
    T* velocities = m_engine->velocities();

    if (m_sim.massRandom)
    {
        for (quint64 i = 0; i < num; ++i)
        {
            masses[i] = T(bhs::rand0to1() * m_sim.massAvg * 2.0 * correct.kg);
        }
    } else {
        for (quint64 i = 0; i < num; ++i)
        {
            masses[i] = m_sim.massAvg;
        }
    }
    for (quint64 i = 0; i < num * 3; ++i)
    {
        coordinates[i] = T(bhs::rand0center1max() * m_sim.scale * correct.m);<commit_msg>fix bug cube - not random masses<commit_after>#include "initializer3d.h"

//####################################################################
//
// To avoid a float overflow and speed up the calculations.
//
// Convert
//
// 10^10 (m) = 10000000000 (m) = 1 (length here)
// 10^30 (kg) = 1 (mass here)
//
// G constant (m^3 kg^-1 s^-2) : -10-10-10+30 = 0 (not change)
//
// You should choose the right scale for your calculations.
// The "Correct" class help this Conversions.
//
//####################################################################

template class Initializer3D<float>;
template class Initializer3D<double>;

template <typename T>
void Initializer3D<T>::initRandomCube()
{
    Correct correct(m_sim.scale);
    m_engine->changeModelScale(correct.m);

    quint64 num = m_engine->numberOfParticle();
    T* masses = m_engine->masses();
    T* coordinates = m_engine->coordinates();
    T* velocities = m_engine->velocities();

    if (m_sim.massRandom)
    {
        for (quint64 i = 0; i < num; ++i)
        {
            masses[i] = T(bhs::rand0to1() * m_sim.massAvg * 2.0 * correct.kg);
        }
    } else {
        for (quint64 i = 0; i < num; ++i)
        {
            masses[i] = m_sim.massAvg * correct.kg;
        }
    }
    for (quint64 i = 0; i < num * 3; ++i)
    {
        coordinates[i] = T(bhs::rand0center1max() * m_sim.scale * correct.m);
{'fraction_non_alphanumeric': 0.2448604992657856, 'fraction_numerical': 0.04038179148311307, 'mean_word_length': 2.8873038516405134, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5419924', 'n_tokens_mistral': 976, 'n_tokens_neox': 900, 'n_words': 227}