preCICE v3.1.2
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
algorithm.hpp File Reference
#include <algorithm>
#include <array>
#include <fmt/ostream.h>
#include <functional>
#include <iterator>
#include <set>
#include <type_traits>
#include <utility>
Include dependency graph for algorithm.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  precice::utils::RangePreview< InputIter >
 The RangePreview object used as a lazy proxy struct for proviewing the content of a Range. More...
 
struct  fmt::formatter< precice::utils::RangePreview< Iter > >
 

Namespaces

namespace  precice
 Main namespace of the precice library.
 
namespace  precice::utils
 contains precice-related utilities.
 

Functions

template<class InputIt1 , class InputIt2 , class OutputIt >
void precice::utils::set_intersection_indices (InputIt1 ref1, InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first)
 This function is by and large the same as std::set_intersection(). The only difference is that we don't return the intersection set itself, but we return the indices of elements in InputIt1, which appear in both sets ( InputIt1 and InputIt2 ) The implementation was taken from https://en.cppreference.com/w/cpp/algorithm/set_intersection#Version_1 with the only difference that we compute and store std::distance() (i.e. the indices) in the output iterator. Similar to the std function, this function operates on sorted ranges.
 
template<typename... Elements>
auto precice::utils::make_array (Elements &&... elements) -> std::array< typename std::common_type< Elements... >::type, sizeof...(Elements)>
 Function that generates an array from given elements.
 
template<typename Container , typename BinaryPredicate = std::equal_to<typename Container::value_type>>
bool precice::utils::unique_elements (const Container &c, BinaryPredicate p={})
 
template<class InputIter , class ElementType >
void precice::utils::intersperse (InputIter first, InputIter last, const ElementType &elem, std::ostream &out)
 
template<class InputIt1 , class InputIt2 >
std::pair< InputIt1, InputIt2 > precice::utils::mismatch (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2)
 
template<typename Iter >
std::ostreamprecice::utils::operator<< (std::ostream &out, const RangePreview< Iter > &rp)
 Allows streaming of RangePreview objects.
 
template<typename Range , typename Iter = typename Range::const_iterator, typename Size = typename std::iterator_traits<Iter>::difference_type>
const RangePreview< Iter > precice::utils::previewRange (Size n, const Range &range)
 
template<typename T , typename Index , size_t n>
auto precice::utils::reorder_array (const std::array< Index, n > &order, const std::array< T, n > &elements) -> std::array< T, n >
 Reorders an array given an array of unique indices.
 
template<class InputIt , class Size , class InOutIt >
void precice::utils::add_n (InputIt first, Size count, InOutIt result)
 
template<class InputIt , class Unary >
void precice::utils::for_each_unique (InputIt first, InputIt last, Unary func)
 Calls each value in the range of [first, last[ exactly once.
 
template<class InputIt , class Predicate >
std::pair< InputIt, InputIt > precice::utils::find_first_range (InputIt first, InputIt last, Predicate p)
 Finds the first range in [first, last[ that fulfills a predicate.