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 std::vector<unsigned int> index_map)
85 const unsigned int subfunction_index =
91 unsigned int max_index =
92 *std::max_element(index_map.begin(), index_map.end());
107 std::make_pair(subfunction_index, j);
128 const Real time = 0)
override 137 libmesh_assert_greater_equal (output.
size(),
170 virtual std::unique_ptr<FunctionBase<Output>>
clone()
const override 175 return std::unique_ptr<FunctionBase<Output>> (returnval);
202 #endif // LIBMESH_COMPOSITE_FUNCTION_H std::vector< std::unique_ptr< FunctionBase< Output > > > subfunctions
CompositeFunction & operator=(CompositeFunction &&)=default
virtual void zero() override final
Set every element in the vector to 0.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
unsigned int n_components() const
void resize(const unsigned int n)
Resize the vector.
The libMesh namespace provides an interface to certain functionality in the library.
virtual std::unique_ptr< FunctionBase< Output > > clone() const override
virtual Output operator()(const Point &p, const Real time=0) override
A function that returns a vector whose components are defined by multiple functions.
bool is_time_dependent() const
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.
CompositeFunction()=default
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual ~CompositeFunction()=default
The subfunctions vector is automatically cleaned up.
std::vector< std::pair< unsigned int, unsigned int > > reverse_index_map
std::vector< std::vector< unsigned int > > index_maps
virtual unsigned int size() const override final
virtual std::unique_ptr< FunctionBase< Output > > clone() const =0
virtual Output component(unsigned int i, const Point &p, Real time) override
Base class for functors that can be evaluated at a point and (optionally) time.
unsigned int n_subfunctions() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
void attach_subfunction(const FunctionBase< Output > &f, std::vector< unsigned int > index_map)
Attach a new subfunction, along with a map from the indices of the attached subfunction to the indice...
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...