MFEM  v3.4
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Friends | List of all members
mfem::Array2D< T > Class Template Reference

Dynamic 2D array using row-major layout. More...

#include <array.hpp>

Public Member Functions

 Array2D ()
 
 Array2D (int m, int n)
 
void SetSize (int m, int n)
 
int NumRows () const
 
int NumCols () const
 
const T & operator() (int i, int j) const
 
T & operator() (int i, int j)
 
const T * operator[] (int i) const
 
T * operator[] (int i)
 
const T * operator() (int i) const
 
T * operator() (int i)
 
const T * GetRow (int i) const
 
T * GetRow (int i)
 
void GetRow (int i, Array< T > &sa) const
 Extract a copy of the i-th row into the Array sa. More...
 
void Save (std::ostream &out, int fmt=0) const
 Save the Array2D to the stream out using the format fmt. The format fmt can be: More...
 
void Load (std::istream &in, int fmt=0)
 Read an Array2D from the stream in using format fmt. The format fmt can be: More...
 
void Load (const char *filename, int fmt=0)
 Read an Array2D from a file. More...
 
void Load (int new_size0, int new_size1, std::istream &in)
 Set the Array2D dimensions to new_size0 x new_size1 and read that many entries from the stream in. More...
 
void Copy (Array2D &copy) const
 
void operator= (const T &a)
 
void MakeRef (const Array2D &master)
 Make this Array a reference to 'master'. More...
 
void DeleteAll ()
 Delete all dynamically allocated memory, reseting all dimentions to zero. More...
 
void Print (std::ostream &out=mfem::out, int width=4)
 Prints array to stream with width elements per row. More...
 

Friends

void Swap (Array2D< T > &, Array2D< T > &)
 

Detailed Description

template<class T>
class mfem::Array2D< T >

Dynamic 2D array using row-major layout.

Definition at line 289 of file array.hpp.

Constructor & Destructor Documentation

template<class T>
mfem::Array2D< T >::Array2D ( )
inline

Definition at line 305 of file array.hpp.

template<class T>
mfem::Array2D< T >::Array2D ( int  m,
int  n 
)
inline

Definition at line 306 of file array.hpp.

Member Function Documentation

template<class T>
void mfem::Array2D< T >::Copy ( Array2D< T > &  copy) const
inline

Definition at line 364 of file array.hpp.

template<class T>
void mfem::Array2D< T >::DeleteAll ( )
inline

Delete all dynamically allocated memory, reseting all dimentions to zero.

Definition at line 375 of file array.hpp.

template<class T>
const T* mfem::Array2D< T >::GetRow ( int  i) const
inline

Definition at line 322 of file array.hpp.

template<class T>
T* mfem::Array2D< T >::GetRow ( int  i)
inline

Definition at line 323 of file array.hpp.

template<class T>
void mfem::Array2D< T >::GetRow ( int  i,
Array< T > &  sa 
) const
inline

Extract a copy of the i-th row into the Array sa.

Definition at line 326 of file array.hpp.

template<class T>
void mfem::Array2D< T >::Load ( std::istream &  in,
int  fmt = 0 
)
inline

Read an Array2D from the stream in using format fmt. The format fmt can be:

0 - read the number of rows and columns, then the entries 1 - read NumRows() x NumCols() entries, using row-major layout

Definition at line 350 of file array.hpp.

template<class T >
void mfem::Array2D< T >::Load ( const char *  filename,
int  fmt = 0 
)

Read an Array2D from a file.

Definition at line 182 of file array.cpp.

template<class T>
void mfem::Array2D< T >::Load ( int  new_size0,
int  new_size1,
std::istream &  in 
)
inline

Set the Array2D dimensions to new_size0 x new_size1 and read that many entries from the stream in.

Definition at line 361 of file array.hpp.

template<class T>
void mfem::Array2D< T >::MakeRef ( const Array2D< T > &  master)
inline

Make this Array a reference to 'master'.

Definition at line 371 of file array.hpp.

template<class T>
int mfem::Array2D< T >::NumCols ( ) const
inline

Definition at line 311 of file array.hpp.

template<class T>
int mfem::Array2D< T >::NumRows ( ) const
inline

Definition at line 310 of file array.hpp.

template<class T >
const T & mfem::Array2D< T >::operator() ( int  i,
int  j 
) const
inline

Definition at line 771 of file array.hpp.

template<class T >
T & mfem::Array2D< T >::operator() ( int  i,
int  j 
)
inline

Definition at line 781 of file array.hpp.

template<class T>
const T* mfem::Array2D< T >::operator() ( int  i) const
inline

Definition at line 319 of file array.hpp.

template<class T>
T* mfem::Array2D< T >::operator() ( int  i)
inline

Definition at line 320 of file array.hpp.

template<class T>
void mfem::Array2D< T >::operator= ( const T &  a)
inline

Definition at line 367 of file array.hpp.

template<class T >
const T * mfem::Array2D< T >::operator[] ( int  i) const
inline

Definition at line 791 of file array.hpp.

template<class T >
T * mfem::Array2D< T >::operator[] ( int  i)
inline

Definition at line 800 of file array.hpp.

template<class T >
void mfem::Array2D< T >::Print ( std::ostream &  out = mfem::out,
int  width = 4 
)

Prints array to stream with width elements per row.

Definition at line 192 of file array.cpp.

template<class T>
void mfem::Array2D< T >::Save ( std::ostream &  out,
int  fmt = 0 
) const
inline

Save the Array2D to the stream out using the format fmt. The format fmt can be:

0 - write the number of rows and columns, followed by all entries 1 - write only the entries, using row-major layout

Definition at line 338 of file array.hpp.

template<class T>
void mfem::Array2D< T >::SetSize ( int  m,
int  n 
)
inline

Definition at line 308 of file array.hpp.

Friends And Related Function Documentation

template<class T>
void Swap ( Array2D< T > &  a,
Array2D< T > &  b 
)
friend

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