BEM++  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
local_dof_lists_cache.hpp
1 // Copyright (C) 2011-2012 by the Bem++ Authors
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #ifndef bempp_local_dof_lists_cache_hpp
22 #define bempp_local_dof_lists_cache_hpp
23 
24 #include "../common/common.hpp"
25 #include "../common/shared_ptr.hpp"
26 #include "../common/types.hpp"
27 
28 #include <tbb/concurrent_unordered_map.h>
29 #include <vector>
30 #include <iostream>
31 
32 namespace Bempp
33 {
34 
36 template <typename BasisFunctionType> class Space;
43 template <typename BasisFunctionType>
45 {
50  typedef int DofIndex;
51  std::vector<DofIndex> originalIndices;
52  std::vector<int> elementIndices;
53  std::vector<std::vector<LocalDofIndex> > localDofIndices;
54  std::vector<std::vector<BasisFunctionType> > localDofWeights;
55  std::vector<std::vector<int> > arrayIndices;
56 };
57 
61 template <typename BasisFunctionType>
63 {
64 public:
66  const std::vector<unsigned int>& p2o,
67  bool indexWithGlobalDofs);
69 
72  shared_ptr<const LocalDofLists<BasisFunctionType> > get(
73  int start, int indexCount);
74 
75 private:
76  void findLocalDofs(
77  int start,
78  int indexCount,
79  std::vector<typename LocalDofLists<BasisFunctionType>::DofIndex>& originalIndices,
80  std::vector<int>& elementIndices,
81  std::vector<std::vector<LocalDofIndex> >& localDofIndices,
82  std::vector<std::vector<BasisFunctionType> >& localDofWeights,
83  std::vector<std::vector<int> >& arrayIndices) const;
84 
85  void findLocalDofs(
86  int index,
87  std::vector<typename LocalDofLists<BasisFunctionType>::DofIndex>& originalIndices,
88  std::vector<int>& elementIndices,
89  std::vector<std::vector<LocalDofIndex> >& localDofIndices,
90  std::vector<std::vector<BasisFunctionType> >& localDofWeights,
91  std::vector<std::vector<int> >& arrayIndices) const;
92 
93 private:
95  const Space<BasisFunctionType>& m_space;
96  const std::vector<unsigned int>& m_p2o;
97  bool m_indexWithGlobalDofs;
98 
99  typedef tbb::concurrent_unordered_map<std::pair<int, int>,
100  const LocalDofLists<BasisFunctionType>*> LocalDofListsMap;
101  LocalDofListsMap m_map;
103 };
104 
105 } // namespace Bempp
106 
107 #endif
Function space.
Definition: assembled_potential_operator.hpp:35
Data used by WeakFormAcaAssemblyHelper to convert between H-matrix indices, global and local degrees ...
Definition: local_dof_lists_cache.hpp:44
Cache of LocalDofLists objects.
Definition: local_dof_lists_cache.hpp:62
int DofIndex
Type used to index matrices.
Definition: local_dof_lists_cache.hpp:50