Reference documentation for deal.II version 8.4.2
helper_functions.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2011 - 2015 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  {
36  // forward declaration of internal data structure
37  template <typename Number> struct ConstraintValues;
38 
44  struct TaskInfo
45  {
49  TaskInfo ();
50 
54  void clear ();
55 
59  std::size_t memory_consumption () const;
60 
61  unsigned int block_size;
62  unsigned int n_blocks;
63  unsigned int block_size_last;
64  unsigned int position_short_block;
65  bool use_multithreading;
66  bool use_partition_partition;
67  bool use_coloring_only;
68 
69  std::vector<unsigned int> partition_color_blocks_row_index;
70  std::vector<unsigned int> partition_color_blocks_data;
71  unsigned int evens;
72  unsigned int odds;
73  unsigned int n_blocked_workers;
74  unsigned int n_workers;
75 
76  std::vector<unsigned int> partition_evens;
77  std::vector<unsigned int> partition_odds;
78  std::vector<unsigned int> partition_n_blocked_workers;
79  std::vector<unsigned int> partition_n_workers;
80  };
81 
82 
83 
88  struct SizeInfo
89  {
93  SizeInfo ();
94 
98  void clear();
99 
104  template <typename StreamType>
105  void print_memory_statistics (StreamType &out,
106  std::size_t data_length) const;
107 
112  void make_layout (const unsigned int n_active_cells_in,
113  const unsigned int vectorization_length_in,
114  std::vector<unsigned int> &boundary_cells,
115  std::vector<unsigned int> &irregular_cells);
116 
117  unsigned int n_active_cells;
118  unsigned int n_macro_cells;
119  unsigned int boundary_cells_start;
120  unsigned int boundary_cells_end;
121  unsigned int vectorization_length;
122 
128  IndexSet ghost_cells;
129 
133  MPI_Comm communicator;
134  unsigned int my_pid;
135  unsigned int n_procs;
136  };
137 
141  enum CellType {cartesian=0, affine=1, general=2, undefined=3};
142 
143 
156  template<typename Number>
158  {
159  FPArrayComparator (const Number scaling);
160 
161  bool operator() (const std::vector<Number> &v1,
162  const std::vector<Number> &v2) const;
163 
164  template <int dim>
165  bool operator ()(const Tensor<1,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t1,
166  const Tensor<1,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t2) const;
167 
168  template <int dim>
169  bool operator ()(const Tensor<2,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t1,
170  const Tensor<2,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t2) const;
171 
172  Number tolerance;
173  };
174 
175  // Note: Implementation in matrix_free.templates.h
176 
177  } // end of namespace MatrixFreeFunctions
178 } // end of namespace internal
179 
180 DEAL_II_NAMESPACE_CLOSE
181 
182 #endif
Definition: mpi.h:48