/usr/include/deal.II/lac/block_vector.templates.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 | //---------------------------------------------------------------------------
// $Id: block_vector.templates.h 19347 2009-08-26 18:09:32Z kanschat $
// Version: $Name$
//
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 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_vector_templates_h
#define __deal2__block_vector_templates_h
#include <base/config.h>
#include <lac/block_vector.h>
#include <lac/trilinos_block_vector.h>
#include <cmath>
#include <algorithm>
DEAL_II_NAMESPACE_OPEN
template <typename Number>
BlockVector<Number>::BlockVector (const unsigned int n_blocks,
const unsigned int block_size)
{
reinit (n_blocks, block_size);
}
template <typename Number>
BlockVector<Number>::BlockVector (const std::vector<unsigned int> &n)
{
reinit (n, false);
}
template <typename Number>
BlockVector<Number>::BlockVector (const BlockIndices& n)
{
reinit (n, false);
}
template <typename Number>
BlockVector<Number>::BlockVector (const BlockVector<Number>& v)
:
BlockVectorBase<Vector<Number> > ()
{
this->components.resize (v.n_blocks());
this->block_indices = v.block_indices;
for (unsigned int i=0; i<this->n_blocks(); ++i)
this->components[i] = v.components[i];
}
#ifndef DEAL_II_EXPLICIT_CONSTRUCTOR_BUG
template <typename Number>
template <typename OtherNumber>
BlockVector<Number>::BlockVector (const BlockVector<OtherNumber>& v)
{
reinit (v, true);
*this = v;
}
#endif
#ifdef DEAL_II_USE_TRILINOS
template <typename Number>
BlockVector<Number>::BlockVector (const TrilinosWrappers::BlockVector &v)
{
this->block_indices = v.get_block_indices();
this->components.resize(this->n_blocks());
for (unsigned int i=0; i<this->n_blocks(); ++i)
this->components[i] = v.block(i);
BaseClass::collect_sizes();
}
#endif
template <typename Number>
void BlockVector<Number>::reinit (const unsigned int n_bl,
const unsigned int bl_sz,
const bool fast)
{
std::vector<unsigned int> n(n_bl, bl_sz);
reinit(n, fast);
}
template <typename Number>
void BlockVector<Number>::reinit (const std::vector<unsigned int> &n,
const bool fast)
{
this->block_indices.reinit (n);
if (this->components.size() != this->n_blocks())
this->components.resize(this->n_blocks());
for (unsigned int i=0; i<this->n_blocks(); ++i)
this->components[i].reinit(n[i], fast);
}
template <typename Number>
void BlockVector<Number>::reinit (
const BlockIndices& n,
const bool fast)
{
this->block_indices = n;
if (this->components.size() != this->n_blocks())
this->components.resize(this->n_blocks());
for (unsigned int i=0; i<this->n_blocks(); ++i)
this->components[i].reinit(n.block_size(i), fast);
}
template <typename Number>
template <typename Number2>
void BlockVector<Number>::reinit (const BlockVector<Number2>& v,
const bool fast)
{
this->block_indices = v.get_block_indices();
if (this->components.size() != this->n_blocks())
this->components.resize(this->n_blocks());
for (unsigned int i=0;i<this->n_blocks();++i)
this->block(i).reinit(v.block(i), fast);
}
template <typename Number>
BlockVector<Number>::~BlockVector ()
{}
#ifdef DEAL_II_USE_TRILINOS
template <typename Number>
inline
BlockVector<Number> &
BlockVector<Number>::operator = (const TrilinosWrappers::BlockVector &v)
{
BaseClass::operator = (v);
return *this;
}
#endif
template <typename Number>
void BlockVector<Number>::swap (BlockVector<Number> &v)
{
Assert (this->n_blocks() == v.n_blocks(),
ExcDimensionMismatch(this->n_blocks(), v.n_blocks()));
for (unsigned int i=0; i<this->n_blocks(); ++i)
dealii::swap (this->components[i], v.components[i]);
dealii::swap (this->block_indices, v.block_indices);
}
template <typename Number>
void BlockVector<Number>::print (std::ostream &out,
const unsigned int precision,
const bool scientific,
const bool across) const
{
for (unsigned int i=0;i<this->n_blocks();++i)
{
if (across)
out << 'C' << i << ':';
else
out << "Component " << i << std::endl;
this->components[i].print(out, precision, scientific, across);
}
}
template <typename Number>
void BlockVector<Number>::block_write (std::ostream &out) const
{
for (unsigned int i=0;i<this->n_blocks();++i)
this->components[i].block_write(out);
}
template <typename Number>
void BlockVector<Number>::block_read (std::istream &in)
{
for (unsigned int i=0;i<this->n_blocks();++i)
this->components[i].block_read(in);
}
DEAL_II_NAMESPACE_CLOSE
#endif
|