/usr/include/dune/pdelab/gridfunctionspace/dunefunctionslocalfunctionspace.hh is in libdune-pdelab-dev 2.5.0~20170124g7cf9f47a-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLOCALFUNCTIONSPACE_HH
#define DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLOCALFUNCTIONSPACE_HH
#include<vector>
#include <dune/common/stdstreams.hh>
#include <dune/geometry/referenceelements.hh>
#include <dune/localfunctions/common/interfaceswitch.hh>
#include <dune/localfunctions/common/localkey.hh>
#include <dune/typetree/typetree.hh>
#include <dune/pdelab/gridfunctionspace/tags.hh>
#include <dune/pdelab/gridfunctionspace/localvector.hh>
namespace Dune {
namespace PDELab {
//! \addtogroup GridFunctionSpace
//! \ingroup PDELab
//! \{
namespace Experimental {
template<typename LFS>
struct LeafLFSMixin
: public TypeTree::LeafNode
{
const auto& finiteElement() const
{
return static_cast<const LFS*>(this)->tree().finiteElement();
}
template<typename Tree>
struct Traits
{
using FiniteElement = typename Tree::FiniteElement;
using FiniteElementType = FiniteElement;
};
};
template<typename GFS, typename TreePath = TypeTree::HybridTreePath<>>
class LocalFunctionSpace
: public LeafLFSMixin<LocalFunctionSpace<GFS,TreePath>>
{
public:
using Basis = typename GFS::Basis;
using LocalView = typename Basis::LocalView;
using Tree = TypeTree::ChildForTreePath<typename LocalView::Tree,TreePath>;
using LocalIndexSet = typename Basis::LocalIndexSet;
using DOFIndex = typename Basis::MultiIndex;
template<typename LFS, typename C, typename Tag>
friend class LFSIndexCacheBase;
struct Traits
: public LeafLFSMixin<LocalFunctionSpace<GFS,TreePath>>::template Traits<Tree>
{
using GridFunctionSpace = GFS;
using SizeType = std::size_t;
using DOFIndex = typename Basis::MultiIndex;
using ConstraintsType = typename GFS::Traits::ConstraintsType;
};
using size_type = std::size_t;
LocalFunctionSpace(std::shared_ptr<const GFS> gfs, TreePath tree_path = TreePath(), size_type offset = 0)
: _gfs(gfs)
, _local_view(gfs->basis())
, _tree_path(tree_path)
, _tree(TypeTree::child(_local_view.tree(),tree_path))
, _local_index_set(gfs->basis().localIndexSet())
{}
size_type subSpaceDepth() const
{
return 0;
}
//! \brief get current size
size_type size () const
{
return _local_view.size();
}
size_type maxSize () const
{
// _dof_indices is always as large as the max local size of the root GFS
return _local_view.maxSize();
}
//! \brief map index in this local function space to root local function space
size_type localIndex (size_type index) const
{
return _tree.localIndex(index);
}
DOFIndex dofIndex(size_type index) const
{
return _local_index_set.index(_tree.localIndex(index));
}
//! Returns the GridFunctionSpace underlying this LocalFunctionSpace.
const GFS& gridFunctionSpace() const
{
return *_gfs;
}
void bind(const typename GFS::Traits::EntitySet::template Codim<0>::Entity& e)
{
_local_view.bind(e);
_local_index_set.bind(_local_view);
}
const typename Traits::ConstraintsType& constraints() const
{
return _gfs->constraints();
}
const Tree& tree() const
{
return _tree;
}
private:
std::shared_ptr<const GFS> _gfs;
LocalView _local_view;
TreePath _tree_path;
const Tree& _tree;
LocalIndexSet _local_index_set;
};
// forward declare GridFunctionSpace
template<typename DFBasis, typename V, typename CE=NoConstraints>
class GridFunctionSpace;
} // namespace Experimental
template<typename DFBasis, typename V, typename CE, typename TAG>
class LocalFunctionSpace<Experimental::GridFunctionSpace<DFBasis,V,CE>,TAG>
: public Experimental::LocalFunctionSpace<Experimental::GridFunctionSpace<DFBasis,V,CE>>
{
using GFS = Experimental::GridFunctionSpace<DFBasis,V,CE>;
public:
LocalFunctionSpace(std::shared_ptr<const GFS> gfs)
: Experimental::LocalFunctionSpace<GFS>(gfs)
{}
LocalFunctionSpace(const GFS& gfs)
: Experimental::LocalFunctionSpace<GFS>(stackobject_to_shared_ptr(gfs))
{}
};
template<typename DFBasis, typename V, typename CE>
class LocalFunctionSpace<Experimental::GridFunctionSpace<DFBasis,V,CE>,AnySpaceTag>
: public Experimental::LocalFunctionSpace<Experimental::GridFunctionSpace<DFBasis,V,CE>>
{
using GFS = Experimental::GridFunctionSpace<DFBasis,V,CE>;
public:
LocalFunctionSpace(std::shared_ptr<const GFS> gfs)
: Experimental::LocalFunctionSpace<GFS>(gfs)
{}
LocalFunctionSpace(const GFS& gfs)
: Experimental::LocalFunctionSpace<GFS>(stackobject_to_shared_ptr(gfs))
{}
};
//! \} group GridFunctionSpace
} // namespace PDELab
} // namespace Dune
#endif // DUNE_PDELAB_GRIDFUNCTIONSPACE_DUNEFUNCTIONSLOCALFUNCTIONSPACE_HH
|