libMesh::ConstCouplingRow Class Reference

#include <coupling_matrix.h>

Public Types

typedef ConstCouplingRowConstIterator const_iterator
 

Public Member Functions

 ConstCouplingRow (unsigned int row_in, const CouplingMatrix &mat_in)
 
const_iterator begin () const
 
const_iterator end () const
 
bool operator== (const ConstCouplingRow &other) const
 
bool operator!= (const ConstCouplingRow &other) const
 

Protected Attributes

unsigned int _row_i
 
const CouplingMatrix_mat
 
std::size_t _begin_location
 
const std::size_t _end_location
 
CouplingMatrix::rc_type::const_iterator _begin_it
 

Friends

class ConstCouplingRowConstIterator
 

Detailed Description

This proxy class acts like a container of indices from a single coupling row

Definition at line 335 of file coupling_matrix.h.

Member Typedef Documentation

Constructor & Destructor Documentation

libMesh::ConstCouplingRow::ConstCouplingRow ( unsigned int  row_in,
const CouplingMatrix mat_in 
)
inline

Definition at line 338 of file coupling_matrix.h.

References std::max(), and libMesh::MeshTools::Subdivision::prev.

339  :
340  _row_i(row_in), _mat(mat_in),
342  {
343  libmesh_assert_less(_row_i, _mat.size());
344 
345  // Location for i,N, where we'll start looking for our beginning
346  // range
348 
349  const std::size_t max_size = std::numeric_limits<std::size_t>::max();
350 
351  // Find the range that might contain i,N
352  // lower_bound isn't *quite* what we want
353  _begin_it = std::upper_bound
354  (_mat._ranges.begin(), _mat._ranges.end(),
355  std::make_pair(_begin_location, max_size));
356  if (_begin_it !=_mat._ranges.begin())
357  --_begin_it;
358  else
359  _begin_it=_mat._ranges.end();
360 
361  // If that range doesn't exist then we're an empty row
362  if (_begin_it == _mat._ranges.end())
363  _begin_location = max_size;
364  else
365  {
366  const std::size_t lastloc = _begin_it->second;
367 #ifdef DEBUG
368  const std::size_t firstloc = _begin_it->first;
369  libmesh_assert_less_equal(firstloc, lastloc);
370 #endif
371 
372  // If that range ends before i,0 then we're an empty row
373  std::size_t zero_location = _row_i*_mat.size();
374  if (zero_location > lastloc)
375  {
376  _begin_location = max_size;
377  _begin_it = _mat._ranges.end();
378  }
379  else
380  // We have *some* entry(s) in this row, we just need to find
381  // the earliest
382  {
383  while (_begin_it != _mat._ranges.begin())
384  {
385  CouplingMatrix::rc_type::const_iterator prev =
386  _begin_it;
387  --prev;
388 
389  if (prev->second < zero_location)
390  break;
391 
392  _begin_it = prev;
393  }
394  if (_begin_it->first < zero_location)
395  _begin_location = zero_location;
396  else
397  _begin_location = _begin_it->first;
398  }
399  }
400  }
static const unsigned int prev[3]
const std::size_t _end_location
long double max(long double a, double b)
unsigned int size() const
const CouplingMatrix & _mat
CouplingMatrix::rc_type::const_iterator _begin_it

Member Function Documentation

ConstCouplingRow::const_iterator libMesh::ConstCouplingRow::begin ( ) const
inline

Definition at line 552 of file coupling_matrix.h.

Referenced by libMesh::DofMap::add_neighbors_to_send_list().

552  {
553  return const_iterator (*this, _begin_location, _begin_it);
554 }
ConstCouplingRowConstIterator const_iterator
CouplingMatrix::rc_type::const_iterator _begin_it
ConstCouplingRow::const_iterator libMesh::ConstCouplingRow::end ( ) const
inline

Definition at line 557 of file coupling_matrix.h.

References std::max().

Referenced by libMesh::DofMap::add_neighbors_to_send_list().

557  {
558  return const_iterator
560  _mat._ranges.end());
561 }
long double max(long double a, double b)
ConstCouplingRowConstIterator const_iterator
const CouplingMatrix & _mat
bool libMesh::ConstCouplingRow::operator!= ( const ConstCouplingRow other) const
inline

Definition at line 428 of file coupling_matrix.h.

429  {
430  return !(*this == other);
431  }
bool libMesh::ConstCouplingRow::operator== ( const ConstCouplingRow other) const
inline

Definition at line 418 of file coupling_matrix.h.

References _begin_it, _begin_location, and _mat.

419  {
420  // Thinking that rows from different matrix objects are equal is
421  // not even wrong
422  libmesh_assert(&_mat == &other._mat);
423 
424  return ((_begin_location == other._begin_location) &&
425  (_begin_it == other._begin_it));
426  }
const CouplingMatrix & _mat
CouplingMatrix::rc_type::const_iterator _begin_it

Friends And Related Function Documentation

friend class ConstCouplingRowConstIterator
friend

Definition at line 434 of file coupling_matrix.h.

Member Data Documentation

CouplingMatrix::rc_type::const_iterator libMesh::ConstCouplingRow::_begin_it
protected

Definition at line 451 of file coupling_matrix.h.

Referenced by operator==().

std::size_t libMesh::ConstCouplingRow::_begin_location
protected

Definition at line 441 of file coupling_matrix.h.

Referenced by operator==().

const std::size_t libMesh::ConstCouplingRow::_end_location
protected

Definition at line 446 of file coupling_matrix.h.

const CouplingMatrix& libMesh::ConstCouplingRow::_mat
protected

Definition at line 437 of file coupling_matrix.h.

Referenced by operator==().

unsigned int libMesh::ConstCouplingRow::_row_i
protected

Definition at line 436 of file coupling_matrix.h.


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