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

#include <Mesh.H>

Collaboration diagram for Mesh::NodalCoordinates:

Public Member Functions

 NodalCoordinates ()
 
 NodalCoordinates (IndexType n)
 
 NodalCoordinates (IndexType n, double *data)
 
 ~NodalCoordinates ()
 
bool good () const
 
IndexType size () const
 
IndexType Size () const
 
void destroy ()
 
void init ()
 
void init (IndexType n)
 
void init (IndexType n, double *data)
 
void init_node (IndexType n, const GeoPrim::CPoint &)
 
void init_copy (IndexType n, double *data)
 
int NNodes () const
 
double & x (IndexType n=1)
 
const double & x (IndexType n=1) const
 
double & y (IndexType n=1)
 
const double & y (IndexType n=1) const
 
double & z (IndexType n=1)
 
const double & z (IndexType n=1) const
 
double * operator[] (IndexType n)
 
const double * operator[] (IndexType n) const
 
const GeoPrim::CPoint closest_point (const GeoPrim::CPoint &p) const
 
Mesh::IndexType closest_node (const GeoPrim::CPoint &p, double *dist_ptr=NULL) const
 

Protected Attributes

double * ncdata
 
IndexType nnodes
 

Private Attributes

bool mydata
 
int verblevel
 
std::ostream * Out
 
std::ostream * Err
 

Friends

std::ostream & operator<< (std::ostream &oSt, const Mesh::NodalCoordinates &nc)
 
std::istream & operator>> (std::istream &iSt, Mesh::NodalCoordinates &nc)
 

Detailed Description

Definition at line 250 of file Mesh.H.

Constructor & Destructor Documentation

Definition at line 14 of file Mesh.C.

15  {
16  ncdata = NULL;
17  nnodes = 0;
18  mydata = false;
19  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262

Definition at line 20 of file Mesh.C.

References n.

21  {
22  if(n > 0){
23  ncdata = new double [3 * n];
24  nnodes = n;
25  mydata = true;
26  }
27  else {
28  ncdata = NULL;
29  nnodes = 0;
30  mydata = false;
31  }
32  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n
NodalCoordinates ( IndexType  n,
double *  data 
)

Definition at line 33 of file Mesh.C.

References n.

34  {
35  if((n > 0) && (data != NULL)){
36  mydata = false;
37  nnodes = n;
38  ncdata = data;
39  }
40  else {
41  ncdata = NULL;
42  nnodes = 0;
43  mydata = false;
44  }
45  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n

Definition at line 46 of file Mesh.C.

46 {destroy();};

Member Function Documentation

Mesh::IndexType closest_node ( const GeoPrim::CPoint p,
double *  dist_ptr = NULL 
) const

Definition at line 100 of file Mesh.C.

References dist(), i, ncdata, nnodes, and nvc::norm().

101  {
102  double dist = 1000000;
103  Mesh::IndexType reti = 0;
104  for(unsigned int i = 0;i < nnodes;i++){
105  GeoPrim::CPoint testp(&ncdata[3*i]);
106  double testd = (p-testp).norm();
107  if(testd < dist){
108  dist = testd;
109  reti = i + 1;
110  }
111  }
112  if(dist_ptr)
113  *dist_ptr = dist;
114  return(reti);
115  };
double * ncdata
Definition: Mesh.H:261
T norm(const NVec< DIM, T > &v)
blockLoc i
Definition: read.cpp:79
IndexType nnodes
Definition: Mesh.H:262
long double dist(long double *coord1, long double *coord2, int size)
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57

Here is the call graph for this function:

const GeoPrim::CPoint closest_point ( const GeoPrim::CPoint p) const

Definition at line 85 of file Mesh.C.

References dist(), i, ncdata, nnodes, and nvc::norm().

86  {
87  double dist = 1000000;
88  GeoPrim::CPoint retval;
89  for(unsigned int i = 0;i < nnodes;i++){
90  GeoPrim::CPoint testp(&ncdata[3*i]);
91  double testd = (p-testp).norm();
92  if(testd < dist){
93  dist = testd;
94  retval = testp;
95  }
96  }
97  return(retval);
98  };
double * ncdata
Definition: Mesh.H:261
T norm(const NVec< DIM, T > &v)
blockLoc i
Definition: read.cpp:79
IndexType nnodes
Definition: Mesh.H:262
long double dist(long double *coord1, long double *coord2, int size)

Here is the call graph for this function:

void destroy ( )

Definition at line 50 of file Mesh.C.

Referenced by init_copy(), and Mesh::MeshUtilityObject::~MeshUtilityObject().

50  {
51  if(ncdata && mydata){
52  delete [] ncdata;
53  nnodes = 0;
54  ncdata = NULL;
55  mydata = false;
56  }
57  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262

Here is the caller graph for this function:

bool good ( ) const

Definition at line 47 of file Mesh.C.

47 { return(ncdata ? true : false);};
double * ncdata
Definition: Mesh.H:261
void init ( )

Definition at line 58 of file Mesh.C.

Referenced by main(), and Mesh::operator>>().

58 {destroy();};

Here is the caller graph for this function:

void init ( IndexType  n)

Definition at line 59 of file Mesh.C.

References n.

60  {
61  destroy();
62  if(n > 0){
63  ncdata = new double [3 * n];
64  nnodes = n;
65  mydata = true;
66  }
67  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n
void init ( IndexType  n,
double *  data 
)

Definition at line 68 of file Mesh.C.

References n.

69  {
70  destroy();
71  if(n > 0){
72  ncdata = data;
73  nnodes = n;
74  mydata = false;
75  }
76  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n
void init_copy ( IndexType  n,
double *  data 
)

Definition at line 117 of file Mesh.C.

References destroy(), mydata, n, ncdata, and nnodes.

118  {
119  destroy();
120  if(n > 0 && data){
121  ncdata = new double [3*n];
122  nnodes = n;
123  mydata = true;
124  std::memcpy(ncdata,data,n*sizeof(double)*3);
125  }
126  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n

Here is the call graph for this function:

void init_node ( IndexType  n,
const GeoPrim::CPoint point 
)

Definition at line 78 of file Mesh.C.

References x, CPoint::x(), y, CPoint::y(), z, and CPoint::z().

Referenced by main(), and test().

79  {
80  this->x(n) = point.x();
81  this->y(n) = point.y();
82  this->z(n) = point.z();
83  };
double & z(IndexType n=1)
Definition: Mesh.H:300
const NT & n
double & x(IndexType n=1)
Definition: Mesh.H:280
double & y(IndexType n=1)
Definition: Mesh.H:290

Here is the call graph for this function:

Here is the caller graph for this function:

int NNodes ( void  ) const
inline

Definition at line 278 of file Mesh.H.

References nnodes.

Referenced by Mesh::writeVtkData(), and writeVtkData().

278 { return nnodes; };
IndexType nnodes
Definition: Mesh.H:262

Here is the caller graph for this function:

double* operator[] ( IndexType  n)
inline

Definition at line 310 of file Mesh.H.

References ncdata, and nnodes.

311  {
312  assert(!(n > nnodes || n == 0));
313  return(&ncdata[3*(n-1)]);
314  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n
const double* operator[] ( IndexType  n) const
inline

Definition at line 315 of file Mesh.H.

References ncdata, and nnodes.

316  {
317  assert(!(n > nnodes || n == 0));
318  return(&ncdata[3*(n-1)]);
319  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n
Mesh::IndexType size ( ) const

Definition at line 48 of file Mesh.C.

Referenced by Mesh::operator<<(), and Mesh::operator>>().

48 { return(nnodes);};
IndexType nnodes
Definition: Mesh.H:262

Here is the caller graph for this function:

Mesh::IndexType Size ( ) const

Definition at line 49 of file Mesh.C.

Referenced by main(), Mesh::MeshUtilityObject::NumberOfNodes(), stitchGrids(), TRAIL_SurfaceMesh2Window(), and TRAIL_UnstructuredMesh2Pane().

49 { return(nnodes);};
IndexType nnodes
Definition: Mesh.H:262

Here is the caller graph for this function:

double& x ( IndexType  n = 1)
inline

Definition at line 280 of file Mesh.H.

References n, ncdata, and nnodes.

Referenced by main().

281  {
282  assert(!(n > nnodes || n == 0));
283  return(ncdata[(n-1)*3]);
284  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n

Here is the caller graph for this function:

const double& x ( IndexType  n = 1) const
inline

Definition at line 285 of file Mesh.H.

References n, ncdata, and nnodes.

286  {
287  assert(!(n > nnodes || n == 0));
288  return(ncdata[(n-1)*3]);
289  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n
double& y ( IndexType  n = 1)
inline

Definition at line 290 of file Mesh.H.

References n, ncdata, and nnodes.

Referenced by main(), and stitchGrids().

291  {
292  assert(!(n > nnodes || n == 0));
293  return(ncdata[(3*(n-1))+1]);
294  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n

Here is the caller graph for this function:

const double& y ( IndexType  n = 1) const
inline

Definition at line 295 of file Mesh.H.

References n, ncdata, and nnodes.

296  {
297  assert(!(n > nnodes || n == 0));
298  return(ncdata[(3*(n-1))+1]);
299  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n
double& z ( IndexType  n = 1)
inline

Definition at line 300 of file Mesh.H.

References n, ncdata, and nnodes.

Referenced by main(), and stitchGrids().

301  {
302  assert(!(n > nnodes || n == 0));
303  return(ncdata[(3*(n-1))+2]);
304  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n

Here is the caller graph for this function:

const double& z ( IndexType  n = 1) const
inline

Definition at line 305 of file Mesh.H.

References n, ncdata, and nnodes.

306  {
307  assert(!(n > nnodes || n == 0));
308  return(ncdata[(3*(n-1))+2]);
309  };
double * ncdata
Definition: Mesh.H:261
IndexType nnodes
Definition: Mesh.H:262
const NT & n

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  oSt,
const Mesh::NodalCoordinates nc 
)
friend

Definition at line 2128 of file Mesh.C.

2129  {
2130  // if(nc.size() == 0) return(oSt);
2131  oSt.setf(std::ios::scientific);
2132  oSt.setf(std::ios::showpoint);
2133  oSt << std::setprecision(10) << std::setiosflags(std::ios::left);
2134  oSt << nc.size();
2135  if(nc.size() > 0) oSt << "\n";
2136  for(IndexType n = 1;n <= nc.size() ;n++){
2137  oSt << std::setw(16) << nc[n][0] << "\t"
2138  << std::setw(16) << nc[n][1] << "\t"
2139  << std::setw(16) << nc[n][2];
2140  if(n != nc.size())
2141  oSt << std::endl;
2142  }
2143  return (oSt);
2144  }
const NT & n
IndexType size() const
Definition: Mesh.C:48
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57
std::istream& operator>> ( std::istream &  iSt,
Mesh::NodalCoordinates nc 
)
friend

Definition at line 2108 of file Mesh.C.

2109  {
2110  // if(nc.size() == 0) return (iSt);
2111  std::string line;
2112  IndexType nnodes;
2113  std::getline(iSt,line);
2114  std::istringstream Istr(line);
2115  Istr >> nnodes;
2116  if(nnodes > 0){
2117  nc.init(nnodes);
2118  for(IndexType n = 1;n <= nc.size();n++){
2119  double *inPtr = nc[n];
2120  std::getline(iSt,line);
2121  std::istringstream Istr2(line);
2122  Istr2 >> inPtr[0] >> inPtr[1] >> inPtr[2];
2123  }
2124  }
2125  return(iSt);
2126  }
IndexType nnodes
Definition: Mesh.H:262
const NT & n
IndexType size() const
Definition: Mesh.C:48
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57

Member Data Documentation

std::ostream* Err
private

Definition at line 259 of file Mesh.H.

bool mydata
private

Definition at line 256 of file Mesh.H.

Referenced by init_copy().

double* ncdata
protected

Definition at line 261 of file Mesh.H.

Referenced by closest_node(), closest_point(), init_copy(), operator[](), x(), y(), and z().

IndexType nnodes
protected

Definition at line 262 of file Mesh.H.

Referenced by closest_node(), closest_point(), init_copy(), NNodes(), operator[](), x(), y(), and z().

std::ostream* Out
private

Definition at line 258 of file Mesh.H.

int verblevel
private

Definition at line 257 of file Mesh.H.


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