23#ifndef VCL_MESH_COMPONENTS_BASE_INDEX_CONTAINER_COMPONENT_H
24#define VCL_MESH_COMPONENTS_BASE_INDEX_CONTAINER_COMPONENT_H
26#include "container_component.h"
28#include <vclib/mesh/iterators/components/pointer_from_index_iterator.h>
30#include <vclib/space/core.h>
78 typename DerivedComponent,
82 typename ParentElemType,
86class IndexContainerComponent :
87 public ContainerComponent<
99 using Base = ContainerComponent<
112 IndexContainerComponent()
114 if constexpr (!Base::IS_VERTICAL) {
121 if constexpr (N >= 0) {
122 container().fill(UINT_NULL);
135 const auto& indices() const requires std::is_same_v<T, Elem>
141 using Base::container;
143 using ConstIndexIterator =
typename Base::ConstIterator;
145 PointerFromIndexIterator<ConstIndexIterator, Elem, ParentElemType>;
146 using ConstIterator =
147 ConstPointerFromIndexIterator<ConstIndexIterator, Elem, ParentElemType>;
163 void updateReferences(
const Elem*, std::size_t offset = 0)
166 auto& baseContainer = Base::container();
168 for (uint j = 0; j < baseContainer.size(); ++j) {
169 if (baseContainer.at(j) != UINT_NULL) {
170 baseContainer.at(j) += offset;
184 void updateReferences(
const std::vector<uint>& newIndices)
186 auto& baseContainer = Base::container();
188 for (uint j = 0; j < baseContainer.size(); ++j) {
189 if (baseContainer.at(j) != UINT_NULL) {
190 baseContainer.at(j) = newIndices.at(baseContainer.at(j));