SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RegularVector2dField2d.hpp
Go to the documentation of this file.
1 /*
2  * Copyright(c):
3  * Signal Image and Communications (SIC) Department
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * - University of Poitiers, France http://www.univ-poitiers.fr
6  * - XLIM Institute UMR CNRS 7252 http://www.xlim.fr/
7  *
8  * and
9  *
10  * D2 Fluid, Thermic and Combustion
11  * - University of Poitiers, France http://www.univ-poitiers.fr
12  * - PPRIME Institute - UPR CNRS 3346 http://www.pprime.fr
13  * - ISAE-ENSMA http://www.ensma.fr
14  *
15  * Contributor(s):
16  * The SLIP team,
17  * Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>,
18  * Laurent David <laurent.david_AT_lea.univ-poitiers.fr>,
19  * Ludovic Chatellier <ludovic.chatellier_AT_univ-poitiers.fr>,
20  * Lionel Thomas <lionel.thomas_AT_univ-poitiers.fr>,
21  * Denis Arrivault <arrivault_AT_sic.univ-poitiers.fr>,
22  * Julien Dombre <julien.dombre_AT_univ-poitiers.fr>.
23  *
24  * Description:
25  * The Simple Library of Image Processing (SLIP) is a new image processing
26  * library. It is written in the C++ language following as much as possible
27  * the ISO/ANSI C++ standard. It is consequently compatible with any system
28  * satisfying the ANSI C++ complience. It works on different Unix , Linux ,
29  * Mircrosoft Windows and Mac OS X plateforms. SLIP is a research library that
30  * was created by the Signal, Image and Communications (SIC) departement of
31  * the XLIM, UMR 7252 CNRS Institute in collaboration with the Fluids, Thermic
32  * and Combustion departement of the P', UPR 3346 CNRS Institute of the
33  * University of Poitiers.
34  *
35  * The SLIP Library source code has been registered to the APP (French Agency
36  * for the Protection of Programs) by the University of Poitiers and CNRS,
37  * under registration number IDDN.FR.001.300034.000.S.P.2010.000.21000.
38 
39  * http://www.sic.sp2mi.univ-poitiers.fr/slip/
40  *
41  * This software is governed by the CeCILL-C license under French law and
42  * abiding by the rules of distribution of free software. You can use,
43  * modify and/ or redistribute the software under the terms of the CeCILL-C
44  * license as circulated by CEA, CNRS and INRIA at the following URL
45  * http://www.cecill.info.
46  * As a counterpart to the access to the source code and rights to copy,
47  * modify and redistribute granted by the license, users are provided only
48  * with a limited warranty and the software's author, the holder of the
49  * economic rights, and the successive licensors have only limited
50  * liability.
51  *
52  * In this respect, the user's attention is drawn to the risks associated
53  * with loading, using, modifying and/or developing or reproducing the
54  * software by the user in light of its specific status of free software,
55  * that may mean that it is complicated to manipulate, and that also
56  * therefore means that it is reserved for developers and experienced
57  * professionals having in-depth computer knowledge. Users are therefore
58  * encouraged to load and test the software's suitability as regards their
59  * requirements in conditions enabling the security of their systems and/or
60  * data to be ensured and, more generally, to use and operate it in the
61  * same conditions as regards security.
62  *
63  * The fact that you are presently reading this means that you have had
64  * knowledge of the CeCILL-C license and that you accept its terms.
65  */
66 
67 
68 
75 #ifndef SLIP_REGULARVECTOR2DFIELD2D_HPP
76 #define SLIP_REGULARVECTOR2DFIELD2D_HPP
77 
78 #include <iostream>
79 #include <fstream>
80 #include <iterator>
81 #include <cassert>
82 #include <numeric>
83 #include <algorithm>
84 #include <cmath>
85 #include <string>
86 #include <cstddef>
87 #include "Matrix.hpp"
88 #include "stride_iterator.hpp"
89 #include "kstride_iterator.hpp"
90 #include "iterator2d_box.hpp"
91 #include "iterator2d_range.hpp"
92 #include "apply.hpp"
93 #include "Vector2d.hpp"
94 #include "Point2d.hpp"
96 #include "derivatives.hpp"
97 #include "arithmetic_op.hpp"
98 #include "io_tools.hpp"
100 
101 #include <boost/serialization/access.hpp>
102 #include <boost/serialization/split_member.hpp>
103 #include <boost/serialization/version.hpp>
104 #include <boost/serialization/base_object.hpp>
105 
106 namespace slip
107 {
108 
109 template<typename T>
110 class stride_iterator;
111 
112 template<typename T>
113 class iterator2d_box;
114 
115 template<typename T>
116 class iterator2d_range;
117 
118 template<typename T>
119 class const_iterator2d_box;
120 
121 template<typename T>
122 class const_iterator2d_range;
123 
124 
125 template <typename T>
126 class DPoint2d;
127 
128 template <typename T>
129 class Point2d;
130 
131 template <typename T>
132 class Box2d;
133 
134  template <typename T, typename GridT>
136 
137  template <typename T, typename GridT>
138  std::ostream& operator<<(std::ostream & out, const slip::RegularVector2dField2d<T,GridT>& a);
139 
164  template <typename T, typename GridT = double>
165 class RegularVector2dField2d:public slip::GenericMultiComponent2d<slip::Vector2d<T> >
166 {
167 public :
168 
173 
174 
175  typedef value_type* pointer;
176  typedef const value_type* const_pointer;
178  typedef const value_type& const_reference;
179 
180  typedef ptrdiff_t difference_type;
181  typedef std::size_t size_type;
182 
183  typedef pointer iterator;
185 
186  typedef std::reverse_iterator<iterator> reverse_iterator;
187  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
188 
189 
194 
195  typedef std::reverse_iterator<iterator> reverse_row_iterator;
196  typedef std::reverse_iterator<const_iterator> const_reverse_row_iterator;
197  typedef std::reverse_iterator<col_iterator> reverse_col_iterator;
198  typedef std::reverse_iterator<const_col_iterator> const_reverse_col_iterator;
199 
202 
204  typedef GridT grid_value_type;
211 
213 
214  static const std::size_t DIM = 2;
215 public:
221 
226  base(),init_point_(slip::Point2d<GridT>()),grid_step_(slip::Point2d<GridT>(GridT(1),GridT(1)))
227  {}
228 
237  const size_type width):
238  base(height,width),init_point_(slip::Point2d<GridT>()),grid_step_(slip::Point2d<GridT>(GridT(1),GridT(1)))
239  {}
240 
251  const size_type width,
252  const slip::Point2d<GridT>& init_point,
253  const slip::Point2d<GridT>& grid_step):
254  base(height,width),init_point_(init_point),grid_step_(grid_step)
255  {}
256 
264  const size_type width,
265  const slip::Vector2d<T>& val):
266  base(height,width,val),init_point_(slip::Point2d<GridT>()),grid_step_(slip::Point2d<GridT>(GridT(1),GridT(1)))
267  {}
268 
278  const size_type width,
279  const slip::Point2d<GridT>& init_point,
280  const slip::Point2d<GridT>& grid_step,
281  const slip::Vector2d<T>& val):
282  base(height,width,val),init_point_(init_point),grid_step_(grid_step)
283  {}
284 
292  const size_type width,
293  const T* val):
294  base(height,width,val),init_point_(slip::Point2d<GridT>()),grid_step_(slip::Point2d<GridT>(GridT(1),GridT(1)))
295  {}
296 
297 
298 
299 
309  const size_type width,
310  const slip::Point2d<GridT>& init_point,
311  const slip::Point2d<GridT>& grid_step,
312  const T* val):
313  base(height,width,val),init_point_(init_point),grid_step_(grid_step)
314  {}
315 
323  const size_type width,
324  const slip::Vector2d<T>* val):
325  base(height,width,val),init_point_(slip::Point2d<GridT>()),grid_step_(slip::Point2d<GridT>(GridT(1),GridT(1)))
326  {}
327 
337  const size_type width,
338  const slip::Point2d<GridT>& init_point,
339  const slip::Point2d<GridT>& grid_step,
340  const slip::Vector2d<T>* val):
341  base(height,width,val),init_point_(init_point),grid_step_(grid_step)
342  {}
343 
344 
355  template<typename InputIterator>
357  const size_type width,
358  InputIterator first,
359  InputIterator last):
360  base(height,width,first,last),init_point_(slip::Point2d<GridT>()),grid_step_(slip::Point2d<GridT>(GridT(1),GridT(1)))
361  {
362  // this->init_point_ = slip::Point2d<GridT>();
363 // this->grid_step_ = slip::Point2d<GridT>(GridT(1),GridT(1));
364  }
365 
366 
379  template<typename InputIterator>
381  const size_type width,
382  const slip::Point2d<GridT>& init_point,
383  const slip::Point2d<GridT>& grid_step,
384  InputIterator first,
385  InputIterator last):
386  base(height,width,first,last),init_point_(init_point),grid_step_(grid_step)
387  {
388  // this->init_point_ = init_point;
389 // this->grid_step_ = grid_step;
390 
391  }
392 
393 
394 
395 
409  template<typename InputIterator>
411  const size_type width,
412  InputIterator first1,
413  InputIterator last1,
414  InputIterator first2):
415  base(height,width),init_point_(slip::Point2d<GridT>()),grid_step_(slip::Point2d<GridT>(GridT(1),GridT(1)))
416  {
417 
418  std::vector<InputIterator> first_iterators_list(2);
419  first_iterators_list[0] = first1;
420  first_iterators_list[1] = first2;
421  this->fill(first_iterators_list,last1);
422 
423  }
424 
440  template<typename InputIterator>
442  const size_type width,
443  const slip::Point2d<GridT>& init_point,
444  const slip::Point2d<GridT>& grid_step,
445  InputIterator first1,
446  InputIterator last1,
447  InputIterator first2):
448  base(height,width),init_point_(init_point),grid_step_(grid_step)
449  {
450 
451  std::vector<InputIterator> first_iterators_list(2);
452  first_iterators_list[0] = first1;
453  first_iterators_list[1] = first2;
454  this->fill(first_iterators_list,last1);
455 
456  }
457 
458 
462  RegularVector2dField2d(const self& rhs):
463  base(rhs),init_point_(rhs.init_point_),grid_step_(rhs.grid_step_)
464  {}
465 
470  {}
471 
472 
481  std::string name() const;
482 
483 
488 
494  friend std::ostream& operator<< <>(std::ostream & out, const self& a);
495 
496 
497 
505  void write_gnuplot(const std::string& file_path_name) const;
506 
507 
524  void write_tecplot(const std::string& file_path_name,
525  const std::string& title,
526  const std::string& zone) const;
527 
528 
536  void read_gnuplot(const std::string& file_path_name);
537 
538 
553  void read_tecplot(const std::string& file_path_name);
554 
555 
556 
563 
564 
570  self& operator=(const slip::Vector2d<T>& val);
571 
572 
578  self& operator=(const T& val);
579 
580 
581 
582 
583 
603  T& Vx1(const size_type i,
604  const size_type j);
605 
606 
607 
620  const T& Vx1(const size_type i,
621  const size_type j) const;
622 
623 
637  T& Vx2(const size_type i,
638  const size_type j);
639 
652  const T& Vx2(const size_type i,
653  const size_type j) const;
654 
655 
669  T& u(const size_type i,
670  const size_type j);
671 
672 
673 
686  const T& u(const size_type i,
687  const size_type j) const;
688 
689 
703  T& v(const size_type i,
704  const size_type j);
705 
718  const T& v(const size_type i,
719  const size_type j) const;
720 
721 
734  norm_type norm(const size_type i,
735  const size_type j) const;
736 
737 
751  norm_type angle(const size_type i,
752  const size_type j) const;
766  const GridT x1(const size_type i,
767  const size_type j) const;
768 
782  const GridT x2(const size_type i,
783  const size_type j) const;
784 
798  const GridT x(const size_type i,
799  const size_type j) const;
800 
814  const GridT y(const size_type i,
815  const size_type j) const;
816 
821  void set_init_point(const slip::Point2d<GridT>& init_point);
822 
823 
828  const slip::Point2d<GridT>& get_init_point() const;
829 
834  void set_grid_step(const slip::Point2d<GridT>& grid_step);
835 
840  const slip::Point2d<GridT>& get_grid_step() const;
841 
842 
843 
850 
851 
864  self& operator+=(const T& val);
865  self& operator-=(const T& val);
866  self& operator*=(const T& val);
867  self& operator/=(const T& val);
868 
869 // self& operator%=(const T& val);
870 // self& operator^=(const T& val);
871 // self& operator&=(const T& val);
872 // self& operator|=(const T& val);
873 // self& operator<<=(const T& val);
874 // self& operator>>=(const T& val);
875 
876 
877  self operator-() const;
878 // self operator!() const;
879 
885  self& operator+=(const slip::Vector2d<T>& val);
886  self& operator-=(const slip::Vector2d<T>& val);
887  self& operator*=(const slip::Vector2d<T>& val);
888  self& operator/=(const slip::Vector2d<T>& val);
889 
890 
891 
892  self& operator+=(const self& rhs);
893  self& operator-=(const self& rhs);
894  self& operator*=(const self& rhs);
895  self& operator/=(const self& rhs);
896 
897 
904 
934  template<typename Container2D>
935  void derivative(const std::size_t component,
936  const slip::SPATIAL_DIRECTION der_dir,
937  const std::size_t der_order,
938  const std::size_t sch_order,
939  Container2D& result) const
940  {
941  assert(component < 2);
942  assert(sch_order >= der_order);
943  assert( ((der_dir == X_DIRECTION) && (this->rows() > sch_order))
944  ||((der_dir == Y_DIRECTION) && (this->cols() > sch_order)) );
945  assert((sch_order / 2) <= sch_order);
946  const std::size_t sch_shift = sch_order / 2;
947 
948  //computes all kernels
949  slip::Matrix<double> kernels(sch_order + 1, sch_order + 1);
950  std::vector<slip::Matrix<double>::iterator> kernels_iterators(sch_order + 1);
951  for(std::size_t i = 0; i < (sch_order + 1); ++i)
952  {
953  kernels_iterators[i] = kernels.row_begin(i);
954  }
955 
956  if(der_dir == X_DIRECTION)
957  {
958  slip::finite_diff_kernels(der_order,sch_order,sch_shift,
959  grid_step_[0],
960  kernels_iterators);
961  const size_type rows = this->rows();
962  for(size_type i = 0; i < rows; ++i)
963  {
964  slip::derivative(this->row_begin(component,i),
965  this->row_end(component,i),
966  der_order,
967  sch_order,
968  sch_shift,
969  kernels_iterators,
970  result.row_begin(i));
971  }
972  }
973 
974  if(der_dir == Y_DIRECTION)
975  {
976  slip::finite_diff_kernels(der_order,sch_order,sch_shift,
977  grid_step_[1],
978  kernels_iterators);
979  const size_type cols = this->cols();
980  for(size_type j = 0; j < cols; ++j)
981  {
982  slip::derivative(this->col_rbegin(component,j),
983  this->col_rend(component,j),
984  der_order,
985  sch_order,
986  sch_shift,
987  kernels_iterators,
988  result.col_rbegin(j));
989  }
990  }
991  // slip::derivative_2d(this->upper_left(component),
992 // this->bottom_right(component),
993 // this->grid_step_,
994 // der_dir,
995 // der_order,
996 // sch_order,
997 // result.upper_left(),
998 // result.bottom_right());
999 
1000  }
1001 
1002 
1039  template<typename Container2D>
1040  void derivative(const std::size_t component,
1041  const slip::SPATIAL_DIRECTION der_dir,
1042  const std::size_t der_order,
1043  const std::size_t sch_order,
1044  const slip::Box2d<int> box,
1045  Container2D& result) const
1046  {
1047  assert(component < 2);
1048  assert(sch_order >= der_order);
1049  assert( ((der_dir == X_DIRECTION) && (this->rows() > sch_order))
1050  ||((der_dir == Y_DIRECTION) && (this->cols() > sch_order)) );
1051  assert((sch_order / 2) <= sch_order);
1052  const std::size_t sch_shift = sch_order / 2;
1053 
1054  //computes all kernels
1055  slip::Matrix<double> kernels(sch_order + 1, sch_order + 1);
1056  std::vector<slip::Matrix<double>::iterator> kernels_iterators(sch_order + 1);
1057  for(std::size_t i = 0; i < (sch_order + 1); ++i)
1058  {
1059  kernels_iterators[i] = kernels.row_begin(i);
1060  }
1061 
1062  const size_type rows=box.height();
1063  const size_type cols=box.width();
1064 
1065  if(der_dir == X_DIRECTION)
1066  {
1067  slip::finite_diff_kernels(der_order,sch_order,sch_shift,
1068  grid_step_[0],
1069  kernels_iterators);
1070  const slip::Range<int> range_row(box.upper_left()[1],box.bottom_right()[1],1);
1071  for(int i = box.upper_left()[0]; i <= box.bottom_right()[0]; ++i)
1072  {
1073  slip::derivative(this->row_begin(component,i, range_row),
1074  this->row_end(component,i, range_row),
1075  der_order,
1076  sch_order,
1077  sch_shift,
1078  kernels_iterators,
1079  result.row_begin(i, range_row));
1080  }
1081  }
1082 
1083  if(der_dir == Y_DIRECTION)
1084  {
1085  slip::finite_diff_kernels(der_order,sch_order,sch_shift,
1086  grid_step_[1],
1087  kernels_iterators);
1088  const slip::Range<int> range_col(box.upper_left()[0],box.bottom_right()[0],1);
1089  for(int j = box.upper_left()[1]; j <= box.bottom_right()[1]; ++j)
1090  {
1091  slip::derivative(this->col_rbegin(component,j, range_col),
1092  this->col_rend(component,j, range_col),
1093  der_order,
1094  sch_order,
1095  sch_shift,
1096  kernels_iterators,
1097  result.col_rbegin(j, range_col));
1098  }
1099  }
1100  }
1101 
1102 
1118  template<typename Container2D>
1119  void divergence(const std::size_t sch_order,
1120  Container2D& result) const
1121  {
1122  assert(sch_order >= 1);
1123  assert((sch_order / 2) <= sch_order);
1124 
1125  const std::size_t der_order = 1;
1126  //x-derivative of the x component (first component)
1127  slip::Matrix<double> Mtmp(this->rows(),this->cols());
1128  std::size_t component = 0;
1129  this->derivative(component,slip::X_DIRECTION,der_order,sch_order,Mtmp);
1130 
1131 
1132  //y-derivative of the y component (second component)
1133  component = 1;
1134  this->derivative(component,slip::Y_DIRECTION,der_order,sch_order,result);
1135 
1136  //compute the divergence
1137  slip::plus(Mtmp.begin(),Mtmp.end(),result.begin(),result.begin());
1138 
1139 
1140  }
1141 
1142 
1162  template<typename Container2D>
1163  void vorticity(const std::size_t sch_order,
1164  Container2D& result) const
1165  {
1166  assert(sch_order >= 1);
1167  assert((sch_order / 2) <= sch_order);
1168 
1169  const std::size_t der_order = 1;
1170 
1171  //derivate the y component (second component)
1172  slip::Matrix<double> Mtmp(this->rows(),this->cols());
1173  std::size_t component = 1;
1174  this->derivative(component,slip::X_DIRECTION,der_order,sch_order,Mtmp);
1175 
1176  //derivate the x component (first component)
1177  component = 0;
1178  this->derivative(component,slip::Y_DIRECTION,der_order,sch_order,result);
1179 
1180  //compute the divergence
1181  slip::minus(Mtmp.begin(),Mtmp.end(),result.begin(),result.begin());
1182 
1183  }
1184 
1185 
1202  template<typename Container2D>
1203  void lambda2(const std::size_t sch_order,
1204  Container2D& result)
1205  {
1206  assert(sch_order >= 1);
1207  assert((sch_order / 2) <= sch_order);
1208 
1209  const std::size_t der_order = 1;
1210  const size_type rows = this->rows();
1211  const size_type cols = this->cols();
1212 
1213  //vectorial x derivative of the RegularVector2dField2d
1214  self Mtmpx(rows,cols);
1216  this->bottom_right(),
1217  this->grid_step_,
1219  der_order,
1220  sch_order,
1221  Mtmpx.upper_left(),
1222  Mtmpx.bottom_right());
1223 
1224  //vectorial y derivative of the RegularVector2dField2d
1225  self Mtmpy(rows,cols);
1227  this->bottom_right(),
1228  this->grid_step_,
1230  der_order,
1231  sch_order,
1232  Mtmpy.upper_left(),
1233  Mtmpy.bottom_right());
1234  //compute the lamda2
1235  for(size_type i = 0; i < rows; ++i)
1236  {
1237  for(size_type j = 0; j < cols; ++j)
1238  {
1239  result[i][j] = Mtmpx[i][j][1] * Mtmpy[i][j][0] - Mtmpx[i][j][0] * Mtmpy[i][j][1];
1240  }
1241  }
1242 
1243 
1244  }
1245 
1246 
1255  template<typename Container2D>
1256  void norm(Container2D& result)
1257  {
1258  //typedef slip::Vector2d<double> vector;
1259  std::transform(this->begin(),this->end(),result.begin(),std::mem_fun_ref(&value_type::Euclidean_norm));
1260 
1261  }
1262 
1271  template<typename Container2D>
1272  void angle(Container2D& result)
1273  {
1274 
1275  std::transform(this->begin(),this->end(),result.begin(),std::mem_fun_ref(&slip::Vector2d<T>::angle));
1276 
1277  }
1278 
1283 private:
1284  slip::Point2d<GridT> init_point_;
1285  slip::Point2d<GridT> grid_step_;
1286 
1287 private :
1289  template<class Archive>
1290  void save(Archive & ar, const unsigned int version) const
1291  {
1292  ar & init_point_ & grid_step_;
1293  ar & boost::serialization::base_object<slip::GenericMultiComponent2d<slip::Vector2d<T> > >(*this);
1294  }
1295  template<class Archive>
1296  void load(Archive & ar, const unsigned int version)
1297  {
1298  ar & init_point_ & grid_step_;
1299  ar & boost::serialization::base_object<slip::GenericMultiComponent2d<slip::Vector2d<T> > >(*this);
1300  }
1301  BOOST_SERIALIZATION_SPLIT_MEMBER()
1302  };
1303 
1312 
1333 
1334 
1335 
1336 }//slip::
1337 
1338 namespace slip{
1339 
1340 
1347 template<typename T, typename GridT>
1348 RegularVector2dField2d<T,GridT> operator+(const RegularVector2dField2d<T,GridT>& M1,
1349  const T& val);
1350 
1357  template<typename T, typename GridT>
1358  RegularVector2dField2d<T,GridT> operator+(const T& val,
1359  const RegularVector2dField2d<T,GridT>& M1);
1360 
1361 
1368 template<typename T, typename GridT>
1369 RegularVector2dField2d<T,GridT> operator-(const RegularVector2dField2d<T,GridT>& M1,
1370  const T& val);
1371 
1378  template<typename T, typename GridT>
1379  RegularVector2dField2d<T,GridT> operator-(const T& val,
1380  const RegularVector2dField2d<T,GridT>& M1);
1381 
1382 
1383 
1390  template<typename T, typename GridT>
1391  RegularVector2dField2d<T,GridT> operator*(const RegularVector2dField2d<T,GridT>& M1,
1392  const T& val);
1393 
1400  template<typename T, typename GridT>
1401  RegularVector2dField2d<T,GridT> operator*(const T& val,
1402  const RegularVector2dField2d<T,GridT>& M1);
1403 
1404 
1405 
1412  template<typename T, typename GridT>
1413  RegularVector2dField2d<T,GridT> operator/(const RegularVector2dField2d<T,GridT>& M1,
1414  const T& val);
1415 
1416 
1425 template<typename T, typename GridT>
1426 RegularVector2dField2d<T,GridT> operator+(const RegularVector2dField2d<T,GridT>& M1,
1427  const RegularVector2dField2d<T,GridT>& M2);
1428 
1435 template<typename T, typename GridT>
1436 RegularVector2dField2d<T,GridT> operator+(const RegularVector2dField2d<T,GridT>& M1,
1437  const slip::Vector2d<T>& val);
1438 
1445  template<typename T, typename GridT>
1446  RegularVector2dField2d<T,GridT> operator+(const slip::Vector2d<T>& val,
1447  const RegularVector2dField2d<T,GridT>& M1);
1448 
1449 
1450 
1459 template<typename T, typename GridT>
1460 RegularVector2dField2d<T,GridT> operator-(const RegularVector2dField2d<T,GridT>& M1,
1461  const RegularVector2dField2d<T,GridT>& M2);
1462 
1463 
1470 template<typename T, typename GridT>
1471 RegularVector2dField2d<T,GridT> operator-(const RegularVector2dField2d<T,GridT>& M1,
1472  const slip::Vector2d<T>& val);
1473 
1480  template<typename T, typename GridT>
1481  RegularVector2dField2d<T,GridT> operator-(const slip::Vector2d<T>& val,
1482  const RegularVector2dField2d<T,GridT>& M1);
1483 
1484 
1485 
1494  template<typename T, typename GridT>
1495  RegularVector2dField2d<T,GridT> operator*(const RegularVector2dField2d<T,GridT>& M1,
1496  const RegularVector2dField2d<T,GridT>& M2);
1497 
1498 
1505 template<typename T, typename GridT>
1506 RegularVector2dField2d<T,GridT> operator*(const RegularVector2dField2d<T,GridT>& M1,
1507  const slip::Vector2d<T>& val);
1508 
1515  template<typename T, typename GridT>
1516  RegularVector2dField2d<T,GridT> operator*(const slip::Vector2d<T>& val,
1517  const RegularVector2dField2d<T,GridT>& M1);
1518 
1519 
1520 
1529  template<typename T, typename GridT>
1530  RegularVector2dField2d<T,GridT> operator/(const RegularVector2dField2d<T,GridT>& M1,
1531  const RegularVector2dField2d<T,GridT>& M2);
1532 
1539 template<typename T, typename GridT>
1540 RegularVector2dField2d<T,GridT> operator/(const RegularVector2dField2d<T,GridT>& M1,
1541  const slip::Vector2d<T>& val);
1542 
1543 
1544 
1545 
1546 }//slip::
1547 
1548 namespace slip
1549 {
1550 
1551 
1552  // template<typename T, typename GridT>
1553 // inline
1554 // RegularVector2dField2d<T,GridT>& RegularVector2dField2d<T,GridT>::operator=(const RegularVector2dField2d<T,GridT> & rhs)
1555 // {
1556 // if(this != &rhs)
1557 // {
1558 // *(this->matrix_) = *(rhs.matrix_);
1559 // this->init_point_ = rhs.init_point_;
1560 // this->grid_step_ = rhs.grid_step_;
1561 // }
1562 // return *this;
1563 // }
1564 
1565  template<typename T, typename GridT>
1566  inline
1568  {
1569  std::fill_n(this->begin(),this->size(),val);
1570  return *this;
1571  }
1572 
1573 
1574  template<typename T, typename GridT>
1575  inline
1577  {
1578  std::fill_n(this->begin(),this->size(),val);
1579  return *this;
1580  }
1581 
1582 
1583  template<typename T, typename GridT>
1584  inline
1586  const typename RegularVector2dField2d::size_type j)
1587  {
1588  return (*this)[i][j][0];
1589  }
1590 
1591  template<typename T, typename GridT>
1592  inline
1594  const typename RegularVector2dField2d::size_type j) const
1595  {
1596  return (*this)[i][j][0];
1597  }
1598 
1599  template<typename T, typename GridT>
1600  inline
1602  const typename RegularVector2dField2d::size_type j)
1603  {
1604  return this->Vx1(i,j);
1605  }
1606 
1607  template<typename T, typename GridT>
1608  inline
1610  const typename RegularVector2dField2d::size_type j) const
1611  {
1612  return this->Vx1(i,j);
1613  }
1614 
1615  template<typename T, typename GridT>
1616  inline
1618  const typename RegularVector2dField2d::size_type j)
1619  {
1620  return (*this)[i][j][1];
1621  }
1622 
1623  template<typename T, typename GridT>
1624  inline
1626  const typename RegularVector2dField2d::size_type j) const
1627  {
1628  return (*this)[i][j][1];
1629  }
1630  template<typename T, typename GridT>
1631  inline
1633  const typename RegularVector2dField2d::size_type j)
1634  {
1635  return this->Vx2(i,j);
1636  }
1637 
1638  template<typename T, typename GridT>
1639  inline
1641  const typename RegularVector2dField2d::size_type j) const
1642  {
1643  return this->Vx2(i,j);
1644  }
1645 
1646  template<typename T, typename GridT>
1647  inline
1650  const typename RegularVector2dField2d::size_type j) const
1651  {
1652  return (*this)[i][j].Euclidean_norm();
1653  }
1654 
1655  template<typename T, typename GridT>
1656  inline
1659  const typename RegularVector2dField2d::size_type j) const
1660  {
1661  return (*this)[i][j].angle();
1662  }
1663 
1664  template<typename T, typename GridT>
1665  inline
1667  const typename RegularVector2dField2d::size_type j) const
1668  {
1669  return this->init_point_[0] + GridT(j) * this->grid_step_[0];
1670  }
1671 
1672  template<typename T, typename GridT>
1673  inline
1675  const typename RegularVector2dField2d::size_type j) const
1676  {
1677  return this->init_point_[1]
1678  + GridT(this->rows() - 1 - i) * this->grid_step_[1];
1679  }
1680 
1681  template<typename T, typename GridT>
1682  inline
1684  const typename RegularVector2dField2d::size_type j) const
1685  {
1686  return this->x1(i,j);
1687  }
1688 
1689  template<typename T, typename GridT>
1690  inline
1692  const typename RegularVector2dField2d::size_type j) const
1693  {
1694  return this->x2(i,j);
1695  }
1696 
1697 
1698  template<typename T, typename GridT>
1699  inline
1701  {
1702  return this->init_point_;
1703  }
1704 
1705  template<typename T, typename GridT>
1706  inline
1708  {
1709  this->init_point_ = init_point;
1710  }
1711 
1712  template<typename T, typename GridT>
1713  inline
1715  {
1716  return this->grid_step_;
1717  }
1718 
1719  template<typename T, typename GridT>
1720  inline
1722  {
1723  this->grid_step_ = grid_step;
1724  }
1725 
1726  template<typename T, typename GridT>
1727  inline
1729  {
1730  std::transform(this->begin(),this->end(),this->begin(),std::bind2nd(std::plus<slip::Vector2d<T> >(),val));
1731  return *this;
1732  }
1733 
1734  template<typename T, typename GridT>
1735  inline
1737  {
1738  std::transform(this->begin(),this->end(),this->begin(),std::bind2nd(std::minus<slip::Vector2d<T> >(),val));
1739  return *this;
1740  }
1741 
1742  template<typename T, typename GridT>
1743  inline
1745  {
1746  std::transform(this->begin(),this->end(),this->begin(),std::bind2nd(std::multiplies<slip::Vector2d<T> >(),val));
1747  return *this;
1748  }
1749 
1750  template<typename T, typename GridT>
1751  inline
1753  {
1754  std::transform(this->begin(),this->end(),this->begin(),std::bind2nd(std::divides<slip::Vector2d<T> >(),val));
1755  return *this;
1756  }
1757 
1758 
1759 
1760  template<typename T, typename GridT>
1761  inline
1763  {
1764  std::transform(this->begin(),this->end(),this->begin(),std::bind2nd(std::plus<slip::Vector2d<T> >(),val));
1765  return *this;
1766  }
1767 
1768  template<typename T, typename GridT>
1769  inline
1771  {
1772  std::transform(this->begin(),this->end(),this->begin(),std::bind2nd(std::minus<slip::Vector2d<T> >(),val));
1773  return *this;
1774  }
1775 
1776  template<typename T, typename GridT>
1777  inline
1779  {
1780  std::transform(this->begin(),this->end(),this->begin(),std::bind2nd(std::multiplies<slip::Vector2d<T> >(),val));
1781  return *this;
1782  }
1783 
1784  template<typename T, typename GridT>
1785  inline
1787  {
1788  std::transform(this->begin(),this->end(),this->begin(),std::bind2nd(std::divides<slip::Vector2d<T> >(),val));
1789  return *this;
1790  }
1791 
1792 
1793 
1794  template<typename T, typename GridT>
1795  inline
1797  {
1799  std::transform(this->begin(),this->end(),tmp.begin(),std::negate<slip::Vector2d<T> >());
1800  return tmp;
1801  }
1802 
1803  template<typename T, typename GridT>
1804  inline
1806  {
1807  assert(this->dim1() == rhs.dim1());
1808  assert(this->dim2() == rhs.dim2());
1809  if(this->get_init_point() != rhs.get_init_point())
1810  {
1811  throw std::runtime_error(slip::GRID_INIT_POINT_ERROR);
1812  }
1813  if(this->get_grid_step() != rhs.get_grid_step())
1814  {
1815  throw std::runtime_error(slip::GRID_STEP_ERROR);
1816  }
1817  std::transform(this->begin(),this->end(),rhs.begin(),this->begin(),std::plus<typename RegularVector2dField2d::value_type>());
1818  return *this;
1819  }
1820 
1821  template<typename T, typename GridT>
1822  inline
1824  {
1825  assert(this->dim1() == rhs.dim1());
1826  assert(this->dim2() == rhs.dim2());
1827  if(this->get_init_point() != rhs.get_init_point())
1828  {
1829  throw std::runtime_error(slip::GRID_INIT_POINT_ERROR);
1830  }
1831  if(this->get_grid_step() != rhs.get_grid_step())
1832  {
1833  throw std::runtime_error(slip::GRID_STEP_ERROR);
1834  }
1835  std::transform(this->begin(),this->end(),rhs.begin(),this->begin(),std::minus<typename RegularVector2dField2d::value_type>());
1836  return *this;
1837  }
1838 
1839  template<typename T, typename GridT>
1840  inline
1842  {
1843  assert(this->dim1() == rhs.dim1());
1844  assert(this->dim2() == rhs.dim2());
1845  if(this->get_init_point() != rhs.get_init_point())
1846  {
1847  throw std::runtime_error(slip::GRID_INIT_POINT_ERROR);
1848  }
1849  if(this->get_grid_step() != rhs.get_grid_step())
1850  {
1851  throw std::runtime_error(slip::GRID_STEP_ERROR);
1852  }
1853  std::transform(this->begin(),this->end(),rhs.begin(),this->begin(),std::multiplies<typename RegularVector2dField2d::value_type>());
1854  return *this;
1855  }
1856 
1857  template<typename T, typename GridT>
1858  inline
1860  {
1861  assert(this->dim1() == rhs.dim1());
1862  assert(this->dim2() == rhs.dim2());
1863  if(this->get_init_point() != rhs.get_init_point())
1864  {
1865  throw std::runtime_error(slip::GRID_INIT_POINT_ERROR);
1866  }
1867  if(this->get_grid_step() != rhs.get_grid_step())
1868  {
1869  throw std::runtime_error(slip::GRID_STEP_ERROR);
1870  }
1871  std::transform(this->begin(),this->end(),rhs.begin(),this->begin(),std::divides<typename RegularVector2dField2d::value_type>());
1872  return *this;
1873  }
1874 
1875  template <typename T, typename GridT>
1876  inline
1877  std::ostream& operator<<(std::ostream & out,
1879  {
1880 
1881  out<<"init point: "<<a.init_point_<<std::endl;
1882  out<<"grid step: "<<a.grid_step_<<std::endl;
1883  out<<"data: "<<std::endl;
1884  typedef typename RegularVector2dField2d<T,GridT>::size_type size_type;
1885  size_type rows = a.rows();
1886  size_type cols = a.cols();
1887 
1888  for(size_type i = 0; i < rows; ++i)
1889  {
1890  for(size_type j = 0; j < cols; ++j)
1891  {
1892  out<<a[i][j]<<" ";
1893  }
1894  out<<std::endl;
1895  }
1896  return out;
1897  }
1898 
1899 
1900  template<typename T, typename GridT>
1901  inline
1902  std::string
1903  RegularVector2dField2d<T,GridT>::name() const {return "RegularVector2dField2d";}
1904 
1905 
1906  template<typename T, typename GridT>
1907  inline
1908  void RegularVector2dField2d<T,GridT>::write_gnuplot(const std::string& file_path_name) const
1909  {
1910  slip::write_gnuplot_vect2d<slip::RegularVector2dField2d<T,GridT> >(*this,
1911  this->init_point_,this->grid_step_,file_path_name);
1912  }
1913 
1914  template<typename T, typename GridT>
1915  inline
1916  void RegularVector2dField2d<T,GridT>::write_tecplot(const std::string& file_path_name,
1917  const std::string& title,
1918  const std::string& zone) const
1919  {
1920  slip::write_tecplot_vect2d<slip::RegularVector2dField2d<T,GridT> >(*this,
1921  this->init_point_,
1922  this->grid_step_,
1923  file_path_name,
1924  title,
1925  zone);
1926  }
1927  template<typename T, typename GridT>
1928  inline
1929  void RegularVector2dField2d<T,GridT>::read_gnuplot(const std::string& file_path_name)
1930  {
1931  slip::read_gnuplot_vect2d<slip::RegularVector2dField2d<T,GridT> >(file_path_name,*this, this->init_point_,
1932  this->grid_step_);
1933  }
1934 
1935  template<typename T, typename GridT>
1936  inline
1937  void RegularVector2dField2d<T,GridT>::read_tecplot(const std::string& file_path_name)
1938 
1939  {
1940  slip::read_tecplot_vect2d<slip::RegularVector2dField2d<T,GridT> >(file_path_name,*this,this->init_point_,this->grid_step_);
1941  }
1942 
1943 
1944  template<typename T, typename GridT>
1945  inline
1947  const T& val)
1948  {
1950  tmp += val;
1951  return tmp;
1952  }
1953 
1954  template<typename T, typename GridT>
1955  inline
1958  {
1959  return M1 + val;
1960  }
1961 
1962  template<typename T, typename GridT>
1963  inline
1965  const T& val)
1966  {
1968  tmp -= val;
1969  return tmp;
1970  }
1971 
1972  template<typename T, typename GridT>
1973  inline
1976  {
1977  return -(M1 - val);
1978  }
1979 
1980 
1981  template<typename T, typename GridT>
1982  inline
1984  const T& val)
1985  {
1987  tmp *= val;
1988  return tmp;
1989  }
1990 
1991  template<typename T, typename GridT>
1992  inline
1995  {
1996  return M1 * val;
1997  }
1998 
1999 
2000  template<typename T, typename GridT>
2001  inline
2003  const T& val)
2004  {
2006  tmp /= val;
2007  return tmp;
2008  }
2009 
2010  template<typename T, typename GridT>
2011  inline
2014  {
2016  tmp+=M2;
2017 
2018  return tmp;
2019  }
2020 
2021 
2022  template<typename T, typename GridT>
2023  inline
2025  const slip::Vector2d<T>&val)
2026  {
2028  tmp += val;
2029  return tmp;
2030  }
2031 
2032  template<typename T, typename GridT>
2033  inline
2036  {
2037  return M1 + val;
2038  }
2039 
2040 
2041 
2042  template<typename T, typename GridT>
2043  inline
2046  {
2048  tmp-=M2;
2049  return tmp;
2050  }
2051 
2052 
2053  template<typename T, typename GridT>
2054  inline
2056  const slip::Vector2d<T>&val)
2057  {
2059  tmp -= val;
2060  return tmp;
2061  }
2062 
2063  template<typename T, typename GridT>
2064  inline
2067  {
2068  return -(M1 - val);
2069  }
2070 
2071 
2072  template<typename T, typename GridT>
2073  inline
2076  {
2077 
2079  tmp*=M2;
2080 
2081  return tmp;
2082  }
2083 
2084 
2085  template<typename T, typename GridT>
2086  inline
2088  const slip::Vector2d<T>&val)
2089  {
2091  tmp *= val;
2092  return tmp;
2093  }
2094 
2095  template<typename T, typename GridT>
2096  inline
2099  {
2100  return M1 * val;
2101  }
2102 
2103 
2104  template<typename T, typename GridT>
2105  inline
2108  {
2109 
2111  tmp/=M2;
2112 
2113  return tmp;
2114  }
2115 
2116 
2117  template<typename T, typename GridT>
2118  inline
2120  const slip::Vector2d<T>&val)
2121  {
2123  tmp /= val;
2124  return tmp;
2125  }
2126 
2127 
2128 
2129 }//slip::
2130 
2131 #endif //SLIP_REGULARVECTOR2DFIELD2D_HPP
RegularVector2dField2d()
Constructs a RegularVector2dField2d.
void minus(InputIterator1 __first1, InputIterator1 __last1, InputIterator2 __first2, OutputIterator __result)
Computes the difference of two ranges.
friend class boost::serialization::access
T & Vx2(const size_type i, const size_type j)
Subscript access to second element of the data contained in the RegularVector2dField2d.
const GridT x(const size_type i, const size_type j) const
Subscript access to the real x1 value of the indexed (i,j) point of the RegularVector2dField2d.
CoordType height() const
compute the height of the Box2d.
Definition: Box2d.hpp:378
std::reverse_iterator< const_iterator > const_reverse_iterator
slip::kstride_iterator< const_vector2d_pointer, 2 > const_vector2d_iterator
iterator begin()
Returns a read/write iterator that points to the first element in the GenericMultiComponent2d. Iteration is done in ordinary element order.
void vorticity(const std::size_t sch_order, Container2D &result) const
Computes finite differences vorticity (curl) of a RegularVector2dField2d.
This is a GenericMultiComponent2d class. This container statisfies the BidirectionnalContainer concep...
void read_tecplot(const std::string &file_path_name)
Reads a RegularVector2dField2d from a tecplot file path name.
T & v(const size_type i, const size_type j)
Subscript access to second element of the data contained in the RegularVector2dField2d.
RegularVector2dField2d(const size_type height, const size_type width, const T *val)
Constructs a RegularVector2dField2d initialized by an array val.
size_type cols() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
slip::RegularVector2dField2d< unsigned long, double > RegularVector2dField2d_ul
unsigned long alias
std::string name() const
Returns the name of the class.
void set_grid_step(const slip::Point2d< GridT > &grid_step)
Write access to the grid step of the grid.
norm_type Euclidean_norm() const
Returns the Euclidean norm of the elements of the kvector.
Definition: KVector.hpp:832
RegularVector2dField2d< float, double > Regular2D3Cf
float alias
slip::RegularVector2dField2d< unsigned short, double > RegularVector2dField2d_us
unsigned long alias
Provides a class to manipulate multicomponent 2d containers.
void read_gnuplot(const std::string &file_path_name)
Reads a RegularVector2dField2d from a gnuplot file path name.
Color< T > operator+(const Color< T > &V1, const Color< T > &V2)
Definition: Color.hpp:602
iterator begin()
Returns a read/write iterator that points to the first element in the Matrix. Iteration is done in or...
Definition: Matrix.hpp:2789
Provides a class to manipulate iterator2d within a slip::Box2d. It is used to iterate throw 2d contai...
void divides(InputIterator1 __first1, InputIterator1 __last1, InputIterator2 __first2, OutputIterator __result)
Computes the pointwise division of two ranges.
RegularVector2dField2d(const size_type height, const size_type width, InputIterator first, InputIterator last)
Contructs a RegularVector2dField2d from a range.
size_type dim2() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
RegularVector2dField2d(const size_type height, const size_type width, InputIterator first1, InputIterator last1, InputIterator first2)
Contructs a RegularVector2dField2d from a 2 ranges.
CoordType width() const
compute the width of the Box2d.
Definition: Box2d.hpp:374
slip::GenericMultiComponent2d< slip::Vector2d< T > >::const_iterator2d const_iterator2d
row_iterator row_begin(const size_type row)
Returns a read/write iterator that points to the first element of the row row in the GenericMultiComp...
void bottom_right(Point< CoordType, 2 >)
Accessor/Mutator of the bottom_right point (p2) of Box2d.
Definition: Box2d.hpp:338
RegularVector2dField2d(const size_type height, const size_type width, const slip::Vector2d< T > &val)
Constructs a RegularVector2dField2d initialized by the scalar value val.
std::reverse_iterator< iterator > reverse_row_iterator
Provides some derivative algorithms and derivative functors.
RegularVector2dField2d(const size_type height, const size_type width, const slip::Point2d< GridT > &init_point, const slip::Point2d< GridT > &grid_step)
Constructs a RegularVector2dField2d.
row_iterator row_end(const size_type row)
Returns a read/write iterator that points one past the end element of the row row in the GenericMulti...
void write_gnuplot(const std::string &file_path_name) const
Writes a RegularVector2dField2d to a gnuplot file path name.
const slip::Point2d< GridT > & get_grid_step() const
Read access to the init point of the grid.
Provides a class to iterate a 1d range according to a constant step.
slip::lin_alg_traits< value_type >::value_type norm_type
Provides a class to manipulate 2d Vector.
GenericMultiComponent2d< slip::Vector2d< T > > base
slip::GenericMultiComponent2d< slip::Vector2d< T > >::iterator2d iterator2d
This is a 2d Field containing slip::Vector2d associated with a regular grid. This container statisfie...
RegularVector2dField2d(const size_type height, const size_type width, const slip::Point2d< GridT > &init_point, const slip::Point2d< GridT > &grid_step, InputIterator first, InputIterator last)
Contructs a RegularVector2dField2d from a range.
void set_init_point(const slip::Point2d< GridT > &init_point)
Write access to the init point of the grid.
This is a point2d class, a specialized version of Point<CoordType,DIM> with DIM = 2...
Definition: Array2d.hpp:132
RegularVector2dField2d(const size_type height, const size_type width, const slip::Point2d< GridT > &init_point, const slip::Point2d< GridT > &grid_step, const T *val)
Constructs a RegularVector2dField2d initialized by an array val.
RegularVector2dField2d(const self &rhs)
Constructs a copy of the RegularVector2dField2d rhs.
size_type height() const
Returns the height (first dimension size) in the GenericMultiComponent2d.
slip::kstride_iterator< vector2d_pointer, 2 > vector2d_iterator
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...
Definition: Array2d.hpp:122
RegularVector2dField2d(const size_type height, const size_type width, const slip::Point2d< GridT > &init_point, const slip::Point2d< GridT > &grid_step, const slip::Vector2d< T > &val)
Constructs a RegularVector2dField2d initialized by the scalar value val.
RegularVector2dField2d(const size_type height, const size_type width, const slip::Point2d< GridT > &init_point, const slip::Point2d< GridT > &grid_step, InputIterator first1, InputIterator last1, InputIterator first2)
Contructs a RegularVector2dField2d from a 2 ranges.
void derivative_2d(Iterator2d1 I_up, Iterator2d1 I_bot, const slip::Point2d< T > &grid_step, slip::SPATIAL_DIRECTION der_dir, const std::size_t der_order, const std::size_t sch_order, Iterator2d2 R_up, Iterator2d2 R_bot)
Computes finite differences derivatives of a 2d range.
reverse_col_iterator col_rend(const size_type col)
Returns a read/write reverse iterator that points one past the first element of the column column in ...
RegularVector2dField2d< float, double > Regular2D3C_f
float alias
T & u(const size_type i, const size_type j)
Subscript access to first element of the data contained in the RegularVector2dField2d.
iterator begin()
Returns a read/write iterator that points to the first element in the kvector. Iteration is done in o...
Definition: KVector.hpp:196
const RegularVector2dField2d< T, GridT > const_self
RegularVector2dField2d(const size_type height, const size_type width, const slip::Point2d< GridT > &init_point, const slip::Point2d< GridT > &grid_step, const slip::Vector2d< T > *val)
Constructs a RegularVector2dField2d initialized by an array val.
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.
self & operator=(const slip::Vector2d< T > &val)
Affects all the element of the RegularVector2dField2d by val.
void angle(Container2D &result)
Computes angle (radian) of each element with the cartesian axis and write it to a Container2D...
slip::stride_iterator< pointer > col_iterator
const std::string GRID_STEP_ERROR
Definition: error.hpp:88
const std::string GRID_INIT_POINT_ERROR
Definition: error.hpp:87
iterator2d upper_left()
Returns a read/write iterator2d that points to the first element of the GenericMultiComponent2d. It points to the upper left element of the GenericMultiComponent2d.
RegularVector2dField2d(const size_type height, const size_type width, const slip::Vector2d< T > *val)
Constructs a RegularVector2dField2d initialized by an array val.
const vector2d_value_type * const_vector2d_pointer
This is some iterator to iterate a 2d container into a slip::Box2d area defined by the indices of the...
Definition: Array2d.hpp:116
Provides some input/ouput algorithms.
RegularVector2dField2d< double, double > Regular2D3C_d
double alias
Numerical matrix class. This container statisfies the BidirectionnalContainer concepts of the STL...
void fill(const slip::Vector2d< T > &value)
Fills the container range [begin(),begin()+size()) with copies of value.
Provides some algorithms to computes arithmetical operations on ranges.
const slip::Point2d< GridT > & get_init_point() const
Read access to the init point of the grid.
std::ostream & operator<<(std::ostream &out, const Array< T > &a)
Definition: Array.hpp:1282
T & Vx1(const size_type i, const size_type j)
Subscript access to first element of the data contained in the RegularVector2dField2d.
void upper_left(Point< CoordType, 2 >)
Accessor/Mutator of the upper_left point (p1) of Box2d.
Definition: Box2d.hpp:325
iterator end()
Returns a read/write iterator that points one past the last element in the GenericMultiComponent2d. Iteration is done in ordinary element order.
norm_type angle(const size_type i, const size_type j) const
Subscript access to a local angle contained in the RegularVector2dField2d. The result is a radian bet...
reverse_col_iterator col_rbegin(const size_type col)
Returns a read/write reverse iterator that points to the last element of the column column in the Gen...
RegularVector2dField2d< double, double > Regular2D3Cd
double alias
self & operator+=(const T &val)
Add val to each element of the RegularVector2dField2d.
slip::RegularVector2dField2d< char, double > RegularVector2dField2d_c
char alias
This is a Vector2d struct. It is a specialization of kvector. It implements some peculiar 2d operatio...
Definition: Vector2d.hpp:99
~RegularVector2dField2d()
Destructor of the RegularVector2dField2d.
slip::RegularVector2dField2d< long, double > RegularVector2dField2d_l
long alias
slip::RegularVector2dField2d< unsigned char, double > RegularVector2dField2d_uc
unsigned char alias
RegularVector2dField2d(const size_type height, const size_type width)
Constructs a RegularVector2dField2d.
void write_tecplot(const std::string &file_path_name, const std::string &title, const std::string &zone) const
Writes a RegularVector2dField2d to a tecplot file path name.
void derivative(const std::size_t component, const slip::SPATIAL_DIRECTION der_dir, const std::size_t der_order, const std::size_t sch_order, const slip::Box2d< int > box, Container2D &result) const
Computes finite differences derivatives of a RegularVector2dField2d.
void lambda2(const std::size_t sch_order, Container2D &result)
Computes finite differences lambda2 of a RegularVector2dField2d.
iterator end()
Returns a read/write iterator that points one past the last element in the Matrix. Iteration is done in ordinary element order.
Definition: Matrix.hpp:2796
vector2d_value_type & vector2d_reference
const GridT x1(const size_type i, const size_type j) const
Subscript access to the real x1 value of the indexed (i,j) point of the RegularVector2dField2d.
size_type width() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
const vector2d_value_type const_vector2d_reference
SPATIAL_DIRECTION
Choose between different spatial directions.
slip::RegularVector2dField2d< int, double > RegularVector2dField2d_i
int alias
Provides a class to manipulate Numerical Matrix.
std::reverse_iterator< iterator > reverse_iterator
Provides some algorithms to apply C like functions to ranges.
Provides a class to modelize 2d points.
slip::RegularVector2dField2d< short, double > RegularVector2dField2d_s
short alias
Provides a class to iterate a 1d range according to a step.
size_type rows() const
Returns the number of rows (first dimension size) in the GenericMultiComponent2d. ...
norm_type norm(const size_type i, const size_type j) const
Subscript access to a local norm contained in the RegularVector2dField2d.
void derivative(const std::size_t component, const slip::SPATIAL_DIRECTION der_dir, const std::size_t der_order, const std::size_t sch_order, Container2D &result) const
Computes finite differences derivatives of a RegularVector2dField2d.
void derivative(SrcIter first, SrcIter last, const std::size_t der_ord, const std::size_t sch_ord, const std::size_t sch_shift, const Container2D &M, ResIter result)
Computes 1d finite differences derivatives of an iterator range.
slip::stride_iterator< const_pointer > const_col_iterator
void divergence(const std::size_t sch_order, Container2D &result) const
Computes finite differences divergence of a RegularVector2dField2d.
void finite_diff_kernels(const std::size_t der_ord, const std::size_t sch_ord, const std::size_t sch_shift, std::vector< KernelsIterator > &kernels_first)
Computes finite differences kernels for derivation based on Taylor series (sch_ord-sch_shift steps up...
slip::RegularVector2dField2d< unsigned int, double > RegularVector2dField2d_ui
unsigned int alias
std::reverse_iterator< const_col_iterator > const_reverse_col_iterator
iterator2d bottom_right()
Returns a read/write iterator2d that points to the past the end element of the GenericMultiComponent2...
void norm(Container2D &result)
Computes Eucliean norm of each element in the field and write it to a Container2D.
row_iterator row_begin(const size_type row)
Returns a read/write iterator that points to the first element of the row row in the Matrix...
Color< T > operator*(const Color< T > &V1, const Color< T > &V2)
Definition: Color.hpp:658
Provides a class to manipulate iterator2d within a slip::Range. It is used to iterate throw 2d contai...
const GridT x2(const size_type i, const size_type j) const
Subscript access to the real x2 value of the indexed (i,j) point of the RegularVector2dField2d.
Color< T > operator/(const Color< T > &V1, const Color< T > &V2)
Definition: Color.hpp:686
const GridT y(const size_type i, const size_type j) const
Subscript access to the real x2 value of the indexed (i,j) point of the RegularVector2dField2d.
slip::RegularVector2dField2d< double, double > RegularVector2dField2d_d
double alias
Color< T > operator-(const Color< T > &V1, const Color< T > &V2)
Definition: Color.hpp:630
slip::RegularVector2dField2d< float, double > RegularVector2dField2d_f
float alias
std::reverse_iterator< const_iterator > const_reverse_row_iterator