Poster of Linux kernelThe best gift for a Linux geek
CouplingMatrix

CouplingMatrix

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

CouplingMatrix -  

SYNOPSIS


#include <coupling_matrix.h>  

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 41 of file coupling_matrix.h.  

Constructor & Destructor Documentation

 

CouplingMatrix::CouplingMatrix (const unsigned intn = 0) [inline]Constructor.

Definition at line 109 of file coupling_matrix.h.

References resize().

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

Member Function Documentation

 

void CouplingMatrix::clear () [inline]Clears the matrix.

Definition at line 163 of file coupling_matrix.h.

References _size, and _values.

{
  _size = 0;

  _values.clear();
}
 

bool CouplingMatrix::empty () const [inline]Returns:

true if the matrix is empty.

Definition at line 173 of file coupling_matrix.h.

References _size.

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

{
  return (_size == 0);
}
 

unsigned char & CouplingMatrix::operator() (const unsigned inti, const unsigned intj) [inline]Returns:

the (i,j) entry of the matrix as a writeable reference.

Definition at line 130 of file coupling_matrix.h.

References _size, and _values.

{
  libmesh_assert (i < _size);
  libmesh_assert (j < _size);

  return _values[i*_size + j];
}
 

unsigned char CouplingMatrix::operator() (const unsigned inti, const unsigned intj) const [inline]Returns:

the (i,j) entry of the matrix.

Definition at line 118 of file coupling_matrix.h.

References _size, and _values.

{
  libmesh_assert (i < _size);
  libmesh_assert (j < _size);

  return _values[i*_size + j];
}
 

void CouplingMatrix::resize (const unsigned intn) [inline]Resizes the matrix and initializes all entries to be 0.

Definition at line 150 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 CouplingMatrix::size () const [inline]Returns:

the size of the matrix, i.e. N for an NxN matrix.

Definition at line 142 of file coupling_matrix.h.

References _size.

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

{
  return _size;
}
 

Member Data Documentation

 

unsigned int CouplingMatrix::_size [private]The size of the matrix.

Definition at line 98 of file coupling_matrix.h.

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

std::vector<unsigned char> 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 93 of file coupling_matrix.h.

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

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Private Attributes
Detailed Description
Constructor & Destructor Documentation
CouplingMatrix::CouplingMatrix (const unsigned intn = 0) [inline]Constructor.
Member Function Documentation
void CouplingMatrix::clear () [inline]Clears the matrix.
bool CouplingMatrix::empty () const [inline]Returns:
unsigned char & CouplingMatrix::operator() (const unsigned inti, const unsigned intj) [inline]Returns:
unsigned char CouplingMatrix::operator() (const unsigned inti, const unsigned intj) const [inline]Returns:
void CouplingMatrix::resize (const unsigned intn) [inline]Resizes the matrix and initializes all entries to be 0.
unsigned int CouplingMatrix::size () const [inline]Returns:
Member Data Documentation
unsigned int CouplingMatrix::_size [private]The size of the matrix.
std::vector<unsigned char> CouplingMatrix::_values [private]The actual matrix values. These are stored as unsigned chars because a vector of bools is not what you think.
Author

This document was created by man2html, using the manual pages.
Time: 21:43:49 GMT, April 16, 2011