22 #include <initializer_list>
30 #include <boost/numeric/ublas/vector_expression.hpp>
31 #include <boost/numeric/ublas/storage.hpp>
32 #include <boost/numeric/ublas/detail/vector_assign.hpp>
59 template<
class T, std::
size_t N>
76 typedef typename boost::numeric::ublas::type_traits<T>::const_reference
const_reference;
82 typedef boost::numeric::ublas::vector_reference<self_type>
closure_type;
99 explicit BOOST_UBLAS_INLINE
106 explicit BOOST_UBLAS_INLINE
116 explicit BOOST_UBLAS_INLINE
117 array_1d (
const std::initializer_list<value_type>& rInitList):
120 KRATOS_DEBUG_ERROR_IF(rInitList.size()>
N) <<
"Size of list greater than the size of the array!" << std::endl;
122 std::copy(rInitList.begin(), rInitList.end(),
data().
begin());
149 array_1d (
const boost::numeric::ublas::vector_expression<AE> &ae)
151 boost::numeric::ublas::vector_assign<boost::numeric::ublas::scalar_assign> (*
this, ae);
221 vector_assign_scalar<scalar_divides_assign> (*
this, at);
233 return std::equal (data_.begin(), data_.end(),
v.data_.begin());
245 std::fill (data_.begin(), data_.end(),
value_type ());
260 vector_assign_scalar<scalar_multiplies_assign> (*
this, at);
267 vector_assign<scalar_plus_assign> (*
this, ae);
275 vector_assign<scalar_assign> (*
this, ae);
285 data ().swap (
v.data ());
288 #ifndef BOOST_UBLAS_NO_MEMBER_FRIENDS
315 BOOST_UBLAS_CHECK (
i <
N, bad_index ());
316 return (data_ [
i] =
t);
321 BOOST_UBLAS_CHECK (
i <
N, bad_index ());
338 typedef typename array_type::const_iterator const_iterator_type;
339 typedef typename array_type::iterator iterator_type;
342 #ifdef BOOST_UBLAS_USE_INDEXED_ITERATOR
343 typedef indexed_iterator<self_type, dense_random_access_iterator_tag> iterator;
344 typedef indexed_const_iterator<self_type, dense_random_access_iterator_tag> const_iterator;
346 class const_iterator;
354 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
363 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
378 vector_assign<scalar_minus_assign>(*
this,ae);
393 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
395 public container_const_reference<array_1d>,
396 public random_access_iterator_base<dense_random_access_iterator_tag,
397 const_iterator, value_type, difference_type>
401 #ifdef BOOST_MSVC_STD_ITERATOR
413 container_const_reference<
self_type> (), it_ () {}
416 container_const_reference<
self_type> (
v), it_ (it) {}
418 #ifndef BOOST_UBLAS_QUALIFIED_TYPENAME
423 container_const_reference<
self_type> (it ()), it_ (it.it_) {}
453 BOOST_UBLAS_CHECK (&(*
this) () == &it (), external_logic ());
461 BOOST_UBLAS_CHECK (it_ >= (*
this) ().
begin ().it_ && it_ < (*
this) ().
end ().it_, bad_index ());
469 BOOST_UBLAS_CHECK (it_ >= (*
this) ().
begin ().it_ && it_ < (*
this) ().
end ().it_, bad_index ());
470 return it_ - (*this) ().
begin ().it_;
477 container_const_reference<self_type>::assign (&it ());
486 BOOST_UBLAS_CHECK (&(*
this) () == &it (), external_logic ());
487 return it_ == it.it_;
492 BOOST_UBLAS_CHECK (&(*
this) () == &it (), external_logic ());
497 const_iterator_type it_;
503 #ifndef BOOST_UBLAS_USE_INDEXED_ITERATOR
505 public container_reference<array_1d>,
506 public random_access_iterator_base<dense_random_access_iterator_tag,
507 iterator, value_type, difference_type>
511 #ifndef BOOST_MSVC_STD_ITERATOR
521 container_reference<
self_type> (), it_ () {}
524 container_reference<
self_type> (
v), it_ (it) {}
554 BOOST_UBLAS_CHECK (&(*
this) () == &it (), external_logic ());
562 BOOST_UBLAS_CHECK (it_ >= (*
this) ().
begin ().it_ && it_ < (*
this) ().
end ().it_ , bad_index ());
570 BOOST_UBLAS_CHECK (it_ >= (*
this) ().
begin ().it_ && it_ < (*
this) ().
end ().it_ , bad_index ());
571 return it_ - (*this) ().
begin ().it_;
578 container_reference<self_type>::assign (&it ());
587 BOOST_UBLAS_CHECK (&(*
this) () == &it (), external_logic ());
588 return it_ == it.it_;
593 BOOST_UBLAS_CHECK (&(*
this) () == &it (), external_logic ());
613 return find (data_.size ());
624 return find (data_.size ());
629 #ifdef BOOST_MSVC_STD_ITERATOR
646 #ifdef BOOST_MSVC_STD_ITERATOR
647 typedef reverse_iterator_base<iterator, value_type, reference>
reverse_iterator;
781 template <
class TClassType>
784 const TClassType& rValue
787 std::hash<TClassType> hasher;
788 rSeed ^= hasher(rValue) + 0x9e3779b9 + (rSeed<<6) + (rSeed>>2);
794 template<
class T, std::
size_t N>
798 std::size_t
seed = 0;
Definition: array_1d.h:398
BOOST_UBLAS_INLINE const_iterator & operator++()
Definition: array_1d.h:427
BOOST_UBLAS_INLINE const_iterator(const iterator &it)
Definition: array_1d.h:419
BOOST_UBLAS_INLINE const_iterator(const self_type &v, const const_iterator_type &it)
Definition: array_1d.h:415
BOOST_UBLAS_INLINE const_iterator()
Definition: array_1d.h:412
BOOST_UBLAS_INLINE const_iterator & operator=(const const_iterator &it)
Definition: array_1d.h:475
array_1d::const_reference reference
Definition: array_1d.h:406
BOOST_UBLAS_INLINE difference_type operator-(const const_iterator &it) const
Definition: array_1d.h:451
BOOST_UBLAS_INLINE const_iterator & operator-=(difference_type n)
Definition: array_1d.h:445
BOOST_UBLAS_INLINE bool operator<(const const_iterator &it) const
Definition: array_1d.h:490
array_1d::difference_type difference_type
Definition: array_1d.h:404
BOOST_UBLAS_INLINE const_iterator & operator+=(difference_type n)
Definition: array_1d.h:439
BOOST_UBLAS_INLINE bool operator==(const const_iterator &it) const
Definition: array_1d.h:484
array_1d::value_type value_type
Definition: array_1d.h:405
dense_random_access_iterator_tag iterator_category
Definition: array_1d.h:400
BOOST_UBLAS_INLINE size_type index() const
Definition: array_1d.h:467
BOOST_UBLAS_INLINE const_reference operator*() const
Definition: array_1d.h:459
BOOST_UBLAS_INLINE const_iterator & operator--()
Definition: array_1d.h:433
const array_1d::pointer pointer
Definition: array_1d.h:407
Definition: array_1d.h:508
dense_random_access_iterator_tag iterator_category
Definition: array_1d.h:510
BOOST_UBLAS_INLINE iterator(self_type &v, const iterator_type &it)
Definition: array_1d.h:523
array_1d::difference_type difference_type
Definition: array_1d.h:512
BOOST_UBLAS_INLINE iterator & operator--()
Definition: array_1d.h:534
BOOST_UBLAS_INLINE reference operator*() const
Definition: array_1d.h:560
BOOST_UBLAS_INLINE iterator()
Definition: array_1d.h:520
BOOST_UBLAS_INLINE size_type index() const
Definition: array_1d.h:568
array_1d::value_type value_type
Definition: array_1d.h:513
BOOST_UBLAS_INLINE bool operator==(const iterator &it) const
Definition: array_1d.h:585
array_1d::pointer pointer
Definition: array_1d.h:515
BOOST_UBLAS_INLINE bool operator<(const iterator &it) const
Definition: array_1d.h:591
BOOST_UBLAS_INLINE difference_type operator-(const iterator &it) const
Definition: array_1d.h:552
array_1d::reference reference
Definition: array_1d.h:514
BOOST_UBLAS_INLINE iterator & operator=(const iterator &it)
Definition: array_1d.h:576
BOOST_UBLAS_INLINE iterator & operator-=(difference_type n)
Definition: array_1d.h:546
BOOST_UBLAS_INLINE iterator & operator+=(difference_type n)
Definition: array_1d.h:540
BOOST_UBLAS_INLINE iterator & operator++()
Definition: array_1d.h:528
Short class definition.
Definition: array_1d.h:61
boost::numeric::ublas::reverse_iterator_base< iterator > reverse_iterator
Definition: array_1d.h:649
self_type vector_temporary_type
Definition: array_1d.h:83
T & reference
Definition: array_1d.h:77
BOOST_UBLAS_INLINE void swap(array_1d &v)
Definition: array_1d.h:281
T * pointer
Definition: array_1d.h:79
BOOST_UBLAS_INLINE array_1d & assign(const boost::numeric::ublas::vector_expression< AE > &ae)
Definition: array_1d.h:273
BOOST_UBLAS_INLINE array_1d & minus_assign(const boost::numeric::ublas::vector_expression< AE > &ae)
Definition: array_1d.h:376
std::size_t size_type
Definition: array_1d.h:73
boost::numeric::ublas::reverse_iterator_base< const_iterator > const_reverse_iterator
Definition: array_1d.h:632
BOOST_UBLAS_INLINE reverse_iterator rbegin()
Definition: array_1d.h:653
std::ptrdiff_t difference_type
Definition: array_1d.h:74
BOOST_UBLAS_INLINE array_1d(size_type array_size, value_type v)
Definition: array_1d.h:107
BOOST_UBLAS_INLINE array_1d()
Default constructor.
Definition: array_1d.h:93
BOOST_UBLAS_INLINE void clear()
Definition: array_1d.h:325
BOOST_UBLAS_INLINE void resize(size_type array_size, bool preserve=true)
Definition: array_1d.h:242
BOOST_UBLAS_INLINE iterator end()
Definition: array_1d.h:622
BOOST_UBLAS_INLINE array_1d & operator=(const array_1d &v)
Definition: array_1d.h:187
BOOST_UBLAS_INLINE array_1d & operator+=(const boost::numeric::ublas::vector_expression< AE > &ae)
Definition: array_1d.h:203
BOOST_UBLAS_INLINE const_reference operator()(size_type i) const
Definition: array_1d.h:160
BOOST_UBLAS_INLINE array_1d & operator-=(const boost::numeric::ublas::vector_expression< AE > &ae)
Definition: array_1d.h:211
BOOST_UBLAS_INLINE friend void swap(array_1d &v1, array_1d &v2)
Definition: array_1d.h:290
BOOST_UBLAS_INLINE const_reference operator[](size_type i) const
Definition: array_1d.h:173
BOOST_UBLAS_INLINE array_1d(size_type array_size, const array_type &rdata)
Definition: array_1d.h:127
BOOST_UBLAS_INLINE array_1d(size_type array_size)
Definition: array_1d.h:100
BOOST_UBLAS_INLINE const array_type & data() const
Definition: array_1d.h:383
BOOST_UBLAS_INLINE const_iterator find(size_type i) const
Definition: array_1d.h:352
boost::numeric::ublas::vector_reference< self_type > closure_type
Definition: array_1d.h:82
BOOST_UBLAS_INLINE array_type & data()
Definition: array_1d.h:388
BOOST_UBLAS_INLINE size_type size() const
Definition: array_1d.h:370
boost::numeric::ublas::type_traits< T >::const_reference const_reference
Definition: array_1d.h:76
BOOST_UBLAS_INLINE reverse_iterator rend()
Definition: array_1d.h:658
BOOST_UBLAS_INLINE iterator begin()
Definition: array_1d.h:617
std::array< T, N > array_type
Definition: array_1d.h:78
const boost::numeric::ublas::vector_reference< const self_type > const_closure_type
Definition: array_1d.h:81
BOOST_UBLAS_INLINE const_reverse_iterator rbegin() const
Definition: array_1d.h:636
BOOST_UBLAS_INLINE array_1d(const std::initializer_list< value_type > &rInitList)
Definition: array_1d.h:117
BOOST_UBLAS_INLINE reference insert_element(size_type i, const_reference t)
Definition: array_1d.h:313
boost::numeric::ublas::dense_tag storage_category
Definition: array_1d.h:84
BOOST_UBLAS_INLINE array_1d & operator*=(const AT &at)
Definition: array_1d.h:258
BOOST_UBLAS_INLINE const_iterator end() const
Definition: array_1d.h:611
BOOST_UBLAS_INLINE array_1d & operator/=(const AT &at)
Definition: array_1d.h:219
BOOST_UBLAS_INLINE void erase_element(size_type i)
Definition: array_1d.h:319
array_1d< T, N > self_type
Definition: array_1d.h:80
BOOST_UBLAS_INLINE array_1d & assign_temporary(array_1d &v)
Definition: array_1d.h:249
KRATOS_CLASS_POINTER_DEFINITION(array_1d)
Pointer definition of array_1d.
BOOST_UBLAS_INLINE iterator find(size_type i)
Definition: array_1d.h:361
T value_type
Definition: array_1d.h:75
BOOST_UBLAS_INLINE array_1d(const array_1d &v)
Definition: array_1d.h:132
BOOST_UBLAS_INLINE array_1d(const boost::numeric::ublas::vector_expression< AE > &ae)
Definition: array_1d.h:149
BOOST_UBLAS_INLINE array_1d & plus_assign(const boost::numeric::ublas::vector_expression< AE > &ae)
Definition: array_1d.h:265
BOOST_UBLAS_INLINE bool operator==(const array_1d &v) const
Compares whether this array_1d is equal to the given array_1d.
Definition: array_1d.h:231
BOOST_UBLAS_INLINE const_iterator begin() const
Definition: array_1d.h:606
BOOST_UBLAS_INLINE const_reverse_iterator rend() const
Definition: array_1d.h:641
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
Definition: array_1d.h:772
void HashCombine(std::size_t &rSeed, const TClassType &rValue)
This method creates an "unique" hash for the input value.
Definition: array_1d.h:782
int seed
Definition: GenerateWind.py:138
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
AMatrix::MatrixExpression< TExpressionType, AMatrix::row_major_access > vector_expression
Definition: amatrix_interface.h:490
v
Definition: generate_convection_diffusion_explicit_element.py:114
tuple const
Definition: ode_solve.py:403
int t
Definition: ode_solve.py:392
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
N
Definition: sensitivityMatrix.py:29
namespace
Definition: array_1d.h:793
integer i
Definition: TensorModule.f:17
std::size_t operator()(const Kratos::array_1d< T, N > &rArray)
Definition: array_1d.h:797