Reference documentation for deal.II version 8.5.1
helper_functions.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2011 - 2016 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 
17 #ifndef dealii__matrix_free_helper_functions_h
18 #define dealii__matrix_free_helper_functions_h
19 
20 
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/memory_consumption.h>
23 #include <deal.II/base/index_set.h>
24 #include <deal.II/base/utilities.h>
25 #include <deal.II/base/tensor.h>
26 #include <deal.II/base/vectorization.h>
27 
28 DEAL_II_NAMESPACE_OPEN
29 
30 
31 
32 namespace internal
33 {
34  namespace MatrixFreeFunctions
35  {
41  struct TaskInfo
42  {
46  TaskInfo ();
47 
51  void clear ();
52 
56  std::size_t memory_consumption () const;
57 
58  unsigned int block_size;
59  unsigned int n_blocks;
60  unsigned int block_size_last;
61  unsigned int position_short_block;
62  bool use_multithreading;
63  bool use_partition_partition;
64  bool use_coloring_only;
65 
66  std::vector<unsigned int> partition_color_blocks_row_index;
67  std::vector<unsigned int> partition_color_blocks_data;
68  unsigned int evens;
69  unsigned int odds;
70  unsigned int n_blocked_workers;
71  unsigned int n_workers;
72 
73  std::vector<unsigned int> partition_evens;
74  std::vector<unsigned int> partition_odds;
75  std::vector<unsigned int> partition_n_blocked_workers;
76  std::vector<unsigned int> partition_n_workers;
77  };
78 
79 
80 
85  struct SizeInfo
86  {
90  SizeInfo ();
91 
95  void clear();
96 
101  template <typename StreamType>
102  void print_memory_statistics (StreamType &out,
103  std::size_t data_length) const;
104 
109  void make_layout (const unsigned int n_active_cells_in,
110  const unsigned int vectorization_length_in,
111  std::vector<unsigned int> &boundary_cells,
112  std::vector<unsigned int> &irregular_cells);
113 
114  unsigned int n_active_cells;
115  unsigned int n_macro_cells;
116  unsigned int boundary_cells_start;
117  unsigned int boundary_cells_end;
118  unsigned int vectorization_length;
119 
125  IndexSet ghost_cells;
126 
130  MPI_Comm communicator;
131  unsigned int my_pid;
132  unsigned int n_procs;
133  };
134 
138  enum CellType
139  {
143  cartesian = 0,
147  affine = 1,
152  general = 2,
156  undefined = 3
157  };
158 
159 
172  template<typename Number>
174  {
175  FPArrayComparator (const Number scaling);
176 
177  bool operator() (const std::vector<Number> &v1,
178  const std::vector<Number> &v2) const;
179 
180  template <int dim>
181  bool operator ()(const Tensor<1,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t1,
182  const Tensor<1,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t2) const;
183 
184  template <int dim>
185  bool operator ()(const Tensor<2,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t1,
186  const Tensor<2,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t2) const;
187 
188  Number tolerance;
189  };
190 
191  // Note: Implementation in matrix_free.templates.h
192 
193  } // end of namespace MatrixFreeFunctions
194 } // end of namespace internal
195 
196 DEAL_II_NAMESPACE_CLOSE
197 
198 #endif
void print_memory_statistics(StreamType &out, std::size_t data_length) const
void make_layout(const unsigned int n_active_cells_in, const unsigned int vectorization_length_in, std::vector< unsigned int > &boundary_cells, std::vector< unsigned int > &irregular_cells)
Definition: mpi.h:41