Loading...
Searching...
No Matches
MultiMeshFunction.h
// Copyright (C) 2013-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 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: 2013-09-25
// Last changed: 2016-03-02
#ifndef __MULTI_MESH_FUNCTION_H
#define __MULTI_MESH_FUNCTION_H
#include <memory>
#include <boost/ptr_container/ptr_map.hpp>
#include <dolfin/common/Variable.h>
namespace dolfin
{
// Forward declarations
class MultiMeshFunctionSpace;
class GenericVector;
class Function;
class MultiMeshFunction;
class FiniteElement;
class MultiMeshFunction : public Variable
{
public:
MultiMeshFunction();
explicit MultiMeshFunction(std::shared_ptr<const MultiMeshFunctionSpace> V);
MultiMeshFunction(std::shared_ptr<const MultiMeshFunctionSpace> V,
std::shared_ptr<GenericVector> x);
virtual ~MultiMeshFunction();
void assign_part(std::size_t a, const Function& v);
std::shared_ptr<const Function> part(std::size_t i) const;
std::shared_ptr<const Function> part(std::size_t i, bool deepcopy) const;
std::shared_ptr<GenericVector> vector();
std::shared_ptr<const GenericVector> vector() const;
virtual std::shared_ptr<const MultiMeshFunctionSpace> function_space() const
{
return _function_space;
}
void restrict(double* w,
const FiniteElement& element,
std::size_t part,
const Cell& dolfin_cell,
const double* coordinate_dofs,
const ufc::cell& ufc_cell) const;
void eval(Array<double>& values, const Array<double>& x,
std::size_t part,
const ufc::cell& cell) const;
void eval(Array<double>& values, const Array<double>& x) const;
void restrict_as_ufc_function(double* w,
const FiniteElement& element,
std::size_t part,
const Cell& dolfin_cell,
const double* coordinate_dofs,
const ufc::cell& ufc_cell) const;
private:
// Initialize vector
void init_vector();
// Compute ghost indices
void compute_ghost_indices(std::pair<std::size_t, std::size_t> range,
std::vector<la_index>& ghost_indices) const;
// The function space
std::shared_ptr<const MultiMeshFunctionSpace> _function_space;
// The vector of expansion coefficients (local)
std::shared_ptr<GenericVector> _vector;
// Cache of regular functions for the parts
mutable std::map<std::size_t, std::shared_ptr<const Function> > _function_parts;
};
}
#endif
dolfin::Array
Definition Array.h:42
dolfin::Cell
A Cell is a MeshEntity of topological codimension 0.
Definition Cell.h:43
dolfin::FiniteElement
This is a wrapper for a UFC finite element (ufc::finite_element).
Definition FiniteElement.h:36
dolfin::Function
Definition Function.h:66
dolfin::GenericVector
This class defines a common interface for vectors.
Definition GenericVector.h:48
dolfin::MultiMeshFunctionSpace
Definition MultiMeshFunctionSpace.h:48
dolfin::MultiMeshFunction
Definition MultiMeshFunction.h:43
dolfin::MultiMeshFunction::vector
std::shared_ptr< GenericVector > vector()
Definition MultiMeshFunction.cpp:150
dolfin::MultiMeshFunction::function_space
virtual std::shared_ptr< const MultiMeshFunctionSpace > function_space() const
Definition MultiMeshFunction.h:115
dolfin::MultiMeshFunction::eval
void eval(Array< double > &values, const Array< double > &x, std::size_t part, const ufc::cell &cell) const
Definition MultiMeshFunction.cpp:246
dolfin::MultiMeshFunction::restrict
void restrict(double *w, const FiniteElement &element, std::size_t part, const Cell &dolfin_cell, const double *coordinate_dofs, const ufc::cell &ufc_cell) const
Definition MultiMeshFunction.cpp:215
dolfin::MultiMeshFunction::MultiMeshFunction
MultiMeshFunction()
Constructor.
Definition MultiMeshFunction.cpp:34
dolfin::MultiMeshFunction::~MultiMeshFunction
virtual ~MultiMeshFunction()
Destructor.
Definition MultiMeshFunction.cpp:60
dolfin::MultiMeshFunction::assign_part
void assign_part(std::size_t a, const Function &v)
Definition MultiMeshFunction.cpp:88
dolfin::MultiMeshFunction::part
std::shared_ptr< const Function > part(std::size_t i) const
Definition MultiMeshFunction.cpp:65
dolfin::MultiMeshFunction::restrict_as_ufc_function
void restrict_as_ufc_function(double *w, const FiniteElement &element, std::size_t part, const Cell &dolfin_cell, const double *coordinate_dofs, const ufc::cell &ufc_cell) const
Restrict as UFC function (by calling eval).
Definition MultiMeshFunction.cpp:288
dolfin::Variable::Variable
Variable()
Create unnamed variable.
Definition Variable.cpp:31
dolfin
Definition adapt.h:30