<commit_before>// ===================================================================
/**
 * Implements robust overlap methods for convex bounding volumes.
 * Also includes parser for processed trajectory files.
 */
// ===================================================================
/*
 * Utils.cpp: Version 1.0
 * Created 26/07/2016 by <NAME>
 */
// ===================================================================

#include <fstream>

#include "Utils.hpp"


// ============================
/* Wrapper for MPI datatypes */
// ============================
template<> Utils<float> ::Utils(): MPI_type(MPI_FLOAT)    {}
template<> Utils<double>::Utils(): MPI_type(MPI_DOUBLE)   {}

template<> Utils<uint>  ::Utils(): MPI_type(MPI_UNSIGNED) {}
template<> Utils<ullint>::Utils(): MPI_type(MPI_UNSIGNED_LONG_LONG) {}

// ============================
/* Bounding spherocylinders overlap test */
// ============================
template<typename number>
bool Utils<number>::OverlapBoundSC(const Vector3<number>& R_cm, BNode<number>* Node1, BNode<number>* Node2)
{
    number xlambda;
    number xmu;
    number aux1;
    number aux2;
    number rm2;

    Vector3<number> R_sep;
    
    // Root spherocylinders centers are forced to the particle center of mass 
    if      ( Node1->is_root && Node2->is_root ) R_sep = R_cm;
    else if ( Node1->is_root )                   R_sep = R_cm + Node2->Center;
    else if ( Node2->is_root )                   R_sep = R_cm - Node1->Center;
    else                                         R_sep = R_cm + Node2->Center - Node1->Center;

    number rEo1  = Node1->Axis.dot(R_sep);
    number rEo2  = Node2->Axis.dot(R_sep);;
    number o1Eo2 = Node1->Axis.dot(Node2->Axis);
    
    number rsqr  = SQR(Node1->l_cr + Node2->l_cr);
    number cc    = 1. - SQR(o1Eo2);<commit_msg>Templated all objects for float support<commit_after>// ===================================================================
/**
 * Implements robust overlap methods for convex bounding volumes.
 * Also includes parser for processed trajectory files.
 */
// ===================================================================
/*
 * Utils.cpp: Version 1.0
 * Created 26/07/2016 by <NAME>
 */
// ===================================================================

#include <fstream>

#include "Utils.hpp"


// ============================
/* Wrappers for MPI datatypes */
// ============================
template<> Utils<float> ::Utils(): MPI_type(MPI_FLOAT)              {}
template<> Utils<double>::Utils(): MPI_type(MPI_DOUBLE)             {}

template<> Utils<int>   ::Utils(): MPI_type(MPI_INT)                {}
template<> Utils<uint>  ::Utils(): MPI_type(MPI_UNSIGNED)           {}
template<> Utils<ullint>::Utils(): MPI_type(MPI_UNSIGNED_LONG_LONG) {}

// ============================
/* Bounding spherocylinders overlap test */
// ============================
template<typename number>
bool Utils<number>::OverlapBoundSC(const Vector3<number>& R_cm, BNode<number>* Node1, BNode<number>* Node2)
{
    number xlambda;
    number xmu;
    number aux1;
    number aux2;
    number rm2;

    Vector3<number> R_sep;
    
    // Root spherocylinders centers are forced to the particle center of mass 
    if      ( Node1->is_root && Node2->is_root ) R_sep = R_cm;
    else if ( Node1->is_root )                   R_sep = R_cm + Node2->Center;
    else if ( Node2->is_root )                   R_sep = R_cm - Node1->Center;
    else                                         R_sep = R_cm + Node2->Center - Node1->Center;

    number rEo1  = Node1->Axis.dot(R_sep);
    number rEo2  = Node2->Axis.dot(R_sep);;
    number o1Eo2 = Node1->Axis.dot(Node2->Axis);
    
    number rsqr  = SQR(Node1->l_cr + Node2->l_cr);
    number cc    = 1. - SQR(o1Eo2);
{'fraction_non_alphanumeric': 0.28203083466241363, 'fraction_numerical': 0.020202020202020204, 'mean_word_length': 3.3153669724770642, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7268406', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1126, 'n_words': 250}