$extrastylesheet
libMesh::CouplingMatrix Class Reference

#include <coupling_matrix.h>

List of all members.

Public Member Functions

 CouplingMatrix (const unsigned int n=0)
unsigned char operator() (const unsigned int i, const unsigned int j) const
unsigned char & operator() (const unsigned int i, const unsigned int j)
unsigned int size () const
void resize (const unsigned int n)
void clear ()
bool empty () const

Private Attributes

std::vector< unsigned char > _values
unsigned int _size

Detailed Description

This class defines a coupling matrix. A coupling matrix is simply a matrix of ones and zeros describing how different components in a system couple with each other. A coupling matrix is necessarily square but not necessarily symmetric.

Definition at line 42 of file coupling_matrix.h.


Constructor & Destructor Documentation

libMesh::CouplingMatrix::CouplingMatrix ( const unsigned int  n = 0) [inline, explicit]

Constructor.

Definition at line 111 of file coupling_matrix.h.

References resize().

                                                    :
  _values(), _size(n)
{
  this->resize(n);
}

Member Function Documentation

void libMesh::CouplingMatrix::clear ( ) [inline]

Clears the matrix.

Definition at line 165 of file coupling_matrix.h.

References _size, and _values.

{
  _size = 0;

  _values.clear();
}
bool libMesh::CouplingMatrix::empty ( ) const [inline]
Returns:
true if the matrix is empty.

Definition at line 175 of file coupling_matrix.h.

References _size.

Referenced by libMesh::SparsityPattern::Build::operator()().

{
  return (_size == 0);
}
unsigned char libMesh::CouplingMatrix::operator() ( const unsigned int  i,
const unsigned int  j 
) const [inline]
Returns:
the (i,j) entry of the matrix.

Definition at line 120 of file coupling_matrix.h.

References _size, and _values.

{
  libmesh_assert_less (i, _size);
  libmesh_assert_less (j, _size);

  return _values[i*_size + j];
}
unsigned char & libMesh::CouplingMatrix::operator() ( const unsigned int  i,
const unsigned int  j 
) [inline]
Returns:
the (i,j) entry of the matrix as a writeable reference.

Definition at line 132 of file coupling_matrix.h.

References _size, and _values.

{
  libmesh_assert_less (i, _size);
  libmesh_assert_less (j, _size);

  return _values[i*_size + j];
}
void libMesh::CouplingMatrix::resize ( const unsigned int  n) [inline]

Resizes the matrix and initializes all entries to be 0.

Definition at line 152 of file coupling_matrix.h.

References _size, and _values.

Referenced by CouplingMatrix().

{
  _size = n;

  _values.resize(_size*_size);

  for (unsigned int i=0; i<_values.size(); i++)
    _values[i] = 0;
}
unsigned int libMesh::CouplingMatrix::size ( ) const [inline]
Returns:
the size of the matrix, i.e. N for an NxN matrix.

Definition at line 144 of file coupling_matrix.h.

References _size.

Referenced by libMesh::SparsityPattern::Build::operator()().

{
  return _size;
}

Member Data Documentation

unsigned int libMesh::CouplingMatrix::_size [private]

The size of the matrix.

Definition at line 100 of file coupling_matrix.h.

Referenced by clear(), empty(), operator()(), resize(), and size().

std::vector<unsigned char> libMesh::CouplingMatrix::_values [private]

The actual matrix values. These are stored as unsigned chars because a vector of bools is not what you think.

Definition at line 95 of file coupling_matrix.h.

Referenced by clear(), operator()(), and resize().


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