74 #ifndef SLIP_BLOCK4D_HPP
75 #define SLIP_BLOCK4D_HPP
84 #include <boost/serialization/access.hpp>
85 #include <boost/serialization/split_member.hpp>
86 #include <boost/serialization/string.hpp>
87 #include <boost/serialization/complex.hpp>
88 #include <boost/serialization/version.hpp>
93 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
96 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
97 std::ostream& operator<<(std::ostream & out,const slip::block4d<T,NS,NP,NR,NC>& b);
99 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
102 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
105 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
108 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
111 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
114 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
138 template <
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
162 static const std::size_t
SIZE = NS * NP * NR * NC;
163 static const std::size_t
DIM = 4;
182 void fill(
const T& val);
188 void fill(
const T* val);
200 friend std::ostream& operator<< <>(std::ostream & out,
const self& b);
209 friend bool operator== <>(
const self& x,
const self& y);
218 friend bool operator!= <>(
const self& x,
const self& y);
227 friend bool operator< <>(
const self& x,
const self& y);
236 friend bool operator> <>(
const self& x,
const self& y);
245 friend bool operator<= <>(
const self& x,
const self& y);
254 friend bool operator>= <>(
const self& x,
const self& y);
286 T*
operator()(
const std::size_t l,
const std::size_t i,
287 const std::size_t j);
300 const T*
operator()(
const std::size_t l,
const std::size_t i,
301 const std::size_t j)
const;
317 T &
operator()(
const std::size_t l,
const std::size_t i,
319 const std::size_t k);
334 const T &
operator()(
const std::size_t l,
const std::size_t i,
336 const std::size_t k)
const;
345 std::string
name()
const {
return "block4d";}
350 static std::size_t
dim1() {
return NS;}
352 static std::size_t
dim2() {
return NP;}
354 static std::size_t
dim3() {
return NR;}
356 static std::size_t
dim4() {
return NC;}
374 template<
class Archive>
375 void save(Archive & ar,
const unsigned int version)
const
379 template<
class Archive>
380 void load(Archive & ar,
const unsigned int version)
385 BOOST_SERIALIZATION_SPLIT_MEMBER()
392 template<
typename T, std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
396 return data[0].begin();
399 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
403 return data[NS-1].end();
406 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
410 return data[0].begin();
413 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
417 return data[NS-1].end();
421 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
425 return std::reverse_iterator<T*>(end());
428 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
432 return std::reverse_iterator<T*>(begin());
435 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
439 return std::reverse_iterator<const T*>(end());
442 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
446 return std::reverse_iterator<const T*>(begin());
449 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
457 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
466 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
468 std::ostream& operator<<(std::ostream & out,const block4d<T,NS,NP,NR,NC>& b)
471 for(std::size_t i = 0; i < NS; ++i)
473 out << std::endl <<
"############### SLAB "<<i<<
" ######################" << std::endl<< b.data[i];
481 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
486 for(std::size_t n = 0; n < NS; ++n)
495 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
500 for(std::size_t n = 0; n < NS; ++n)
510 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
514 assert(x.dim()==y.dim());
515 for(std::size_t n = 0; n < NS; ++n)
524 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
529 for(std::size_t n = 0; n < NS; ++n)
538 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
542 assert(x.dim()==y.dim());
543 for(std::size_t n = 0; n < NS; ++n)
552 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
557 for(std::size_t n = 0; n < NS; ++n)
565 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
573 return data[l][i][j];
576 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
579 const std::size_t j)
const
584 return data[l][i][j];
588 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
598 return data[l][i][j][k];
601 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
605 const std::size_t k)
const
611 return data[l * NC * NR * NP + i * NC * NR + j * NC + k];
615 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
619 for(std::size_t i = 0; i < NS; ++i){
625 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
629 for(std::size_t i = 0; i < NS; ++i){
630 data[i].fill(&val[i*NP*NR*NC]);
635 template<
typename T,std::
size_t NS, std::
size_t NP, std::
size_t NR, std::
size_t NC>
639 std::swap_ranges(begin(),end(),M.
begin());
645 #endif //SLIP_BLOCK4D_HPP
bool operator!=(const Array< T > &x, const Array< T > &y)
Provides a class to manipulate 3d static and generic arrays.
std::reverse_iterator< iterator > reverse_iterator
friend class boost::serialization::access
slip::block3d< T, NP, NR, NC > data[NS]
std::string name() const
Returns the name of the class.
const value_type * const_pointer
ptrdiff_t difference_type
std::reverse_iterator< const_iterator > const_reverse_iterator
Provides a class to tag SLIP iterators.
static std::size_t dim1()
Returns the first dimension of the block4d (number of slabs)
const_pointer const_iterator
This a four-dimensional static and generic container. This container statisfies the BidirectionnalCon...
static std::size_t dim()
Returns the dimension of the block4d.
bool operator>(const Array< T > &x, const Array< T > &y)
void fill(const T &val)
Init the block4d filled it with val value.
static std::size_t size()
Returns the size (number of elements) of the block4d.
reverse_iterator rbegin()
static std::size_t dim3()
Returns the third dimension of the block4d (number of rows)
static const std::size_t DIM
T * operator()(const std::size_t l, const std::size_t i, const std::size_t j)
Returns a pointer at the first element of the l'th slab, the i'th plan and the j'th row...
slip::block3d< T, NP, NR, NC > & operator[](const std::size_t i)
Returns a reference to the i'th slab of the block4d.
static std::size_t dim4()
Returns the fourth dimension of the block4d (number of columns)
static std::size_t size_max()
Returns the maximal size (number of elements) of the block4d.
This a three-dimensional static and generic container. This container statisfies the BidirectionnalCo...
void swap(self &M)
Swaps the contents of two block4d.
static const std::size_t SIZE
static bool empty()
Returns true if the block4d size is 0.
static std::size_t dim2()
Returns the second dimension of the block4d (number of plans)
bool operator==(const Array< T > &x, const Array< T > &y)
const value_type & const_reference
bool operator>=(const Array< T > &x, const Array< T > &y)
std::random_access_iterator4d_tag iterator_category