/usr/include/dolfin/fem/MultiMeshDirichletBC.h is in libdolfin-dev 2016.2.0-2.
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 | // Copyright (C) 2014-2016 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 4 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/>.
//
// First added: 2014-05-12
// Last changed: 2016-03-02
#ifndef __MULTI_MESH_DIRICHLET_BC_H
#define __MULTI_MESH_DIRICHLET_BC_H
#include <vector>
#include <memory>
#include <dolfin/mesh/SubDomain.h>
namespace dolfin
{
// Forward declarations
class MultiMeshFunctionSpace;
class GenericFunction;
class SubDomain;
class GenericMatrix;
class GenericVector;
class DirichletBC;
/// This class is used to set Dirichlet boundary conditions for
/// multimesh function spaces.
class MultiMeshDirichletBC
{
public:
/// Create boundary condition for subdomain
///
/// *Arguments*
/// V (_MultiMeshFunctionSpace_)
/// The function space
/// g (_GenericFunction_)
/// The value
/// sub_domain (_SubDomain_)
/// The subdomain
/// method (std::string)
/// Option passed to DirichletBC.
/// check_midpoint (bool)
/// Option passed to DirichletBC.
/// exclude_overlapped_boundaries (bool)
/// If true, then the variable on_boundary will
/// be set to false for facets that are overlapped
/// by another mesh (irrespective of the layering order
/// of the meshes).
MultiMeshDirichletBC(std::shared_ptr<const MultiMeshFunctionSpace> V,
std::shared_ptr<const GenericFunction> g,
std::shared_ptr<const SubDomain> sub_domain,
std::string method="topological",
bool check_midpoint=true,
bool exclude_overlapped_boundaries=true);
/// Create boundary condition for subdomain specified by index
///
/// *Arguments*
/// V (_FunctionSpace_)
/// The function space.
/// g (_GenericFunction_)
/// The value.
/// sub_domains (_MeshFunction_ <std::size_t>)
/// Subdomain markers
/// sub_domain (std::size_t)
/// The subdomain index (number)
/// part (std::size_t)
/// The part on which to set boundary conditions
/// method (std::string)
/// Optional argument: A string specifying the
/// method to identify dofs.
MultiMeshDirichletBC(std::shared_ptr<const MultiMeshFunctionSpace> V,
std::shared_ptr<const GenericFunction> g,
std::shared_ptr<const MeshFunction<std::size_t>> sub_domains,
std::size_t sub_domain,
std::size_t part,
std::string method="topological");
/// Destructor
~MultiMeshDirichletBC();
/// Apply boundary condition to a matrix
///
/// *Arguments*
/// A (_GenericMatrix_)
/// The matrix to apply boundary condition to.
void apply(GenericMatrix& A) const;
/// Apply boundary condition to a vector
///
/// *Arguments*
/// b (_GenericVector_)
/// The vector to apply boundary condition to.
void apply(GenericVector& b) const;
/// Apply boundary condition to a linear system
///
/// *Arguments*
/// A (_GenericMatrix_)
/// The matrix to apply boundary condition to.
/// b (_GenericVector_)
/// The vector to apply boundary condition to.
void apply(GenericMatrix& A,
GenericVector& b) const;
/// Apply boundary condition to vectors for a nonlinear problem
///
/// *Arguments*
/// b (_GenericVector_)
/// The vector to apply boundary conditions 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 boundary conditions to.
/// b (_GenericVector_)
/// The vector to apply boundary conditions to.
/// x (_GenericVector_)
/// Another vector (nonlinear problem).
void apply(GenericMatrix& A,
GenericVector& b,
const GenericVector& x) const;
private:
// Subclass of SubDomain wrapping user-defined subdomain
class MultiMeshSubDomain : public SubDomain
{
public:
// Constructor
MultiMeshSubDomain(std::shared_ptr<const SubDomain> sub_domain,
std::shared_ptr<const MultiMesh> multimesh,
bool exclude_overlapped_boundaries);
// Destructor
~MultiMeshSubDomain();
// Callback for checking whether point is in domain
bool inside(const Array<double>& x, bool on_boundary) const;
// Set current part
void set_current_part(std::size_t current_part);
private:
// User-defined subdomain
std::shared_ptr<const SubDomain> _user_sub_domain;
// Multimesh
std::shared_ptr<const MultiMesh> _multimesh;
// Current part
std::size_t _current_part;
// Check whether to exclude boundaries overlapped by other meshes
bool _exclude_overlapped_boundaries;
};
// List of boundary conditions for parts
std::vector<std::shared_ptr<const DirichletBC>> _bcs;
// Wrapper of user-defined subdomain
mutable std::shared_ptr<MultiMeshSubDomain> _sub_domain;
// Check whether to exclude boundaries overlapped by other meshes
bool _exclude_overlapped_boundaries;
};
}
#endif
|