.. Documentation for the header file dolfin/mesh/MeshFunction.h .. _programmers_reference_cpp_mesh_meshfunction: MeshFunction.h ============== .. note:: The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded. .. cpp:class:: MeshFunction *Parent class(es)* * :cpp:class:`Variable` 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. .. cpp:function:: MeshFunction() Create empty mesh function .. cpp:function:: explicit MeshFunction(std::shared_ptr mesh) Create empty mesh function on given mesh @param mesh (Mesh) The mesh to create mesh function on. .. cpp:function:: MeshFunction(std::shared_ptr mesh, std::size_t dim) Create mesh function of given dimension on given mesh @param mesh (Mesh) The mesh to create mesh function on. @param dim (std::size_t) The mesh entity dimension for the mesh function. .. cpp:function:: MeshFunction(std::shared_ptr mesh, std::size_t dim, const T& value) Create mesh of given dimension on given mesh and initialize to a value @param mesh (:cpp:class:`Mesh`) The mesh to create mesh function on. @param dim (std::size_t) The mesh entity dimension. @param value (T) The value. .. cpp:function:: MeshFunction(std::shared_ptr mesh, const std::string filename) Create function from data file (shared_ptr version) @param mesh (:cpp:class:`Mesh`) The mesh to create mesh function on. @param filename (std::string) The filename to create mesh function from. .. cpp:function:: MeshFunction(std::shared_ptr mesh, const MeshValueCollection& value_collection) Create function from a MeshValueCollecion (shared_ptr version) @param mesh (:cpp:class:`Mesh`) The mesh to create mesh function on. @param value_collection (:cpp:class:`MeshValueCollection`) The mesh value collection for the mesh function data. .. cpp:function:: MeshFunction(std::shared_ptr mesh, std::size_t dim, const MeshDomains& domains) Create function from MeshDomains @param mesh (:cpp:class:`Mesh`) The mesh to create mesh function on. @param dim (std::size_t) The dimension of the MeshFunction @param domains (_MeshDomains) The domains from which to extract the domain markers .. cpp:function:: MeshFunction(const MeshFunction& f) Copy constructor @param f (:cpp:class:`MeshFunction`) The object to be copied. .. cpp:function:: MeshFunction& operator= (const MeshFunction& f) Assign mesh function to other mesh function Assignment operator @param f (:cpp:class:`MeshFunction`) A :cpp:class:`MeshFunction` object to assign to another MeshFunction. .. cpp:function:: MeshFunction& operator=(const MeshValueCollection& mesh) Assignment operator @param mesh (:cpp:class:`MeshValueCollection`) A :cpp:class:`MeshValueCollection` object used to construct a MeshFunction. .. cpp:function:: std::shared_ptr mesh() const Return mesh associated with mesh function @return :cpp:class:`Mesh` The mesh. .. cpp:function:: std::size_t dim() const Return topological dimension @return std::size_t The dimension. .. cpp:function:: bool empty() const Return true if empty @return bool True if empty. .. cpp:function:: std::size_t size() const Return size (number of entities) @return std::size_t The size. .. cpp:function:: const T* values() const Return array of values (const. version) return T The values. .. cpp:function:: T* values() Return array of values return T The values. .. cpp:function:: T& operator[] (const MeshEntity& entity) Return value at given mesh entity @param entity (:cpp:class:`MeshEntity`) The mesh entity. return T The value at the given entity. .. cpp:function:: const T& operator[] (const MeshEntity& entity) const Return value at given mesh entity (const version) @param entity (:cpp:class:`MeshEntity`) The mesh entity. @return T The value at the given entity. .. cpp:function:: T& operator[] (std::size_t index) Return value at given index @param index (std::size_t) The index. @return T The value at the given index. .. cpp:function:: const T& operator[] (std::size_t index) const Return value at given index (const version) @param index (std::size_t) The index. @return T The value at the given index. .. cpp:function:: const MeshFunction& operator= (const T& value) Set all values to given value @param value (T) .. cpp:function:: void init(std::size_t dim) Initialize mesh function for given topological dimension @param dim (std::size_t) The dimension. .. cpp:function:: void init(std::size_t dim, std::size_t size) Initialize mesh function for given topological dimension of given size @param dim (std::size_t) The dimension. @param size (std::size_t) The size. .. cpp:function:: void init(std::shared_ptr mesh, std::size_t dim) Initialize mesh function for given topological dimension @param mesh (:cpp:class:`Mesh`) The mesh. @param dim (std::size_t) The dimension. .. cpp:function:: void init(std::shared_ptr mesh, std::size_t dim, std::size_t size) Initialize mesh function for given topological dimension of given size (shared_ptr version) @param mesh (:cpp:class:`Mesh`) The mesh. @param dim (std::size_t) The dimension. @param size (std::size_t) The size. .. cpp:function:: void set_value(std::size_t index, const T& value) Set value at given index @param index (std::size_t) The index. @param value (T) The value. .. cpp:function:: void set_value(std::size_t index, const T& value, const Mesh& mesh) Compatibility function for use in SubDomains .. cpp:function:: void set_values(const std::vector& values) Set values @param values (std::vector) The values. .. cpp:function:: void set_all(const T& value) Set all values to given value @param value (T) The value to set all values to. .. cpp:function:: std::vector where_equal(T value) Get indices where meshfunction is equal to given value *Arguments* value (T) The value. *Returns* std::vector The indices. .. cpp:function:: std::string str(bool verbose) const Return informal string representation (pretty-print) @param verbose (bool) Flag to turn on additional output. @return std::string An informal representation.