/usr/include/deal.II/matrix_free/helper_functions.h is in libdeal.ii-dev 8.1.0-6ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | // ---------------------------------------------------------------------
// $Id: helper_functions.h 30036 2013-07-18 16:55:32Z maier $
//
// Copyright (C) 2011 - 2013 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
#ifndef __deal2__matrix_free_helper_functions_h
#define __deal2__matrix_free_helper_functions_h
#include <deal.II/base/exceptions.h>
#include <deal.II/base/memory_consumption.h>
#include <deal.II/base/index_set.h>
#include <deal.II/base/utilities.h>
#include <deal.II/base/tensor.h>
#include <deal.II/base/vectorization.h>
DEAL_II_NAMESPACE_OPEN
namespace internal
{
namespace MatrixFreeFunctions
{
// forward declaration of internal data structure
template <typename Number> struct ConstraintValues;
/**
* A struct that collects all information
* related to parallelization with threads:
* The work is subdivided into tasks that can
* be done independently.
*/
struct TaskInfo
{
/**
* Constructor.
*/
TaskInfo ();
/**
* Clears all the data fields and resets them
* to zero.
*/
void clear ();
/**
* Returns the memory consumption of
* the class.
*/
std::size_t memory_consumption () const;
unsigned int block_size;
unsigned int n_blocks;
unsigned int block_size_last;
unsigned int position_short_block;
bool use_multithreading;
bool use_partition_partition;
bool use_coloring_only;
std::vector<unsigned int> partition_color_blocks_row_index;
std::vector<unsigned int> partition_color_blocks_data;
unsigned int evens;
unsigned int odds;
unsigned int n_blocked_workers;
unsigned int n_workers;
std::vector<unsigned int> partition_evens;
std::vector<unsigned int> partition_odds;
std::vector<unsigned int> partition_n_blocked_workers;
std::vector<unsigned int> partition_n_workers;
};
/**
* A struct that collects all information
* related to the size of the problem and MPI
* parallelization.
*/
struct SizeInfo
{
/**
* Constructor.
*/
SizeInfo ();
/**
* Clears all data fields and resets the sizes
* to zero.
*/
void clear();
/**
* Prints minimum, average, and
* maximal memory consumption over the
* MPI processes.
*/
template <typename STREAM>
void print_memory_statistics (STREAM &out,
std::size_t data_length) const;
/**
* Determines the position of cells
* with ghosts for distributed-memory
* calculations.
*/
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);
unsigned int n_active_cells;
unsigned int n_macro_cells;
unsigned int boundary_cells_start;
unsigned int boundary_cells_end;
unsigned int vectorization_length;
/**
* index sets to describe the layout of cells:
* locally owned cells and locally active
* cells
*/
IndexSet locally_owned_cells;
IndexSet ghost_cells;
/**
* MPI communicator
*/
MPI_Comm communicator;
unsigned int my_pid;
unsigned int n_procs;
};
/**
* Data type to identify cell type.
*/
enum CellType {cartesian=0, affine=1, general=2, undefined=3};
/**
* A class that is used to compare floating point arrays (e.g. std::vectors,
* Tensor<1,dim>, etc.). The idea of this class is to consider two arrays as
* equal if they are the same within a given tolerance. We use this
* comparator class within an std::map<> of the given arrays. Note that this
* comparison operator does not satisfy all the mathematical properties one
* usually wants to have (consider e.g. the numbers a=0, b=0.1, c=0.2 with
* tolerance 0.15; the operator gives a<c, but neither of a<b? or b<c? is
* satisfied). This is not a problem in the use cases for this class, but be
* careful when using it in other contexts.
*/
template<typename Number>
struct FPArrayComparator
{
FPArrayComparator (const Number scaling);
bool operator() (const std::vector<Number> &v1,
const std::vector<Number> &v2) const;
template <int dim>
bool operator ()(const Tensor<1,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t1,
const Tensor<1,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t2) const;
template <int dim>
bool operator ()(const Tensor<2,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t1,
const Tensor<2,dim,Tensor<1,VectorizedArray<Number>::n_array_elements,Number> > &t2) const;
Number tolerance;
};
// Note: Implementation in matrix_free.templates.h
} // end of namespace MatrixFreeFunctions
} // end of namespace internal
DEAL_II_NAMESPACE_CLOSE
#endif
|