DOLFIN
DOLFIN C++ interface
Loading...
Searching...
No Matches
dolfin::MeshFunction< T > Class Template Reference

#include <MeshFunction.h>

Inheritance diagram for dolfin::MeshFunction< T >:
Collaboration diagram for dolfin::MeshFunction< T >:

Public Member Functions

 MeshFunction ()
 Create empty mesh function.
 
 MeshFunction (std::shared_ptr< const Mesh > mesh)
 
 MeshFunction (std::shared_ptr< const Mesh > mesh, std::size_t dim)
 
 MeshFunction (std::shared_ptr< const Mesh > mesh, std::size_t dim, const T &value)
 
 MeshFunction (std::shared_ptr< const Mesh > mesh, const std::string filename)
 
 MeshFunction (std::shared_ptr< const Mesh > mesh, const MeshValueCollection< T > &value_collection)
 
 MeshFunction (std::shared_ptr< const Mesh > mesh, std::size_t dim, const MeshDomains &domains)
 
 MeshFunction (const MeshFunction< T > &f)
 
 ~MeshFunction ()
 Destructor.
 
MeshFunction< T > & operator= (const MeshFunction< T > &f)
 
MeshFunction< T > & operator= (const MeshValueCollection< T > &mesh)
 
std::shared_ptr< const Meshmesh () const
 
std::size_t dim () const
 
bool empty () const
 
std::size_t size () const
 
const T * values () const
 
T * values ()
 
T & operator[] (const MeshEntity &entity)
 
const T & operator[] (const MeshEntity &entity) const
 
T & operator[] (std::size_t index)
 
const T & operator[] (std::size_t index) const
 
const MeshFunction< T > & operator= (const T &value)
 
void init (std::size_t dim)
 
void init (std::size_t dim, std::size_t size)
 
void init (std::shared_ptr< const Mesh > mesh, std::size_t dim)
 
void init (std::shared_ptr< const Mesh > mesh, std::size_t dim, std::size_t size)
 
void set_value (std::size_t index, const T &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)
 
void set_all (const T &value)
 
std::vector< std::size_t > where_equal (T value)
 
std::string str (bool verbose) const
 
std::string str (bool verbose) const
 Return informal string representation (pretty-print)
 
std::string str (bool verbose) const
 Return informal string representation (pretty-print)
 
std::string str (bool verbose) const
 Return informal string representation (pretty-print)
 
std::string str (bool verbose) const
 Return informal string representation (pretty-print)
 
- Public Member Functions inherited from dolfin::Variable
 Variable ()
 Create unnamed variable.
 
 Variable (const std::string name, const std::string label)
 Create variable with given name and label.
 
 Variable (const Variable &variable)
 Copy constructor.
 
virtual ~Variable ()
 Destructor.
 
const Variableoperator= (const Variable &variable)
 Assignment operator.
 
void rename (const std::string name, const std::string label)
 Rename variable.
 
std::string name () const
 Return name.
 
std::string label () const
 Return label (description)
 
std::size_t id () const
 
- Public Member Functions inherited from dolfin::Hierarchical< MeshFunction< T > >
 Hierarchical (T &self)
 Constructor.
 
virtual ~Hierarchical ()
 Destructor.
 
std::size_t depth () const
 
bool has_parent () const
 
bool has_child () const
 
T & parent ()
 
const T & parent () const
 Return parent in hierarchy (const version).
 
std::shared_ptr< T > parent_shared_ptr ()
 
std::shared_ptr< const T > parent_shared_ptr () const
 Return shared pointer to parent (const version).
 
T & child ()
 
const T & child () const
 Return child in hierarchy (const version).
 
std::shared_ptr< T > child_shared_ptr ()
 
std::shared_ptr< const T > child_shared_ptr () const
 Return shared pointer to child (const version).
 
T & root_node ()
 
const T & root_node () const
 Return root node object in hierarchy (const version).
 
std::shared_ptr< T > root_node_shared_ptr ()
 
std::shared_ptr< const T > root_node_shared_ptr () const
 Return shared pointer to root node object in hierarchy (const version).
 
T & leaf_node ()
 
const T & leaf_node () const
 Return leaf node object in hierarchy (const version).
 
std::shared_ptr< T > leaf_node_shared_ptr ()
 
std::shared_ptr< const T > leaf_node_shared_ptr () const
 Return shared pointer to leaf node object in hierarchy (const version).
 
void set_parent (std::shared_ptr< T > parent)
 Set parent.
 
void clear_child ()
 Clear child.
 
void set_child (std::shared_ptr< T > child)
 Set child.
 
const Hierarchicaloperator= (const Hierarchical &hierarchical)
 Assignment operator.
 
void _debug () const
 Function useful for debugging the hierarchy.
 

Additional Inherited Members

- Public Attributes inherited from dolfin::Variable
Parameters parameters
 Parameters.
 

Detailed Description

template<typename T>
class dolfin::MeshFunction< T >

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.

Constructor & Destructor Documentation

◆ MeshFunction() [1/7]

template<typename T >
dolfin::MeshFunction< T >::MeshFunction ( std::shared_ptr< const Mesh > mesh)
explicit

Create empty mesh function on given mesh

Parameters
mesh(Mesh) The mesh to create mesh function on.

◆ MeshFunction() [2/7]

template<typename T >
dolfin::MeshFunction< T >::MeshFunction ( std::shared_ptr< const Mesh > mesh,
std::size_t dim )

Create mesh function of given dimension on given mesh

Parameters
mesh(Mesh) The mesh to create mesh function on.
dim(std::size_t) The mesh entity dimension for the mesh function.

◆ MeshFunction() [3/7]

template<typename T >
dolfin::MeshFunction< T >::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

Parameters
mesh(Mesh) The mesh to create mesh function on.
dim(std::size_t) The mesh entity dimension.
value(T) The value.

◆ MeshFunction() [4/7]

template<typename T >
dolfin::MeshFunction< T >::MeshFunction ( std::shared_ptr< const Mesh > mesh,
const std::string filename )

Create function from data file (shared_ptr version)

Parameters
mesh(Mesh) The mesh to create mesh function on.
filename(std::string) The filename to create mesh function from.

◆ MeshFunction() [5/7]

template<typename T >
dolfin::MeshFunction< T >::MeshFunction ( std::shared_ptr< const Mesh > mesh,
const MeshValueCollection< T > & value_collection )

Create function from a MeshValueCollecion (shared_ptr version)

Parameters
mesh(Mesh) The mesh to create mesh function on.
value_collection(MeshValueCollection) The mesh value collection for the mesh function data.

◆ MeshFunction() [6/7]

template<typename T >
dolfin::MeshFunction< T >::MeshFunction ( std::shared_ptr< const Mesh > mesh,
std::size_t dim,
const MeshDomains & domains )

Create function from MeshDomains

Parameters
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() [7/7]

template<typename T >
dolfin::MeshFunction< T >::MeshFunction ( const MeshFunction< T > & f)

Copy constructor

Parameters
f(MeshFunction) The object to be copied.

Member Function Documentation

◆ dim()

template<typename T >
std::size_t dolfin::MeshFunction< T >::dim ( ) const

Return topological dimension

Returns
std::size_t The dimension.

◆ empty()

template<typename T >
bool dolfin::MeshFunction< T >::empty ( ) const

Return true if empty

Returns
bool True if empty.

◆ init() [1/4]

template<typename T >
void dolfin::MeshFunction< T >::init ( std::shared_ptr< const Mesh > mesh,
std::size_t dim )

Initialize mesh function for given topological dimension

Parameters
mesh(Mesh) The mesh.
dim(std::size_t) The dimension.

◆ init() [2/4]

template<typename T >
void dolfin::MeshFunction< T >::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)

Parameters
mesh(Mesh) The mesh.
dim(std::size_t) The dimension.
size(std::size_t) The size.

◆ init() [3/4]

template<typename T >
void dolfin::MeshFunction< T >::init ( std::size_t dim)

Initialize mesh function for given topological dimension

Parameters
dim(std::size_t) The dimension.

◆ init() [4/4]

template<typename T >
void dolfin::MeshFunction< T >::init ( std::size_t dim,
std::size_t size )

Initialize mesh function for given topological dimension of given size

Parameters
dim(std::size_t) The dimension.
size(std::size_t) The size.

◆ mesh()

template<typename T >
std::shared_ptr< const Mesh > dolfin::MeshFunction< T >::mesh ( ) const

Return mesh associated with mesh function

Returns
Mesh The mesh.

◆ operator=() [1/3]

template<typename T >
MeshFunction< T > & dolfin::MeshFunction< T >::operator= ( const MeshFunction< T > & f)

Assign mesh function to other mesh function Assignment operator

Parameters
f(MeshFunction) A MeshFunction object to assign to another MeshFunction.

◆ operator=() [2/3]

template<typename T >
MeshFunction< T > & dolfin::MeshFunction< T >::operator= ( const MeshValueCollection< T > & mesh)

Assignment operator

Parameters
mesh(MeshValueCollection) A MeshValueCollection object used to construct a MeshFunction.

◆ operator=() [3/3]

template<typename T >
const MeshFunction< T > & dolfin::MeshFunction< T >::operator= ( const T & value)

Set all values to given value

Parameters
value(T)

◆ operator[]() [1/4]

template<typename T >
T & dolfin::MeshFunction< T >::operator[] ( const MeshEntity & entity)

Return value at given mesh entity

Parameters
entity(MeshEntity) The mesh entity.

return T The value at the given entity.

◆ operator[]() [2/4]

template<typename T >
const T & dolfin::MeshFunction< T >::operator[] ( const MeshEntity & entity) const

Return value at given mesh entity (const version)

Parameters
entity(MeshEntity) The mesh entity.
Returns
T The value at the given entity.

◆ operator[]() [3/4]

template<typename T >
T & dolfin::MeshFunction< T >::operator[] ( std::size_t index)

Return value at given index

Parameters
index(std::size_t) The index.
Returns
T The value at the given index.

◆ operator[]() [4/4]

template<typename T >
const T & dolfin::MeshFunction< T >::operator[] ( std::size_t index) const

Return value at given index (const version)

Parameters
index(std::size_t) The index.
Returns
T The value at the given index.

◆ set_all()

template<typename T >
void dolfin::MeshFunction< T >::set_all ( const T & value)

Set all values to given value

Parameters
value(T) The value to set all values to.

◆ set_value()

template<typename T >
void dolfin::MeshFunction< T >::set_value ( std::size_t index,
const T & value )

Set value at given index

Parameters
index(std::size_t) The index.
value(T) The value.

◆ set_values()

template<typename T >
void dolfin::MeshFunction< T >::set_values ( const std::vector< T > & values)

Set values

Parameters
values(std::vector<T>) The values.

◆ size()

template<typename T >
std::size_t dolfin::MeshFunction< T >::size ( ) const

Return size (number of entities)

Returns
std::size_t The size.

◆ str() [1/5]

std::string dolfin::MeshFunction< double >::str ( bool verbose) const
virtual

Return informal string representation (pretty-print)

Reimplemented from dolfin::Variable.

◆ str() [2/5]

std::string dolfin::MeshFunction< std::size_t >::str ( bool verbose) const
virtual

Return informal string representation (pretty-print)

Reimplemented from dolfin::Variable.

◆ str() [3/5]

template<typename T >
std::string dolfin::MeshFunction< T >::str ( bool verbose) const
virtual

Return informal string representation (pretty-print)

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

Reimplemented from dolfin::Variable.

◆ str() [4/5]

std::string dolfin::MeshFunction< double >::str ( bool verbose) const
virtual

Return informal string representation (pretty-print)

Reimplemented from dolfin::Variable.

◆ str() [5/5]

std::string dolfin::MeshFunction< std::size_t >::str ( bool verbose) const
virtual

Return informal string representation (pretty-print)

Reimplemented from dolfin::Variable.

◆ values() [1/2]

template<typename T >
T * dolfin::MeshFunction< T >::values ( )

Return array of values

return T The values.

◆ values() [2/2]

template<typename T >
const T * dolfin::MeshFunction< T >::values ( ) const

Return array of values (const. version)

return T The values.

◆ where_equal()

template<typename T >
std::vector< std::size_t > dolfin::MeshFunction< T >::where_equal ( T value)

Get indices where meshfunction is equal to given value

Arguments value (T) The value. Returns std::vector<T> The indices.


The documentation for this class was generated from the following files: