Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Nektar::NekPoint< data_type > Class Template Reference

#include <NekPoint.hpp>

Collaboration diagram for Nektar::NekPoint< data_type >:
Collaboration graph
[legend]

Public Types

typedef data_type DataType
 
typedef ThreeD dim
 

Public Member Functions

 NekPoint ()
 
 NekPoint (const std::string &pointValues)
 
 NekPoint (typename boost::call_traits< DataType >::param_type x, typename boost::call_traits< DataType >::param_type y, typename boost::call_traits< DataType >::param_type z)
 
 NekPoint (typename boost::call_traits< DataType >::const_reference a)
 
 NekPoint (const NekPoint< DataType > &rhs)
 
 ~NekPoint ()
 
NekPoint< DataType > & operator= (const NekPoint< DataType > &rhs)
 
boost::call_traits< DataType >
::reference 
operator() (unsigned int i)
 Returns i^{th} element. More...
 
boost::call_traits< DataType >
::const_reference 
operator() (unsigned int i) const
 
boost::call_traits< DataType >
::reference 
operator[] (unsigned int i)
 
boost::call_traits< DataType >
::const_reference 
operator[] (unsigned int i) const
 
boost::call_traits< DataType >
::const_reference 
x () const
 
boost::call_traits< DataType >
::const_reference 
y () const
 
boost::call_traits< DataType >
::const_reference 
z () const
 
boost::call_traits< DataType >
::const_reference 
a () const
 
boost::call_traits< DataType >
::const_reference 
b () const
 
boost::call_traits< DataType >
::const_reference 
c () const
 
boost::call_traits< DataType >
::const_reference 
r () const
 
boost::call_traits< DataType >
::const_reference 
s () const
 
boost::call_traits< DataType >
::const_reference 
t () const
 
void SetX (typename boost::call_traits< DataType >::const_reference val)
 
void SetY (typename boost::call_traits< DataType >::const_reference val)
 
void SetZ (typename boost::call_traits< DataType >::const_reference val)
 
boost::call_traits< DataType >
::reference 
x ()
 
boost::call_traits< DataType >
::reference 
y ()
 
boost::call_traits< DataType >
::reference 
z ()
 
const DataTypeGetPtr () const
 
bool operator== (const NekPoint< DataType > &rhs) const
 
bool operator!= (const NekPoint< DataType > &rhs) const
 
void negate ()
 Arithmetic Routines. More...
 
NekPoint< DataTypeoperator- () const
 
NekPoint< DataType > & operator+= (const NekPoint< DataType > &rhs)
 
NekPoint< DataType > & operator+= (typename boost::call_traits< DataType >::param_type rhs)
 
NekPoint< DataType > & operator-= (const NekPoint< DataType > &rhs)
 
NekPoint< DataType > & operator-= (typename boost::call_traits< DataType >::param_type rhs)
 
NekPoint< DataType > & operator*= (typename boost::call_traits< DataType >::param_type rhs)
 
NekPoint< DataType > & operator/= (typename boost::call_traits< DataType >::param_type rhs)
 
std::string AsString () const
 

Static Public Member Functions

static unsigned int dimension ()
 Returns the number of dimensions for the point. More...
 

Private Attributes

DataType m_data [dim::Value]
 

Detailed Description

template<typename data_type>
class Nektar::NekPoint< data_type >

Definition at line 61 of file NekPoint.hpp.

Member Typedef Documentation

template<typename data_type>
typedef data_type Nektar::NekPoint< data_type >::DataType

Definition at line 64 of file NekPoint.hpp.

template<typename data_type>
typedef ThreeD Nektar::NekPoint< data_type >::dim

Definition at line 65 of file NekPoint.hpp.

Constructor & Destructor Documentation

template<typename data_type>
Nektar::NekPoint< data_type >::NekPoint ( )
inline

Definition at line 68 of file NekPoint.hpp.

69  {
70  // This may be suboptimal if DataType isn't numeric.
71  // If we use them then maybe we could look at an enable_if
72  // template to choose a better constructor.
73  for(unsigned int i = 0; i < dim::Value; ++i)
74  {
75  // If you get a compile error pointing you here then
76  // the DataType being stored in the point doesn't have an
77  // accessible operator= or default copy constructor.
78  m_data[i] = DataType();
79  }
80  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
data_type DataType
Definition: NekPoint.hpp:64
template<typename data_type>
Nektar::NekPoint< data_type >::NekPoint ( const std::string &  pointValues)
inline

Definition at line 82 of file NekPoint.hpp.

83  {
84  bool result = fromString(pointValues, *this);
85  ASSERTL0(result, "Unable to create a point from a string.");
86  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
bool fromString(const std::string &str, NekPoint< DataType > &result)
Definition: NekPoint.hpp:473
template<typename data_type>
Nektar::NekPoint< data_type >::NekPoint ( typename boost::call_traits< DataType >::param_type  x,
typename boost::call_traits< DataType >::param_type  y,
typename boost::call_traits< DataType >::param_type  z 
)
inline

Definition at line 88 of file NekPoint.hpp.

91  {
92  m_data[0] = x;
93  m_data[1] = y;
94  m_data[2] = z;
95  }
boost::call_traits< DataType >::const_reference y() const
Definition: NekPoint.hpp:170
boost::call_traits< DataType >::const_reference z() const
Definition: NekPoint.hpp:176
boost::call_traits< DataType >::const_reference x() const
Definition: NekPoint.hpp:164
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
Nektar::NekPoint< data_type >::NekPoint ( typename boost::call_traits< DataType >::const_reference  a)
inlineexplicit

Definition at line 97 of file NekPoint.hpp.

98  {
99  boost::function_requires< Nektar::AssignableConcept<DataType> >();
100 
101  for(unsigned int i = 0; i < dim::Value; ++i)
102  {
103  m_data[i] = a;
104  }
105  }
static const unsigned int Value
boost::call_traits< DataType >::const_reference a() const
Definition: NekPoint.hpp:182
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
Nektar::NekPoint< data_type >::NekPoint ( const NekPoint< DataType > &  rhs)
inline

Definition at line 108 of file NekPoint.hpp.

109  {
110  for(unsigned int i = 0; i < dim::Value; ++i)
111  {
112  m_data[i] = rhs.m_data[i];
113  }
114  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
Nektar::NekPoint< data_type >::~NekPoint ( )
inline

Definition at line 116 of file NekPoint.hpp.

117  {
118  }

Member Function Documentation

template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::a ( ) const
inline

Definition at line 182 of file NekPoint.hpp.

Referenced by Nektar::NekPoint< NekDouble >::NekPoint().

183  {
184  BOOST_STATIC_ASSERT(dim::Value >= 1);
185  return m_data[0];
186  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
std::string Nektar::NekPoint< data_type >::AsString ( ) const
inline

Definition at line 352 of file NekPoint.hpp.

Referenced by Nektar::operator<<().

353  {
354  std::string result = "(";
355  for(unsigned int i = 0; i < dim::Value; ++i)
356  {
357  result += boost::lexical_cast<std::string>(m_data[i]);
358  if( i < dim::Value-1 )
359  {
360  result += ", ";
361  }
362  }
363  result += ")";
364  return result;
365  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::b ( ) const
inline

Definition at line 188 of file NekPoint.hpp.

189  {
190  BOOST_STATIC_ASSERT(dim::Value >= 2);
191  return (*this)[1];
192  }
static const unsigned int Value
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::c ( ) const
inline

Definition at line 194 of file NekPoint.hpp.

195  {
196  BOOST_STATIC_ASSERT(dim::Value >= 3);
197  return (*this)[2];
198  }
static const unsigned int Value
template<typename data_type>
static unsigned int Nektar::NekPoint< data_type >::dimension ( )
inlinestatic

Returns the number of dimensions for the point.

Definition at line 131 of file NekPoint.hpp.

131 { return dim::Value; }
static const unsigned int Value
template<typename data_type>
const DataType* Nektar::NekPoint< data_type >::GetPtr ( ) const
inline

Definition at line 254 of file NekPoint.hpp.

255  {
256  return &m_data[0];
257  }
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
void Nektar::NekPoint< data_type >::negate ( )
inline

Arithmetic Routines.

Definition at line 281 of file NekPoint.hpp.

Referenced by Nektar::negate(), and Nektar::NekPoint< NekDouble >::operator-().

282  {
283  for(int i=0; i < dim::Value; ++i)
284  {
285  (*this)[i] = -(*this)[i];
286  }
287  }
static const unsigned int Value
template<typename data_type>
bool Nektar::NekPoint< data_type >::operator!= ( const NekPoint< DataType > &  rhs) const
inline

Definition at line 273 of file NekPoint.hpp.

274  {
275  return !(*this == rhs);
276  }
template<typename data_type>
boost::call_traits<DataType>::reference Nektar::NekPoint< data_type >::operator() ( unsigned int  i)
inline

Returns i^{th} element.

Parameters
iThe element to return.
Precondition
i < dim
Returns
A reference to the i^{th} element.

Retrieves the i^{th} element. Since it returns a reference you may assign a new value (i.e., p(2) = 3.2;)

This operator performs range checking.

Definition at line 142 of file NekPoint.hpp.

143  {
144  ASSERTL0( (i>=0) && (i<dim::Value), "Invalid access to NekPoint data via parenthesis operator: index out of range");
145  return m_data[i];
146  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::operator() ( unsigned int  i) const
inline

Definition at line 148 of file NekPoint.hpp.

149  {
150  ASSERTL0( (i>=0) && (i<dim::Value), "Invalid access to NekPoint data via parenthesis operator: index out of range");
151  return m_data[i];
152  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
NekPoint<DataType>& Nektar::NekPoint< data_type >::operator*= ( typename boost::call_traits< DataType >::param_type  rhs)
inline

Definition at line 334 of file NekPoint.hpp.

335  {
336  for(unsigned int i = 0; i < dim::Value; ++i)
337  {
338  m_data[i] *= rhs;
339  }
340  return *this;
341  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
NekPoint<DataType>& Nektar::NekPoint< data_type >::operator+= ( const NekPoint< DataType > &  rhs)
inline

Definition at line 297 of file NekPoint.hpp.

298  {
299  for(unsigned int i=0; i < dim::Value; ++i)
300  {
301  m_data[i] += rhs.m_data[i];
302  }
303  return *this;
304  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
NekPoint<DataType>& Nektar::NekPoint< data_type >::operator+= ( typename boost::call_traits< DataType >::param_type  rhs)
inline

Definition at line 306 of file NekPoint.hpp.

307  {
308  for(unsigned int i = 0; i < dim::Value; ++i)
309  {
310  m_data[i] += rhs;
311  }
312  return *this;
313  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
NekPoint<DataType> Nektar::NekPoint< data_type >::operator- ( ) const
inline

Definition at line 289 of file NekPoint.hpp.

290  {
291  NekPoint<DataType> result(*this);
292  result.negate();
293  return result;
294  }
template<typename data_type>
NekPoint<DataType>& Nektar::NekPoint< data_type >::operator-= ( const NekPoint< DataType > &  rhs)
inline

Definition at line 315 of file NekPoint.hpp.

316  {
317  for(unsigned int i=0; i < dim::Value; ++i)
318  {
319  m_data[i] -= rhs.m_data[i];
320  }
321  return *this;
322  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
NekPoint<DataType>& Nektar::NekPoint< data_type >::operator-= ( typename boost::call_traits< DataType >::param_type  rhs)
inline

Definition at line 325 of file NekPoint.hpp.

326  {
327  for(unsigned int i = 0; i < dim::Value; ++i)
328  {
329  m_data[i] -= rhs;
330  }
331  return *this;
332  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
NekPoint<DataType>& Nektar::NekPoint< data_type >::operator/= ( typename boost::call_traits< DataType >::param_type  rhs)
inline

Definition at line 343 of file NekPoint.hpp.

344  {
345  for(unsigned int i = 0; i < dim::Value; ++i)
346  {
347  m_data[i] /= rhs;
348  }
349  return *this;
350  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
NekPoint<DataType>& Nektar::NekPoint< data_type >::operator= ( const NekPoint< DataType > &  rhs)
inline

Definition at line 121 of file NekPoint.hpp.

122  {
123  for(unsigned int i = 0; i < dim::Value; ++i)
124  {
125  m_data[i] = rhs.m_data[i];
126  }
127  return *this;
128  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
bool Nektar::NekPoint< data_type >::operator== ( const NekPoint< DataType > &  rhs) const
inline

Definition at line 259 of file NekPoint.hpp.

260  {
261  for(unsigned int i = 0; i < dim::Value; ++i)
262  {
263  // If you get a compile error here then you have to
264  // add a != operator to the DataType class.
265  if( m_data[i] != rhs.m_data[i] )
266  {
267  return false;
268  }
269  }
270  return true;
271  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
boost::call_traits<DataType>::reference Nektar::NekPoint< data_type >::operator[] ( unsigned int  i)
inline

Definition at line 154 of file NekPoint.hpp.

155  {
156  return m_data[i];
157  }
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::operator[] ( unsigned int  i) const
inline

Definition at line 159 of file NekPoint.hpp.

160  {
161  return m_data[i];
162  }
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::r ( ) const
inline

Definition at line 200 of file NekPoint.hpp.

201  {
202  BOOST_STATIC_ASSERT(dim::Value >= 1);
203  return m_data[0];
204  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::s ( ) const
inline

Definition at line 206 of file NekPoint.hpp.

207  {
208  BOOST_STATIC_ASSERT(dim::Value >= 2);
209  return (*this)[1];
210  }
static const unsigned int Value
template<typename data_type>
void Nektar::NekPoint< data_type >::SetX ( typename boost::call_traits< DataType >::const_reference  val)
inline

Definition at line 218 of file NekPoint.hpp.

Referenced by Nektar::MultiRegions::ExpList::GetExpIndex().

219  {
220  BOOST_STATIC_ASSERT(dim::Value >= 1);
221  m_data[0] = val;
222  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
void Nektar::NekPoint< data_type >::SetY ( typename boost::call_traits< DataType >::const_reference  val)
inline

Definition at line 224 of file NekPoint.hpp.

Referenced by Nektar::MultiRegions::ExpList::GetExpIndex().

225  {
226  BOOST_STATIC_ASSERT(dim::Value >= 2);
227  m_data[1] = val;
228  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
void Nektar::NekPoint< data_type >::SetZ ( typename boost::call_traits< DataType >::const_reference  val)
inline

Definition at line 230 of file NekPoint.hpp.

Referenced by Nektar::MultiRegions::ExpList::GetExpIndex().

231  {
232  BOOST_STATIC_ASSERT(dim::Value >= 2);
233  m_data[2] = val;
234  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::t ( ) const
inline

Definition at line 212 of file NekPoint.hpp.

213  {
214  BOOST_STATIC_ASSERT(dim::Value >= 3);
215  return (*this)[2];
216  }
static const unsigned int Value
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::x ( ) const
inline

Definition at line 164 of file NekPoint.hpp.

Referenced by Nektar::SpatialDomains::PointGeom::dist(), Nektar::SpatialDomains::PointGeom::dot(), and Nektar::NekPoint< NekDouble >::NekPoint().

165  {
166  BOOST_STATIC_ASSERT(dim::Value >= 1);
167  return m_data[0];
168  }
static const unsigned int Value
DataType m_data[dim::Value]
Definition: NekPoint.hpp:368
template<typename data_type>
boost::call_traits<DataType>::reference Nektar::NekPoint< data_type >::x ( )
inline

Definition at line 236 of file NekPoint.hpp.

237  {
238  BOOST_STATIC_ASSERT(dim::Value >= 1);
239  return (*this)(0);
240  }
static const unsigned int Value
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::y ( ) const
inline

Definition at line 170 of file NekPoint.hpp.

Referenced by Nektar::SpatialDomains::PointGeom::dist(), Nektar::SpatialDomains::PointGeom::dot(), and Nektar::NekPoint< NekDouble >::NekPoint().

171  {
172  BOOST_STATIC_ASSERT(dim::Value >= 2);
173  return (*this)[1];
174  }
static const unsigned int Value
template<typename data_type>
boost::call_traits<DataType>::reference Nektar::NekPoint< data_type >::y ( )
inline

Definition at line 242 of file NekPoint.hpp.

243  {
244  BOOST_STATIC_ASSERT(dim::Value >= 2);
245  return (*this)(1);
246  }
static const unsigned int Value
template<typename data_type>
boost::call_traits<DataType>::const_reference Nektar::NekPoint< data_type >::z ( ) const
inline

Definition at line 176 of file NekPoint.hpp.

Referenced by Nektar::SpatialDomains::PointGeom::dist(), Nektar::SpatialDomains::PointGeom::dot(), and Nektar::NekPoint< NekDouble >::NekPoint().

177  {
178  BOOST_STATIC_ASSERT(dim::Value >= 3);
179  return (*this)[2];
180  }
static const unsigned int Value
template<typename data_type>
boost::call_traits<DataType>::reference Nektar::NekPoint< data_type >::z ( )
inline

Definition at line 248 of file NekPoint.hpp.

249  {
250  BOOST_STATIC_ASSERT(dim::Value >= 3);
251  return (*this)(2);
252  }
static const unsigned int Value

Member Data Documentation

template<typename data_type>
DataType Nektar::NekPoint< data_type >::m_data[dim::Value]
private