Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
points Class Reference

#include <points.h>

Inheritance diagram for points:
Collaboration diagram for points:

Public Member Functions

 points ()
 
 points (int num_points)
 
 points (const points &p)
 
pointsoperator= (const points &p)
 
virtual ~points ()
 
virtual pointsclone ()
 
void set_num_points (int n)
 
void set_num_vars (int n)
 
void set_num_indep_vars (int indep_vars)
 
int get_num_points ()
 
int get_num_vars ()
 
int get_num_indep_vars ()
 
void set_point_val (int point_number, int var, long double val)
 
void clear_dep_vars (int point_number)
 
pnt get_point (int n)
 
virtual int get_closest (long double *coord)
 
virtual std::vector< int > get_connected_points (int point_num)
 
virtual void sort ()
 
long double largest_val (int dim)
 
long double smallest_val (int dim)
 

Static Public Member Functions

static void delete_all (std::vector< points * > points_vector)
 
static bool contains_null (std::vector< points * > points_vector)
 

Protected Attributes

int num_points
 
int num_vars
 
int num_indep_vars
 
pnt ** pt_str
 
bitmap pt_set
 

Detailed Description

Definition at line 30 of file points.h.

Constructor & Destructor Documentation

points ( )

Definition at line 7 of file points.cpp.

References num_indep_vars, num_points, num_vars, and pt_str.

Referenced by clone().

7  {
8  this->num_points = 0;
9  this->num_vars = 0;
10  this->num_indep_vars = 0;
11  this->pt_str = NULL;
12  return;
13 }
int num_points
Definition: points.h:80
int num_vars
Definition: points.h:81
pnt ** pt_str
Definition: points.h:85
int num_indep_vars
Definition: points.h:82

Here is the caller graph for this function:

points ( int  num_points)
points ( const points p)

Definition at line 30 of file points.cpp.

References bitmap::check_value(), i, num_indep_vars, num_points, num_vars, pt_set, and pt_str.

30  {
31 
33  num_vars = p.num_vars;
35 
36  if(num_points > 0)
37  pt_str = new pnt*[num_points];
38 
39  pt_set = p.pt_set;
40 
41  for(int i=0; i<num_points; i++){
42  if(pt_set.check_value(i)){
43 
44  pt_str[i] = new pnt( *(p.pt_str[i]) );
45 
46  }
47  }
48 
49 }
bitmap pt_set
Definition: points.h:89
int num_points
Definition: points.h:80
Point object that represents a single point.
Definition: datatypedef.h:68
int num_vars
Definition: points.h:81
pnt ** pt_str
Definition: points.h:85
bool check_value(int n)
blockLoc i
Definition: read.cpp:79
int num_indep_vars
Definition: points.h:82

Here is the call graph for this function:

~points ( )
virtual

Definition at line 15 of file points.cpp.

References bitmap::check_value(), i, num_points, pt_set, and pt_str.

15  {
16 
17  if(num_points > 0){
18 
19  for(int i=0; i<num_points; i++){
20  if(pt_set.check_value(i)){
21  delete pt_str[i];
22  }
23  }
24  delete[] pt_str;
25  }
26 
27  return;
28 }
bitmap pt_set
Definition: points.h:89
int num_points
Definition: points.h:80
pnt ** pt_str
Definition: points.h:85
bool check_value(int n)
blockLoc i
Definition: read.cpp:79

Here is the call graph for this function:

Member Function Documentation

void clear_dep_vars ( int  point_number)

Definition at line 171 of file points.cpp.

References i, num_indep_vars, pt_str, and pnt::vals.

171  {
172 
173  long double *temp = new long double[num_indep_vars];
174 
175  for(int i=0; i<num_indep_vars; i++){
176  temp[i] = pt_str[point_number]->vals[i];
177  }
178 
179  delete[] pt_str[point_number]->vals;
180  pt_str[point_number]->vals = temp;
181 }
long double * vals
Definition: datatypedef.h:69
pnt ** pt_str
Definition: points.h:85
blockLoc i
Definition: read.cpp:79
int num_indep_vars
Definition: points.h:82
points * clone ( )
virtual

Reimplemented in manual_index_pts, indexed_points, and connect_points.

Definition at line 80 of file points.cpp.

References points().

Referenced by Interpolate::bilinear().

80  {
81  return new points(*this);
82 }
points()
Definition: points.cpp:7

Here is the call graph for this function:

Here is the caller graph for this function:

bool contains_null ( std::vector< points * >  points_vector)
static

Definition at line 237 of file points.cpp.

Referenced by compareFiles().

237  {
238  for(int set_num = 0; set_num < points_vector.size(); set_num++){
239  if(points_vector[set_num] == NULL)
240  return true;
241  }
242 
243  return false;
244 }

Here is the caller graph for this function:

void delete_all ( std::vector< points * >  points_vector)
static

Definition at line 227 of file points.cpp.

Referenced by compareFiles().

227  {
228  for(int set_num = 0; set_num < points_vector.size(); set_num++){
229  if(points_vector[set_num] != NULL){
230  delete points_vector[set_num];
231  }
232  }
233 
234  points_vector.erase(points_vector.begin(), points_vector.end());
235 }

Here is the caller graph for this function:

int get_closest ( long double *  coord)
virtual

Reimplemented in indexed_points, and connect_points.

Definition at line 192 of file points.cpp.

Referenced by Interpolate::bilinear().

192  {
193  return -1;
194 }

Here is the caller graph for this function:

std::vector< int > get_connected_points ( int  point_num)
virtual

Reimplemented in indexed_points, and connect_points.

Definition at line 196 of file points.cpp.

Referenced by Interpolate::getCell().

196  {
197  std::vector<int> ret;
198  return ret;
199 }

Here is the caller graph for this function:

int get_num_indep_vars ( )

Definition at line 125 of file points.cpp.

References num_indep_vars.

Referenced by TecplotOrderedWriter::addOrderedPartition(), Interpolate::bilinear(), and TecplotOrderedWriter::writePoints().

125  {
126  return num_indep_vars;
127 }
int num_indep_vars
Definition: points.h:82

Here is the caller graph for this function:

int get_num_points ( )

Definition at line 117 of file points.cpp.

References num_points.

Referenced by Interpolate::bilinear(), calcAverageValue(), partition::get_num_points(), maxPoint(), minPoint(), printPointValues(), set_num_points(), and TecplotOrderedWriter::writePoints().

117  {
118  return num_points;
119 }
int num_points
Definition: points.h:80

Here is the caller graph for this function:

int get_num_vars ( )

Definition at line 121 of file points.cpp.

References num_vars.

Referenced by TecplotOrderedWriter::addOrderedPartition(), Interpolate::bilinear(), and TecplotOrderedWriter::writePoints().

121  {
122  return num_vars;
123 }
int num_vars
Definition: points.h:81

Here is the caller graph for this function:

pnt get_point ( int  n)

Definition at line 183 of file points.cpp.

References bitmap::check_value(), pt_set, and pt_str.

Referenced by Interpolate::bilinear(), calcAverageValue(), partition::get_point(), Interpolate::getCell(), maxPoint(), minPoint(), printPointValues(), Interpolate::sortPoints(), and TecplotOrderedWriter::writePoints().

183  {
184  if(pt_set.check_value(n))
185  return *(pt_str[n]);
186  else{
187  pnt blank;
188  return blank;
189  }
190 }
bitmap pt_set
Definition: points.h:89
Point object that represents a single point.
Definition: datatypedef.h:68
pnt ** pt_str
Definition: points.h:85
bool check_value(int n)
const NT & n

Here is the call graph for this function:

Here is the caller graph for this function:

long double largest_val ( int  dim)

Definition at line 205 of file points.cpp.

References i, num_points, pt_str, and pnt::vals.

205  {
206  long double largest = -std::numeric_limits<long double>::infinity();
207 
208  for(int i=0; i<num_points; i++){
209  if(pt_str[i]->vals[dim] > largest)
210  largest = pt_str[i]->vals[dim];
211  }
212 
213  return largest;
214 }
int num_points
Definition: points.h:80
long double * vals
Definition: datatypedef.h:69
pnt ** pt_str
Definition: points.h:85
blockLoc i
Definition: read.cpp:79
points & operator= ( const points p)

Definition at line 51 of file points.cpp.

References bitmap::check_value(), i, num_indep_vars, num_points, num_vars, pt_set, and pt_str.

Referenced by connect_points::operator=(), and indexed_points::operator=().

51  {
52 
53  if(this != &p){
54 
55  for(int i=0; i<num_points; i++){
56  if(pt_set.check_value(i))
57  delete pt_str[i];
58  }
59 
60  if(pt_str != NULL)
61  delete[] pt_str;
62 
63  num_points = p.num_points;
64  num_vars = p.num_vars;
66 
67  pt_set = p.pt_set;
68  pt_str = new pnt*[num_points];
69 
70  for(int i=0; i<num_points; i++){
71  if(pt_set.check_value(i)){
72  pt_str[i] = new pnt( *(p.pt_str[i]) );
73  }
74  }
75  }
76 
77  return *this;
78 }
bitmap pt_set
Definition: points.h:89
int num_points
Definition: points.h:80
Point object that represents a single point.
Definition: datatypedef.h:68
int num_vars
Definition: points.h:81
pnt ** pt_str
Definition: points.h:85
bool check_value(int n)
blockLoc i
Definition: read.cpp:79
int num_indep_vars
Definition: points.h:82

Here is the call graph for this function:

Here is the caller graph for this function:

void set_num_indep_vars ( int  indep_vars)

Definition at line 113 of file points.cpp.

References num_indep_vars.

Referenced by tpz_ordered::parse_data(), and tpz_fequad::parse_data().

113  {
114  num_indep_vars = indep_vars;
115 }
int num_indep_vars
Definition: points.h:82

Here is the caller graph for this function:

void set_num_points ( int  n)

Definition at line 84 of file points.cpp.

References bitmap::check_value(), get_num_points(), i, n, num_points, pt_set, pt_str, and bitmap::set_size().

Referenced by tpz_ordered::parse_data(), and tpz_fequad::parse_data().

84  {
85 
86  if(num_points <= 0){
87  pt_str = new pnt*[n];
88  }
89  else{
90  pnt **temp;
91  temp = new pnt*[n];
92 
93  for(int i=0; i<get_num_points(); i++){
94  if(pt_set.check_value(i)){
95  temp[i] = pt_str[i];
96  delete pt_str[i];
97  }
98  }
99 
100  delete[] pt_str;
101  pt_str = temp;
102  }
103 
104  this->num_points = n;
105  pt_set.set_size(n);
106 
107 }
bitmap pt_set
Definition: points.h:89
int num_points
Definition: points.h:80
Point object that represents a single point.
Definition: datatypedef.h:68
pnt ** pt_str
Definition: points.h:85
bool check_value(int n)
blockLoc i
Definition: read.cpp:79
void set_size(int n)
const NT & n
int get_num_points()
Definition: points.cpp:117

Here is the call graph for this function:

Here is the caller graph for this function:

void set_num_vars ( int  n)

Definition at line 109 of file points.cpp.

References n, and num_vars.

Referenced by tpz_ordered::parse_data(), and tpz_fequad::parse_data().

109  {
110  num_vars = n;
111 }
int num_vars
Definition: points.h:81
const NT & n

Here is the caller graph for this function:

void set_point_val ( int  point_number,
int  var,
long double  val 
)

Definition at line 129 of file points.cpp.

References bitmap::check_value(), num_points, num_vars, pt_set, pt_str, bitmap::set_value(), pnt::size, and pnt::vals.

Referenced by Interpolate::bilinear(), tpz_ordered::parse_data(), and tpz_fequad::parse_data().

129  {
130 
131  //Check point index
132  if(point_number > num_points)
133  return;
134 
135  //Check if the pnt object has already been created
136  if(pt_set.check_value(point_number)){
137 
138  //Check size of point object
139  if(pt_str[point_number]->size != num_vars && num_vars > pt_str[point_number]->size){
140  pnt *temp = new pnt;
141 
142  temp->vals = new long double[num_vars];
143  temp->size = num_vars;
144 
145  for(int m=0; m<pt_str[point_number]->size; m++){
146  temp->vals[m] = pt_str[point_number]->vals[m];
147  }
148 
149  delete[] pt_str[point_number]->vals;
150  delete[] pt_str[point_number];
151 
152  pt_str[point_number] = temp;
153  }
154 
155  if(pt_str[point_number]->size > var)
156  pt_str[point_number]->vals[var] = val;
157  }
158  else{
159  pt_str[point_number] = new pnt;
160  pt_str[point_number]->vals = new long double[num_vars];
161  pt_str[point_number]->size = num_vars;
162 
163  pt_set.set_value(point_number);
164 
165  if(pt_str[point_number]->size > var)
166  pt_str[point_number]->vals[var] = val;
167 
168  }
169 }
bitmap pt_set
Definition: points.h:89
int size
Definition: datatypedef.h:70
int num_points
Definition: points.h:80
long double * vals
Definition: datatypedef.h:69
Point object that represents a single point.
Definition: datatypedef.h:68
int num_vars
Definition: points.h:81
void set_value(int n)
pnt ** pt_str
Definition: points.h:85
bool check_value(int n)

Here is the call graph for this function:

Here is the caller graph for this function:

long double smallest_val ( int  dim)

Definition at line 216 of file points.cpp.

References i, num_points, pt_str, and pnt::vals.

216  {
217  long double smallest = std::numeric_limits<long double>::infinity();
218 
219  for(int i=0; i<num_points; i++){
220  if(pt_str[i]->vals[dim] < smallest)
221  smallest = pt_str[i]->vals[dim];
222  }
223 
224  return smallest;
225 }
int num_points
Definition: points.h:80
long double * vals
Definition: datatypedef.h:69
pnt ** pt_str
Definition: points.h:85
blockLoc i
Definition: read.cpp:79
void sort ( )
virtual

Reimplemented in indexed_points, and connect_points.

Definition at line 201 of file points.cpp.

201  {
202  return;
203 }

Member Data Documentation

int num_vars
protected

Definition at line 81 of file points.h.

Referenced by get_num_vars(), operator=(), points(), set_num_vars(), and set_point_val().

bitmap pt_set
protected

Definition at line 89 of file points.h.

Referenced by get_point(), operator=(), points(), set_num_points(), set_point_val(), and ~points().


The documentation for this class was generated from the following files: