2 #ifndef DUNE_PDELAB_BACKEND_ISTLMATRIXBACKEND_HH
3 #define DUNE_PDELAB_BACKEND_ISTLMATRIXBACKEND_HH
5 #include <dune/common/typetraits.hh>
14 template<
typename GFSV,
typename GFSU,
typename C,
typename Stats>
21 typedef ElementType
E;
31 typedef typename GFSV::Ordering::Traits::ContainerIndex
RowIndex;
32 typedef typename GFSU::Ordering::Traits::ContainerIndex
ColIndex;
34 typedef typename istl::build_pattern_type<C,GFSV,GFSU,typename GFSV::Ordering::ContainerAllocationTag>::type
Pattern;
42 typedef typename conditional<
44 std::vector<PatternStatistics>,
46 >::type StatisticsReturnType;
50 #if HAVE_TEMPLATE_ALIASES
52 template<
typename RowCache,
typename ColCache>
55 template<
typename RowCache,
typename ColCache>
60 template<
typename RowCache,
typename ColCache>
74 template<
typename RowCache,
typename ColCache>
88 #endif // HAVE_TEMPLATE_ALIASES
93 : _container(make_shared<Container>())
95 _stats = go.matrixBackend().buildPattern(go,*
this);
107 template<
typename GO>
109 : _container(
Dune::stackobject_to_shared_ptr(container))
111 _stats = go.matrixBackend().buildPattern(go,*
this);
114 template<
typename GO>
116 : _container(make_shared<Container>())
118 _stats = go.matrixBackend().buildPattern(go,*
this);
128 : _container(make_shared<Container>())
132 : _container(make_shared<Container>(*(rhs._container)))
142 (*_container) = (*(rhs._container));
146 _container = make_shared<Container>(*(rhs._container));
164 DUNE_THROW(InvalidStateException,
"no pattern statistics available");
168 const std::vector<PatternStatistics>&
patternStatistics(true_type multiple)
const
171 DUNE_THROW(InvalidStateException,
"no pattern statistics available");
185 void attach(shared_ptr<Container> container)
187 _container = container;
192 return bool(_container);
202 return _container->N();
207 return _container->M();
224 return istl::access_matrix_element(
istl::container_tag(*_container),*_container,ri,ci,ri.size()-1,ci.size()-1);
227 const E&
operator()(
const RowIndex& ri,
const ColIndex& ci)
const
229 return istl::access_matrix_element(
istl::container_tag(*_container),*_container,ri,ci,ri.size()-1,ci.size()-1);
248 void clear_row(
const RowIndex& ri,
const E& diagonal_entry)
251 (*this)(ri,ri) = diagonal_entry;
256 shared_ptr<Container> _container;
257 std::vector<PatternStatistics> _stats;
264 #endif // DUNE_PDELAB_BACKEND_ISTLMATRIXBACKEND_HH
Tag for requesting a vector or matrix container without a pre-attached underlying object...
Definition: backend/tags.hh:23
void detach()
Definition: istlmatrixbackend.hh:179
C::block_type block_type
Definition: istlmatrixbackend.hh:25
Definition: istlmatrixbackend.hh:75
C::field_type field_type
Definition: istlmatrixbackend.hh:24
const E & operator()(const RowIndex &ri, const ColIndex &ci) const
Definition: istlmatrixbackend.hh:227
ISTLMatrixContainer(const GO &go, const E &e)
Definition: istlmatrixbackend.hh:115
C::size_type size_type
Definition: istlmatrixbackend.hh:26
Various tags for influencing backend behavior.
tags::container< T >::type container_tag(const T &)
Gets instance of container tag associated with T.
Definition: backend/istl/tags.hh:247
Container & base()
Definition: istlmatrixbackend.hh:237
C Container
Definition: istlmatrixbackend.hh:22
ISTLMatrixContainer(const ISTLMatrixContainer &rhs)
Definition: istlmatrixbackend.hh:131
ISTLMatrixContainer(const GO &go)
Definition: istlmatrixbackend.hh:92
Definition: istlmatrixbackend.hh:61
const StatisticsReturnType & patternStatistics() const
Returns pattern statistics for all contained BCRSMatrix objects.
Definition: istlmatrixbackend.hh:152
const shared_ptr< Container > & storage() const
Definition: istlmatrixbackend.hh:195
ISTLMatrixContainer & operator=(const ISTLMatrixContainer &rhs)
Definition: istlmatrixbackend.hh:135
Definition: adaptivity.hh:26
ISTLMatrixContainer(tags::unattached_container=tags::unattached_container())
Creates an ISTLMatrixContainer without allocating an underlying ISTL matrix.
Definition: istlmatrixbackend.hh:123
ISTLMatrixContainer(tags::attached_container)
Creates an ISTLMatrixContainer with an empty underlying ISTL matrix.
Definition: istlmatrixbackend.hh:127
GFSV::Ordering::Traits::ContainerIndex RowIndex
Definition: istlmatrixbackend.hh:31
GFSU::Ordering::Traits::ContainerIndex ColIndex
Definition: istlmatrixbackend.hh:32
bool attached() const
Definition: istlmatrixbackend.hh:190
ISTLMatrixContainer & operator*=(const E &e)
Definition: istlmatrixbackend.hh:216
void clear_row(const RowIndex &ri, const E &diagonal_entry)
Definition: istlmatrixbackend.hh:248
const E & e
Definition: interpolate.hh:172
void attach(shared_ptr< Container > container)
Definition: istlmatrixbackend.hh:185
istl::build_pattern_type< C, GFSV, GFSU, typename GFSV::Ordering::ContainerAllocationTag >::type Pattern
Definition: istlmatrixbackend.hh:34
ISTLMatrixContainer(const GO &go, Container &container)
Construct matrix container using an externally given matrix as storage.
Definition: istlmatrixbackend.hh:108
void flush()
Definition: istlmatrixbackend.hh:242
Definition: istlmatrixbackend.hh:15
size_type M() const
Definition: istlmatrixbackend.hh:205
const Container & base() const
Definition: istlmatrixbackend.hh:232
GFSV TestGridFunctionSpace
Definition: istlmatrixbackend.hh:29
void finalize()
Definition: istlmatrixbackend.hh:245
LocalView()
Definition: istlmatrixbackend.hh:65
ConstLocalView(const ISTLMatrixContainer &mc)
Definition: istlmatrixbackend.hh:82
LocalView(ISTLMatrixContainer &mc)
Definition: istlmatrixbackend.hh:68
Tag for requesting a vector or matrix container with a pre-attached underlying object.
Definition: backend/tags.hh:27
C::field_type ElementType
Definition: istlmatrixbackend.hh:20
size_type N() const
Definition: istlmatrixbackend.hh:200
Stats PatternStatistics
Definition: istlmatrixbackend.hh:36
E & operator()(const RowIndex &ri, const ColIndex &ci)
Definition: istlmatrixbackend.hh:222
C BaseT
Definition: istlmatrixbackend.hh:23
ConstLocalView()
Definition: istlmatrixbackend.hh:79
GFSU TrialGridFunctionSpace
Definition: istlmatrixbackend.hh:28
ElementType E
Definition: istlmatrixbackend.hh:21