Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
Catch::Generators Namespace Reference

Namespaces

 pf
 

Classes

class  FixedValuesGenerator
 
class  Generator
 
class  GeneratorBase
 
class  GeneratorRandomiser
 
struct  Generators
 
struct  IGenerator
 
struct  NullGenerator
 
class  RangeGenerator
 
struct  RequiresASpecialisationFor
 
class  SingleValueGenerator
 

Typedefs

using GeneratorBasePtr = std::unique_ptr< GeneratorBase >
 

Functions

std::vector< size_t > randomiseIndices (size_t selectionSize, size_t sourceSize)
 
template<typename T >
auto all () -> Generator< T >
 
template<>
auto all< int > () -> Generator< int >
 
template<typename T >
auto range (T const &first, T const &last) -> Generator< T >
 
template<typename T >
auto random (T const &first, T const &last) -> Generator< T >
 
template<typename T >
auto random (size_t size) -> Generator< T >
 
template<typename T >
auto values (std::initializer_list< T > values) -> Generator< T >
 
template<typename T >
auto value (T const &val) -> Generator< T >
 
template<typename T >
auto as () -> Generator< T >
 
template<typename... Ts>
auto table (std::initializer_list< std::tuple< Ts... >> &&tuples) -> Generator< std::tuple< Ts... >>
 
template<typename T , typename... Gs>
auto makeGenerators (Generator< T > &&generator, Gs...moreGenerators) -> Generators< T >
 
template<typename T >
auto makeGenerators (Generator< T > &&generator) -> Generators< T >
 
template<typename T , typename... Gs>
auto makeGenerators (T &&val, Gs...moreGenerators) -> Generators< T >
 
template<typename T , typename U , typename... Gs>
auto makeGenerators (U &&val, Gs...moreGenerators) -> Generators< T >
 
auto acquireGeneratorTracker (SourceLineInfo const &lineInfo) -> IGeneratorTracker &
 
template<typename L >
auto generate (SourceLineInfo const &lineInfo, L const &generatorExpression) -> decltype(std::declval< decltype(generatorExpression())>()[0])
 

Typedef Documentation

using Catch::Generators::GeneratorBasePtr = typedef std::unique_ptr<GeneratorBase>

Definition at line 2997 of file catch.hpp.

Function Documentation

auto Catch::Generators::acquireGeneratorTracker ( SourceLineInfo const &  lineInfo) -> IGeneratorTracker &

Referenced by generate(), and makeGenerators().

template<typename T >
auto Catch::Generators::all ( ) -> Generator<T>

Definition at line 3150 of file catch.hpp.

References all< int >().

3150 { return RequiresASpecialisationFor<T>(); }
template<>
auto Catch::Generators::all< int > ( ) -> Generator< int >

Referenced by all().

template<typename T >
auto Catch::Generators::as ( ) -> Generator<T>

Definition at line 3182 of file catch.hpp.

3182  {
3183  return Generator<T>( 0, pf::make_unique<NullGenerator<T>>() );
3184  }
template<typename L >
auto Catch::Generators::generate ( SourceLineInfo const &  lineInfo,
L const &  generatorExpression 
) -> decltype(std::declval<decltype(generatorExpression())>()[0])

Definition at line 3258 of file catch.hpp.

References acquireGeneratorTracker(), Catch::IGeneratorTracker::getGenerator(), Catch::IGeneratorTracker::getIndex(), Catch::IGeneratorTracker::hasGenerator(), Catch::Generators::pf::make_unique(), and Catch::IGeneratorTracker::setGenerator().

3258  {
3259  using UnderlyingType = typename decltype(generatorExpression())::type;
3260 
3261  IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo );
3262  if( !tracker.hasGenerator() )
3263  tracker.setGenerator( pf::make_unique<Generators<UnderlyingType>>( generatorExpression() ) );
3264 
3265  auto const& generator = static_cast<Generators<UnderlyingType> const&>( *tracker.getGenerator() );
3266  return generator[tracker.getIndex()];
3267  }
std::unique_ptr< T > make_unique(Args &&...args)
Definition: catch.hpp:3053
auto acquireGeneratorTracker(SourceLineInfo const &lineInfo) -> IGeneratorTracker &
template<typename T , typename... Gs>
auto Catch::Generators::makeGenerators ( Generator< T > &&  generator,
Gs...  moreGenerators 
) -> Generators<T>

Definition at line 3231 of file catch.hpp.

3231  {
3232  Generators<T> generators;
3233  generators.m_generators.reserve( 1+sizeof...(Gs) );
3234  generators.populate( std::move( generator ), std::forward<Gs>( moreGenerators )... );
3235  return generators;
3236  }
template<typename T >
auto Catch::Generators::makeGenerators ( Generator< T > &&  generator) -> Generators<T>

Definition at line 3238 of file catch.hpp.

References growth_allz::T.

3238  {
3239  Generators<T> generators;
3240  generators.populate( std::move( generator ) );
3241  return generators;
3242  }
template<typename T , typename... Gs>
auto Catch::Generators::makeGenerators ( T &&  val,
Gs...  moreGenerators 
) -> Generators<T>

Definition at line 3244 of file catch.hpp.

References makeGenerators(), growth_allz::T, and value().

3244  {
3245  return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... );
3246  }
auto makeGenerators(U &&val, Gs...moreGenerators) -> Generators< T >
Definition: catch.hpp:3248
auto value(T const &val) -> Generator< T >
Definition: catch.hpp:3177
template<typename T , typename U , typename... Gs>
auto Catch::Generators::makeGenerators ( U &&  val,
Gs...  moreGenerators 
) -> Generators<T>

Definition at line 3248 of file catch.hpp.

References acquireGeneratorTracker(), growth_allz::T, and value().

Referenced by makeGenerators().

3248  {
3249  return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );
3250  }
auto makeGenerators(U &&val, Gs...moreGenerators) -> Generators< T >
Definition: catch.hpp:3248
auto value(T const &val) -> Generator< T >
Definition: catch.hpp:3177
template<typename T >
auto Catch::Generators::random ( T const &  first,
T const &  last 
) -> Generator<T>

Definition at line 3161 of file catch.hpp.

References range().

3161  {
3162  auto gen = range( first, last );
3163  auto size = gen.size();
3164 
3165  return Generator<T>( size, pf::make_unique<GeneratorRandomiser<T>>( std::move( gen ), size ) );
3166  }
auto range(T const &first, T const &last) -> Generator< T >
Definition: catch.hpp:3156
template<typename T >
auto Catch::Generators::random ( size_t  size) -> Generator<T>

Definition at line 3168 of file catch.hpp.

3168  {
3169  return Generator<T>( size, pf::make_unique<GeneratorRandomiser<T>>( all<T>(), size ) );
3170  }
std::vector<size_t> Catch::Generators::randomiseIndices ( size_t  selectionSize,
size_t  sourceSize 
)
template<typename... Ts>
auto Catch::Generators::table ( std::initializer_list< std::tuple< Ts... >> &&  tuples) -> Generator<std::tuple<Ts...>>

Definition at line 3187 of file catch.hpp.

References values().

3187  {
3188  return values<std::tuple<Ts...>>( std::forward<std::initializer_list<std::tuple<Ts...>>>( tuples ) );
3189  }
auto values(std::initializer_list< T > values) -> Generator< T >
Definition: catch.hpp:3173
template<typename T >
auto Catch::Generators::value ( T const &  val) -> Generator<T>

Definition at line 3177 of file catch.hpp.

Referenced by nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::accept(), Catch::Detail::Approx::Approx(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::back(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::basic_json(), nlohmann::detail::binary_writer< BasicJsonType, CharType >::calc_bson_unsigned_size(), Catch::Capturer::captureValues(), nlohmann::detail::dtoa_impl::compute_boundaries(), Catch::StringMaker< T, typename >::convert(), Catch::Detail::convertUnstreamable(), nlohmann::detail::serializer< BasicJsonType >::dump_escaped(), Catch::Detail::Approx::epsilon(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::erase(), nlohmann::json_pointer< BasicJsonType >::flatten(), nlohmann::detail::from_json(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::get(), nlohmann::detail::binary_writer< BasicJsonType, CharType >::get_msgpack_float_prefix(), get_per(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::get_ptr(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::get_ref(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::get_ref_impl(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::get_to(), Grid< NDIM, T >::Grid(), nlohmann::detail::json_sax_dom_callback_parser< BasicJsonType >::handle_value(), nlohmann::detail::input_adapter::input_adapter(), is_err(), nlohmann::detail::json_ref< BasicJsonType >::json_ref(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::json_value::json_value(), makeGenerators(), Catch::Detail::Approx::margin(), MultiGrid< 3, CHI_PREC_t >::MultiGrid(), Catch::Detail::Approx::operator()(), Catch::operator+(), Catch::ReusableStringStream::operator<<(), Catch::MessageStream::operator<<(), Catch::MessageBuilder::operator<<(), Catch::Decomposer::operator<=(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::operator[](), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::parse(), nlohmann::detail::binary_reader< BasicJsonType, SAX >::parse_bson_element_internal(), Catch::Generators::Generators< T >::populate(), Catch::Detail::rangeToString(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::sax_parse(), Grid< NDIM, T >::set_y(), nlohmann::detail::binary_writer< BasicJsonType, CharType >::to_char_type(), nlohmann::detail::to_chars(), nlohmann::detail::to_json(), nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >::value(), nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_double(), nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_integer(), nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_bson_unsigned(), nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_number(), and nlohmann::detail::binary_writer< BasicJsonType, CharType >::write_number_with_ubjson_prefix().

3177  {
3178  return Generator<T>( 1, pf::make_unique<SingleValueGenerator<T>>( val ) );
3179  }
template<typename T >
auto Catch::Generators::values ( std::initializer_list< T >  values) -> Generator<T>

Definition at line 3173 of file catch.hpp.

Referenced by Catch::Capturer::captureValues(), and table().

3173  {
3174  return Generator<T>( values.size(), pf::make_unique<FixedValuesGenerator<T>>( values ) );
3175  }
auto values(std::initializer_list< T > values) -> Generator< T >
Definition: catch.hpp:3173