dune-pdelab  2.0.0
pattern.hh
Go to the documentation of this file.
1 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=8 sw=2 sts=2:
3 #ifndef DUNE_PDELAB_PATTERN_HH
4 #define DUNE_PDELAB_PATTERN_HH
5 
6 #include<dune/common/exceptions.hh>
7 #include <dune/common/fvector.hh>
8 #include <dune/common/static_assert.hh>
9 
10 namespace Dune {
11  namespace PDELab {
12 
15  {
16  public:
17 
18  // define sparsity pattern of operator representation
19  template<typename LFSU, typename LFSV, typename LocalPattern>
20  void pattern_volume (const LFSU& lfsu, const LFSV& lfsv,
21  LocalPattern& pattern) const
22  {
23  for (size_t i=0; i<lfsv.size(); ++i)
24  for (size_t j=0; j<lfsu.size(); ++j)
25  pattern.addLink(lfsv,i,lfsu,j);
26  }
27  };
28 
31  {
32  public:
33 
34  // define sparsity pattern connecting self and neighbor dofs
35  template<typename LFSU, typename LFSV, typename LocalPattern>
36  void pattern_skeleton (const LFSU& lfsu_s, const LFSV& lfsv_s, const LFSU& lfsu_n, const LFSV& lfsv_n,
37  LocalPattern& pattern_sn,
38  LocalPattern& pattern_ns) const
39  {
40  for (unsigned int i=0; i<lfsv_s.size(); ++i)
41  for (unsigned int j=0; j<lfsu_n.size(); ++j)
42  pattern_sn.addLink(lfsv_s,i,lfsu_n,j);
43 
44  for (unsigned int i=0; i<lfsv_n.size(); ++i)
45  for (unsigned int j=0; j<lfsu_s.size(); ++j)
46  pattern_ns.addLink(lfsv_n,i,lfsu_s,j);
47  }
48  };
49 
52  {
53  public:
54 
55  // define sparsity pattern connecting dofs on boundary elements
56  template<typename LFSU, typename LFSV, typename LocalPattern>
57  void pattern_boundary(const LFSU& lfsu_s, const LFSV& lfsv_s,
58  LocalPattern& pattern_ss) const
59  {
60  for (unsigned int i=0; i<lfsv_s.size(); ++i)
61  for (unsigned int j=0; j<lfsu_s.size(); ++j)
62  pattern_ss.addLink(lfsv_s,i,lfsu_s,j);
63  }
64  };
65 
67  } // namespace PDELab
68 } // namespace Dune
69 
70 #endif
sparsity pattern generator
Definition: pattern.hh:30
void pattern_boundary(const LFSU &lfsu_s, const LFSV &lfsv_s, LocalPattern &pattern_ss) const
Definition: pattern.hh:57
sparsity pattern generator
Definition: pattern.hh:51
void pattern_skeleton(const LFSU &lfsu_s, const LFSV &lfsv_s, const LFSU &lfsu_n, const LFSV &lfsv_n, LocalPattern &pattern_sn, LocalPattern &pattern_ns) const
Definition: pattern.hh:36
void pattern_volume(const LFSU &lfsu, const LFSV &lfsv, LocalPattern &pattern) const
Definition: pattern.hh:20
sparsity pattern generator
Definition: pattern.hh:14