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

#include <points.h>

Inheritance diagram for indexed_points:
Collaboration diagram for indexed_points:

Public Member Functions

 indexed_points ()
 
virtual ~indexed_points ()
 
 indexed_points (const indexed_points &ip)
 
indexed_pointsoperator= (const indexed_points &ip)
 
virtual indexed_pointsclone ()
 
virtual void sort ()
 
pnt get_indexed_point (std::vector< int > loc)
 
virtual int get_closest (long double *coord)
 
virtual std::vector< int > get_connected_points (int point_num)
 
virtual std::vector< int > get_dim ()
 
- 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)
 

Protected Attributes

VariableDimensionArray index
 
bool index_set
 
std::vector< int > index_layout
 
- Protected Attributes inherited from points
int num_points
 
int num_vars
 
int num_indep_vars
 
pnt ** pt_str
 
bitmap pt_set
 

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)
 

Detailed Description

Definition at line 150 of file points.h.

Constructor & Destructor Documentation

Definition at line 393 of file points.cpp.

Referenced by clone().

393  {
394  index_set = false;
395  return;
396 }
bool index_set
Definition: points.h:176

Here is the caller graph for this function:

~indexed_points ( )
virtual

Definition at line 398 of file points.cpp.

398  {
399  return;
400 }
indexed_points ( const indexed_points ip)

Definition at line 402 of file points.cpp.

References index, index_layout, and index_set.

402  : points(ip) {
403 
404  index_set = ip.index_set;
406 
407  index = ip.index;
408 }
std::vector< int > index_layout
Definition: points.h:178
bool index_set
Definition: points.h:176
points()
Definition: points.cpp:7
VariableDimensionArray index
Definition: points.h:175

Member Function Documentation

indexed_points * clone ( )
virtual

Reimplemented from points.

Reimplemented in manual_index_pts.

Definition at line 425 of file points.cpp.

References indexed_points().

425  {
426  return new indexed_points(*this);
427 }

Here is the call graph for this function:

int get_closest ( long double *  coord)
virtual

Reimplemented from points.

Definition at line 440 of file points.cpp.

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

440  {
441 
442  //TODO
443  //Data is ordered;
444  //Improve search algorithm
445 
446  long double low_dist = std::numeric_limits<long double>::infinity();
447  int low_point = -1;
448 
449  //Iterate through all points and find the point in the dataset
450  //that's closest to the specified point
451  for(int i=0; i<num_points; i++){
452 
453  long double *d_calc = new long double[num_indep_vars];
454 
455  for(int m=0; m<num_indep_vars; m++){
456  d_calc[m] = pt_str[i]->vals[m];
457  }
458 
459  long double distance = dist(coord, d_calc, num_indep_vars);
460 
461  if( distance < low_dist ){
462  low_dist = distance;
463  low_point = i;
464  }
465 
466  delete[] d_calc;
467  }
468 
469  return low_point;
470 }
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 472 of file points.cpp.

References i, index, j, VariableDimensionArray::translate_coord_to_index(), and VariableDimensionArray::translate_index_to_coords().

472  {
473 
474  std::vector<int> coords = index.translate_index_to_coords(point_num);
475 
476  std::vector<int> ret;
477 
478  //Iterate through each independent variable
479  for(int i=0; i<coords.size(); i++){
480  std::vector<int> loc;
481 
482  //Positive Direction
483  for(int j=0; j<coords.size(); j++){
484  if(j == i)
485  loc.push_back(coords[j] + 1);
486  else
487  loc.push_back(coords[j]);
488  }
489  int ptup = index.translate_coord_to_index(loc);
490 
491  //Erase coordinates
492  loc.erase(loc.begin(), loc.end());
493 
494  //Negative Direction
495  for(int j=0; j<coords.size(); j++){
496  if(j == i)
497  loc.push_back(coords[j] - 1);
498  else
499  loc.push_back(coords[j]);
500  }
501  int ptdown = index.translate_coord_to_index(loc);
502 
503  if(ptup > 0)
504  ret.push_back(ptup);
505  if(ptdown > 0)
506  ret.push_back(ptdown);
507  }
508 
509  return ret;
510 }
std::vector< int > translate_index_to_coords(int index)
Translate index to coordinates.
Definition: datatypedef.h:245
blockLoc i
Definition: read.cpp:79
int translate_coord_to_index(std::vector< int > vals)
Translate coordinates to the flat index actually used for storage.
Definition: datatypedef.h:220
j indices j
Definition: Indexing.h:6
VariableDimensionArray index
Definition: points.h:175

Here is the call graph for this function:

std::vector< int > get_dim ( )
virtual

Definition at line 512 of file points.cpp.

References index_layout.

Referenced by TecplotOrderedWriter::writePartition(), and TecplotOrderedWriter::writePoints().

512  {
513  return index_layout;
514 }
std::vector< int > index_layout
Definition: points.h:178

Here is the caller graph for this function:

pnt get_indexed_point ( std::vector< int >  loc)

Definition at line 433 of file points.cpp.

References VariableDimensionArray::getValue(), index, and points::pt_str.

433  {
434 
435  int index_loc = index.getValue(loc);
436 
437  return *(pt_str[ index_loc ]);
438 }
pnt ** pt_str
Definition: points.h:85
VariableDimensionArray index
Definition: points.h:175
int getValue(std::vector< int > rLoc)
Get the value specified by the loc coordinates.
Definition: datatypedef.h:272

Here is the call graph for this function:

indexed_points & operator= ( const indexed_points ip)

Definition at line 410 of file points.cpp.

References index, index_layout, index_set, and points::operator=().

Referenced by manual_index_pts::operator=().

410  {
411 
412  if(this != &ip){
413 
415 
416  index_set = ip.index_set;
418 
419  index = ip.index;
420  }
421 
422  return *this;
423 }
std::vector< int > index_layout
Definition: points.h:178
bool index_set
Definition: points.h:176
VariableDimensionArray index
Definition: points.h:175
points & operator=(const points &p)
Definition: points.cpp:51

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 429 of file points.cpp.

429  {
430  return;
431 }

Member Data Documentation

std::vector<int> index_layout
protected

Definition at line 178 of file points.h.

Referenced by get_dim(), indexed_points(), and operator=().

bool index_set
protected

Definition at line 176 of file points.h.

Referenced by indexed_points(), operator=(), and manual_index_pts::set_layout().


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