/usr/include/dolfin/fem/Form.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 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 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | // Copyright (C) 2007-2011 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, 2008-2011.
// Modified by Martin Alnes, 2008.
//
// First added: 2007-04-02
// Last changed: 2011-09-13
#ifndef __FORM_H
#define __FORM_H
#include <map>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <dolfin/common/Hierarchical.h>
#include <dolfin/common/types.h>
#include "DomainAssigner.h"
#include "Equation.h"
// Forward declaration
namespace ufc
{
class form;
}
namespace dolfin
{
class FunctionSpace;
class GenericFunction;
class Mesh;
template <typename T> class MeshFunction;
/// Base class for UFC code generated by FFC for DOLFIN with option -l.
///
/// A note on the order of trial and test spaces: FEniCS numbers
/// argument spaces starting with the leading dimension of the
/// corresponding tensor (matrix). In other words, the test space is
/// numbered 0 and the trial space is numbered 1. However, in order
/// to have a notation that agrees with most existing finite element
/// literature, in particular
///
/// a = a(u, v)
///
/// the spaces are numbered from right to
///
/// a: V_1 x V_0 -> R
///
/// .. note::
///
/// Figure out how to write this in math mode without it getting
/// messed up in the Python version.
///
/// This is reflected in the ordering of the spaces that should be
/// supplied to generated subclasses. In particular, when a bilinear
/// form is initialized, it should be initialized as
///
/// .. code-block:: c++
///
/// a(V_1, V_0) = ...
///
/// where ``V_1`` is the trial space and ``V_0`` is the test space.
/// However, when a form is initialized by a list of argument spaces
/// (the variable ``function_spaces`` in the constructors below, the
/// list of spaces should start with space number 0 (the test space)
/// and then space number 1 (the trial space).
class Form : public Hierarchical<Form>
{
public:
/// Create form of given rank with given number of coefficients
///
/// *Arguments*
/// rank (uint)
/// The rank.
/// num_coefficients (uint)
/// The number of coefficients.
Form(uint rank, uint num_coefficients);
/// Create form (shared data)
///
/// *Arguments*
/// ufc_form (ufc::form)
/// The UFC form.
/// function_spaces (std::vector<_FunctionSpace_>)
/// Vector of function spaces.
/// coefficients (std::vector<_GenericFunction_>)
/// Vector of coefficients.
Form(boost::shared_ptr<const ufc::form> ufc_form,
std::vector<boost::shared_ptr<const FunctionSpace> > function_spaces,
std::vector<boost::shared_ptr<const GenericFunction> > coefficients);
/// Destructor
virtual ~Form();
/// Return rank of form (bilinear form = 2, linear form = 1,
/// functional = 0, etc)
///
/// *Returns*
/// uint
/// The rank of the form.
uint rank() const;
/// Return number of coefficients
///
/// *Returns*
/// uint
/// The number of coefficients.
uint num_coefficients() const;
/// Return coloring type for colored (multi-threaded) assembly of form
/// over a mesh entity of a given dimension
///
/// *Arguments*
/// entity_dim (uint)
/// Dimension.
///
/// *Returns*
/// std::vector<uint>
/// Coloring type.
std::vector<uint> coloring(uint entity_dim) const;
/// Set mesh, necessary for functionals when there are no function spaces
///
/// *Arguments*
/// mesh (_Mesh_)
/// The mesh.
void set_mesh(boost::shared_ptr<const Mesh> mesh);
/// Extract common mesh from form
///
/// *Returns*
/// _Mesh_
/// The mesh.
const Mesh& mesh() const;
/// Return mesh shared pointer (if any)
///
/// *Returns*
/// _Mesh_
/// The mesh shared pointer.
boost::shared_ptr<const Mesh> mesh_shared_ptr() const;
/// Return function space for given argument
///
/// *Arguments*
/// i (uint)
/// Index
///
/// *Returns*
/// _FunctionSpace_
/// Function space shared pointer.
boost::shared_ptr<const FunctionSpace> function_space(uint i) const;
/// Return function spaces for arguments
///
/// *Returns*
/// std::vector<_FunctionSpace_>
/// Vector of function space shared pointers.
std::vector<boost::shared_ptr<const FunctionSpace> > function_spaces() const;
/// Set coefficient with given number (shared pointer version)
///
/// *Arguments*
/// i (uint)
/// The given number.
/// coefficient (_GenericFunction_)
/// The coefficient.
void set_coefficient(uint i,
boost::shared_ptr<const GenericFunction> coefficient);
/// Set coefficient with given name (shared pointer version)
///
/// *Arguments*
/// name (std::string)
/// The name.
/// coefficient (_GenericFunction_)
/// The coefficient.
void set_coefficient(std::string name,
boost::shared_ptr<const GenericFunction> coefficient);
/// Set all coefficients in given map, possibly a subset (shared
/// pointer version)
///
/// *Arguments*
/// coefficients (std::map<std::string, _GenericFunction_>)
/// The map of coefficients.
void set_coefficients(std::map<std::string, boost::shared_ptr<const GenericFunction> > coefficients);
/// Return coefficient with given number
///
/// *Arguments*
/// i (uint)
/// Index
///
/// *Returns*
/// _GenericFunction_
/// The coefficient.
boost::shared_ptr<const GenericFunction> coefficient(uint i) const;
/// Return coefficient with given name
///
/// *Arguments*
/// name (std::string)
/// The name.
///
/// *Returns*
/// _GenericFunction_
/// The coefficient.
boost::shared_ptr<const GenericFunction> coefficient(std::string name) const;
/// Return all coefficients
///
/// *Returns*
/// std::vector<_GenericFunction_>
/// All coefficients.
std::vector<boost::shared_ptr<const GenericFunction> > coefficients() const;
/// Return the number of the coefficient with this name
///
/// *Arguments*
/// name (std::string)
/// The name.
///
/// *Returns*
/// uint
/// The number of the coefficient with the given name.
virtual uint coefficient_number(const std::string & name) const;
/// Return the name of the coefficient with this number
///
/// *Arguments*
/// i (uint)
/// The number
///
/// *Returns*
/// std::string
/// The name of the coefficient with the given number.
virtual std::string coefficient_name(uint i) const;
/// Return cell domains (zero pointer if no domains have been
/// specified)
///
/// *Returns*
/// _MeshFunction_ <uint>
/// The cell domains.
boost::shared_ptr<const MeshFunction<uint> > cell_domains_shared_ptr() const;
/// Return exterior facet domains (zero pointer if no domains have
/// been specified)
///
/// *Returns*
/// boost::shared_ptr<_MeshFunction_ <uint> >
/// The exterior facet domains.
boost::shared_ptr<const MeshFunction<uint> > exterior_facet_domains_shared_ptr() const;
/// Return interior facet domains (zero pointer if no domains have
/// been specified)
///
/// *Returns*
/// _MeshFunction_ <uint>
/// The interior facet domains.
boost::shared_ptr<const MeshFunction<uint> > interior_facet_domains_shared_ptr() const;
/// Set cell domains
///
/// *Arguments*
/// cell_domains (_MeshFunction_ <unsigned int>)
/// The cell domains.
void set_cell_domains(boost::shared_ptr<const MeshFunction<unsigned int> > cell_domains);
/// Set exterior facet domains
///
/// *Arguments*
/// exterior_facet_domains (_MeshFunction_ <unsigned int>)
/// The exterior facet domains.
void set_exterior_facet_domains(boost::shared_ptr<const MeshFunction<unsigned int> > exterior_facet_domains);
/// Set interior facet domains
///
/// *Arguments*
/// interior_facet_domains (_MeshFunction_ <unsigned int>)
/// The interior facet domains.
void set_interior_facet_domains(boost::shared_ptr<const MeshFunction<unsigned int> > interior_facet_domains);
/// Return UFC form shared pointer
///
/// *Returns*
/// ufc::form
/// The UFC form.
boost::shared_ptr<const ufc::form> ufc_form() const;
/// Check function spaces and coefficients
void check() const;
/// Comparison operator, returning equation lhs == rhs
Equation operator==(const Form& rhs) const;
/// Comparison operator, returning equation lhs == 0
Equation operator==(int rhs) const;
// Assignment of domains
CellDomainAssigner dx;
ExteriorFacetDomainAssigner ds;
InteriorFacetDomainAssigner dS;
protected:
// The UFC form
boost::shared_ptr<const ufc::form> _ufc_form;
// Function spaces (one for each argument)
std::vector<boost::shared_ptr<const FunctionSpace> > _function_spaces;
// Coefficients
std::vector<boost::shared_ptr<const GenericFunction> > _coefficients;
// The mesh (needed for functionals when we don't have any spaces)
boost::shared_ptr<const Mesh> _mesh;
// Markers for cell domains
boost::shared_ptr<const MeshFunction<uint> > _cell_domains;
// Markers for exterior facet domains
boost::shared_ptr<const MeshFunction<uint> > _exterior_facet_domains;
// Markers for interior facet domains
boost::shared_ptr<const MeshFunction<uint> > _interior_facet_domains;
private:
const uint _rank;
};
}
#endif
|