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

#include <GeoPrimitives.H>

Public Member Functions

 CPoint ()
 
 CPoint (double ix, double iy, double iz=0.0)
 
 CPoint (const double *p)
 
 CPoint (const CPoint &in)
 
CPointinit ()
 
CPointinit (double ix, double iy, double iz=0.0)
 
CPointinit (const double *p)
 
CPointoperator= (const CPoint &p)
 
CPointcopy (const CPoint &p)
 
double norm () const
 
bool operator== (const CPoint &p) const
 
bool operator!= (const CPoint &p) const
 
bool operator< (const CPoint &p) const
 
bool operator> (const CPoint &p) const
 
bool operator<= (const CPoint &p) const
 
bool operator>= (const CPoint &p) const
 
CPointoperator+= (const CPoint &p)
 
CPointoperator-= (const CPoint &p)
 
CPoint operator* (double num) const
 
CPointoperator*= (double num)
 
double & x ()
 
CPointx (double i)
 
const double & x () const
 
double & y ()
 
CPointy (double i)
 
const double & y () const
 
double & z ()
 
CPointz (double i)
 
const double & z () const
 
const double & operator[] (unsigned int i) const
 
double & operator[] (unsigned int i)
 
CPoint operator+ (const CPoint &p) const
 
CPoint operator- (const CPoint &p) const
 
double Distance (const CPoint &p) const
 
CPointset (double ix, double iy, double iz)
 
CPointreset ()
 

Protected Attributes

double P [3]
 

Friends

CPoint operator* (double, const CPoint &p)
 
std::ostream & operator<< (std::ostream &oSt, const CPoint &p)
 
std::istream & operator>> (std::istream &iSt, CPoint &p)
 
double Distance (const CPoint &p, const GeoPrim::CLine &l)
 

Detailed Description

Definition at line 22 of file GeoPrimitives.H.

Constructor & Destructor Documentation

CPoint ( )
inline

Definition at line 30 of file GeoPrimitives.H.

References CPoint::P.

31  {
32  P[0] = P[1] = P[2] = 0.0;
33  };
CPoint ( double  ix,
double  iy,
double  iz = 0.0 
)
inline

Definition at line 34 of file GeoPrimitives.H.

References CPoint::P.

35  {
36  P[0] = ix;
37  P[1] = iy;
38  P[2] = iz;
39  };
CPoint ( const double *  p)
inline

Definition at line 40 of file GeoPrimitives.H.

References CPoint::P.

41  {
42  P[0] = p[0];
43  P[1] = p[1];
44  P[2] = p[2];
45  };
CPoint ( const CPoint in)
inline

Definition at line 46 of file GeoPrimitives.H.

References CPoint::P.

47  {
48  P[0] = in.P[0];
49  P[1] = in.P[1];
50  P[2] = in.P[2];
51  };

Member Function Documentation

CPoint& copy ( const CPoint p)
inline

Definition at line 80 of file GeoPrimitives.H.

81  {
82  *this = p;
83  return(*this);
84  };
double Distance ( const CPoint p) const
inline

Definition at line 184 of file GeoPrimitives.H.

References CPoint::norm().

185  {
186  return((*this - p).norm());
187  }
double norm() const
Definition: GeoPrimitives.H:85

Here is the call graph for this function:

CPoint& init ( )
inline

Definition at line 52 of file GeoPrimitives.H.

References CPoint::P.

Referenced by test().

53  {
54  P[0] = 0.;
55  P[1] = 0.;
56  P[2] = 0;
57  return(*this);
58  };

Here is the caller graph for this function:

CPoint& init ( double  ix,
double  iy,
double  iz = 0.0 
)
inline

Definition at line 59 of file GeoPrimitives.H.

References CPoint::P.

60  {
61  P[0] = ix;
62  P[1] = iy;
63  P[2] = iz;
64  return(*this);
65  };
CPoint& init ( const double *  p)
inline

Definition at line 66 of file GeoPrimitives.H.

References CPoint::P.

67  {
68  P[0] = p[0];
69  P[1] = p[1];
70  P[2] = p[2];
71  return(*this);
72  };
double norm ( ) const
inline

Definition at line 85 of file GeoPrimitives.H.

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

Referenced by CPoint::Distance(), CPoint::operator<(), CPoint::operator<=(), CPoint::operator>(), and CPoint::operator>=().

86  {
87  return(sqrt((x()*x()) + (y()*y()) + (z()*z())));
88  };
double sqrt(double d)
Definition: double.h:73

Here is the call graph for this function:

Here is the caller graph for this function:

bool operator!= ( const CPoint p) const
inline

Definition at line 95 of file GeoPrimitives.H.

96  {
97  return (!((*this)==p));
98  };
CPoint operator* ( double  num) const
inline

Definition at line 131 of file GeoPrimitives.H.

References CPoint::P.

132  {
133  CPoint rp(P[0]*num,P[1]*num,P[2]*num);
134  return(rp);
135  };
CPoint& operator*= ( double  num)
inline

Definition at line 136 of file GeoPrimitives.H.

References CPoint::P.

137  {
138  P[0] *= num;
139  P[1] *= num;
140  P[2] *= num;
141  return(*this);
142  };
CPoint operator+ ( const CPoint p) const
inline

Definition at line 174 of file GeoPrimitives.H.

References CPoint::P.

175  {
176  CPoint rp(P[0]+p.P[0],P[1]+p.P[1],P[2]+p.P[2]);
177  return(rp);
178  };
CPoint& operator+= ( const CPoint p)
inline

Definition at line 117 of file GeoPrimitives.H.

References CPoint::P.

118  {
119  P[0] += p.P[0];
120  P[1] += p.P[1];
121  P[2] += p.P[2];
122  return(*this);
123  };
CPoint operator- ( const CPoint p) const
inline

Definition at line 179 of file GeoPrimitives.H.

References CPoint::P.

180  {
181  CPoint rp(P[0]-p.P[0],P[1]-p.P[1],P[2]-p.P[2]);
182  return(rp);
183  };
CPoint& operator-= ( const CPoint p)
inline

Definition at line 124 of file GeoPrimitives.H.

References CPoint::P.

125  {
126  P[0] -= p.P[0];
127  P[1] -= p.P[1];
128  P[2] -= p.P[2];
129  return(*this);
130  };
bool operator< ( const CPoint p) const
inline

Definition at line 99 of file GeoPrimitives.H.

References CPoint::norm().

100  {
101  return (norm() < p.norm());
102  };
double norm() const
Definition: GeoPrimitives.H:85

Here is the call graph for this function:

bool operator<= ( const CPoint p) const
inline

Definition at line 107 of file GeoPrimitives.H.

References CPoint::norm().

108  {
109  return ((norm() < p.norm()) ||
110  (*this == p));
111  };
double norm() const
Definition: GeoPrimitives.H:85

Here is the call graph for this function:

CPoint& operator= ( const CPoint p)
inline

Definition at line 73 of file GeoPrimitives.H.

References CPoint::P.

74  {
75  P[0] = p.P[0];
76  P[1] = p.P[1];
77  P[2] = p.P[2];
78  return(*this);
79  };
bool operator== ( const CPoint p) const
inline

Definition at line 89 of file GeoPrimitives.H.

References CPoint::P, and GeoPrim::TOL.

90  {
91  return( (fabs(P[0] - p.P[0]) < TOL) &&
92  (fabs(P[1] - p.P[1]) < TOL) &&
93  (fabs(P[2] - p.P[2]) < TOL) );
94  };
const double TOL
Definition: GeoPrimitives.H:17
bool operator> ( const CPoint p) const
inline

Definition at line 103 of file GeoPrimitives.H.

References CPoint::norm().

104  {
105  return (norm() > p.norm());
106  };
double norm() const
Definition: GeoPrimitives.H:85

Here is the call graph for this function:

bool operator>= ( const CPoint p) const
inline

Definition at line 112 of file GeoPrimitives.H.

References CPoint::norm().

113  {
114  return((norm() > p.norm()) ||
115  (*this == p));
116  };
double norm() const
Definition: GeoPrimitives.H:85

Here is the call graph for this function:

const double& operator[] ( unsigned int  i) const
inline

Definition at line 164 of file GeoPrimitives.H.

References CPoint::P.

165  {
166  if( i > 2 ) i = 0;
167  return(P[i]);
168  };
blockLoc i
Definition: read.cpp:79
double& operator[] ( unsigned int  i)
inline

Definition at line 169 of file GeoPrimitives.H.

References CPoint::P.

170  {
171  if (i > 2) i = 0;
172  return(P[i]);
173  };
blockLoc i
Definition: read.cpp:79
CPoint& reset ( )
inline

Definition at line 195 of file GeoPrimitives.H.

References CPoint::P.

Referenced by CBox::CBox().

196  {
197  P[0] = 0.0;
198  P[1] = 0.0;
199  P[2] = 0.0;
200  return(*this);
201  };

Here is the caller graph for this function:

CPoint& set ( double  ix,
double  iy,
double  iz 
)
inline

Definition at line 188 of file GeoPrimitives.H.

References CPoint::P.

189  {
190  P[0] = ix;
191  P[1] = iy;
192  P[2] = iz;
193  return(*this);
194  };
CPoint& x ( double  i)
inline

Definition at line 144 of file GeoPrimitives.H.

References i, and CPoint::P.

145  {
146  P[0] = i;
147  return(*this);
148  };
blockLoc i
Definition: read.cpp:79
const double& x ( ) const
inline

Definition at line 149 of file GeoPrimitives.H.

References CPoint::P.

149 { return P[0]; };
CPoint& y ( double  i)
inline

Definition at line 151 of file GeoPrimitives.H.

References i, and CPoint::P.

152  {
153  P[1] = i;
154  return(*this);
155  };
blockLoc i
Definition: read.cpp:79
const double& y ( ) const
inline

Definition at line 156 of file GeoPrimitives.H.

References CPoint::P.

156 { return P[1]; };
CPoint& z ( double  i)
inline

Definition at line 158 of file GeoPrimitives.H.

References i, and CPoint::P.

159  {
160  P[2] = i;
161  return(*this);
162  }
blockLoc i
Definition: read.cpp:79
const double& z ( ) const
inline

Definition at line 163 of file GeoPrimitives.H.

References CPoint::P.

163 { return P[2]; };

Friends And Related Function Documentation

double Distance ( const CPoint p,
const GeoPrim::CLine l 
)
friend
CPoint operator* ( double  scalar,
const CPoint p 
)
friend

Definition at line 117 of file GeoPrimitives.C.

118  {
119  GeoPrim::CPoint rv(p);
120  rv.x() *= scalar;
121  rv.y() *= scalar;
122  rv.z() *= scalar;
123  return(rv);
124  }
std::ostream& operator<< ( std::ostream &  oSt,
const CPoint p 
)
friend

Definition at line 62 of file GeoPrimitives.C.

63  {
64  oS << p.x() << " " << p.y() << " " << p.z();
65  return(oS);
66  }
std::istream& operator>> ( std::istream &  iSt,
GeoPrim::CPoint p 
)
friend

Definition at line 69 of file GeoPrimitives.C.

70  {
71  iS >> p[0] >> p[1] >> p[2];
72  return(iS);
73  }

Member Data Documentation


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