2 #ifndef DUNE_PDELAB_BACKEND_ISTL_BCRSMATRIX_HH 3 #define DUNE_PDELAB_BACKEND_ISTL_BCRSMATRIX_HH 8 #include <dune/common/typetraits.hh> 19 template<
typename GFSV,
typename GFSU,
typename C,
typename Stats>
21 :
public Backend::impl::Wrapper<C>
24 friend Backend::impl::Wrapper<C>;
29 typedef ElementType
E;
38 typedef typename GFSV::Ordering::Traits::ContainerIndex
RowIndex;
39 typedef typename GFSU::Ordering::Traits::ContainerIndex
ColIndex;
41 typedef typename ISTL::build_pattern_type<C,GFSV,GFSU,typename GFSV::Ordering::ContainerAllocationTag>::type
Pattern;
49 typedef typename std::conditional<
51 std::vector<PatternStatistics>,
53 >::type StatisticsReturnType;
57 template<
typename RowCache,
typename ColCache>
60 template<
typename RowCache,
typename ColCache>
65 : _container(
std::make_shared<Container>())
67 _stats = go.matrixBackend().buildPattern(go,*
this);
81 : _container(
Dune::stackobject_to_shared_ptr(container))
83 _stats = go.matrixBackend().buildPattern(go,*
this);
88 : _container(
std::make_shared<Container>())
90 _stats = go.matrixBackend().buildPattern(go,*
this);
100 : _container(
std::make_shared<Container>())
104 : _container(
std::make_shared<Container>(*(rhs._container)))
114 (*_container) = (*(rhs._container));
118 _container = std::make_shared<Container>(*(rhs._container));
136 DUNE_THROW(InvalidStateException,
"no pattern statistics available");
140 const std::vector<PatternStatistics>&
patternStatistics(std::true_type multiple)
const 143 DUNE_THROW(InvalidStateException,
"no pattern statistics available");
157 void attach(std::shared_ptr<Container> container)
159 _container = container;
164 return bool(_container);
167 const std::shared_ptr<Container>&
storage()
const 174 return _container->N();
179 return _container->M();
196 return ISTL::access_matrix_element(
ISTL::container_tag(*_container),*_container,ri,ci,ri.size()-1,ci.size()-1);
199 const E&
operator()(
const RowIndex& ri,
const ColIndex& ci)
const 201 return ISTL::access_matrix_element(
ISTL::container_tag(*_container),*_container,ri,ci,ri.size()-1,ci.size()-1);
206 const Container& native()
const 224 void clear_row(
const RowIndex& ri,
const E& diagonal_entry)
227 ISTL::write_matrix_element_if_exists(diagonal_entry,
ISTL::container_tag(*_container),*_container,ri,ri,ri.size()-1,ri.size()-1);
232 std::shared_ptr<Container> _container;
233 std::vector<PatternStatistics> _stats;
242 #endif // DUNE_PDELAB_BACKEND_ISTL_BCRSMATRIX_HH Tag for requesting a vector or matrix container without a pre-attached underlying object...
Definition: backend/common/tags.hh:25
size_type M() const
Definition: bcrsmatrix.hh:177
GFSV::Ordering::Traits::ContainerIndex RowIndex
Definition: bcrsmatrix.hh:38
const Entity & e
Definition: localfunctionspace.hh:111
Definition: bcrsmatrix.hh:20
const std::shared_ptr< Container > & storage() const
Definition: bcrsmatrix.hh:167
BCRSMatrix & operator=(const BCRSMatrix &rhs)
Definition: bcrsmatrix.hh:107
const StatisticsReturnType & patternStatistics() const
Returns pattern statistics for all contained BCRSMatrix objects.
Definition: bcrsmatrix.hh:124
void clear_row(const RowIndex &ri, const E &diagonal_entry)
Definition: bcrsmatrix.hh:224
C::field_type ElementType
Definition: bcrsmatrix.hh:28
tags::container< T >::type container_tag(const T &)
Gets instance of container tag associated with T.
Definition: backend/istl/tags.hh:249
C Container
Definition: bcrsmatrix.hh:30
BCRSMatrix(const GO &go, const E &e)
Definition: bcrsmatrix.hh:87
GFSV TestGridFunctionSpace
Definition: bcrsmatrix.hh:36
BCRSMatrix(const BCRSMatrix &rhs)
Definition: bcrsmatrix.hh:103
BCRSMatrix(Backend::attached_container)
Creates an BCRSMatrix with an empty underlying ISTL matrix.
Definition: bcrsmatrix.hh:99
void flush()
Definition: bcrsmatrix.hh:218
bool attached() const
Definition: bcrsmatrix.hh:162
C::size_type size_type
Definition: bcrsmatrix.hh:33
size_type N() const
Definition: bcrsmatrix.hh:172
ISTL::build_pattern_type< C, GFSV, GFSU, typename GFSV::Ordering::ContainerAllocationTag >::type Pattern
Definition: bcrsmatrix.hh:41
C::field_type field_type
Definition: bcrsmatrix.hh:31
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
GFSU TrialGridFunctionSpace
Definition: bcrsmatrix.hh:35
Various tags for influencing backend behavior.
void detach()
Definition: bcrsmatrix.hh:151
C::block_type block_type
Definition: bcrsmatrix.hh:32
Definition: uncachedmatrixview.hh:12
BCRSMatrix(const GO &go, Container &container)
Construct matrix container using an externally given matrix as storage.
Definition: bcrsmatrix.hh:80
const E & operator()(const RowIndex &ri, const ColIndex &ci) const
Definition: bcrsmatrix.hh:199
ElementType E
Definition: bcrsmatrix.hh:29
BCRSMatrix(const GO &go)
Definition: bcrsmatrix.hh:64
BCRSMatrix(Backend::unattached_container=Backend::unattached_container())
Creates an BCRSMatrix without allocating an underlying ISTL matrix.
Definition: bcrsmatrix.hh:95
void attach(std::shared_ptr< Container > container)
Definition: bcrsmatrix.hh:157
void finalize()
Definition: bcrsmatrix.hh:221
BCRSMatrix & operator*=(const E &e)
Definition: bcrsmatrix.hh:188
Tag for requesting a vector or matrix container with a pre-attached underlying object.
Definition: backend/common/tags.hh:29
GFSU::Ordering::Traits::ContainerIndex ColIndex
Definition: bcrsmatrix.hh:39
E & operator()(const RowIndex &ri, const ColIndex &ci)
Definition: bcrsmatrix.hh:194
Stats PatternStatistics
Definition: bcrsmatrix.hh:43
Definition: uncachedmatrixview.hh:165