libMesh
Public Member Functions | Protected Attributes | List of all members
libMesh::ConstCouplingAccessor Class Reference

This accessor class allows simple access to CouplingMatrix values. More...

#include <coupling_matrix.h>

Inheritance diagram for libMesh::ConstCouplingAccessor:
[legend]

Public Member Functions

 ConstCouplingAccessor (std::size_t loc_in, const CouplingMatrix &mat_in)
 
 operator bool () const
 

Protected Attributes

std::size_t _location
 
const CouplingMatrix_mat
 

Detailed Description

This accessor class allows simple access to CouplingMatrix values.

Definition at line 134 of file coupling_matrix.h.

Constructor & Destructor Documentation

◆ ConstCouplingAccessor()

libMesh::ConstCouplingAccessor::ConstCouplingAccessor ( std::size_t  loc_in,
const CouplingMatrix mat_in 
)
inline

Definition at line 137 of file coupling_matrix.h.

References _location, _mat, and libMesh::CouplingMatrix::size().

138  :
139  _location(loc_in), _mat(mat_in)
140  {
141  libmesh_assert_less(_location, _mat.size() * _mat.size());
142  }
std::size_t size() const
const CouplingMatrix & _mat

Member Function Documentation

◆ operator bool()

libMesh::ConstCouplingAccessor::operator bool ( ) const
inline

Definition at line 144 of file coupling_matrix.h.

References _location, _mat, libMesh::CouplingMatrix::_ranges, and libMesh::MeshTools::Subdivision::next.

145  {
146  const std::size_t max_size = std::numeric_limits<std::size_t>::max();
147 
148  // Find the range that might contain i,j
149  // lower_bound isn't *quite* what we want
150  CouplingMatrix::rc_type::const_iterator lb = std::upper_bound
151  (_mat._ranges.begin(), _mat._ranges.end(),
152  std::make_pair(_location, max_size));
153  if (lb!=_mat._ranges.begin())
154  --lb;
155  else
156  lb=_mat._ranges.end();
157 
158  // If no range might contain i,j then it's 0
159  if (lb == _mat._ranges.end())
160  return false;
161 
162  const std::size_t lastloc = lb->second;
163 
164 #ifdef DEBUG
165  const std::size_t firstloc = lb->first;
166  libmesh_assert_less_equal(firstloc, lastloc);
167  libmesh_assert_less_equal(firstloc, _location);
168 
169  CouplingMatrix::rc_type::const_iterator next = lb;
170  next++;
171  if (next != _mat._ranges.end())
172  {
173  // Ranges should be sorted and should not touch
174  libmesh_assert_greater(next->first, lastloc+1);
175  }
176 #endif
177 
178  return (lastloc >= _location);
179  }
static const unsigned int next[3]
A lookup table for the increment modulo 3 operation, for iterating through the three nodes per elemen...
const CouplingMatrix & _mat

Member Data Documentation

◆ _location

std::size_t libMesh::ConstCouplingAccessor::_location
protected

◆ _mat

const CouplingMatrix& libMesh::ConstCouplingAccessor::_mat
protected

Definition at line 184 of file coupling_matrix.h.

Referenced by ConstCouplingAccessor(), and operator bool().


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