/usr/include/deal.II/dofs/block_info.h is in libdeal.ii-dev 6.3.1-1.1.
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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | //---------------------------------------------------------------------------
// $Id: block_info.h 21432 2010-07-01 16:54:24Z bangerth $
// Version: $Name$
//
// Copyright (C) 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
//---------------------------------------------------------------------------
#ifndef __deal2__block_info_h
#define __deal2__block_info_h
#include <base/subscriptor.h>
#include <base/memory_consumption.h>
#include <lac/block_indices.h>
DEAL_II_NAMESPACE_OPEN
// Forward declarations
template <int dim, int spacedim> class DoFHandler;
template <int dim, int spacedim> class MGDoFHandler;
namespace hp
{
template <int dim, int spacedim> class DoFHandler;
}
/**
* @brief A small class collecting the different BlockIndices involved in
* global, multilevel and local computations.
*
* Once a DoFHandler has been initialized with an FESystem, a data
* object of type BlockInfo (accessed by DoFHandler::block_info() ) is
* filled, which reflects the block structure of the degrees of
* freedom.
*
* BlockInfo consists of several BlockIndices objects. The member
* global() reflects the block structure of the system on the active
* cell level, usually referred to as the global system. As soon as
* DoFHandler::distribute_dofs() has been called, the function
* BlockIndices::block_size() in global() will return the correct
* sizes of each block. After DoFRenumbering::block_wise(),
* BlockIndices::block_start() will return the start index for each of
* the blocks.
*
* When an MGDoFHandler is used, the same structure is automatically
* generated for each level. The level blocks can be accessed through
* level().
*
* Finally, there are local() BlockIndices, which describe the block
* structure on a single cell. This is used for instance by
* MeshWorker::Assembler::MatrixLocalBlocksToGlobalBlocks. The local
* indices are not filled automatically, since they change the
* behavior of the MeshWorker::Assembler classes relying on
* BlockInfo. They must be initialized by hand through initialize_local().
*
* <h3>Usage</h3>
*
* The most common usage for this object is initializing vectors as in
* the following code:
*
* <code>
* MGDofHandler<dim> dof_handler(triangulation);
* dof_handler.distribute_dofs(fesystem);
* DoFRenumbering::block_wise(dof_handler);
*
* BlockVector<double> solution(dof_handler.block_info().global());
*
* MGLevelObject<BlockVector<double> > mg_vector(0, triangulation.n_levels()-1);
* for (unsigned int i=0;i<triangulation.n_levels();++i)
* mg_vector[i].reinit(dof_handler.block_info().level(i));
*</code>
* In this example, <tt>solution</tt> obtains the block structure needed to
* represent a finite element function on the DoFHandler. Similarly,
* all levels of <tt>mg_vector</tt> will have the block structure
* needed on that level.
*
* @todo Extend the functions local() and renumber() to the concept to
* hpDoFHandler.
*
* @ingroup dofs
* @author Guido Kanschat, 2009
*/
class BlockInfo : public Subscriptor
{
public:
/**
* @brief Fill the object with values
* describing block structure
* of the DoFHandler.
*
* This function will also clear
* the local() indices.
*/
template <int dim, int spacedim>
void initialize(const DoFHandler<dim, spacedim>&);
/**
* @brief Fill the object with values
* describing level block
* structure of the
* MGDoFHandler. If
* <tt>levels_only</tt> is false,
* the other initialize() is
* called as well.
*
* This function will also clear
* the local() indices.
*/
template <int dim, int spacedim>
void initialize(const MGDoFHandler<dim, spacedim>&, bool levels_only = false);
/**
* @brief Initialize block structure
* on cells and compute
* renumbering between cell
* dofs and block cell dofs.
*/
template <int dim, int spacedim>
void initialize_local(const DoFHandler<dim, spacedim>&);
/**
* Access the BlockIndices
* structure of the global
* system.
*/
const BlockIndices& global() const;
/**
* Access BlockIndices for the
* local system on a cell.
*/
const BlockIndices& local() const;
/**
* Access the BlockIndices
* structure of a level in the
* multilevel hierarchy.
*/
const BlockIndices& level(unsigned int level) const;
/**
* Return the index after local
* renumbering.
*
* The input of this function is
* an index between zero and the
* number of dofs per cell,
* numbered in local block
* ordering, that is first all
* indices of the first system
* block, then all of the second
* block and so forth. The
* function then outpus the index
* in the standard local
* numbering of DoFAccessor.
*/
unsigned int renumber (unsigned int i) const;
/**
* The number of base elements.
*/
unsigned int n_base_elements() const;
/**
* Return the base element of
* this index.
*/
unsigned int base_element(unsigned int i) const;
/**
* Determine an estimate for the
* memory consumption (in bytes)
* of this object.
*/
unsigned int memory_consumption () const;
private:
/**
* @brief The block structure
* of the global system.
*/
BlockIndices bi_global;
/**
* @brief The multilevel block structure.
*/
std::vector<BlockIndices> levels;
/**
* @brief The block structure
* of the cell systems.
*/
BlockIndices bi_local;
/**
* The base element associated
* with each block.
*/
std::vector<unsigned int> base_elements;
/**
* A vector containing the
* renumbering from the
* standard order of degrees of
* freedom on a cell to a
* component wise
* ordering. Filled by
* initialize().
*/
std::vector<unsigned int> local_renumbering;
};
//----------------------------------------------------------------------//
inline
const BlockIndices&
BlockInfo::global() const
{
return bi_global;
}
inline
const BlockIndices&
BlockInfo::local() const
{
return bi_local;
}
inline
const BlockIndices&
BlockInfo::level(unsigned int l) const
{
AssertIndexRange(l, levels.size());
return levels[l];
}
inline
unsigned int BlockInfo::renumber(unsigned int i) const
{
AssertIndexRange(i, local_renumbering.size());
return local_renumbering[i];
}
inline
unsigned int
BlockInfo::base_element(unsigned int i) const
{
AssertIndexRange(i, base_elements.size());
return base_elements[i];
}
inline
unsigned int
BlockInfo::n_base_elements() const
{
return base_elements.size();
}
inline
unsigned int
BlockInfo::memory_consumption () const
{
unsigned int mem = (MemoryConsumption::memory_consumption (bi_global) +
MemoryConsumption::memory_consumption (levels) +
MemoryConsumption::memory_consumption (bi_local) +
MemoryConsumption::memory_consumption (base_elements)
);
return mem;
}
DEAL_II_NAMESPACE_CLOSE
#endif
|