NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
Loading...
Searching...
No Matches
nimble::quanta Namespace Reference

Classes

class  arrayview_t
 
struct  indexer_t
 
struct  indexer_t< T * >
 
class  invoke_counter_t
 
class  spanarray
 
struct  stopwatch
 

Typedefs

template<class list_t>
using iterated_t = decltype(*std::begin(declref<list_t>()))
 
template<class list_t>
using elem_t = typename std::decay<iterated_t<list_t>>::type
 
template<class F, class... Args>
using return_t = decltype(declref<F>()(declval_exact<Args>()...))
 
template<class F, class... list_t>
using transformed_iterated_t = return_t<F, iterated_t<list_t>...>
 

Functions

template<class T>
void swap (arrayview_t< T > &A, arrayview_t< T > &B)
 
template<class T, class list_t>
std::vector< arrayview_t< T > > partition_into_arrayviews (std::vector< T > &values, const list_t &counts)
 
template<class T>
declval_exact () noexcept
 
template<class T>
std::remove_reference< T >::type & declref () noexcept
 
template<class T>
auto len (T &&obj) -> decltype(obj.size())
 
template<class T>
indexer_t< T > make_indexer (T &list)
 
template<class T>
indexer_t< T * > make_indexer (T *ptr)
 
template<class int_t>
invoke_counter_t< int_t > make_counter (int_t initial=0)
 
template<class list_t, class F>
void remap (list_t &list, F &&func)
 

Typedef Documentation

◆ elem_t

template<class list_t>
using nimble::quanta::elem_t = typename std::decay<iterated_t<list_t>>::type

◆ iterated_t

template<class list_t>
using nimble::quanta::iterated_t = decltype(*std::begin(declref<list_t>()))

◆ return_t

template<class F, class... Args>
using nimble::quanta::return_t = decltype(declref<F>()(declval_exact<Args>()...))

◆ transformed_iterated_t

template<class F, class... list_t>
using nimble::quanta::transformed_iterated_t = return_t<F, iterated_t<list_t>...>

Function Documentation

◆ declref()

template<class T>
std::remove_reference< T >::type & nimble::quanta::declref ( )
noexcept

◆ declval_exact()

template<class T>
T nimble::quanta::declval_exact ( )
noexcept

◆ len()

template<class T>
auto nimble::quanta::len ( T && obj) -> decltype(obj.size())
77{
78 return obj.size();
79}

◆ make_counter()

template<class int_t>
invoke_counter_t< int_t > nimble::quanta::make_counter ( int_t initial = 0)
161{
162 return invoke_counter_t<int_t>{initial};
163}
Definition nimble.quanta.h:125

◆ make_indexer() [1/2]

template<class T>
indexer_t< T > nimble::quanta::make_indexer ( T & list)
112{
113 return indexer_t<T>(list);
114}
Definition nimble.quanta.h:83

◆ make_indexer() [2/2]

template<class T>
indexer_t< T * > nimble::quanta::make_indexer ( T * ptr)
119{
120 return indexer_t<T*>(ptr);
121}

◆ partition_into_arrayviews()

template<class T, class list_t>
std::vector< arrayview_t< T > > nimble::quanta::partition_into_arrayviews ( std::vector< T > & values,
const list_t & counts )
176{
177 std::vector<arrayview_t<T>> views;
178 views.reserve(counts.size());
179 size_t displacement = 0;
180 for (auto& count : counts) {
181 views.emplace_back(values, displacement, count);
182 displacement += count;
183 }
184 return views;
185}

◆ remap()

template<class list_t, class F>
void nimble::quanta::remap ( list_t & list,
F && func )
168{
169 for (auto& elem : list) { elem = func(elem); }
170}

◆ swap()

template<class T>
void nimble::quanta::swap ( arrayview_t< T > & A,
arrayview_t< T > & B )
169{
170 std::swap(A.addr, B.addr);
171 std::swap(A.count, B.count);
172}