Nektar++
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Nektar::NekVector< DataType > Class Template Reference

#include <NekVector.hpp>

Public Types

typedef DataType * iterator
 
typedef const DataType * const_iterator
 

Public Member Functions

 NekVector ()
 Creates an empty vector. More...
 
 NekVector (unsigned int size)
 Creates a vector of given size. The elements are not initialized. More...
 
 NekVector (unsigned int size, typename boost::call_traits< DataType >::const_reference a)
 Creates a vector with given size and initial value. More...
 
 NekVector (const std::string &vectorValues)
 
 NekVector (typename boost::call_traits< DataType >::const_reference x, typename boost::call_traits< DataType >::const_reference y, typename boost::call_traits< DataType >::const_reference z)
 
 NekVector (const NekVector< DataType > &rhs)
 
 NekVector (unsigned int size, const DataType *const ptr)
 
 NekVector (const Array< OneD, DataType > &ptr, PointerWrapper h=eCopy)
 
 NekVector (unsigned int size, Array< OneD, DataType > &ptr, PointerWrapper h=eCopy)
 
 NekVector (unsigned int size, const Array< OneD, const DataType > &ptr, PointerWrapper h=eCopy)
 
 ~NekVector ()
 
NekVector< DataType > & operator= (const NekVector< DataType > &rhs)
 
unsigned int GetDimension () const
 Returns the number of dimensions for the point. More...
 
unsigned int GetRows () const
 
DataType * GetRawPtr ()
 
Array< OneD, DataType > & GetPtr ()
 
const DataType * GetRawPtr () const
 
const Array< OneD, const DataType > & GetPtr () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
boost::call_traits< DataType >::reference operator() (unsigned int i)
 Returns i^{th} element. More...
 
boost::call_traits< DataType >::reference operator[] (unsigned int i)
 
boost::call_traits< DataType >::reference x ()
 
boost::call_traits< DataType >::reference y ()
 
boost::call_traits< DataType >::reference z ()
 
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)
 
NekVector< DataType > & operator+= (const NekVector< DataType > &rhs)
 
NekVector< DataType > & operator-= (const NekVector< DataType > &rhs)
 
NekVector< DataType > & operator*= (typename boost::call_traits< DataType >::const_reference rhs)
 
NekVector< DataType > & operator/= (typename boost::call_traits< DataType >::const_reference rhs)
 
void Normalize ()
 
boost::call_traits< DataType >::const_reference operator() (unsigned int i) const
 
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
 
NekVector< DataType > operator- () const
 
DataType Magnitude () const
 
DataType Dot (const NekVector< DataType > &rhs) const
 
NekVector< DataType > Cross (const NekVector< DataType > &rhs) const
 
std::string AsString () const
 
DataType L1Norm () const
 
DataType L2Norm () const
 
DataType InfinityNorm () const
 
PointerWrapper GetWrapperType () const
 

Protected Member Functions

Array< OneD, DataType > & GetData ()
 
void SetSize (unsigned int s)
 
void SetWrapperType (PointerWrapper p)
 
void SetData (const Array< OneD, DataType > &newData)
 
void Resize (unsigned int newSize)
 

Private Member Functions

 NekVector (const Array< OneD, const DataType > &ptr, PointerWrapper h)
 

Private Attributes

unsigned int m_size
 
Array< OneD, DataType > m_data
 
PointerWrapper m_wrapperType
 

Detailed Description

template<typename DataType>
class Nektar::NekVector< DataType >

Definition at line 56 of file NekVector.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename DataType>
typedef const DataType* Nektar::NekVector< DataType >::const_iterator

Definition at line 105 of file NekVector.hpp.

◆ iterator

template<typename DataType>
typedef DataType* Nektar::NekVector< DataType >::iterator

Definition at line 101 of file NekVector.hpp.

Constructor & Destructor Documentation

◆ NekVector() [1/11]

template<typename DataType >
Nektar::NekVector< DataType >::NekVector ( )

Creates an empty vector.

Definition at line 41 of file NekVector.cpp.

41  :
42  m_size(0),
43  m_data(),
45  {
46  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185

◆ NekVector() [2/11]

template<typename DataType >
Nektar::NekVector< DataType >::NekVector ( unsigned int  size)
explicit

Creates a vector of given size. The elements are not initialized.

Definition at line 49 of file NekVector.cpp.

49  :
50  m_size(size),
51  m_data(size),
53  {
54  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185

◆ NekVector() [3/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( unsigned int  size,
typename boost::call_traits< DataType >::const_reference  a 
)

Creates a vector with given size and initial value.

Definition at line 57 of file NekVector.cpp.

57  :
58  m_size(size),
59  m_data(size),
61  {
62  std::fill_n(m_data.get(), m_size, a);
63  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185

◆ NekVector() [4/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( const std::string &  vectorValues)
explicit

Definition at line 66 of file NekVector.cpp.

66  :
67  m_size(0),
68  m_data(),
70  {
71  try
72  {
73  std::vector<DataType> values = FromString<DataType>(vectorValues);
74  m_size = values.size();
75  m_data = Array<OneD, DataType>(m_size);
76  std::copy(values.begin(), values.end(), m_data.begin());
77 
78  ASSERTL0(m_size > 0, "Error converting string values to vector");
79  }
80  catch(std::runtime_error& e)
81  {
82  NEKERROR(ErrorUtil::efatal, e.what());
83  }
84  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
unsigned int m_size
Definition: NekVector.hpp:183
def copy(self)
Definition: pycml.py:2663
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185
Array< OneD, const DataType >::const_iterator begin() const

◆ NekVector() [5/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( typename boost::call_traits< DataType >::const_reference  x,
typename boost::call_traits< DataType >::const_reference  y,
typename boost::call_traits< DataType >::const_reference  z 
)

Definition at line 87 of file NekVector.cpp.

89  :
90  m_size(3),
91  m_data(m_size),
93  {
94  m_data[0] = x;
95  m_data[1] = y;
96  m_data[2] = z;
97  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
boost::call_traits< DataType >::reference x()
Definition: NekVector.cpp:265
unsigned int m_size
Definition: NekVector.hpp:183
boost::call_traits< DataType >::reference z()
Definition: NekVector.cpp:279
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185
boost::call_traits< DataType >::reference y()
Definition: NekVector.cpp:272

◆ NekVector() [6/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( const NekVector< DataType > &  rhs)

Definition at line 100 of file NekVector.cpp.

100  :
101  m_size(rhs.GetDimension()),
102  m_data(rhs.m_data),
103  m_wrapperType(rhs.m_wrapperType)
104  {
105  if( m_wrapperType == eCopy )
106  {
107  m_data = Array<OneD, DataType>(m_size);
108  std::copy(rhs.begin(), rhs.end(), m_data.get());
109  }
110  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
def copy(self)
Definition: pycml.py:2663
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ NekVector() [7/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( unsigned int  size,
const DataType *const  ptr 
)

Definition at line 113 of file NekVector.cpp.

113  :
114  m_size(size),
115  m_data(size, ptr),
117  {
118  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185

◆ NekVector() [8/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( const Array< OneD, DataType > &  ptr,
PointerWrapper  h = eCopy 
)
explicit

Definition at line 121 of file NekVector.cpp.

121  :
122  m_size(ptr.num_elements()),
123  m_data(ptr),
124  m_wrapperType(h)
125  {
126  if( h == eCopy )
127  {
128  m_data = Array<OneD, DataType>(m_size);
129  CopyArray(ptr, m_data);
130  }
131  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
void CopyArray(const Array< OneD, ConstDataType > &source, Array< OneD, DataType > &dest)
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185

◆ NekVector() [9/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( unsigned int  size,
Array< OneD, DataType > &  ptr,
PointerWrapper  h = eCopy 
)

Definition at line 134 of file NekVector.cpp.

134  :
135  m_size(size),
136  m_data(ptr),
137  m_wrapperType(h)
138  {
139  if( h == eCopy )
140  {
141  ASSERTL0(size <= ptr.num_elements(), "Attempting to populate a vector of size " +
142  std::to_string(size) + " but the incoming array only has " +
143  std::to_string(ptr.num_elements()) + " elements.");
144 
145  m_data = Array<OneD, DataType>(size);
146  std::copy(ptr.begin(), ptr.begin()+size, m_data.begin());
147  }
148  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
def copy(self)
Definition: pycml.py:2663
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185
Array< OneD, const DataType >::const_iterator begin() const

◆ NekVector() [10/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( unsigned int  size,
const Array< OneD, const DataType > &  ptr,
PointerWrapper  h = eCopy 
)

Definition at line 164 of file NekVector.cpp.

164  :
165  m_size(size),
166  m_data(ptr, eVECTOR_WRAPPER),
167  m_wrapperType(h)
168  {
169  if( h == eCopy )
170  {
171  ASSERTL0(size <= ptr.num_elements(), "Attempting to populate a vector of size " +
172  std::to_string(size) + " but the incoming array only has " +
173  std::to_string(ptr.num_elements()) + " elements.");
174 
175  m_data = Array<OneD, DataType>(size);
176  std::copy(ptr.begin(), ptr.begin()+size, m_data.begin());
177  }
178  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
def copy(self)
Definition: pycml.py:2663
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185
Array< OneD, const DataType >::const_iterator begin() const

◆ ~NekVector()

template<typename DataType >
Nektar::NekVector< DataType >::~NekVector ( )

Definition at line 181 of file NekVector.cpp.

181 {}

◆ NekVector() [11/11]

template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( const Array< OneD, const DataType > &  ptr,
PointerWrapper  h 
)
private

Definition at line 151 of file NekVector.cpp.

151  :
152  m_size(ptr.num_elements()),
153  m_data(ptr, eVECTOR_WRAPPER),
154  m_wrapperType(h)
155  {
156  if( h == eCopy )
157  {
158  m_data = Array<OneD, DataType>(m_size);
159  CopyArray(ptr, m_data);
160  }
161  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
void CopyArray(const Array< OneD, ConstDataType > &source, Array< OneD, DataType > &dest)
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185

Member Function Documentation

◆ AsString()

template<typename DataType >
std::string Nektar::NekVector< DataType >::AsString ( ) const

Definition at line 388 of file NekVector.cpp.

Referenced by Nektar::operator-(), and Nektar::operator<<().

388 { return Nektar::AsString(*this); }
std::string AsString(const NekVector< DataType > &v)
Definition: NekVector.cpp:1042

◆ begin() [1/2]

template<typename DataType >
NekVector< DataType >::iterator Nektar::NekVector< DataType >::begin ( )

◆ begin() [2/2]

template<typename DataType >
NekVector< DataType >::const_iterator Nektar::NekVector< DataType >::begin ( ) const

Definition at line 245 of file NekVector.cpp.

245 { return GetRawPtr(); }
DataType * GetRawPtr()
Definition: NekVector.cpp:221

◆ Cross()

template<typename DataType>
NekVector< DataType > Nektar::NekVector< DataType >::Cross ( const NekVector< DataType > &  rhs) const

Definition at line 382 of file NekVector.cpp.

Referenced by Nektar::operator-().

383  {
384  return Nektar::Cross(*this, rhs);
385  }
NekVector< DataType > Cross(const NekVector< DataType > &lhs, const NekVector< DataType > &rhs)
Definition: NekVector.cpp:1025
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ Dot()

template<typename DataType>
DataType Nektar::NekVector< DataType >::Dot ( const NekVector< DataType > &  rhs) const

Definition at line 379 of file NekVector.cpp.

Referenced by Nektar::operator-().

379 { return Nektar::Dot(*this, rhs); }
DataType Dot(const NekVector< DataType > &lhs, const NekVector< DataType > &rhs)
Definition: NekVector.cpp:989
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ end() [1/2]

template<typename DataType >
NekVector< DataType >::iterator Nektar::NekVector< DataType >::end ( )

◆ end() [2/2]

template<typename DataType >
NekVector< DataType >::const_iterator Nektar::NekVector< DataType >::end ( ) const

Definition at line 248 of file NekVector.cpp.

248 { return GetRawPtr() + GetDimension(); }
DataType * GetRawPtr()
Definition: NekVector.cpp:221
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209

◆ GetData()

template<typename DataType >
Array< OneD, DataType > & Nektar::NekVector< DataType >::GetData ( )
protected

Definition at line 404 of file NekVector.cpp.

404 { return m_data; }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184

◆ GetDimension()

template<typename DataType >
unsigned int Nektar::NekVector< DataType >::GetDimension ( ) const

◆ GetPtr() [1/2]

template<typename DataType >
Array< OneD, DataType > & Nektar::NekVector< DataType >::GetPtr ( )

◆ GetPtr() [2/2]

template<typename DataType >
const Array< OneD, const DataType > & Nektar::NekVector< DataType >::GetPtr ( ) const

Definition at line 236 of file NekVector.cpp.

236 { return m_data; }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184

◆ GetRawPtr() [1/2]

template<typename DataType >
DataType * Nektar::NekVector< DataType >::GetRawPtr ( )

◆ GetRawPtr() [2/2]

template<typename DataType >
const DataType * Nektar::NekVector< DataType >::GetRawPtr ( ) const

Definition at line 230 of file NekVector.cpp.

231  {
232  return m_data.get();
233  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184

◆ GetRows()

template<typename DataType >
unsigned int Nektar::NekVector< DataType >::GetRows ( ) const

◆ GetWrapperType()

template<typename DataType >
PointerWrapper Nektar::NekVector< DataType >::GetWrapperType ( ) const

Definition at line 401 of file NekVector.cpp.

401 { return m_wrapperType; }
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185

◆ InfinityNorm()

template<typename DataType >
DataType Nektar::NekVector< DataType >::InfinityNorm ( ) const

Definition at line 398 of file NekVector.cpp.

Referenced by Nektar::operator-().

398 { return Nektar::InfinityNorm(*this); }
DataType InfinityNorm(const NekVector< DataType > &v)
Definition: NekVector.cpp:929

◆ L1Norm()

template<typename DataType >
DataType Nektar::NekVector< DataType >::L1Norm ( ) const

Definition at line 392 of file NekVector.cpp.

Referenced by Nektar::operator-().

392 { return Nektar::L1Norm(*this); }
DataType L1Norm(const NekVector< DataType > &v)
Definition: NekVector.cpp:895

◆ L2Norm()

template<typename DataType >
DataType Nektar::NekVector< DataType >::L2Norm ( ) const

Definition at line 395 of file NekVector.cpp.

Referenced by Nektar::operator-().

395 { return Nektar::L2Norm(*this); }
DataType L2Norm(const NekVector< DataType > &v)
Definition: NekVector.cpp:912

◆ Magnitude()

template<typename DataType >
DataType Nektar::NekVector< DataType >::Magnitude ( ) const

Definition at line 376 of file NekVector.cpp.

Referenced by Nektar::Normalize(), and Nektar::operator-().

376 { return Nektar::Magnitude(*this); }
DataType Magnitude(const NekVector< DataType > &v)
Definition: NekVector.cpp:973

◆ Normalize()

template<typename DataType >
void Nektar::NekVector< DataType >::Normalize ( )

Definition at line 335 of file NekVector.cpp.

Referenced by Nektar::operator-().

335 { return Nektar::Normalize(*this); }
void Normalize(NekVector< DataType > &v)
Definition: NekVector.cpp:1009

◆ operator()() [1/2]

template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::operator() ( unsigned int  i)

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 251 of file NekVector.cpp.

252  {
253  ASSERTL1(i < this->GetDimension(),
254  "Invalid access to m_data via parenthesis operator");
255  return this->GetData()[i];
256  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:404
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ operator()() [2/2]

template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::operator() ( unsigned int  i) const

Definition at line 338 of file NekVector.cpp.

339  {
340  ASSERTL1(i < GetDimension(),
341  "Invalid access to m_data via parenthesis operator");
342  return m_data[i];
343  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ operator*=()

template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator*= ( typename boost::call_traits< DataType >::const_reference  rhs)

Definition at line 321 of file NekVector.cpp.

322  {
323  MultiplyEqual(*this, rhs);
324  return *this;
325  }
void MultiplyEqual(NekMatrix< LhsDataType, StandardMatrixTag > &lhs, typename boost::call_traits< LhsDataType >::const_reference rhs)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ operator+=()

template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator+= ( const NekVector< DataType > &  rhs)

Definition at line 307 of file NekVector.cpp.

308  {
309  AddEqual(*this, rhs);
310  return *this;
311  }
RhsMatrixType void AddEqual(NekMatrix< DataType, StandardMatrixTag > &result, const NekMatrix< RhsDataType, RhsMatrixType > &rhs)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ operator-()

template<typename DataType >
NekVector< DataType > Nektar::NekVector< DataType >::operator- ( ) const

Definition at line 373 of file NekVector.cpp.

373 { return Negate(*this); }
NekVector< DataType > Negate(const NekVector< DataType > &v)
Definition: NekVector.cpp:944

◆ operator-=()

template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator-= ( const NekVector< DataType > &  rhs)

Definition at line 314 of file NekVector.cpp.

315  {
316  SubtractEqual(*this, rhs);
317  return *this;
318  }
DNekMat void SubtractEqual(NekMatrix< DataType, StandardMatrixTag > &result, const NekMatrix< RhsDataType, RhsMatrixType > &rhs)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ operator/=()

template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator/= ( typename boost::call_traits< DataType >::const_reference  rhs)

Definition at line 328 of file NekVector.cpp.

329  {
330  DivideEqual(*this, rhs);
331  return *this;
332  }
void DivideEqual(NekVector< ResultDataType > &result, const NekDouble &rhs)
Definition: NekVector.cpp:621
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ operator=()

template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator= ( const NekVector< DataType > &  rhs)

Definition at line 184 of file NekVector.cpp.

185  {
186  if( m_wrapperType == eCopy )
187  {
188  // If the current vector is a copy, then regardless of the rhs type
189  // we just copy over the values, resizing if needed.
190  if( GetDimension() != rhs.GetDimension() )
191  {
192  m_size = rhs.GetDimension();
193  m_data = Array<OneD, DataType>(m_size);
194  }
195  }
196  else if( m_wrapperType == eWrapper )
197  {
198  // If the current vector is wrapped, then just copy over the top,
199  // but the sizes of the two vectors must be the same.
200  ASSERTL0(GetDimension() == rhs.GetDimension(), "Wrapped NekVectors must have the same dimension in operator=");
201  }
202 
203  std::copy(rhs.begin(), rhs.end(), m_data.get());
204  return *this;
205  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
def copy(self)
Definition: pycml.py:2663
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
PointerWrapper m_wrapperType
Definition: NekVector.hpp:185
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ operator[]() [1/2]

template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::operator[] ( unsigned int  i)

Definition at line 259 of file NekVector.cpp.

260  {
261  return this->GetData()[i];
262  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:404

◆ operator[]() [2/2]

template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::operator[] ( unsigned int  i) const

Definition at line 346 of file NekVector.cpp.

347  {
348  return m_data[i];
349  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184

◆ Resize()

template<typename DataType >
void Nektar::NekVector< DataType >::Resize ( unsigned int  newSize)
protected

Definition at line 416 of file NekVector.cpp.

417  {
418  if(m_data.num_elements() < newSize )
419  {
420  m_data = Array<OneD, DataType>(newSize);
421  }
422  m_size = newSize;
423  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184
unsigned int m_size
Definition: NekVector.hpp:183
size_t num_elements() const
Returns the array&#39;s size.

◆ SetData()

template<typename DataType>
void Nektar::NekVector< DataType >::SetData ( const Array< OneD, DataType > &  newData)
protected

Definition at line 413 of file NekVector.cpp.

413 { m_data = newData; }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:184

◆ SetSize()

template<typename DataType >
void Nektar::NekVector< DataType >::SetSize ( unsigned int  s)
protected

Definition at line 407 of file NekVector.cpp.

407 { m_size = s; }
unsigned int m_size
Definition: NekVector.hpp:183

◆ SetWrapperType()

template<typename DataType >
void Nektar::NekVector< DataType >::SetWrapperType ( PointerWrapper  p)
protected

Definition at line 410 of file NekVector.cpp.

◆ SetX()

template<typename DataType>
void Nektar::NekVector< DataType >::SetX ( typename boost::call_traits< DataType >::const_reference  val)

Definition at line 286 of file NekVector.cpp.

287  {
288  ASSERTL1(this->GetDimension() >= 1, "Invalid use of NekVector::SetX");
289  this->GetData()[0] = val;
290  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:404
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ SetY()

template<typename DataType>
void Nektar::NekVector< DataType >::SetY ( typename boost::call_traits< DataType >::const_reference  val)

Definition at line 293 of file NekVector.cpp.

294  {
295  ASSERTL1(this->GetDimension() >= 2, "Invalid use of NekVector::SetX");
296  this->GetData()[1] = val;
297  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:404
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ SetZ()

template<typename DataType>
void Nektar::NekVector< DataType >::SetZ ( typename boost::call_traits< DataType >::const_reference  val)

Definition at line 300 of file NekVector.cpp.

301  {
302  ASSERTL1(this->GetDimension() >= 3, "Invalid use of NekVector::SetX");
303  this->GetData()[2] = val;
304  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:404
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ x() [1/2]

template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::x ( )

Definition at line 265 of file NekVector.cpp.

Referenced by Nektar::Cross().

266  {
267  ASSERTL1(this->GetDimension() >= 1, "Invalid use of NekVector::x");
268  return (*this)(0);
269  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ x() [2/2]

template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::x ( ) const

Definition at line 352 of file NekVector.cpp.

353  {
354  ASSERTL1( GetDimension() >= 1, "Invalid use of NekVector::x");
355  return (*this)(0);
356  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ y() [1/2]

template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::y ( )

Definition at line 272 of file NekVector.cpp.

Referenced by Nektar::Cross().

273  {
274  ASSERTL1(this->GetDimension() >= 2, "Invalid use of NekVector::y");
275  return (*this)(1);
276  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ y() [2/2]

template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::y ( ) const

Definition at line 359 of file NekVector.cpp.

360  {
361  ASSERTL1( GetDimension() >= 2, "Invalid use of NekVector::y");
362  return (*this)(1);
363  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ z() [1/2]

template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::z ( )

Definition at line 279 of file NekVector.cpp.

Referenced by Nektar::Cross().

280  {
281  ASSERTL1(this->GetDimension() >= 3, "Invalid use of NekVector::z");
282  return (*this)(2);
283  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ z() [2/2]

template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::z ( ) const

Definition at line 366 of file NekVector.cpp.

367  {
368  ASSERTL1( GetDimension() >= 3, "Invalid use of NekVector::z");
369  return (*this)(2);
370  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:209
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

Member Data Documentation

◆ m_data

template<typename DataType>
Array<OneD, DataType> Nektar::NekVector< DataType >::m_data
private

Definition at line 184 of file NekVector.hpp.

◆ m_size

template<typename DataType>
unsigned int Nektar::NekVector< DataType >::m_size
private

Definition at line 183 of file NekVector.hpp.

◆ m_wrapperType

template<typename DataType>
PointerWrapper Nektar::NekVector< DataType >::m_wrapperType
private

Definition at line 185 of file NekVector.hpp.