Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Nektar::NekVector< DataType > Singleton Reference

#include <NekVector.hpp>

Collaboration diagram for Nektar::NekVector< DataType >:
Collaboration graph
[legend]

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>
singleton Nektar::NekVector< DataType >

Definition at line 69 of file NekVector.hpp.

Member Typedef Documentation

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

Definition at line 154 of file NekVector.hpp.

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

Definition at line 150 of file NekVector.hpp.

Constructor & Destructor Documentation

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

Creates an empty vector.

Definition at line 44 of file NekVector.cpp.

44  :
45  m_size(0),
46  m_data(),
48  {
49  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
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 52 of file NekVector.cpp.

52  :
53  m_size(size),
54  m_data(size),
56  {
57  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
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 60 of file NekVector.cpp.

References Nektar::Array< OneD, DataType >::get(), Nektar::NekVector< DataType >::m_data, and Nektar::NekVector< DataType >::m_size.

60  :
61  m_size(size),
62  m_data(size),
64  {
65  std::fill_n(m_data.get(), m_size, a);
66  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( const std::string &  vectorValues)
explicit

Definition at line 69 of file NekVector.cpp.

References ASSERTL0, Nektar::Array< OneD, DataType >::begin(), ErrorUtil::efatal, Nektar::NekVector< DataType >::m_data, Nektar::NekVector< DataType >::m_size, and NEKERROR.

69  :
70  m_size(0),
71  m_data(),
73  {
74  try
75  {
76  std::vector<DataType> values = FromString<DataType>(vectorValues);
77  m_size = values.size();
78  m_data = Array<OneD, DataType>(m_size);
79  std::copy(values.begin(), values.end(), m_data.begin());
80 
81  ASSERTL0(m_size > 0, "Error converting string values to vector");
82  }
83  catch(std::runtime_error& e)
84  {
85  NEKERROR(ErrorUtil::efatal, e.what());
86  }
87  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:185
unsigned int m_size
Definition: NekVector.hpp:240
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
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 90 of file NekVector.cpp.

References Nektar::NekVector< DataType >::m_data, Nektar::NekVector< DataType >::x(), Nektar::NekVector< DataType >::y(), and Nektar::NekVector< DataType >::z().

92  :
93  m_size(3),
94  m_data(m_size),
96  {
97  m_data[0] = x;
98  m_data[1] = y;
99  m_data[2] = z;
100  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
boost::call_traits< DataType >::reference x()
Definition: NekVector.cpp:267
unsigned int m_size
Definition: NekVector.hpp:240
boost::call_traits< DataType >::reference z()
Definition: NekVector.cpp:281
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
boost::call_traits< DataType >::reference y()
Definition: NekVector.cpp:274
template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( const NekVector< DataType > &  rhs)

Definition at line 103 of file NekVector.cpp.

References Nektar::NekVector< DataType >::begin(), Nektar::eCopy, Nektar::NekVector< DataType >::end(), Nektar::Array< OneD, DataType >::get(), Nektar::NekVector< DataType >::m_data, Nektar::NekVector< DataType >::m_size, and Nektar::NekVector< DataType >::m_wrapperType.

103  :
104  m_size(rhs.GetDimension()),
105  m_data(rhs.m_data),
106  m_wrapperType(rhs.m_wrapperType)
107  {
108  if( m_wrapperType == eCopy )
109  {
110  m_data = Array<OneD, DataType>(m_size);
111  std::copy(rhs.begin(), rhs.end(), m_data.get());
112  }
113  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( unsigned int  size,
const DataType *const  ptr 
)

Definition at line 116 of file NekVector.cpp.

116  :
117  m_size(size),
118  m_data(size, ptr),
120  {
121  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( const Array< OneD, DataType > &  ptr,
PointerWrapper  h = eCopy 
)
explicit

Definition at line 124 of file NekVector.cpp.

References Nektar::CopyArray(), Nektar::eCopy, Nektar::NekVector< DataType >::m_data, and Nektar::NekVector< DataType >::m_size.

124  :
125  m_size(ptr.num_elements()),
126  m_data(ptr),
127  m_wrapperType(h)
128  {
129  if( h == eCopy )
130  {
131  m_data = Array<OneD, DataType>(m_size);
132  CopyArray(ptr, m_data);
133  }
134  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
void CopyArray(const Array< OneD, ConstDataType > &source, Array< OneD, DataType > &dest)
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( unsigned int  size,
Array< OneD, DataType > &  ptr,
PointerWrapper  h = eCopy 
)

Definition at line 137 of file NekVector.cpp.

References ASSERTL0, Nektar::Array< OneD, DataType >::begin(), Nektar::eCopy, Nektar::NekVector< DataType >::m_data, and Nektar::Array< OneD, const DataType >::num_elements().

137  :
138  m_size(size),
139  m_data(ptr),
140  m_wrapperType(h)
141  {
142  if( h == eCopy )
143  {
144  ASSERTL0(size <= ptr.num_elements(), "Attempting to populate a vector of size " +
145  boost::lexical_cast<std::string>(size) + " but the incoming array only has " +
146  boost::lexical_cast<std::string>(ptr.num_elements()) + " elements.");
147 
148  m_data = Array<OneD, DataType>(size);
149  std::copy(ptr.begin(), ptr.begin()+size, m_data.begin());
150  }
151  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType>
Nektar::NekVector< DataType >::NekVector ( unsigned int  size,
const Array< OneD, const DataType > &  ptr,
PointerWrapper  h = eCopy 
)

Definition at line 167 of file NekVector.cpp.

References ASSERTL0, Nektar::Array< OneD, const DataType >::begin(), Nektar::Array< OneD, DataType >::begin(), Nektar::eCopy, Nektar::NekVector< DataType >::m_data, and Nektar::Array< OneD, const DataType >::num_elements().

167  :
168  m_size(size),
169  m_data(ptr, eVECTOR_WRAPPER),
170  m_wrapperType(h)
171  {
172  if( h == eCopy )
173  {
174  ASSERTL0(size <= ptr.num_elements(), "Attempting to populate a vector of size " +
175  boost::lexical_cast<std::string>(size) + " but the incoming array only has " +
176  boost::lexical_cast<std::string>(ptr.num_elements()) + " elements.");
177 
178  m_data = Array<OneD, DataType>(size);
179  std::copy(ptr.begin(), ptr.begin()+size, m_data.begin());
180  }
181  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType >
Nektar::NekVector< DataType >::~NekVector ( )

Definition at line 184 of file NekVector.cpp.

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

Definition at line 154 of file NekVector.cpp.

References Nektar::CopyArray(), Nektar::eCopy, Nektar::NekVector< DataType >::m_data, and Nektar::NekVector< DataType >::m_size.

154  :
155  m_size(ptr.num_elements()),
156  m_data(ptr, eVECTOR_WRAPPER),
157  m_wrapperType(h)
158  {
159  if( h == eCopy )
160  {
161  m_data = Array<OneD, DataType>(m_size);
162  CopyArray(ptr, m_data);
163  }
164  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
void CopyArray(const Array< OneD, ConstDataType > &source, Array< OneD, DataType > &dest)
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242

Member Function Documentation

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

Definition at line 391 of file NekVector.cpp.

References Nektar::AsString().

391 { return Nektar::AsString(*this); }
std::string AsString(const NekVector< DataType > &v)
Definition: NekVector.cpp:1045
template<typename DataType >
NekVector< DataType >::iterator Nektar::NekVector< DataType >::begin ( )
template<typename DataType >
NekVector< DataType >::const_iterator Nektar::NekVector< DataType >::begin ( ) const

Definition at line 248 of file NekVector.cpp.

248 { return GetRawPtr(); }
DataType * GetRawPtr()
Definition: NekVector.cpp:224
template<typename DataType>
NekVector< DataType > Nektar::NekVector< DataType >::Cross ( const NekVector< DataType > &  rhs) const

Definition at line 385 of file NekVector.cpp.

References Nektar::Cross().

386  {
387  return Nektar::Cross(*this, rhs);
388  }
NekVector< DataType > Cross(const NekVector< DataType > &lhs, const NekVector< DataType > &rhs)
Definition: NekVector.cpp:1028
template<typename DataType>
DataType Nektar::NekVector< DataType >::Dot ( const NekVector< DataType > &  rhs) const

Definition at line 382 of file NekVector.cpp.

References Nektar::Dot().

382 { return Nektar::Dot(*this, rhs); }
DataType Dot(const NekVector< DataType > &lhs, const NekVector< DataType > &rhs)
Definition: NekVector.cpp:992
template<typename DataType >
NekVector< DataType >::iterator Nektar::NekVector< DataType >::end ( )

Definition at line 245 of file NekVector.cpp.

Referenced by Nektar::DiagonalBlockMatrixMultiply(), Nektar::L1Norm(), Nektar::L2Norm(), Nektar::NekVector< DataType >::NekVector(), Nektar::NekVector< DataType >::operator=(), and Nektar::operator==().

245 { return GetRawPtr() + this->GetDimension(); }
DataType * GetRawPtr()
Definition: NekVector.cpp:224
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
template<typename DataType >
NekVector< DataType >::const_iterator Nektar::NekVector< DataType >::end ( ) const

Definition at line 251 of file NekVector.cpp.

251 { return GetRawPtr() + GetDimension(); }
DataType * GetRawPtr()
Definition: NekVector.cpp:224
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
template<typename DataType >
Array< OneD, DataType > & Nektar::NekVector< DataType >::GetData ( )
protected

Definition at line 407 of file NekVector.cpp.

407 { return m_data; }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
template<typename DataType >
unsigned int Nektar::NekVector< DataType >::GetDimension ( ) const
template<typename DataType >
Array< OneD, DataType > & Nektar::NekVector< DataType >::GetPtr ( )
template<typename DataType >
const Array< OneD, const DataType > & Nektar::NekVector< DataType >::GetPtr ( ) const

Definition at line 239 of file NekVector.cpp.

239 { return m_data; }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
template<typename DataType >
DataType * Nektar::NekVector< DataType >::GetRawPtr ( )
template<typename DataType >
const DataType * Nektar::NekVector< DataType >::GetRawPtr ( ) const

Definition at line 233 of file NekVector.cpp.

234  {
235  return m_data.get();
236  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
template<typename DataType >
unsigned int Nektar::NekVector< DataType >::GetRows ( ) const
template<typename DataType >
PointerWrapper Nektar::NekVector< DataType >::GetWrapperType ( ) const

Definition at line 404 of file NekVector.cpp.

404 { return m_wrapperType; }
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType >
DataType Nektar::NekVector< DataType >::InfinityNorm ( ) const

Definition at line 401 of file NekVector.cpp.

References Nektar::InfinityNorm().

401 { return Nektar::InfinityNorm(*this); }
DataType InfinityNorm(const NekVector< DataType > &v)
Definition: NekVector.cpp:932
template<typename DataType >
DataType Nektar::NekVector< DataType >::L1Norm ( ) const

Definition at line 395 of file NekVector.cpp.

References Nektar::L1Norm().

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

Definition at line 398 of file NekVector.cpp.

References Nektar::L2Norm().

398 { return Nektar::L2Norm(*this); }
DataType L2Norm(const NekVector< DataType > &v)
Definition: NekVector.cpp:915
template<typename DataType >
DataType Nektar::NekVector< DataType >::Magnitude ( ) const

Definition at line 379 of file NekVector.cpp.

References Nektar::Magnitude().

Referenced by Nektar::Normalize().

379 { return Nektar::Magnitude(*this); }
DataType Magnitude(const NekVector< DataType > &v)
Definition: NekVector.cpp:976
template<typename DataType >
void Nektar::NekVector< DataType >::Normalize ( )

Definition at line 337 of file NekVector.cpp.

References Nektar::Normalize().

337 { return Nektar::Normalize(*this); }
void Normalize(NekVector< DataType > &v)
Definition: NekVector.cpp:1012
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 254 of file NekVector.cpp.

References ASSERTL1.

255  {
256  ASSERTL1((i >= 0) && (i < this->GetDimension()), "Invalid access to m_data via parenthesis operator");
257  return this->GetData()[i];
258  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:407
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::operator() ( unsigned int  i) const

Definition at line 340 of file NekVector.cpp.

References ASSERTL1.

341  {
342  ASSERTL1(( i >= 0) && (i < GetDimension()), "Invalid access to m_data via parenthesis operator");
343  return m_data[i];
344  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator*= ( typename boost::call_traits< DataType >::const_reference  rhs)

Definition at line 323 of file NekVector.cpp.

References Nektar::MultiplyEqual().

324  {
325  MultiplyEqual(*this, rhs);
326  return *this;
327  }
void MultiplyEqual(NekMatrix< LhsDataType, StandardMatrixTag > &lhs, typename boost::call_traits< LhsDataType >::const_reference rhs)
template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator+= ( const NekVector< DataType > &  rhs)

Definition at line 309 of file NekVector.cpp.

References Nektar::AddEqual().

310  {
311  AddEqual(*this, rhs);
312  return *this;
313  }
RhsMatrixType void AddEqual(NekMatrix< DataType, StandardMatrixTag > &result, const NekMatrix< RhsDataType, RhsMatrixType > &rhs)
template<typename DataType >
NekVector< DataType > Nektar::NekVector< DataType >::operator- ( ) const

Definition at line 375 of file NekVector.cpp.

References Nektar::Negate().

375 { return Negate(*this); }
NekVector< DataType > Negate(const NekVector< DataType > &v)
Definition: NekVector.cpp:947
template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator-= ( const NekVector< DataType > &  rhs)

Definition at line 316 of file NekVector.cpp.

References Nektar::SubtractEqual().

317  {
318  SubtractEqual(*this, rhs);
319  return *this;
320  }
DNekMat void SubtractEqual(NekMatrix< DataType, StandardMatrixTag > &result, const NekMatrix< RhsDataType, RhsMatrixType > &rhs)
template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator/= ( typename boost::call_traits< DataType >::const_reference  rhs)

Definition at line 330 of file NekVector.cpp.

References Nektar::DivideEqual().

331  {
332  DivideEqual(*this, rhs);
333  return *this;
334  }
void DivideEqual(NekVector< ResultDataType > &result, const NekDouble &rhs)
Definition: NekVector.cpp:624
template<typename DataType>
NekVector< DataType > & Nektar::NekVector< DataType >::operator= ( const NekVector< DataType > &  rhs)

Definition at line 187 of file NekVector.cpp.

References ASSERTL0, Nektar::NekVector< DataType >::begin(), Nektar::eCopy, Nektar::NekVector< DataType >::end(), Nektar::eWrapper, and Nektar::NekVector< DataType >::GetDimension().

188  {
189  if( m_wrapperType == eCopy )
190  {
191  // If the current vector is a copy, then regardless of the rhs type
192  // we just copy over the values, resizing if needed.
193  if( GetDimension() != rhs.GetDimension() )
194  {
195  m_size = rhs.GetDimension();
196  m_data = Array<OneD, DataType>(m_size);
197  }
198  }
199  else if( m_wrapperType == eWrapper )
200  {
201  // If the current vector is wrapped, then just copy over the top,
202  // but the sizes of the two vectors must be the same.
203  ASSERTL0(GetDimension() == rhs.GetDimension(), "Wrapped NekVectors must have the same dimension in operator=");
204  }
205 
206  std::copy(rhs.begin(), rhs.end(), m_data.get());
207  return *this;
208  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::operator[] ( unsigned int  i)

Definition at line 261 of file NekVector.cpp.

262  {
263  return this->GetData()[i];
264  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:407
template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::operator[] ( unsigned int  i) const

Definition at line 347 of file NekVector.cpp.

348  {
349  return m_data[i];
350  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
template<typename DataType >
void Nektar::NekVector< DataType >::Resize ( unsigned int  newSize)
protected

Definition at line 419 of file NekVector.cpp.

420  {
421  if(m_data.num_elements() < newSize )
422  {
423  m_data = Array<OneD, DataType>(newSize);
424  }
425  m_size = newSize;
426  }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
unsigned int m_size
Definition: NekVector.hpp:240
size_type num_elements() const
Returns the array's size.
template<typename DataType>
void Nektar::NekVector< DataType >::SetData ( const Array< OneD, DataType > &  newData)
protected

Definition at line 416 of file NekVector.cpp.

416 { m_data = newData; }
Array< OneD, DataType > m_data
Definition: NekVector.hpp:241
template<typename DataType >
void Nektar::NekVector< DataType >::SetSize ( unsigned int  s)
protected

Definition at line 410 of file NekVector.cpp.

410 { m_size = s; }
unsigned int m_size
Definition: NekVector.hpp:240
template<typename DataType >
void Nektar::NekVector< DataType >::SetWrapperType ( PointerWrapper  p)
protected

Definition at line 413 of file NekVector.cpp.

413 { m_wrapperType = p; }
PointerWrapper m_wrapperType
Definition: NekVector.hpp:242
template<typename DataType>
void Nektar::NekVector< DataType >::SetX ( typename boost::call_traits< DataType >::const_reference  val)

Definition at line 288 of file NekVector.cpp.

References ASSERTL1.

289  {
290  ASSERTL1(this->GetDimension() >= 1, "Invalid use of NekVector::SetX");
291  this->GetData()[0] = val;
292  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:407
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType>
void Nektar::NekVector< DataType >::SetY ( typename boost::call_traits< DataType >::const_reference  val)

Definition at line 295 of file NekVector.cpp.

References ASSERTL1.

296  {
297  ASSERTL1(this->GetDimension() >= 2, "Invalid use of NekVector::SetX");
298  this->GetData()[1] = val;
299  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:407
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType>
void Nektar::NekVector< DataType >::SetZ ( typename boost::call_traits< DataType >::const_reference  val)

Definition at line 302 of file NekVector.cpp.

References ASSERTL1.

303  {
304  ASSERTL1(this->GetDimension() >= 3, "Invalid use of NekVector::SetX");
305  this->GetData()[2] = val;
306  }
Array< OneD, DataType > & GetData()
Definition: NekVector.cpp:407
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::x ( )

Definition at line 267 of file NekVector.cpp.

References ASSERTL1.

Referenced by Nektar::Cross(), and Nektar::NekVector< DataType >::NekVector().

268  {
269  ASSERTL1(this->GetDimension() >= 1, "Invalid use of NekVector::x");
270  return (*this)(0);
271  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::x ( ) const

Definition at line 353 of file NekVector.cpp.

References ASSERTL1.

354  {
355  ASSERTL1( GetDimension() >= 1, "Invalid use of NekVector::x");
356  return (*this)(0);
357  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::y ( )

Definition at line 274 of file NekVector.cpp.

References ASSERTL1.

Referenced by Nektar::Cross(), and Nektar::NekVector< DataType >::NekVector().

275  {
276  ASSERTL1(this->GetDimension() >= 2, "Invalid use of NekVector::y");
277  return (*this)(1);
278  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::y ( ) const

Definition at line 360 of file NekVector.cpp.

References ASSERTL1.

361  {
362  ASSERTL1( GetDimension() >= 2, "Invalid use of NekVector::y");
363  return (*this)(1);
364  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType >
boost::call_traits< DataType >::reference Nektar::NekVector< DataType >::z ( )

Definition at line 281 of file NekVector.cpp.

References ASSERTL1.

Referenced by Nektar::Cross(), and Nektar::NekVector< DataType >::NekVector().

282  {
283  ASSERTL1(this->GetDimension() >= 3, "Invalid use of NekVector::z");
284  return (*this)(2);
285  }
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
template<typename DataType >
boost::call_traits< DataType >::const_reference Nektar::NekVector< DataType >::z ( ) const

Definition at line 367 of file NekVector.cpp.

References ASSERTL1.

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

Member Data Documentation

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

Definition at line 241 of file NekVector.hpp.

Referenced by Nektar::NekVector< DataType >::NekVector().

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

Definition at line 240 of file NekVector.hpp.

Referenced by Nektar::NekVector< DataType >::NekVector().

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

Definition at line 242 of file NekVector.hpp.

Referenced by Nektar::NekVector< DataType >::NekVector().