Commit eff0166b authored by Quentin Khan's avatar Quentin Khan

Move Contrib folder outside Src/Utils

parent d97868b2
......@@ -140,7 +140,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
# Set scalfmm to default libraries
set(SCALFMM_LIBRARIES "")
set(SCALFMM_CXX_FLAGS "-std=c++14 -fpic -Wall")
set(SCALFMM_CXX_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/Src/Utils/Contribs")
set(SCALFMM_CXX_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/Contribs")
#
#
# Test if openmp is here
......
......@@ -4,7 +4,6 @@
#include <string>
#include <ostream>
#include "../../FOstreamTuple.hpp"
#include "integer_sequence.hpp"
namespace inria {
......@@ -94,7 +93,6 @@ namespace inria {
*/
template<typename T>
ostream_joiner& operator=(const T& value) {
using scalfmm::operator<<;
if(! this->_first) {
*(this->_os) << this->_delim;
}
......
......@@ -13,8 +13,9 @@
#include <vector>
#include <unordered_set>
#include "Utils/Contribs/inria/ostream_joiner.hpp"
#include "Utils/Contribs/inria/detection_idiom.hpp"
#include "Utils/FOstreamTuple.hpp"
#include "inria/ostream_joiner.hpp"
#include "inria/detection_idiom.hpp"
#include "FBox.hpp"
#include "Utils/FPoint.hpp"
......@@ -1026,7 +1027,8 @@ private:
if(print_particles && p_container.size() > 0) {
os << " [";
auto it = inria::make_ostream_joiner(os, ", ");
std::copy(p_container.begin(), p_container.end(), it);
std::transform(p_container.begin(), p_container.end(),
it, scalfmm::tuple_out);
os << "]";
}
os << '\n';
......
......@@ -8,7 +8,7 @@
#ifndef FBASIC_PARTICLE_HPP
#define FBASIC_PARTICLE_HPP
#include "Utils/Contribs/inria/integer_sequence.hpp"
#include "inria/integer_sequence.hpp"
#include "Utils/FPoint.hpp"
#include "Utils/FTypePack.hpp"
......
......@@ -13,7 +13,7 @@
#include "Utils/variadic_container.hpp"
#include "Utils/FAlignedAllocator.hpp"
#include "Utils/Contribs/inria/integer_sequence.hpp"
#include "inria/integer_sequence.hpp"
namespace scalfmm {
namespace details {
......
......@@ -5,7 +5,7 @@
#include "Utils/FGlobal.hpp"
#include "Utils/Contribs/inria/logic.hpp"
#include "inria/logic.hpp"
#include "Containers/FTreeCoordinate.hpp"
/** \brief Node structural data
......
......@@ -3,7 +3,7 @@
#include <type_traits>
#include "Utils/Contribs/inria/logic.hpp"
#include "inria/logic.hpp"
#include "Containers/FTreeCoordinate.hpp"
......
......@@ -14,7 +14,7 @@
#include "FStdAlignPolyfill.hpp"
#include "Contribs/inria/integer_sequence.hpp"
#include "inria/integer_sequence.hpp"
/** \file */
......
#ifndef OSTREAM_TUPLE_HPP
#define OSTREAM_TUPLE_HPP
#include "Contribs/inria/integer_sequence.hpp"
#include "inria/ostream_joiner.hpp"
#include "inria/integer_sequence.hpp"
#include <ostream>
#include <tuple>
namespace scalfmm {
namespace details {
namespace tuple_helper {
/** \brief Helper for tuple formatted output
*
* \param os Output stream
* \param t Printed tuple
* \param index_sequence unnamed parameter for automatic deduction of
* Indices template parameter
*
* \tparam Types Types contained in the tuple, automatically deduced
* \tparam Indices Type indices, automatically deduced
*/
template<typename...Types, std::size_t... Indices>
inline void formated_output(std::ostream& os, const std::tuple<Types...>& t,
inria::index_sequence<Indices...>)
{
os << "(" ; // opening brace
// initializer_list members are evaluated from left to right; this
// evaluates to an equivalent to:
//
// os << std::get<0>(t) << ", ";
// os << std::get<1>(t) << ", "
// ...
// std::get<N>(t) << "";
auto l = { (os << std::get<Indices>(t)
<< (Indices != sizeof...(Types)-1 ? ", " : ""), 0) ... };
(void)l; // ignore fact that initializer_list is not used
os << ")" ; // closing brace
}
}
}
/** \brief Formatted std::tuple output
*
* \warning All objects in the tuple are expected to have a formatted output
* operator.
namespace details {
namespace tuple_helper {
/** \brief Helper for tuple formatted output
*
* \param os Output stream
* \param t Printed tuple
* \param index_sequence unnamed parameter for automatic deduction of
* Indices template parameter
*
* \tparam Types Types contained in the tuple, automatically deduced
*
* \note Implementation is done in detail::tuple_helper::formated_output.
* \tparam Indices Type indices, automatically deduced
*/
template<typename CharT, typename Traits, typename...Types>
std::basic_ostream<CharT, Traits>& operator<<(
std::basic_ostream<CharT, Traits>& os, const std::tuple<Types...>& t)
template<typename...Types, std::size_t... Indices>
inline void formated_output(std::ostream& os, const std::tuple<Types...>& t,
inria::index_sequence<Indices...>)
{
scalfmm::details::tuple_helper::formated_output(os, t, inria::index_sequence_for<Types...>());
return os;
os << "(" ; // opening brace
// initializer_list members are evaluated from left to right; this
// evaluates to an equivalent to:
//
// os << std::get<0>(t) << ", ";
// os << std::get<1>(t) << ", "
// ...
// std::get<N>(t) << "";
auto l = { (os << std::get<Indices>(t)
<< (Indices != sizeof...(Types)-1 ? ", " : ""), 0) ... };
(void)l; // ignore fact that initializer_list is not used
os << ")" ; // closing brace
}
template<class... Ts>
struct tuple_wrapper {
const std::tuple<Ts...>& t;
friend std::ostream& operator<<(std::ostream& os, const tuple_wrapper& w) {
using details::tuple_helper::formated_output;
formated_output(os, w.t, inria::index_sequence_for<Ts...>{});
return os;
}
};
} } // close namespace [scalfmm]::details::tuple_helper
namespace {
constexpr struct {
template<class... Ts>
details::tuple_helper::tuple_wrapper<Ts...> operator()(const std::tuple<Ts...>& t) const {
return {t};
}
} tuple_out {};
} // close namsespace scalfmm::details
namespace details {
/**
* \brief Silence the `unused variable` warnings about tuple_out
*/
template<class T>
void silence_tuple_out_warning() {
tuple_out(std::tuple<>{});
}
using scalfmm::operator<<;
} // close namespace scalfmm::details
} // close namespace scalfmm
#endif
......@@ -11,7 +11,7 @@
#include "FOstreamTuple.hpp"
#include "Contribs/inria/integer_sequence.hpp"
#include "inria/integer_sequence.hpp"
/// To discard fold expression results
struct noop_t {
......
......@@ -7,7 +7,7 @@
#include <fstream>
#include "Utils/make_unique.hpp"
#include "Utils/Contribs/inria/integer_sequence.hpp"
#include "inria/integer_sequence.hpp"
#include "../FPerfTestParams.hpp"
/// Tree descriptor base model
......
......@@ -7,10 +7,10 @@
#include "Utils/FAlgorithmTimers.hpp"
#include "Utils/Contribs/inria/tcli/tcli.hpp"
#include "Utils/Contribs/inria/tcli/help_descriptor.hpp"
#include "inria/tcli/tcli.hpp"
#include "inria/tcli/help_descriptor.hpp"
#include "Utils/Contribs/json.hpp"
#include "json.hpp"
namespace json = nlohmann;
......
......@@ -7,7 +7,7 @@
#include "FPerfTestParams.hpp"
#include "Descriptors.hpp"
#include "Utils/Contribs/inria/integer_sequence.hpp"
#include "inria/integer_sequence.hpp"
namespace scalfmm {
......@@ -433,16 +433,6 @@ namespace scalfmm {
std::cout << algo->name() << ": ";
std::cout << algo->description() << '\n';
if(params.checksum) {
checksum_generator check{0, 0,
loader->getNumberOfParticles()/2,
loader->getNumberOfParticles()-1};
tree->forEachLeaf(check);
std::cerr << "Energy: " << check.energy << '\n';
params.json["checksum"]["energy"] = check.energy;
}
// Run the algorithm
timers["algo"].tic();
algo->execute();
......
......@@ -12,7 +12,7 @@
#include "Kernels/P2P/FP2PParticleContainerIndexed.hpp"
#include "Utils/Contribs/inria/logic.hpp"
#include "inria/logic.hpp"
using FReal = double;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment