NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
Loading...
Searching...
No Matches
nimble::quanta::spanarray< T > Class Template Reference

#include <nimble.quanta.arrayview.h>

Public Member Functions

 spanarray ()=default
 
 spanarray (spanarray &&)=default
 
 spanarray (size_t elem_count, size_t section_count)
 
template<class int_t>
 spanarray (const std::vector< int_t > &sect_sizes)
 
size_t size () const
 
arrayview_t< T > * data ()
 
arrayview_t< T > * begin ()
 
arrayview_t< T > * end ()
 
const arrayview_t< const T > * begin () const
 
const arrayview_t< const T > * end () const
 
template<class int_t>
arrayview_t< T > & operator[] (int_t index)
 
template<class int_t>
const arrayview_t< const T > & operator[] (int_t index) const
 
template<class int_t, class int2_t>
T & operator() (int_t section_index, int2_t element_index)
 
template<class int_t, class int2_t>
const T & operator() (int_t section_index, int2_t element_index) const
 

Constructor & Destructor Documentation

◆ spanarray() [1/4]

template<class T>
nimble::quanta::spanarray< T >::spanarray ( )
default

◆ spanarray() [2/4]

template<class T>
nimble::quanta::spanarray< T >::spanarray ( spanarray< T > && )
default

◆ spanarray() [3/4]

template<class T>
nimble::quanta::spanarray< T >::spanarray ( size_t elem_count,
size_t section_count )
inline
201 : arr{new T[elem_count]},
202 sections{new arrayview_t<T>[section_count]},
203 elem_count{elem_count},
204 section_count{section_count}
205 {
206 }
Definition nimble.quanta.arrayview.h:189

◆ spanarray() [4/4]

template<class T>
template<class int_t>
nimble::quanta::spanarray< T >::spanarray ( const std::vector< int_t > & sect_sizes)
inline
210 {
211 size_t displacement = 0;
212 T* scan0 = data();
213 for (size_t i = 0; i < section_count; ++i) {
214 size_t section_size = (size_t)sect_sizes[i];
215 sections[i] = {scan0, displacement, section_size};
217 }
218 }
arrayview_t< T > * end()
Definition nimble.quanta.arrayview.h:236
arrayview_t< T > * begin()
Definition nimble.quanta.arrayview.h:231
arrayview_t< T > * data()
Definition nimble.quanta.arrayview.h:226
size_t size() const
Definition nimble.quanta.arrayview.h:221

Member Function Documentation

◆ begin() [1/2]

template<class T>
arrayview_t< T > * nimble::quanta::spanarray< T >::begin ( )
inline
232 {
233 return sections.get();
234 }

◆ begin() [2/2]

template<class T>
const arrayview_t< const T > * nimble::quanta::spanarray< T >::begin ( ) const
inline
242 {
243 return sections.get()->as_span_of_const_ptr();
244 }

◆ data()

template<class T>
arrayview_t< T > * nimble::quanta::spanarray< T >::data ( )
inline
227 {
228 return sections.get();
229 }

◆ end() [1/2]

template<class T>
arrayview_t< T > * nimble::quanta::spanarray< T >::end ( )
inline
237 {
238 return begin() + section_count;
239 }

◆ end() [2/2]

template<class T>
const arrayview_t< const T > * nimble::quanta::spanarray< T >::end ( ) const
inline
247 {
248 return begin() + section_count;
249 }

◆ operator()() [1/2]

template<class T>
template<class int_t, class int2_t>
T & nimble::quanta::spanarray< T >::operator() ( int_t section_index,
int2_t element_index )
inline
266 {
267 return sections[section_index][element_index];
268 }

◆ operator()() [2/2]

template<class T>
template<class int_t, class int2_t>
const T & nimble::quanta::spanarray< T >::operator() ( int_t section_index,
int2_t element_index ) const
inline
272 {
273 sections[0].swap(sections[1], sections[2]);
274 return sections[section_index][element_index];
275 }

◆ operator[]() [1/2]

template<class T>
template<class int_t>
arrayview_t< T > & nimble::quanta::spanarray< T >::operator[] ( int_t index)
inline
254 {
255 return sections[index];
256 }

◆ operator[]() [2/2]

template<class T>
template<class int_t>
const arrayview_t< const T > & nimble::quanta::spanarray< T >::operator[] ( int_t index) const
inline
260 {
261 return sections[index].as_span_of_const();
262 }

◆ size()

template<class T>
size_t nimble::quanta::spanarray< T >::size ( ) const
inline
222 {
223 return section_count;
224 }

The documentation for this class was generated from the following file: