Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
points.h
Go to the documentation of this file.
1 /*
2  * Defines points classes
3  * Used for storing datapoints
4  */
5 
6 #ifndef _POINTS_H_
7 #define _POINTS_H_
8 
9 #include <cstdio>
10 #include <cstdlib>
11 #include <iostream>
12 #include <ostream>
13 #include <fstream>
14 #include <string>
15 #include <time.h>
16 #include <sstream>
17 #include <iomanip>
18 #include <math.h>
19 #include <limits>
20 
21 #include "util.h"
22 #include "datatypedef.h"
23 
24 
25 
26 /*
27  * Points Storage Class
28  */
29 
30 class points {
31 
32  public:
33 
34  points();
35 
36  points(int num_points);
37 
38  points(const points &p);
39 
40  points & operator = (const points &p);
41 
42  virtual ~points();
43 
44  virtual points *clone();
45 
46  //Set Info
47  void set_num_points(int n);
48  void set_num_vars(int n);
49  void set_num_indep_vars(int indep_vars);
50 
51  int get_num_points();
52  int get_num_vars();
53  int get_num_indep_vars();
54 
55  //Point manipulation
56  void set_point_val(int point_number, int var, long double val);
57  void clear_dep_vars(int point_number);
58  pnt get_point(int n);
59 
60  //Get nearest point in specified direction
61  virtual int get_closest(long double *coord);
62  virtual std::vector<int> get_connected_points(int point_num);
63 
64  virtual void sort();
65 
66  //Point statistics
67  long double largest_val(int dim);
68  long double smallest_val(int dim);
69 
70  //Static functions
71 
72  //Delete all points in the point vector
73  static void delete_all(std::vector<points*> points_vector);
74 
75  //Returns true if any of the datasets are null
76  static bool contains_null(std::vector<points*> points_vector);
77 
78  protected:
79 
81  int num_vars;
83 
84  //POINT STORAGE
86 
87  //Point Set Map
88  //Used to keep track of memory usage
90 
91 };
92 
93 
94 
95 class connect_points : public points {
96 
97  public:
98 
100 
101  virtual ~connect_points();
102 
104 
105  connect_points(const connect_points &cp);
106 
107  virtual connect_points *clone();
108 
109  virtual int get_closest(long double *coord);
110 
111  void set_connectivity(int point_num, int c_point);
112 
113  virtual std::vector<int> get_connected_points(int point_num);
114 
115  virtual void sort();
116 
117  private:
118 
119  struct conn_points{
120 
121  std::vector<int> points;
122 
123  conn_points();
124 
125  ~conn_points();
126 
127  conn_points(const conn_points &cp);
128 
129  //TODO
130  //Move implementation to cpp file
132 
133  if(this != &cp){
134  points = cp.points;
135  }
136 
137  return *this;
138  }
139 
140  void set_next(int n);
141  };
142 
143  //Connected Points List
145 
146 };
147 
148 
149 
150 class indexed_points : public points {
151 
152  public:
153 
154  indexed_points();
155 
156  virtual ~indexed_points();
157 
158  indexed_points(const indexed_points &ip);
159 
161 
162  virtual indexed_points *clone();
163 
164  virtual void sort();
165 
166  pnt get_indexed_point(std::vector<int> loc);
167 
168  virtual int get_closest(long double *coord);
169  virtual std::vector<int> get_connected_points(int point_num);
170 
171  virtual std::vector<int> get_dim();
172 
173  protected:
174 
176  bool index_set;
177 
178  std::vector<int> index_layout;
179 };
180 
181 
182 
184 
185  public:
186 
188 
190 
192 
194 
195  virtual manual_index_pts *clone();
196 
197  void set_layout(std::vector<int> index_layout);
198 
199  void set_index(int point_num, std::vector<int> loc);
200 
201 };
202 
203 
204 #endif
int get_num_vars()
Definition: points.cpp:121
indexed_points & operator=(const indexed_points &ip)
Definition: points.cpp:410
bitmap pt_set
Definition: points.h:89
virtual std::vector< int > get_connected_points(int point_num)
Definition: points.cpp:344
virtual std::vector< int > get_connected_points(int point_num)
Definition: points.cpp:196
long double largest_val(int dim)
Definition: points.cpp:205
std::vector< int > index_layout
Definition: points.h:178
void set_num_indep_vars(int indep_vars)
Definition: points.cpp:113
Variable dimension array, an array whose dimensions can be specified at runtime.
Definition: datatypedef.h:133
virtual connect_points * clone()
Definition: points.cpp:289
int num_points
Definition: points.h:80
bool index_set
Definition: points.h:176
Definition: points.h:30
virtual indexed_points * clone()
Definition: points.cpp:425
int coord[NPANE][NROW *NCOL][3]
Definition: blastest.C:86
virtual manual_index_pts * clone()
Definition: points.cpp:537
void set_index(int point_num, std::vector< int > loc)
Definition: points.cpp:555
long double smallest_val(int dim)
Definition: points.cpp:216
manual_index_pts & operator=(const manual_index_pts &mip)
Definition: points.cpp:532
virtual ~points()
Definition: points.cpp:15
virtual std::vector< int > get_dim()
Definition: points.cpp:512
void set_point_val(int point_number, int var, long double val)
Definition: points.cpp:129
pnt get_point(int n)
Definition: points.cpp:183
Point object that represents a single point.
Definition: datatypedef.h:68
void set_num_points(int n)
Definition: points.cpp:84
int num_vars
Definition: points.h:81
virtual std::vector< int > get_connected_points(int point_num)
Definition: points.cpp:472
virtual void sort()
Definition: points.cpp:429
pnt ** pt_str
Definition: points.h:85
points()
Definition: points.cpp:7
std::vector< int > points
Definition: points.h:121
pnt get_indexed_point(std::vector< int > loc)
Definition: points.cpp:433
virtual void sort()
Definition: points.cpp:363
virtual void sort()
Definition: points.cpp:201
virtual ~indexed_points()
Definition: points.cpp:398
const NT & n
virtual ~connect_points()
Definition: points.cpp:254
void set_connectivity(int point_num, int c_point)
Definition: points.cpp:321
static void delete_all(std::vector< points * > points_vector)
Definition: points.cpp:227
conn_points & operator=(const conn_points &cp)
Definition: points.h:131
connect_points & operator=(const connect_points &cp)
Definition: points.cpp:270
int get_num_indep_vars()
Definition: points.cpp:125
VariableDimensionArray index
Definition: points.h:175
void set_layout(std::vector< int > index_layout)
Definition: points.cpp:541
static bool contains_null(std::vector< points * > points_vector)
Definition: points.cpp:237
virtual int get_closest(long double *coord)
Definition: points.cpp:192
void clear_dep_vars(int point_number)
Definition: points.cpp:171
virtual int get_closest(long double *coord)
Definition: points.cpp:293
void set_num_vars(int n)
Definition: points.cpp:109
int num_indep_vars
Definition: points.h:82
conn_points * c_points
Definition: points.h:144
int get_num_points()
Definition: points.cpp:117
virtual int get_closest(long double *coord)
Definition: points.cpp:440
points & operator=(const points &p)
Definition: points.cpp:51
virtual points * clone()
Definition: points.cpp:80