18#ifndef LIBMESH_COMPOSITE_FEM_FUNCTION_H
19#define LIBMESH_COMPOSITE_FEM_FUNCTION_H
22#include "libmesh/dense_vector.h"
23#include "libmesh/fem_function_base.h"
24#include "libmesh/int_range.h"
25#include "libmesh/libmesh.h"
26#include "libmesh/point.h"
43template <
typename Output=Number>
74 std::vector<unsigned int> index_map)
76 const unsigned int subfunction_index =
82 unsigned int max_index =
83 *std::max_element(index_map.begin(), index_map.end());
98 std::make_pair(subfunction_index, j);
106 const Real time = 0)
override
116 libmesh_assert_greater_equal (output.
size(),
150 virtual std::unique_ptr<FEMFunctionBase<Output>>
clone()
const override
152 auto returnval = std::make_unique<CompositeFEMFunction>();
FEMFunction which is a function of another function.
void attach_subfunction(const FEMFunctionBase< Output > &f, std::vector< unsigned int > index_map)
Attach a new subfunction, along with a map from the indices of that subfunction to the indices of the...
CompositeFEMFunction(const CompositeFEMFunction &)=delete
This class contains unique_ptr members so it can't be default copied or assigned.
virtual Output operator()(const FEMContext &c, const Point &p, const Real time=0) override
CompositeFEMFunction()=default
std::vector< std::pair< unsigned int, unsigned int > > reverse_index_map
std::vector< std::vector< unsigned int > > index_maps
CompositeFEMFunction(CompositeFEMFunction &&)=default
This class can be default move constructed and assigned.
CompositeFEMFunction & operator=(CompositeFEMFunction &&)=default
virtual ~CompositeFEMFunction()=default
The subfunctions vector is automatically cleaned up.
std::vector< std::unique_ptr< FEMFunctionBase< Output > > > subfunctions
unsigned int n_components() const
virtual std::unique_ptr< FEMFunctionBase< Output > > clone() const override
unsigned int n_subfunctions() const
virtual Output component(const FEMContext &c, unsigned int i, const Point &p, Real time) override
Defines a dense vector for use in Finite Element-type computations.
void resize(const unsigned int n)
Resize the vector.
virtual void zero() override final
Set every element in the vector to 0.
virtual unsigned int size() const override final
This class provides all data required for a physics package (e.g.
FEMFunctionBase is a base class from which users can derive in order to define "function-like" object...
virtual std::unique_ptr< FEMFunctionBase< Output > > clone() const =0
A Point defines a location in LIBMESH_DIM dimensional Real space.
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real