MFEM  v4.4.0
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 &os, 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)
 
Array2Doperator= (const Array2D &a)=default
 
void MakeRef (const Array2D &master)
 Make this Array a reference to 'master'. More...
 
void DeleteAll ()
 Delete all dynamically allocated memory, resetting all dimensions 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 351 of file array.hpp.

Constructor & Destructor Documentation

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

Definition at line 367 of file array.hpp.

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

Definition at line 368 of file array.hpp.

Member Function Documentation

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

Definition at line 426 of file array.hpp.

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

Delete all dynamically allocated memory, resetting all dimensions to zero.

Definition at line 439 of file array.hpp.

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

Definition at line 384 of file array.hpp.

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

Definition at line 385 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 388 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 412 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 145 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 423 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 435 of file array.hpp.

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

Definition at line 373 of file array.hpp.

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

Definition at line 372 of file array.hpp.

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

Definition at line 907 of file array.hpp.

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

Definition at line 917 of file array.hpp.

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

Definition at line 381 of file array.hpp.

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

Definition at line 382 of file array.hpp.

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

Definition at line 429 of file array.hpp.

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

Definition at line 927 of file array.hpp.

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

Definition at line 936 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 155 of file array.cpp.

template<class T>
void mfem::Array2D< T >::Save ( std::ostream &  os,
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 400 of file array.hpp.

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

Definition at line 370 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: