/usr/include/dolfin/fem/PeriodicBC.h is in libdolfin1.0-dev 1.0.0-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 | // Copyright (C) 2007-2008 Anders Logg
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can 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 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// Modified by Garth N. Wells 2007
// Modified by Johan Hake 2009
//
// First added: 2007-07-08
// Last changed: 2009-10-21
#ifndef __PERIODIC_BC_H
#define __PERIODIC_BC_H
#include <boost/shared_ptr.hpp>
#include <dolfin/common/types.h>
#include "BoundaryCondition.h"
namespace dolfin
{
class Mesh;
class SubDomain;
class Form;
class GenericMatrix;
class GenericVector;
/// This class specifies the interface for setting periodic boundary
/// conditions for partial differential equations,
///
/// .. math::
///
/// u(x) &= u(F^{-1}(x)) \hbox { on } G,
///
/// u(x) &= u(F(x)) \hbox{ on } H,
///
/// where F : H --> G is a map from a subdomain H to a subdomain G.
///
/// A periodic boundary condition must be defined by the domain G
/// and the map F pulling coordinates back from H to G. The domain
/// and the map are both defined by a subclass of _SubDomain_ which
/// must overload both the inside() function, which specifies the
/// points of G, and the map() function, which specifies the map
/// from the points of H to the points of G.
///
/// The implementation is based on matching degrees of freedom on G
/// with degrees of freedom on H and only works when the mapping F
/// is bijective between the sets of coordinates associated with the
/// two domains. In other words, the nodes (degrees of freedom) must
/// be aligned on G and H.
///
/// The matching of degrees of freedom is done at the construction
/// of the periodic boundary condition and is reused on subsequent
/// applications to a linear system. The matching may be recomputed
/// by calling the ``rebuild()`` function.
class PeriodicBC : public BoundaryCondition
{
public:
/// Create periodic boundary condition for subdomain
///
/// *Arguments*
/// V (_FunctionSpace_)
/// The function space.
/// sub_domain (_SubDomain_)
/// The sub domain.
PeriodicBC(const FunctionSpace& V,
const SubDomain& sub_domain);
/// Create periodic boundary condition for subdomain
///
/// *Arguments*
/// V (_FunctionSpace_)
/// The function space.
/// sub_domain (_SubDomain_)
/// The subdomain.
PeriodicBC(boost::shared_ptr<const FunctionSpace> V,
boost::shared_ptr<const SubDomain> sub_domain);
/// Destructor
~PeriodicBC();
/// Apply boundary condition to a matrix
///
/// *Arguments*
/// A (_GenericMatrix_)
/// The matrix to apply bc to.
void apply(GenericMatrix& A) const;
/// Apply boundary condition to a vector
///
/// *Arguments*
/// b (_GenericVector_)
/// The vector to apply bc to.
void apply(GenericVector& b) const;
/// Apply boundary condition to a linear system
///
/// *Arguments*
/// A (_GenericMatrix_)
/// The matrix.
/// b (_GenericVector_)
/// The vector.
void apply(GenericMatrix& A, GenericVector& b) const;
/// Apply boundary condition to a vector for a nonlinear problem
///
/// *Arguments*
/// b (_GenericVector_)
/// The vector to apply bc to.
/// x (_GenericVector_)
/// Another vector (nonlinear problem).
void apply(GenericVector& b, const GenericVector& x) const;
/// Apply boundary condition to a linear system for a nonlinear
/// problem
///
/// *Arguments*
/// A (_GenericMatrix_)
/// The matrix to apply bc to.
/// b (_GenericVector_)
/// The vector to apply bc to.
/// x (_GenericVector_)
/// Another vector (nonlinear problem).
void apply(GenericMatrix& A, GenericVector& b, const GenericVector& x) const;
/// Rebuild mapping between dofs
void rebuild();
private:
// Apply boundary conditions, common method
void apply(GenericMatrix* A, GenericVector* b, const GenericVector* x) const;
// Extract dof pairs for sub space and append to list
void extract_dof_pairs(const FunctionSpace& function_space, std::vector<std::pair<uint, uint> >& dof_pairs);
// The subdomain
boost::shared_ptr<const SubDomain> sub_domain;
// Number of dof pairs
uint num_dof_pairs;
// Array of master dofs (size num_dof_pairs)
std::vector<uint> master_dofs;
// Array of slave dofs (size num_dof_pairs)
std::vector<uint> slave_dofs;
// Right-hand side values, used for zeroing entries in right-hand side (size num_dof_pairs)
mutable std::vector<double> rhs_values_master;
mutable std::vector<double> rhs_values_slave;
};
}
#endif
|