23#ifndef VCL_MESH_COMPONENTS_CUSTOM_COMPONENTS_H
24#define VCL_MESH_COMPONENTS_CUSTOM_COMPONENTS_H
26#include "detail/custom_components_data.h"
28#include <vclib/concepts/mesh/components/custom_components.h>
90template<
typename ParentElemType =
void>
93 static const bool IS_VERTICAL = !std::is_same_v<ParentElemType, void>;
95 detail::CustomComponentsData<ParentElemType, IS_VERTICAL> mData;
122 return mData.componentExists(
143 template<
typename CompType>
167 return mData.componentType(
179 template<
typename CompType>
209 template<
typename CompType>
239 template<
typename CompType>
246 template<
typename CompType>
247 void addCustomComponent(
254 void deleteCustomComponent(
const std::string&
compName)
255 requires (!IS_VERTICAL)
257 return mData.deleteCustomComponent(
compName);
261 template<
typename Element>
262 void importFrom(
const Element& e,
bool =
true)
266 if constexpr (!IS_VERTICAL && HasCustomComponents<Element>) {
267 mData = e.CustomComponents::mData;
271 void serialize(std::ostream& os)
const
276 void deserialize(std::istream& is)
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
The CustomComponents Component is a container of additional components associated to an Element (e....
Definition custom_components.h:92
std::type_index customComponentType(const std::string &compName) const
Returns the std::type_index of the custom component of the given name.
Definition custom_components.h:165
bool isCustomComponentOfType(const std::string &compName) const
Returns true if the custom component of the given name is of the type given as template argument,...
Definition custom_components.h:144
std::vector< std::string > customComponentNamesOfType() const
Returns a std::vector of std::strings containing the names of the custom components of the type given...
Definition custom_components.h:180
static const uint COMPONENT_ID
The ID of component.
Definition custom_components.h:101
CustomComponents()=default
Initilizes an empty container of custom components.
const CompType & customComponent(const std::string &compName) const
Returns the const reference to the custom component of the given name having the type given as templa...
Definition custom_components.h:210
CompType & customComponent(const std::string &compName)
Returns the reference to the custom component of the given name having the type given as template arg...
Definition custom_components.h:240
bool hasCustomComponent(const std::string &compName) const
Returns true if the element has a custom component with the given name, false otherwise....
Definition custom_components.h:120