Reference documentation for deal.II version 9.0.0
number_cache.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <deal.II/base/memory_consumption.h>
17 #include <deal.II/dofs/number_cache.h>
18 
19 #include <numeric>
20 
21 
22 DEAL_II_NAMESPACE_OPEN
23 
24 namespace internal
25 {
26  namespace DoFHandlerImplementation
27  {
29  :
30  n_global_dofs (0),
31  n_locally_owned_dofs (0)
32  {}
33 
34 
35 
37  :
38  n_global_dofs (n_global_dofs),
39  n_locally_owned_dofs (n_global_dofs),
40  locally_owned_dofs (complete_index_set(n_global_dofs)),
41  n_locally_owned_dofs_per_processor (1, n_global_dofs),
42  locally_owned_dofs_per_processor (1, complete_index_set(n_global_dofs))
43  {}
44 
45 
46 
47  NumberCache::NumberCache (const std::vector<IndexSet> &locally_owned_dofs_per_processor,
48  const unsigned int my_rank)
49  :
50  locally_owned_dofs_per_processor (locally_owned_dofs_per_processor)
51  {
52  const unsigned int n_procs = locally_owned_dofs_per_processor.size();
53 
54  // compress IndexSet representation before using it for anything else
55  for (unsigned int p=0; p<n_procs; ++p)
57 
58  n_locally_owned_dofs_per_processor.resize (n_procs);
59  for (unsigned int p=0; p<n_procs; ++p)
61  = locally_owned_dofs_per_processor[p].n_elements();
64 
65 
66  n_global_dofs = std::accumulate (n_locally_owned_dofs_per_processor.begin(),
69  }
70 
71 
72 
74  {
75  n_global_dofs = 0;
80  }
81 
82  std::size_t
84  {
85  return
91  }
92  }
93 }
94 
95 DEAL_II_NAMESPACE_CLOSE
void clear()
Definition: index_set.h:1549
unsigned int global_dof_index
Definition: types.h:88
std::vector< types::global_dof_index > n_locally_owned_dofs_per_processor
Definition: number_cache.h:141
std::vector< IndexSet > locally_owned_dofs_per_processor
Definition: number_cache.h:152
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)