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" 43 template <
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>();
182 #endif // LIBMESH_COMPOSITE_FEM_FUNCTION_H virtual void zero() override final
Set every element in the vector to 0.
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...
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
std::vector< std::pair< unsigned int, unsigned int > > reverse_index_map
void resize(const unsigned int n)
Resize the vector.
virtual std::unique_ptr< FEMFunctionBase< Output > > clone() const override
unsigned int n_components() const
The libMesh namespace provides an interface to certain functionality in the library.
virtual Output component(const FEMContext &c, unsigned int i, const Point &p, Real time) override
CompositeFEMFunction & operator=(CompositeFEMFunction &&)=default
std::vector< std::vector< unsigned int > > index_maps
FEMFunction which is a function of another function.
This class provides all data required for a physics package (e.g.
std::vector< std::unique_ptr< FEMFunctionBase< Output > > > subfunctions
virtual Output operator()(const FEMContext &c, const Point &p, const Real time=0) override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual unsigned int size() const override final
CompositeFEMFunction()=default
unsigned int n_subfunctions() const
virtual ~CompositeFEMFunction()=default
The subfunctions vector is automatically cleaned up.
virtual std::unique_ptr< FEMFunctionBase< Output > > clone() const =0
FEMFunctionBase is a base class from which users can derive in order to define "function-like" object...
A Point defines a location in LIBMESH_DIM dimensional Real space.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...