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

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ ConstCouplingRow()

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

Definition at line 340 of file coupling_matrix.h.

References _begin_it, _begin_location, _end_location, _mat, libMesh::CouplingMatrix::_ranges, _row_i, std::max(), libMesh::MeshTools::Subdivision::prev, and libMesh::CouplingMatrix::size().

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

◆ begin()

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

Definition at line 554 of file coupling_matrix.h.

References _begin_it, and _begin_location.

554  {
555  return const_iterator (*this, _begin_location, _begin_it);
556 }
ConstCouplingRowConstIterator const_iterator
CouplingMatrix::rc_type::const_iterator _begin_it

◆ end()

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

Definition at line 559 of file coupling_matrix.h.

References _mat, libMesh::CouplingMatrix::_ranges, and std::max().

559  {
560  return const_iterator
562  _mat._ranges.end());
563 }
long double max(long double a, double b)
ConstCouplingRowConstIterator const_iterator
const CouplingMatrix & _mat

◆ operator!=()

bool libMesh::ConstCouplingRow::operator!= ( const ConstCouplingRow other) const
inline

Definition at line 430 of file coupling_matrix.h.

431  {
432  return !(*this == other);
433  }

◆ operator==()

bool libMesh::ConstCouplingRow::operator== ( const ConstCouplingRow other) const
inline

Definition at line 420 of file coupling_matrix.h.

References _begin_it, _begin_location, and _mat.

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

Friends And Related Function Documentation

◆ ConstCouplingRowConstIterator

friend class ConstCouplingRowConstIterator
friend

Definition at line 436 of file coupling_matrix.h.

Member Data Documentation

◆ _begin_it

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

Definition at line 453 of file coupling_matrix.h.

Referenced by begin(), ConstCouplingRow(), and operator==().

◆ _begin_location

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

Definition at line 443 of file coupling_matrix.h.

Referenced by begin(), ConstCouplingRow(), and operator==().

◆ _end_location

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

◆ _mat

◆ _row_i

unsigned int libMesh::ConstCouplingRow::_row_i
protected

Definition at line 438 of file coupling_matrix.h.

Referenced by ConstCouplingRow().


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