Loading...
Searching...
No Matches
Form.h
// Copyright (C) 2007-2014 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: 2014-02-14
#ifndef __FORM_H
#define __FORM_H
#include <map>
#include <vector>
#include <memory>
#include <dolfin/common/Hierarchical.h>
#include <dolfin/common/types.h>
#include "Equation.h"
// Forward declaration
namespace ufc
{
class form;
}
namespace dolfin
{
class FunctionSpace;
class GenericFunction;
class Mesh;
template <typename T> class MeshFunction;
class Form : public Hierarchical<Form>
{
public:
Form(std::size_t rank, std::size_t num_coefficients);
Form(std::shared_ptr<const ufc::form> ufc_form,
std::vector<std::shared_ptr<const FunctionSpace>> function_spaces);
virtual ~Form();
std::size_t rank() const;
std::size_t num_coefficients() const;
std::size_t original_coefficient_position(std::size_t i) const;
std::vector<std::size_t> coloring(std::size_t entity_dim) const;
void set_mesh(std::shared_ptr<const Mesh> mesh);
std::shared_ptr<const Mesh> mesh() const;
std::shared_ptr<const FunctionSpace> function_space(std::size_t i) const;
std::vector<std::shared_ptr<const FunctionSpace>> function_spaces() const;
void set_coefficient(std::size_t i,
std::shared_ptr<const GenericFunction> coefficient);
void set_coefficient(std::string name,
std::shared_ptr<const GenericFunction> coefficient);
void set_coefficients(std::map<std::string,
std::shared_ptr<const GenericFunction>> coefficients);
void set_some_coefficients(std::map<std::string,
std::shared_ptr<const GenericFunction>> coefficients);
std::shared_ptr<const GenericFunction> coefficient(std::size_t i) const;
std::shared_ptr<const GenericFunction> coefficient(std::string name) const;
std::vector<std::shared_ptr<const GenericFunction>> coefficients() const;
virtual std::size_t coefficient_number(const std::string & name) const;
virtual std::string coefficient_name(std::size_t i) const;
std::shared_ptr<const MeshFunction<std::size_t>> cell_domains() const;
std::shared_ptr<const MeshFunction<std::size_t>>
exterior_facet_domains() const;
std::shared_ptr<const MeshFunction<std::size_t>>
interior_facet_domains() const;
std::shared_ptr<const MeshFunction<std::size_t>> vertex_domains() const;
void set_cell_domains(std::shared_ptr<const MeshFunction<std::size_t>>
cell_domains);
void set_exterior_facet_domains(std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains);
void set_interior_facet_domains(std::shared_ptr<const MeshFunction<std::size_t>> interior_facet_domains);
void set_vertex_domains(std::shared_ptr<const MeshFunction<std::size_t>> vertex_domains);
std::shared_ptr<const ufc::form> ufc_form() const;
void check() const;
Equation operator==(const Form& rhs) const;
Equation operator==(int rhs) const;
std::shared_ptr<const MeshFunction<std::size_t>> dx;
std::shared_ptr<const MeshFunction<std::size_t>> ds;
std::shared_ptr<const MeshFunction<std::size_t>> dS;
std::shared_ptr<const MeshFunction<std::size_t>> dP;
protected:
// The UFC form
std::shared_ptr<const ufc::form> _ufc_form;
// Function spaces (one for each argument)
std::vector<std::shared_ptr<const FunctionSpace>> _function_spaces;
// Coefficients
std::vector<std::shared_ptr<const GenericFunction>> _coefficients;
// The mesh (needed for functionals when we don't have any spaces)
std::shared_ptr<const Mesh> _mesh;
private:
const std::size_t _rank;
};
}
#endif
dolfin::Equation
Definition Equation.h:41
dolfin::Form::original_coefficient_position
std::size_t original_coefficient_position(std::size_t i) const
Definition Form.cpp:86
dolfin::Form::rank
std::size_t rank() const
Definition Form.cpp:64
dolfin::Form::set_coefficient
void set_coefficient(std::size_t i, std::shared_ptr< const GenericFunction > coefficient)
Definition Form.cpp:207
dolfin::Form::ds
std::shared_ptr< const MeshFunction< std::size_t > > ds
Domain markers for exterior facets.
Definition Form.h:325
dolfin::Form::coefficients
std::vector< std::shared_ptr< const GenericFunction > > coefficients() const
Definition Form.cpp:284
dolfin::Form::ufc_form
std::shared_ptr< const ufc::form > ufc_form() const
Definition Form.cpp:348
dolfin::Form::vertex_domains
std::shared_ptr< const MeshFunction< std::size_t > > vertex_domains() const
Definition Form.cpp:319
dolfin::Form::set_some_coefficients
void set_some_coefficients(std::map< std::string, std::shared_ptr< const GenericFunction > > coefficients)
Definition Form.cpp:226
dolfin::Form::set_interior_facet_domains
void set_interior_facet_domains(std::shared_ptr< const MeshFunction< std::size_t > > interior_facet_domains)
Definition Form.cpp:337
dolfin::Form::set_vertex_domains
void set_vertex_domains(std::shared_ptr< const MeshFunction< std::size_t > > vertex_domains)
Definition Form.cpp:343
dolfin::Form::exterior_facet_domains
std::shared_ptr< const MeshFunction< std::size_t > > exterior_facet_domains() const
Definition Form.cpp:309
dolfin::Form::dx
std::shared_ptr< const MeshFunction< std::size_t > > dx
Domain markers for cells.
Definition Form.h:323
dolfin::Form::function_spaces
std::vector< std::shared_ptr< const FunctionSpace > > function_spaces() const
Definition Form.cpp:202
dolfin::Form::operator==
Equation operator==(const Form &rhs) const
Comparison operator, returning equation lhs == rhs.
Definition Form.cpp:394
dolfin::Form::coefficient_number
virtual std::size_t coefficient_number(const std::string &name) const
Definition Form.cpp:289
dolfin::Form::~Form
virtual ~Form()
Destructor.
Definition Form.cpp:59
dolfin::Form::coloring
std::vector< std::size_t > coloring(std::size_t entity_dim) const
Definition Form.cpp:92
dolfin::Form::dP
std::shared_ptr< const MeshFunction< std::size_t > > dP
Domain markers for vertices.
Definition Form.h:329
dolfin::Form::set_cell_domains
void set_cell_domains(std::shared_ptr< const MeshFunction< std::size_t > > cell_domains)
Definition Form.cpp:325
dolfin::Form::set_exterior_facet_domains
void set_exterior_facet_domains(std::shared_ptr< const MeshFunction< std::size_t > > exterior_facet_domains)
Definition Form.cpp:331
dolfin::Form::num_coefficients
std::size_t num_coefficients() const
Definition Form.cpp:75
dolfin::Form::function_space
std::shared_ptr< const FunctionSpace > function_space(std::size_t i) const
Definition Form.cpp:196
dolfin::Form::set_mesh
void set_mesh(std::shared_ptr< const Mesh > mesh)
Definition Form.cpp:116
dolfin::Form::mesh
std::shared_ptr< const Mesh > mesh() const
Definition Form.cpp:121
dolfin::Form::set_coefficients
void set_coefficients(std::map< std::string, std::shared_ptr< const GenericFunction > > coefficients)
Definition Form.cpp:220
dolfin::Form::cell_domains
std::shared_ptr< const MeshFunction< std::size_t > > cell_domains() const
Definition Form.cpp:304
dolfin::Form::coefficient_name
virtual std::string coefficient_name(std::size_t i) const
Definition Form.cpp:296
dolfin::Form::dS
std::shared_ptr< const MeshFunction< std::size_t > > dS
Domain markers for interior facets.
Definition Form.h:327
dolfin::Form::check
void check() const
Check function spaces and coefficients.
Definition Form.cpp:353
dolfin::Form::Form
Form(std::size_t rank, std::size_t num_coefficients)
Definition Form.cpp:43
dolfin::Form::coefficient
std::shared_ptr< const GenericFunction > coefficient(std::size_t i) const
Definition Form.cpp:273
dolfin::Form::interior_facet_domains
std::shared_ptr< const MeshFunction< std::size_t > > interior_facet_domains() const
Definition Form.cpp:314
dolfin::FunctionSpace
Definition FunctionSpace.h:54
dolfin::GenericFunction
Definition GenericFunction.h:54
dolfin::Hierarchical< Form >::Hierarchical
Hierarchical(Form &self)
Definition Hierarchical.h:48
dolfin::MeshFunction
Definition MeshFunction.h:58
dolfin::Mesh
Definition Mesh.h:84
dolfin
Definition adapt.h:30