MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
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)
 
 Array2D (const Array2D &)=default
 
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.
 
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:
 
void Load (std::istream &in, int fmt=0)
 Read an Array2D from the stream in using format fmt. The format fmt can be:
 
void Load (const char *filename, int fmt=0)
 Read an Array2D from a file.
 
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.
 
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'.
 
void DeleteAll ()
 Delete all dynamically allocated memory, resetting all dimensions to zero.
 
void Print (std::ostream &out=mfem::out, int width=4)
 Prints array to stream with width elements per row.
 

Friends

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

Detailed Description

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

Dynamic 2D array using row-major layout.

Definition at line 371 of file array.hpp.

Constructor & Destructor Documentation

◆ Array2D() [1/3]

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

Definition at line 380 of file array.hpp.

◆ Array2D() [2/3]

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

Definition at line 381 of file array.hpp.

◆ Array2D() [3/3]

template<class T >
mfem::Array2D< T >::Array2D ( const Array2D< T > & )
default

Member Function Documentation

◆ Copy()

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

Definition at line 441 of file array.hpp.

◆ DeleteAll()

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

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

Definition at line 454 of file array.hpp.

◆ GetRow() [1/3]

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

Definition at line 400 of file array.hpp.

◆ GetRow() [2/3]

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

Definition at line 399 of file array.hpp.

◆ GetRow() [3/3]

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 403 of file array.hpp.

◆ Load() [1/3]

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.

◆ Load() [2/3]

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 438 of file array.hpp.

◆ Load() [3/3]

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 427 of file array.hpp.

◆ MakeRef()

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

Make this Array a reference to 'master'.

Definition at line 450 of file array.hpp.

◆ NumCols()

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

Definition at line 388 of file array.hpp.

◆ NumRows()

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

Definition at line 387 of file array.hpp.

◆ operator()() [1/4]

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

Definition at line 397 of file array.hpp.

◆ operator()() [2/4]

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

Definition at line 396 of file array.hpp.

◆ operator()() [3/4]

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

Definition at line 942 of file array.hpp.

◆ operator()() [4/4]

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

Definition at line 932 of file array.hpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Definition at line 444 of file array.hpp.

◆ operator[]() [1/2]

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

Definition at line 961 of file array.hpp.

◆ operator[]() [2/2]

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

Definition at line 952 of file array.hpp.

◆ Print()

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.

◆ Save()

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 415 of file array.hpp.

◆ SetSize()

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

Definition at line 385 of file array.hpp.

Friends And Related Symbol Documentation

◆ Swap

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

Definition at line 971 of file array.hpp.


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