74 #ifndef SLIP_DENSEVECTOR2DFIELD2D_HPP
75 #define SLIP_DENSEVECTOR2DFIELD2D_HPP
99 #include <boost/serialization/access.hpp>
100 #include <boost/serialization/split_member.hpp>
101 #include <boost/serialization/version.hpp>
102 #include <boost/serialization/base_object.hpp>
108 class stride_iterator;
111 class iterator2d_box;
114 class iterator2d_range;
117 class const_iterator2d_box;
120 class const_iterator2d_range;
123 template <
typename T>
126 template <
typename T>
129 template <
typename T>
132 template <
typename T>
156 template <
typename T>
205 static const std::size_t
DIM = 2;
241 base(height,width,val)
253 base(height,width,val)
265 base(height,width,val)
279 template<
typename InputIterator>
284 base(height,width,first,last)
303 template<
typename InputIterator>
306 InputIterator first1,
308 InputIterator first2):
312 std::vector<InputIterator> first_iterators_list(2);
313 first_iterators_list[0] = first1;
314 first_iterators_list[1] = first2;
315 this->
fill(first_iterators_list,last1);
342 std::string
name()
const;
377 const std::string& title,
378 const std::string& zone);
676 template<
typename Container2D>
692 template<
typename Container2D>
704 template<
class Archive>
705 void save(Archive & ar,
const unsigned int version)
const
707 ar & boost::serialization::base_object<slip::GenericMultiComponent2d<slip::Vector2d<T> > >(*this);
709 template<
class Archive>
710 void load(Archive & ar,
const unsigned int version)
712 ar & boost::serialization::base_object<slip::GenericMultiComponent2d<slip::Vector2d<T> > >(*this);
714 BOOST_SERIALIZATION_SPLIT_MEMBER()
750 DenseVector2dField2d<T>
operator+(
const DenseVector2dField2d<T>& M1,
760 DenseVector2dField2d<T>
operator+(
const T& val,
761 const DenseVector2dField2d<T>& M1);
771 DenseVector2dField2d<T>
operator-(
const DenseVector2dField2d<T>& M1,
781 DenseVector2dField2d<T>
operator-(
const T& val,
782 const DenseVector2dField2d<T>& M1);
793 DenseVector2dField2d<T>
operator*(
const DenseVector2dField2d<T>& M1,
803 DenseVector2dField2d<T>
operator*(
const T& val,
804 const DenseVector2dField2d<T>& M1);
815 DenseVector2dField2d<T>
operator/(
const DenseVector2dField2d<T>& M1,
828 DenseVector2dField2d<T>
operator+(
const DenseVector2dField2d<T>& M1,
829 const DenseVector2dField2d<T>& M2);
838 DenseVector2dField2d<T>
operator+(
const DenseVector2dField2d<T>& M1,
849 const DenseVector2dField2d<T>& M1);
862 DenseVector2dField2d<T>
operator-(
const DenseVector2dField2d<T>& M1,
863 const DenseVector2dField2d<T>& M2);
873 DenseVector2dField2d<T>
operator-(
const DenseVector2dField2d<T>& M1,
884 const DenseVector2dField2d<T>& M1);
897 DenseVector2dField2d<T>
operator*(
const DenseVector2dField2d<T>& M1,
898 const DenseVector2dField2d<T>& M2);
908 DenseVector2dField2d<T>
operator*(
const DenseVector2dField2d<T>& M1,
919 const DenseVector2dField2d<T>& M1);
932 DenseVector2dField2d<T>
operator/(
const DenseVector2dField2d<T>& M1,
933 const DenseVector2dField2d<T>& M2);
942 DenseVector2dField2d<T>
operator/(
const DenseVector2dField2d<T>& M1,
969 std::fill_n(this->begin(),this->size(),val);
978 std::fill_n(this->begin(),this->size(),val);
988 return (*
this)[i][j][0];
996 return (*
this)[i][j][0];
1004 return this->Vx1(i,j);
1007 template<
typename T>
1012 return this->Vx1(i,j);
1016 template<
typename T>
1021 return (*
this)[i][j][1];
1024 template<
typename T>
1029 return (*
this)[i][j][1];
1033 template<
typename T>
1038 return this->Vx2(i,j);
1041 template<
typename T>
1046 return this->Vx2(i,j);
1049 template<
typename T>
1057 template<
typename T>
1063 return (*
this)[i][j].Euclidean_norm();
1066 template<
typename T>
1072 return (*
this)[i][j].angle();
1075 template<
typename T>
1083 template<
typename T>
1091 template<
typename T>
1101 template<
typename T>
1109 template<
typename T>
1117 template<
typename T>
1125 template<
typename T>
1135 template<
typename T>
1140 std::transform(this->begin(),this->end(),tmp.
begin(),std::negate<slip::Vector2d<T> >());
1144 template<
typename T>
1148 assert(this->dim1() == rhs.
dim1());
1149 assert(this->dim2() == rhs.
dim2());
1150 std::transform(this->begin(),this->end(),rhs.
begin(),this->begin(),std::plus<typename DenseVector2dField2d::value_type>());
1154 template<
typename T>
1158 assert(this->dim1() == rhs.
dim1());
1159 assert(this->dim2() == rhs.
dim2());
1160 std::transform(this->begin(),this->end(),rhs.
begin(),this->begin(),std::minus<typename DenseVector2dField2d::value_type>());
1164 template<
typename T>
1168 assert(this->dim1() == rhs.
dim1());
1169 assert(this->dim2() == rhs.
dim2());
1170 std::transform(this->begin(),this->end(),rhs.
begin(),this->begin(),std::multiplies<typename DenseVector2dField2d::value_type>());
1174 template<
typename T>
1178 assert(this->dim1() == rhs.
dim1());
1179 assert(this->dim2() == rhs.
dim2());
1180 std::transform(this->begin(),this->end(),rhs.
begin(),this->begin(),std::divides<typename DenseVector2dField2d::value_type>());
1185 template<
typename T>
1191 template<
typename T>
1195 slip::write_gnuplot_vect2d<slip::DenseVector2dField2d<T> >(*
this,file_path_name);
1198 template<
typename T>
1201 const std::string& title,
1202 const std::string& zone)
1204 slip::write_tecplot_vect2d<slip::DenseVector2dField2d<T> >(*
this,
1209 template<
typename T>
1213 slip::read_gnuplot_vect2d<slip::DenseVector2dField2d<T> >(file_path_name,*
this);
1216 template<
typename T>
1221 slip::read_tecplot_vect2d<slip::DenseVector2dField2d<T> >(file_path_name,*
this);
1226 template<
typename T>
1236 template<
typename T>
1244 template<
typename T>
1254 template<
typename T>
1263 template<
typename T>
1273 template<
typename T>
1282 template<
typename T>
1292 template<
typename T>
1300 std::transform(M1.
begin(),M1.
end(),M2.
begin(),tmp.
begin(),std::plus<slip::Vector2d<T> >());
1305 template<
typename T>
1315 template<
typename T>
1325 template<
typename T>
1333 std::transform(M1.
begin(),M1.
end(),M2.
begin(),tmp.
begin(),std::minus<slip::Vector2d<T> >());
1338 template<
typename T>
1348 template<
typename T>
1357 template<
typename T>
1365 std::transform(M1.
begin(),M1.
end(),M2.
begin(),tmp.
begin(),std::multiplies<slip::Vector2d<T> >());
1370 template<
typename T>
1380 template<
typename T>
1389 template<
typename T>
1397 std::transform(M1.
begin(),M1.
end(),M2.
begin(),tmp.
begin(),std::divides<slip::Vector2d<T> >());
1402 template<
typename T>
1416 #endif //SLIP_DENSEVECTOR2DFIELD2D_HPP
DenseVector2dField2d(const size_type height, const size_type width, const T *val)
Constructs a DenseVector2dField2d initialized by an array val.
void minus(InputIterator1 __first1, InputIterator1 __last1, InputIterator2 __first2, OutputIterator __result)
Computes the difference of two ranges.
void write_gnuplot(const std::string &file_path_name)
Writes a DenseVector2dField2d to a gnuplot file path name.
void read_tecplot(const std::string &file_path_name)
Reads a DenseVector2dField2d from a tecplot file path name.
GenericMultiComponent2d< slip::Vector2d< T > > base
iterator begin()
Returns a read/write iterator that points to the first element in the GenericMultiComponent2d. Iteration is done in ordinary element order.
DenseVector2dField2d(const self &rhs)
Constructs a copy of the DenseVector2dField2d rhs.
const vector2d_value_type * const_vector2d_pointer
DenseVector2dField2d(const size_type height, const size_type width)
Constructs a DenseVector2dField2d.
This is a GenericMultiComponent2d class. This container statisfies the BidirectionnalContainer concep...
slip::GenericMultiComponent2d< slip::Vector2d< T > >::iterator2d iterator2d
This is a Dense Vector2d Field. This container statisfies the BidirectionnalContainer concepts of the...
slip::DenseVector2dField2d< float > DenseVector2dField2d_f
float alias
norm_type angle(const size_type i, const size_type j) const
Subscript access to a local angle contained in the DenseVector2dField2d. The result is a radian betwe...
norm_type Euclidean_norm() const
Returns the Euclidean norm of the elements of the kvector.
Provides a class to manipulate multicomponent 2d containers.
Color< T > operator+(const Color< T > &V1, const Color< T > &V2)
Provides a class to manipulate iterator2d within a slip::Box2d. It is used to iterate throw 2d contai...
slip::DenseVector2dField2d< short > DenseVector2dField2d_s
short alias
void divides(InputIterator1 __first1, InputIterator1 __last1, InputIterator2 __first2, OutputIterator __result)
Computes the pointwise division of two ranges.
size_type dim2() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
const value_type * const_pointer
slip::kstride_iterator< vector2d_pointer, 2 > vector2d_iterator
slip::GenericMultiComponent2d< slip::Vector2d< T > >::const_iterator2d const_iterator2d
slip::DenseVector2dField2d< unsigned short > DenseVector2dField2d_us
unsigned long alias
Provides some derivative algorithms and derivative functors.
T & Vx1(const size_type i, const size_type j)
Subscript access to first element of the data contained in the DenseVector2dField2d.
~DenseVector2dField2d()
Destructor of the DenseVector2dField2d.
self & operator=(const slip::Vector2d< T > &val)
Affects all the element of the DenseVector2dField2d by val.
Provides a class to iterate a 1d range according to a constant step.
slip::DenseVector2dField2d< unsigned long > DenseVector2dField2d_ul
unsigned long alias
Provides a class to manipulate 2d Vector.
slip::stride_iterator< const_pointer > const_col_iterator
const_pointer const_row_iterator
slip::DenseVector2dField2d< unsigned int > DenseVector2dField2d_ui
unsigned int alias
T & u(const size_type i, const size_type j)
Subscript access to first element of the data contained in the DenseVector2dField2d.
size_type height() const
Returns the height (first dimension size) in the GenericMultiComponent2d.
const value_type & const_reference
slip::DenseVector2dField2d< char > DenseVector2dField2d_c
char alias
std::reverse_iterator< col_iterator > reverse_col_iterator
size_type dim1() const
Returns the number of rows (first dimension size) in the GenericMultiComponent2d. ...
This is some iterator to iterate a 2d container into a Box area defined by the indices of the 2d cont...
const DenseVector2dField2d< T > const_self
iterator begin()
Returns a read/write iterator that points to the first element in the kvector. Iteration is done in o...
std::reverse_iterator< const_iterator > const_reverse_row_iterator
const_pointer const_iterator
std::reverse_iterator< const_col_iterator > const_reverse_col_iterator
T & Vx2(const size_type i, const size_type j)
Subscript access to second element of the data contained in the DenseVector2dField2d.
vector2d_value_type & vector2d_reference
void write_tecplot(const std::string &file_path_name, const std::string &title, const std::string &zone)
Writes a DenseVector2dField2d to a tecplot file path name.
std::string name() const
Returns the name of the class.
void plus(InputIterator1 __first1, InputIterator1 __last1, InputIterator2 __first2, OutputIterator __result)
Computes the addition of two ranges.
void multiplies(InputIterator1 __first1, InputIterator1 __last1, InputIterator2 __first2, OutputIterator __result)
Computes the pointwise product of two ranges.
static const std::size_t DIM
friend class boost::serialization::access
slip::DenseVector2dField2d< unsigned char > DenseVector2dField2d_uc
unsigned char alias
slip::stride_iterator< pointer > col_iterator
void norm(Container2D &result)
Computes Eucliean norm of each element in the field and write it to a Container2D.
std::reverse_iterator< iterator > reverse_row_iterator
void angle(Container2D &result)
Computes angle (radian) of each element with the cartesian axis and write it to a Container2D...
void read_gnuplot(const std::string &file_path_name)
Reads a DenseVector2dField2d from a gnuplot file path name.
DenseVector2dField2d(const size_type height, const size_type width, InputIterator first, InputIterator last)
Contructs a DenseVector2dField2d from a range.
T & v(const size_type i, const size_type j)
Subscript access to second element of the data contained in the DenseVector2dField2d.
slip::DenseVector2dField2d< double > DenseVector2dField2d_d
double alias
slip::lin_alg_traits< value_type >::value_type norm_type
This is some iterator to iterate a 2d container into a slip::Box2d area defined by the indices of the...
const vector2d_value_type const_vector2d_reference
slip::kstride_iterator< const_vector2d_pointer, 2 > const_vector2d_iterator
void fill(const slip::Vector2d< T > &value)
Fills the container range [begin(),begin()+size()) with copies of value.
DenseVector2dField2d(const size_type height, const size_type width, const slip::Vector2d< T > *val)
Constructs a DenseVector2dField2d initialized by an array val.
Provides some algorithms to computes arithmetical operations on ranges.
self & operator+=(const T &val)
Add val to each element of the DenseVector2dField2d.
ptrdiff_t difference_type
iterator end()
Returns a read/write iterator that points one past the last element in the GenericMultiComponent2d. Iteration is done in ordinary element order.
This is a Vector2d struct. It is a specialization of kvector. It implements some peculiar 2d operatio...
norm_type norm(const size_type i, const size_type j) const
Subscript access to a local norm contained in the DenseVector2dField2d.
slip::Vector2d< T > value_type
DenseVector2dField2d()
Constructs a DenseVector2dField2d.
self & operator-=(const T &val)
DenseVector2dField2d(const size_type height, const size_type width, InputIterator first1, InputIterator last1, InputIterator first2)
Contructs a DenseVector2dField2d from a 2 ranges.
std::reverse_iterator< const_iterator > const_reverse_iterator
size_type width() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
vector2d_value_type * vector2d_pointer
Provides a class to manipulate Numerical Matrix.
Provides some algorithms to apply C like functions to ranges.
Provides a class to iterate a 1d range according to a step.
slip::DenseVector2dField2d< long > DenseVector2dField2d_l
long alias
std::reverse_iterator< iterator > reverse_iterator
self & operator/=(const T &val)
self & operator*=(const T &val)
Color< T > operator*(const Color< T > &V1, const Color< T > &V2)
Provides a class to manipulate iterator2d within a slip::Range. It is used to iterate throw 2d contai...
Color< T > operator/(const Color< T > &V1, const Color< T > &V2)
Color< T > operator-(const Color< T > &V1, const Color< T > &V2)
slip::DenseVector2dField2d< int > DenseVector2dField2d_i
int alias
DenseVector2dField2d(const size_type height, const size_type width, const slip::Vector2d< T > &val)
Constructs a DenseVector2dField2d initialized by the scalar value val.