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

#include <points.h>

Inheritance diagram for connect_points:
Collaboration diagram for connect_points:

Classes

struct  conn_points
 

Public Member Functions

 connect_points ()
 
virtual ~connect_points ()
 
connect_pointsoperator= (const connect_points &cp)
 
 connect_points (const connect_points &cp)
 
virtual connect_pointsclone ()
 
virtual int get_closest (long double *coord)
 
void set_connectivity (int point_num, int c_point)
 
virtual std::vector< int > get_connected_points (int point_num)
 
virtual void sort ()
 
- Public Member Functions inherited from points
 points ()
 
 points (int num_points)
 
 points (const points &p)
 
pointsoperator= (const points &p)
 
virtual ~points ()
 
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)
 
long double largest_val (int dim)
 
long double smallest_val (int dim)
 

Private Attributes

conn_pointsc_points
 

Additional Inherited Members

- Static Public Member Functions inherited from points
static void delete_all (std::vector< points * > points_vector)
 
static bool contains_null (std::vector< points * > points_vector)
 
- Protected Attributes inherited from points
int num_points
 
int num_vars
 
int num_indep_vars
 
pnt ** pt_str
 
bitmap pt_set
 

Detailed Description

Definition at line 95 of file points.h.

Constructor & Destructor Documentation

Definition at line 250 of file points.cpp.

References c_points.

Referenced by clone().

250  {
251  c_points = NULL;
252 }
conn_points * c_points
Definition: points.h:144

Here is the caller graph for this function:

~connect_points ( )
virtual

Definition at line 254 of file points.cpp.

References c_points.

254  {
255  delete[] c_points;
256 }
conn_points * c_points
Definition: points.h:144
connect_points ( const connect_points cp)

Definition at line 258 of file points.cpp.

References c_points, i, and points::num_points.

258  : points(cp) {
259 
260  if(cp.num_points > 0){
261 
262  c_points = new conn_points[num_points];
263 
264  for(int i=0; i<num_points; i++){
265  c_points[i] = cp.c_points[i];
266  }
267  }
268 }
int num_points
Definition: points.h:80
points()
Definition: points.cpp:7
blockLoc i
Definition: read.cpp:79
conn_points * c_points
Definition: points.h:144

Member Function Documentation

connect_points * clone ( )
virtual

Reimplemented from points.

Definition at line 289 of file points.cpp.

References connect_points().

289  {
290  return new connect_points(*this);
291 }

Here is the call graph for this function:

int get_closest ( long double *  coord)
virtual

Reimplemented from points.

Definition at line 293 of file points.cpp.

References dist(), i, points::num_indep_vars, points::num_points, points::pt_str, and pnt::vals.

293  {
294 
295  long double low_dist = std::numeric_limits<long double>::infinity();
296  int low_point = -1;
297 
298  //Iterate through all points and find the point that's closest
299  //to the specified point
300  for(int i=0; i<num_points; i++){
301 
302  long double *d_calc = new long double[num_indep_vars];
303 
304  for(int m=0; m<num_indep_vars; m++){
305  d_calc[m] = pt_str[i]->vals[m];
306  }
307 
308  long double distance = dist(coord, d_calc, num_indep_vars);
309 
310  if( distance < low_dist ){
311  low_dist = distance;
312  low_point = i;
313  }
314 
315  delete[] d_calc;
316  }
317 
318  return low_point;
319 }
int num_points
Definition: points.h:80
int coord[NPANE][NROW *NCOL][3]
Definition: blastest.C:86
long double * vals
Definition: datatypedef.h:69
pnt ** pt_str
Definition: points.h:85
blockLoc i
Definition: read.cpp:79
long double dist(long double *coord1, long double *coord2, int size)
int num_indep_vars
Definition: points.h:82

Here is the call graph for this function:

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

Reimplemented from points.

Definition at line 344 of file points.cpp.

References c_points, i, and connect_points::conn_points::points.

344  {
345 
346  std::vector<int> ret;
347 
348  //Point numbers start at 1
349  //Subtract 1 for array storage (starting at 0)
350  point_num = point_num - 1;
351 
352  if(point_num < 0)
353  return ret;
354 
355  for(int i=0; i<c_points[point_num].points.size(); i++){
356  ret.push_back(c_points[point_num].points[i]);
357  }
358 
359  return ret;
360 
361 }
Definition: points.h:30
std::vector< int > points
Definition: points.h:121
blockLoc i
Definition: read.cpp:79
conn_points * c_points
Definition: points.h:144
connect_points & operator= ( const connect_points cp)

Definition at line 270 of file points.cpp.

References c_points, i, points::num_points, and points::operator=().

270  {
271  if(this != &cp){
272 
273  int curr_pts = num_points;
274 
276 
277  delete[] c_points;
278 
279  c_points = new conn_points[cp.num_points];
280 
281  for(int i=0; i<cp.num_points; i++){
282  c_points[i] = cp.c_points[i];
283  }
284  }
285 
286  return *this;
287 }
int num_points
Definition: points.h:80
blockLoc i
Definition: read.cpp:79
conn_points * c_points
Definition: points.h:144
points & operator=(const points &p)
Definition: points.cpp:51

Here is the call graph for this function:

void set_connectivity ( int  point_num,
int  c_point 
)

Definition at line 321 of file points.cpp.

References c_points, i, points::num_points, connect_points::conn_points::points, and connect_points::conn_points::set_next().

Referenced by tpz_fequad::parse_data().

321  {
322 
323  //Point numbers start at 1
324  //Subtract 1 for array storage (starting at 0)
325  point_num = point_num - 1;
326 
327  if(c_points == NULL && num_points > 0){
328  c_points = new conn_points[num_points];
329  }
330 
331  bool dup = false;
332 
333  for(int i=0; i<c_points[point_num].points.size(); i++){
334  if(c_points[point_num].points[i] == c_point){
335  dup = true;
336  break;
337  }
338  }
339 
340  if(!dup)
341  c_points[point_num].set_next(c_point);
342 }
int num_points
Definition: points.h:80
Definition: points.h:30
std::vector< int > points
Definition: points.h:121
blockLoc i
Definition: read.cpp:79
conn_points * c_points
Definition: points.h:144

Here is the call graph for this function:

Here is the caller graph for this function:

void sort ( )
virtual

Reimplemented from points.

Definition at line 363 of file points.cpp.

363  {
364  return;
365 }

Member Data Documentation

conn_points* c_points
private

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