Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
helper_functions.h
1 // ---------------------------------------------------------------------
2 // @f$Id: helper_functions.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 2011 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 
18 #ifndef __deal2__matrix_free_helper_functions_h
19 #define __deal2__matrix_free_helper_functions_h
20 
21 
23 #include <deal.II/base/memory_consumption.h>
24 #include <deal.II/base/index_set.h>
25 #include <deal.II/base/utilities.h>
26 #include <deal.II/base/tensor.h>
27 #include <deal.II/base/vectorization.h>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
31 
32 
33 namespace internal
34 {
35  namespace MatrixFreeFunctions
36  {
37  // forward declaration of internal data structure
38  template <typename Number> struct ConstraintValues;
39 
46  struct TaskInfo
47  {
51  TaskInfo ();
52 
57  void clear ();
58 
63  std::size_t memory_consumption () const;
64 
65  unsigned int block_size;
66  unsigned int n_blocks;
67  unsigned int block_size_last;
68  unsigned int position_short_block;
69  bool use_multithreading;
70  bool use_partition_partition;
71  bool use_coloring_only;
72 
73  std::vector<unsigned int> partition_color_blocks_row_index;
74  std::vector<unsigned int> partition_color_blocks_data;
75  unsigned int evens;
76  unsigned int odds;
77  unsigned int n_blocked_workers;
78  unsigned int n_workers;
79 
80  std::vector<unsigned int> partition_evens;
81  std::vector<unsigned int> partition_odds;
82  std::vector<unsigned int> partition_n_blocked_workers;
83  std::vector<unsigned int> partition_n_workers;
84  };
85 
86 
87 
93  struct SizeInfo
94  {
98  SizeInfo ();
99 
104  void clear();
105 
111  template <typename STREAM>
112  void print_memory_statistics (STREAM &out,
113  std::size_t data_length) const;
114 
120  void make_layout (const unsigned int n_active_cells_in,
121  const unsigned int vectorization_length_in,
122  std::vector<unsigned int> &boundary_cells,
123  std::vector<unsigned int> &irregular_cells);
124 
125  unsigned int n_active_cells;
126  unsigned int n_macro_cells;
127  unsigned int boundary_cells_start;
128  unsigned int boundary_cells_end;
129  unsigned int vectorization_length;
130 
137  IndexSet ghost_cells;
138 
142  MPI_Comm communicator;
143  unsigned int my_pid;
144  unsigned int n_procs;
145  };
146 
150  enum CellType {cartesian=0, affine=1, general=2, undefined=3};
151 
152 
164  template<typename Number>
166  {
167  FPArrayComparator (const Number scaling);
168 
169  bool operator() (const std::vector<Number> &v1,
170  const std::vector<Number> &v2) const;
171 
172  template <int dim>
173  bool operator ()(const Tensor<1,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t1,
174  const Tensor<1,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t2) const;
175 
176  template <int dim>
177  bool operator ()(const Tensor<2,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t1,
178  const Tensor<2,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t2) const;
179 
180  Number tolerance;
181  };
182 
183  // Note: Implementation in matrix_free.templates.h
184 
185  } // end of namespace MatrixFreeFunctions
186 } // end of namespace internal
187 
188 DEAL_II_NAMESPACE_CLOSE
189 
190 #endif
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)
void print_memory_statistics(STREAM &out, std::size_t data_length) const