MeshFunction.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class MeshFunction

Parent class(es)

A MeshFunction is a function that can be evaluated at a set of mesh entities. A MeshFunction is discrete and is only defined at the set of mesh entities of a fixed topological dimension. A MeshFunction may for example be used to store a global numbering scheme for the entities of a (parallel) mesh, marking sub domains or boolean markers for mesh refinement.

MeshFunction()

Create empty mesh function

explicit MeshFunction(std::shared_ptr<const Mesh> mesh)

Create empty mesh function on given mesh

Arguments
mesh (Mesh)
The mesh to create mesh function on.
MeshFunction(std::shared_ptr<const Mesh> mesh, std::size_t dim)

Create mesh function of given dimension on given mesh

Arguments
mesh (Mesh)
The mesh to create mesh function on.
dim (std::size_t)
The mesh entity dimension for the mesh function.
MeshFunction(std::shared_ptr<const Mesh> mesh, std::size_t dim, const T &value)

Create mesh of given dimension on given mesh and initialize to a value

Arguments
mesh (Mesh)
The mesh to create mesh function on.
dim (std::size_t)
The mesh entity dimension.
value (T)
The value.
MeshFunction(std::shared_ptr<const Mesh> mesh, const std::string filename)

Create function from data file (shared_ptr version)

Arguments
mesh (Mesh)
The mesh to create mesh function on.
filename (std::string)
The filename to create mesh function from.
MeshFunction(std::shared_ptr<const Mesh> mesh, const MeshValueCollection<T> &value_collection)

Create function from a MeshValueCollecion (shared_ptr version)

Arguments
mesh (Mesh)
The mesh to create mesh function on.
value_collection (MeshValueCollection <T>)
The mesh value collection for the mesh function data.
MeshFunction(std::shared_ptr<const Mesh> mesh, std::size_t dim, const MeshDomains &domains)

Create function from MeshDomains

Arguments
mesh (Mesh)
The mesh to create mesh function on.
dim (std::size_t)
The dimension of the MeshFunction
domains (_MeshDomains)
The domains from which to extract the domain markers
MeshFunction(const MeshFunction<T> &f)

Copy constructor

Arguments
f (MeshFunction <T>)
The object to be copied.
MeshFunction<T> &operator=(const MeshFunction<T> &f)

Assign mesh function to other mesh function Assignment operator

Arguments
f (MeshFunction <T>)
A MeshFunction object to assign to another MeshFunction.
MeshFunction<T> &operator=(const MeshValueCollection<T> &mesh)

Assignment operator

Arguments
mesh (MeshValueCollection)
A MeshValueCollection object used to construct a MeshFunction.
std::shared_ptr<const Mesh> mesh() const

Return mesh associated with mesh function

Returns
Mesh
The mesh.
std::size_t dim() const

Return topological dimension

Returns
std::size_t
The dimension.
bool empty() const

Return true if empty

Returns
bool
True if empty.
std::size_t size() const

Return size (number of entities)

Returns
std::size_t
The size.
const T *values() const

Return array of values (const. version)

Returns
T
The values.
T *values()

Return array of values

Returns
T
The values.
T &operator[](const MeshEntity &entity)

Return value at given mesh entity

Arguments
entity (MeshEntity)
The mesh entity.
Returns
T
The value at the given entity.
const T &operator[](const MeshEntity &entity) const

Return value at given mesh entity (const version)

Arguments
entity (MeshEntity)
The mesh entity.
Returns
T
The value at the given entity.
T &operator[](std::size_t index)

Return value at given index

Arguments
index (std::size_t)
The index.
Returns
T
The value at the given index.
const T &operator[](std::size_t index) const

Return value at given index (const version)

Arguments
index (std::size_t)
The index.
Returns
T
The value at the given index.
const MeshFunction<T> &operator=(const T &value)

Set all values to given value

void init(std::size_t dim)

Initialize mesh function for given topological dimension

Arguments
dim (std::size_t)
The dimension.
void init(std::size_t dim, std::size_t size)

Initialize mesh function for given topological dimension of given size

Arguments
dim (std::size_t)
The dimension.
size (std::size_t)
The size.
void init(std::shared_ptr<const Mesh> mesh, std::size_t dim)

Initialize mesh function for given topological dimension

Arguments
mesh (Mesh)
The mesh.
dim (std::size_t)
The dimension.
void init(std::shared_ptr<const Mesh> mesh, std::size_t dim, std::size_t size)

Initialize mesh function for given topological dimension of given size (shared_ptr version)

Arguments
mesh (Mesh)
The mesh.
dim (std::size_t)
The dimension.
size (std::size_t)
The size.
void set_value(std::size_t index, const T &value)

Set value at given index

Arguments
index (std::size_t)
The index.
value (T)
The value.
void set_value(std::size_t index, const T &value, const Mesh &mesh)

Compatibility function for use in SubDomains

void set_values(const std::vector<T> &values)

Set values

Arguments
values (std::vector<T>)
The values.
void set_all(const T &value)

Set all values to given value

Arguments
value (T)
The value to set all values to.
std::string str(bool verbose) const

Return informal string representation (pretty-print)

Arguments
verbose (bool)
Flag to turn on additional output.
Returns
std::string
An informal representation.