/usr/include/dolfin/mesh/Restriction.h is in libdolfin-dev 1.4.0+dfsg-4.
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 | // Copyright (C) 2012 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/>.
//
// First added: 2012-11-14
// Last changed: 2012-11-19
#ifndef __RESTRICTION_H
#define __RESTRICTION_H
#include <memory>
#include "MeshFunction.h"
namespace dolfin
{
// Forward declarations
class SubDomain;
/// This class represents a restriction of a mesh to a subdomain,
/// which can be defined as a subset of all the cells, the facets,
/// or possibly lower dimensional entities of the mesh.
class Restriction
{
public:
/// Create cell-based restriction from subdomain
///
/// *Arguments*
/// mesh (_Mesh_)
/// The mesh
/// sub_domain (_SubDomain_)
/// Sub domain defining the restriction
Restriction(const Mesh& mesh, const SubDomain& sub_domain);
/// Create restriction from subdomain to entities of arbitrary dimension
///
/// *Arguments*
/// mesh (_Mesh_)
/// The mesh
/// sub_domain (_SubDomain_)
/// Sub domain defining the restriction
/// dim (std::size_t)
/// Dimension of restriction
Restriction(const Mesh& mesh, const SubDomain& sub_domain, std::size_t dim);
/// Create restriction from domain markers
///
/// *Arguments*
/// domain_markers (_MeshFunction_ <std::size_t>)
/// Domain markers for the cells of the mesh.
/// domain_number (std::size_t)
/// Identifier for domain.
Restriction(const MeshFunction<std::size_t>& domain_markers,
std::size_t domain_number);
/// Create restriction from domain markers (shared pointer version)
///
/// *Arguments*
/// domain_markers (_MeshFunction_ <std::size_t>)
/// Domain markers for the cells of the mesh.
/// domain_number (std::size_t)
/// Identifier for domain.
Restriction(std::shared_ptr<const MeshFunction<std::size_t> > domain_markers,
std::size_t domain_number);
/// Return the full unrestricted mesh
const Mesh& mesh() const;
/// Return topological dimension of restriction
std::size_t dim() const;
/// Check whether restriction contains entity
bool contains(const MeshEntity& entity) const
{
dolfin_assert(_domain_markers);
return (*_domain_markers)[entity] == _domain_number;
}
/// Check whether restriction contains entity (d, i)
bool contains(std::size_t d, std::size_t i) const
{
dolfin_assert(_domain_markers);
dolfin_assert(d == _domain_markers->dim());
return (*_domain_markers)[i] == _domain_number;
}
private:
// Initialize domain markers from subdomain
void init_from_subdomain(const Mesh& mesh,
const SubDomain& sub_domain, std::size_t dim);
// Domain markers
std::shared_ptr<const MeshFunction<std::size_t> > _domain_markers;
// Identifier for domain
std::size_t _domain_number;
};
}
#endif
|