Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
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.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #include <deal.II/base/memory_consumption.h>
17 
18 #include <deal.II/dofs/number_cache.h>
19 
20 #include <numeric>
21 
22 
23 DEAL_II_NAMESPACE_OPEN
24 
25 namespace internal
26 {
27  namespace DoFHandlerImplementation
28  {
30  : n_global_dofs(0)
31  , n_locally_owned_dofs(0)
32  {}
33 
34 
35 
37  : n_global_dofs(n_global_dofs)
38  , n_locally_owned_dofs(n_global_dofs)
39  , locally_owned_dofs(complete_index_set(n_global_dofs))
40  , n_locally_owned_dofs_per_processor(1, n_global_dofs)
41  , locally_owned_dofs_per_processor(1, complete_index_set(n_global_dofs))
42  {}
43 
44 
45 
47  const std::vector<IndexSet> &locally_owned_dofs_per_processor,
48  const unsigned int my_rank)
49  : locally_owned_dofs_per_processor(locally_owned_dofs_per_processor)
50  {
51  const unsigned int n_procs = locally_owned_dofs_per_processor.size();
52 
53  // compress IndexSet representation before using it for anything else
54  for (unsigned int p = 0; p < n_procs; ++p)
56 
57  n_locally_owned_dofs_per_processor.resize(n_procs);
58  for (unsigned int p = 0; p < n_procs; ++p)
60  locally_owned_dofs_per_processor[p].n_elements();
63 
64 
66  std::accumulate(n_locally_owned_dofs_per_processor.begin(),
69  }
70 
71 
72 
73  void
75  {
76  n_global_dofs = 0;
81  }
82 
83  std::size_t
85  {
93  }
94  } // namespace DoFHandlerImplementation
95 } // namespace internal
96 
97 DEAL_II_NAMESPACE_CLOSE
void clear()
Definition: index_set.h:1576
std::vector< types::global_dof_index > n_locally_owned_dofs_per_processor
Definition: number_cache.h:146
unsigned int global_dof_index
Definition: types.h:89
std::vector< IndexSet > locally_owned_dofs_per_processor
Definition: number_cache.h:157
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)