Go to the documentation of this file.
18 #ifndef LIBMESH_COMPOSITE_FUNCTION_H
19 #define LIBMESH_COMPOSITE_FUNCTION_H
22 #include "libmesh/dense_vector.h"
23 #include "libmesh/function_base.h"
24 #include "libmesh/int_range.h"
25 #include "libmesh/libmesh.h"
26 #include "libmesh/point.h"
48 template <
typename Output=Number>
83 const std::vector<unsigned int> & index_map)
85 const unsigned int subfunction_index =
92 unsigned int max_index =
93 *std::max_element(index_map.begin(), index_map.end());
108 std::make_pair(subfunction_index, j);
127 const Real time = 0)
override
136 libmesh_assert_greater_equal (output.
size(),
169 virtual std::unique_ptr<FunctionBase<Output>>
clone()
const override
174 return std::unique_ptr<FunctionBase<Output>> (returnval);
201 #endif // LIBMESH_COMPOSITE_FUNCTION_H
Base class for functors that can be evaluated at a point and (optionally) time.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
A function that returns a vector whose components are defined by multiple functions.
bool is_time_dependent() const
virtual std::unique_ptr< FunctionBase< Output > > clone() const =0
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
The libMesh namespace provides an interface to certain functionality in the library.
virtual void zero() override
Set every element in the vector to 0.
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.
CompositeFunction()=default
std::vector< std::pair< unsigned int, unsigned int > > reverse_index_map
virtual std::unique_ptr< FunctionBase< Output > > clone() const override
CompositeFunction & operator=(CompositeFunction &&)=default
std::vector< std::unique_ptr< FunctionBase< Output > > > subfunctions
virtual ~CompositeFunction()=default
The subfunctions vector is automatically cleaned up.
virtual Output component(unsigned int i, const Point &p, Real time) override
A Point defines a location in LIBMESH_DIM dimensional Real space.
std::vector< std::vector< unsigned int > > index_maps
virtual unsigned int size() const override
unsigned int n_subfunctions() const
void resize(const unsigned int n)
Resize the vector.
void attach_subfunction(const FunctionBase< Output > &f, const std::vector< unsigned int > &index_map)
Attach a new subfunction, along with a map from the indices of the attached subfunction to the indice...
unsigned int n_components() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Output operator()(const Point &p, const Real time=0) override