20 #ifndef LIBMESH_COUPLING_MATRIX_H 21 #define LIBMESH_COUPLING_MATRIX_H 36 class ConstCouplingAccessor;
37 class CouplingAccessor;
39 class ConstCouplingRow;
41 class ConstCouplingRowConstIterator;
68 const unsigned int j)
const;
75 const unsigned int j);
81 unsigned int size()
const;
87 void resize(
const unsigned int n);
144 operator bool()
const {
149 CouplingMatrix::rc_type::const_iterator lb = std::upper_bound
161 const std::size_t lastloc = lb->second;
164 const std::size_t firstloc = lb->first;
165 libmesh_assert_less_equal(firstloc, lastloc);
166 libmesh_assert_less_equal(firstloc,
_location);
168 CouplingMatrix::rc_type::const_iterator
next = lb;
173 libmesh_assert_greater(
next->first, lastloc+1);
197 template <
typename T>
202 const bool as_bool = new_value;
203 libmesh_assert_equal_to(new_value, as_bool);
215 CouplingMatrix::rc_type::iterator lb =
227 if (new_value ==
true)
233 const std::size_t firstloc = lb->first;
234 const std::size_t lastloc = lb->second;
235 libmesh_assert_less_equal(firstloc, lastloc);
236 libmesh_assert_less_equal(firstloc,
_location);
240 CouplingMatrix::rc_type::const_iterator
next = lb;
245 libmesh_assert_greater(
next->first, lastloc+1);
252 if (new_value ==
false)
262 libmesh_assert_less (lb->first, lastloc);
268 libmesh_assert_less (firstloc, lb->second);
274 libmesh_assert_less_equal(
_location+1, lastloc);
278 libmesh_assert_less_equal(firstloc,
_location-1);
281 (lb, std::make_pair(firstloc,
_location-1));
289 CouplingMatrix::rc_type::iterator
next = lb;
291 const std::size_t nextloc =
297 libmesh_assert_greater(nextloc, lastloc+1);
305 next->first = firstloc;
368 const std::size_t lastloc =
_begin_it->second;
370 const std::size_t firstloc =
_begin_it->first;
371 libmesh_assert_less_equal(firstloc, lastloc);
376 if (zero_location > lastloc)
387 CouplingMatrix::rc_type::const_iterator
prev =
391 if (
prev->second < zero_location)
424 libmesh_assert(&
_mat == &other.
_mat);
432 return !(*
this == other);
463 CouplingMatrix::rc_type::const_iterator it_in) :
476 libmesh_assert_equal_to
484 libmesh_assert_not_equal_to
491 libmesh_assert_not_equal_to
536 return !(*
this == other);
546 CouplingMatrix::rc_type::const_iterator
_it;
580 const unsigned int j)
const 582 libmesh_assert_less (i,
_size);
583 libmesh_assert_less (j,
_size);
585 const std::size_t location = std::size_t(i)*
_size + j;
595 const unsigned int j)
597 const std::size_t location = std::size_t(i)*
_size + j;
640 #endif // LIBMESH_COUPLING_MATRIX_H
ConstCouplingAccessor(std::size_t loc_in, const CouplingMatrix &mat_in)
CouplingMatrix & operator &=(const CouplingMatrix &other)
bool operator!=(const ConstCouplingRowConstIterator &other) const
std::size_t _begin_location
CouplingMatrix(const unsigned int n=0)
const std::size_t _end_location
long double max(long double a, double b)
bool operator==(const ConstCouplingRow &other) const
ConstCouplingRowConstIterator & operator++()
ConstCouplingRowConstIterator(const ConstCouplingRow &row_in, std::size_t loc_in, CouplingMatrix::rc_type::const_iterator it_in)
friend class ConstCouplingAccessor
friend class CouplingAccessor
const_iterator end() const
void resize(const unsigned int n)
const ConstCouplingRow & _row
std::pair< std::size_t, std::size_t > range_type
std::vector< range_type > rc_type
CouplingMatrix::rc_type::const_iterator _it
ConstCouplingRow(unsigned int row_in, const CouplingMatrix &mat_in)
ConstCouplingRowConstIterator const_iterator
const_iterator begin() const
unsigned int size() const
bool operator()(const unsigned int i, const unsigned int j) const
const CouplingMatrix & _mat
const CouplingMatrix & _mat
bool operator!=(const ConstCouplingRow &other) const
CouplingMatrix::rc_type::const_iterator _begin_it
CouplingAccessor & operator=(T new_value)
CouplingAccessor(std::size_t loc_in, CouplingMatrix &mat_in)
bool operator==(const ConstCouplingRowConstIterator &other) const
Defines the coupling between variables of a System.