UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
u3d_svrg_math_abstract_surface.hpp
1 // u3d_svrg_math_abstract_surface.hpp
2 // $Id: u3d_svrg_math_abstract_surface.hpp,v 1.13 2007/06/27 15:48:32 guser1 Exp $
3 #ifndef U3D_SVRG_MATH_ABSTRACT_SURFACE_HPP_
4 #define U3D_SVRG_MATH_ABSTRACT_SURFACE_HPP_
5 
6 #include <u3d_point.hpp>
7 #include <u3d_defines.hpp>
8 #include "u3d_abstract_surface.hpp"
9 #include "u3d_nl_eqsolve.hpp"
10 //#include "u3d_svrg_math_abstract_surf4d.hpp"
11 
12 #include <vector>
13 
14 #define S3D_MIN_DELTA_FOR_DIV 1e-10
15 
16 class U3dIntEqLeftPart;
17 
22 {
23 
24  friend class U3dSVRGMathAbstractSurf4d;
25 
26 public:
27 
30  U3dSVRGMathAbstractSurface(U3dPointsAr &points, double g_step);
31 
35 
38 
39 
40 
42  virtual void addPoint(U3dPoint *point);
43 
47  virtual bool removePoint(int ind);
48 
51  virtual void movePoint(int ind, double x, double y, double z);
52 
53 
54 
59  int getGridPoint(int i, int j, U3dPoint &p);
60 
62  int getGridXSize() {
63  return grd_x.size();
64  }
65 
67  int getGridYSize() {
68  return grd_y.size();
69  }
70 
71 
72 
75  void setMinGridStep(double eps) {
76  minGridEps = (eps < 0.)?(0.):(eps);
77  }
78 
81  double getMinGridStep() {
82  return minGridEps;
83  }
84 
85 protected:
86 
89  double minGridEps;
90 
92  std::vector<double> grd_x, grd_y;
93 
95  struct GridCell
96  {
98  GridCell(int i_ind, double i_z) {
99  ip_ind = i_ind;
100  z = i_z;
101  }
102 
103  int ip_ind;
104  double z;
105  };
106 
108  typedef std::vector<GridCell> GridLine;
109 
111  typedef std::vector<GridLine> GridMatrix;
112 
115 
118  void construct_grid(U3dPointsAr &points);
119 
122  void push_ip(U3dPoint *point);
123 
130  static int get_ip_id(double x, std::vector<double> &grd_x,
131  double dx, double &xmn, double &xmx);
132 
136  static void correct_id(int &id, int size) {
137  if (id < 0)
138  id = 0;
139  else if (id >= size)
140  id = size - 1;
141  }
142 
143 private:
144 
146  U3dEqDiv2Solve *m_grd_eq_solver;
147 
149  U3dIntEqLeftPart *m_grd_eq_lp;
150 
152  int m_grd_ip_num;
153 
155  U3dPointsAr m_grd_ips;
156 
158  double m_prev_zmn, m_prev_zmx;
159 
161  double tmpd;
162 
164  int tmpi;
165 
171  static bool add_grid_cell(int ix, int jy, GridCell &cell, GridMatrix &rgrid,
172  double &zmn, double &zmx, double &pzmn, double &pzmx,
173  std::vector<double> &xgd, std::vector<double> &ygd,
174  double x, double y, bool is_increase_xy = true);
175 
179  double calc_nip_z(double x, double y);
180 };
181 
182 
187 {
188 public:
191  {is_init = false;}
192 
194  virtual ~U3dIntEqLeftPart(){}
195 
197  double calc(double z);
198 
200  void init(U3dPointsAr &pips)
201  {ips = pips; is_init = true;}
202 
204  void setPCoords(double px, double py)
205  {x = px; y = py;}
206 
211  double get_2d_ip_dist(int i, double x, double y) {
212  return ((ips[i]->getX() - x)*(ips[i]->getX() - x) +
213  (ips[i]->getY() - y)*(ips[i]->getY() - y));
214  }
215 
220  double get_3d_ip_dist(int i, double x, double y, double z) {
221  return ((ips[i]->getX() - x)*(ips[i]->getX() - x) +
222  (ips[i]->getY() - y)*(ips[i]->getY() - y) +
223  (ips[i]->getZ() - z)*(ips[i]->getZ() - z));
224  }
225 
226 
227 protected:
228 
230  U3dPointsAr ips;
231 
233  double x, y;
234 
236  bool is_init;
237 };
238 
239 #endif /*U3D_SVRG_MATH_ABSTRACT_SURFACE_HPP_*/
int ip_ind
Definition: u3d_svrg_math_abstract_surface.hpp:103
int getGridYSize()
Definition: u3d_svrg_math_abstract_surface.hpp:67
Definition: u3d_math_abstract_surface.hpp:11
U3dIntEqLeftPart()
Definition: u3d_svrg_math_abstract_surface.hpp:190
virtual bool removePoint(int ind)
U3dPointsAr ips
Definition: u3d_svrg_math_abstract_surface.hpp:230
static int get_ip_id(double x, std::vector< double > &grd_x, double dx, double &xmn, double &xmx)
int getGridPoint(int i, int j, U3dPoint &p)
double calc(double z)
virtual void addPoint(U3dPoint *point)
void push_ip(U3dPoint *point)
static void correct_id(int &id, int size)
Definition: u3d_svrg_math_abstract_surface.hpp:136
int getGridXSize()
Definition: u3d_svrg_math_abstract_surface.hpp:62
virtual void movePoint(int ind, double x, double y, double z)
double z
Definition: u3d_svrg_math_abstract_surface.hpp:104
Definition: geometry.H:16
GridCell(int i_ind, double i_z)
Definition: u3d_svrg_math_abstract_surface.hpp:98
std::vector< double > grd_x
Definition: u3d_svrg_math_abstract_surface.hpp:92
Definition: u3d_point.hpp:16
double getMinGridStep()
Definition: u3d_svrg_math_abstract_surface.hpp:81
std::vector< GridLine > GridMatrix
Definition: u3d_svrg_math_abstract_surface.hpp:111
double get_2d_ip_dist(int i, double x, double y)
Definition: u3d_svrg_math_abstract_surface.hpp:211
void setMinGridStep(double eps)
Definition: u3d_svrg_math_abstract_surface.hpp:75
std::vector< GridCell > GridLine
Definition: u3d_svrg_math_abstract_surface.hpp:108
Definition: u3d_nl_eqsolve.hpp:47
Definition: u3d_svrg_math_abstract_surf4d.hpp:50
Definition: u3d_nl_eqsolve.hpp:5
void construct_grid(U3dPointsAr &points)
Definition: u3d_svrg_math_abstract_surface.hpp:21
GridMatrix grid
Definition: u3d_svrg_math_abstract_surface.hpp:114
U3dSVRGMathAbstractSurface(U3dPointsAr &points, double g_step)
double get_3d_ip_dist(int i, double x, double y, double z)
Definition: u3d_svrg_math_abstract_surface.hpp:220
bool is_init
Definition: u3d_svrg_math_abstract_surface.hpp:236
double x
Definition: u3d_svrg_math_abstract_surface.hpp:233
Definition: u3d_svrg_math_abstract_surface.hpp:186
void init(U3dPointsAr &pips)
Definition: u3d_svrg_math_abstract_surface.hpp:200
virtual ~U3dIntEqLeftPart()
Definition: u3d_svrg_math_abstract_surface.hpp:194
void setPCoords(double px, double py)
Definition: u3d_svrg_math_abstract_surface.hpp:204
double minGridEps
Definition: u3d_svrg_math_abstract_surface.hpp:89
Definition: u3d_svrg_math_abstract_surface.hpp:95
virtual ~U3dSVRGMathAbstractSurface()