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().

00111                                                     :
00112   _values(), _size(n)
00113 {
00114   this->resize(n);
00115 }


Member Function Documentation

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

Clears the matrix.

Definition at line 165 of file coupling_matrix.h.

References _size, and _values.

00166 {
00167   _size = 0;
00168 
00169   _values.clear();
00170 }

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()().

00176 {
00177   return (_size == 0);
00178 }

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.

00134 {
00135   libmesh_assert_less (i, _size);
00136   libmesh_assert_less (j, _size);
00137 
00138   return _values[i*_size + j];
00139 }

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.

00122 {
00123   libmesh_assert_less (i, _size);
00124   libmesh_assert_less (j, _size);
00125 
00126   return _values[i*_size + j];
00127 }

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().

00153 {
00154   _size = n;
00155 
00156   _values.resize(_size*_size);
00157 
00158   for (unsigned int i=0; i<_values.size(); i++)
00159     _values[i] = 0;
00160 }

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()().

00145 {
00146   return _size;
00147 }


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:

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:13 UTC

Hosted By:
SourceForge.net Logo