23#ifndef VCL_MESH_CONTAINERS_EDGE_CONTAINER_H
24#define VCL_MESH_CONTAINERS_EDGE_CONTAINER_H
26#include "base/element_container.h"
28#include <vclib/mesh/elements/edge.h>
29#include <vclib/mesh/elements/edge_components.h>
51template<EdgeConcept T>
54 template<EdgeConcept U>
63 using EdgeIterator = Base::ElementIterator;
64 using ConstEdgeIterator = Base::ConstElementIterator;
82 const EdgeType&
edge(
uint i)
const {
return Base::element(
i); }
297 void deleteEdge(
const EdgeType* e) { Base::deleteElement(e); }
314 return Base::elementIndexIfCompact(
i);
330 return Base::elementCompactIndices();
383 EdgeIterator
edgeEnd() {
return Base::elementEnd(); }
405 ConstEdgeIterator
edgeEnd()
const {
return Base::elementEnd(); }
458 return Base::elements(begin, end);
515 return Base::elements(begin, end);
524 Base::enableAllOptionalComponents();
533 Base::disableAllOptionalComponents();
547 requires edge::HasOptionalAdjacentEdges<T>
550 typename T::AdjacentEdges>();
571 requires edge::HasOptionalAdjacentEdges<T>
587 requires edge::HasOptionalAdjacentFaces<T>
590 typename T::AdjacentFaces>();
611 requires edge::HasOptionalAdjacentFaces<T>
744 return Base::hasElemCustomComponent(name);
760 return Base::elemCustomComponentNames();
813 return Base::elemComponentType(name);
874 Base::deleteElemCustomComponent(name);
1001 template<
typename K>
1025 std::remove_cvref_t<T>,
1026 EdgeContainer<typename RemoveRef<T>::EdgeType>>;
1063template<
typename... Args>
A class representing a box in N-dimensional space.
Definition box.h:46
The EdgeContainer class represents a container of Edge elements that can be used in a Mesh class.
Definition edge_container.h:53
bool isPerEdgeCustomComponentOfType(const std::string &name) const
Checks if the custom component of the Edge Element having the given name has the same type of the giv...
Definition edge_container.h:789
std::vector< std::string > perEdgeCustomComponentNames() const
Returns a vector containing all the names of the custom components of any type associated to the Edge...
Definition edge_container.h:757
EdgeIterator edgeEnd()
Returns an iterator to the end of the container.
Definition edge_container.h:383
auto edges(bool jumpDeleted=true) const
Returns a small view object that allows to iterate over the Edges of the containers,...
Definition edge_container.h:484
uint addEdge(uint v0, uint v1)
Add an Edge having the two given vertices to the container, returning its index.
Definition edge_container.h:150
void serializePerEdgeCustomComponentsOfType(std::ostream &os) const
Serializes in the given output stream all the custom components of the Edge Element of type K.
Definition edge_container.h:985
uint addEdge()
Add an Edge to the container, returning its index.
Definition edge_container.h:136
void disableAllPerEdgeOptionalComponents()
Disables all the optional components associated to the Edge type contained in the EdgeContainer.
Definition edge_container.h:531
bool isPerEdgeAdjacentFacesEnabled() const
Checks if the Edge Optional AdjacentFaces is enabled.
Definition edge_container.h:586
void clearEdges()
Clears the Edge container of the Mesh, deleting all the Edges.
Definition edge_container.h:210
auto edges(bool jumpDeleted=true)
Returns a small view object that allows to iterate over the Edges of the containers,...
Definition edge_container.h:430
std::vector< std::string > perEdgeCustomComponentNamesOfType() const
Returns a vector containing all the names of the custom components associated to the Edge Element hav...
Definition edge_container.h:836
const EdgeType & edge(uint i) const
Returns a const reference of the Edge at the i-th position in the Edge Container of the Mesh,...
Definition edge_container.h:82
void deserializePerEdgeCustomComponentsOfType(std::istream &is)
Deserializes in the given input stream all the custom components of the Edge Element of type K.
Definition edge_container.h:1002
void resizeEdges(uint n)
Resizes the Edge container to contain n Edges.
Definition edge_container.h:240
uint addEdge(typename T::VertexType *v0, typename T::VertexType *v1)
Add an Edge having the two given vertices to the container, returning its index.
Definition edge_container.h:170
bool isPerEdgeColorEnabled() const
Checks if the Edge Optional Color is enabled.
Definition edge_container.h:626
std::vector< uint > edgeCompactIndices() const
Returns a vector that tells, for each actual Edge index, the new index that the Edge would have in a ...
Definition edge_container.h:328
uint edgeContainerSize() const
Returns the number of Edges (also deleted) contained in the Edge container of the Mesh.
Definition edge_container.h:117
ConstCustomComponentVectorHandle< K > perEdgeCustomComponentVectorHandle(const std::string &name) const
Returns a const vector handle to the custom component having type K and the given name.
Definition edge_container.h:968
void enablePerEdgeColor()
Enable the Optional Color of the Edge.
Definition edge_container.h:637
void enablePerEdgeMark()
Enable the Optional Mark of the Edge.
Definition edge_container.h:674
void enableAllPerEdgeOptionalComponents()
Enables all the optional components associated to the Edge type contained in the EdgeContainer.
Definition edge_container.h:522
CustomComponentVectorHandle< K > perEdgeCustomComponentVectorHandle(const std::string &name)
Returns a vector handle to the custom component having the type K and the given name.
Definition edge_container.h:919
std::type_index perEdgeCustomComponentType(const std::string &name) const
Returns the std::type_index of the custom component of the Edge Element having the given input name.
Definition edge_container.h:810
void disablePerEdgeAdjacentFaces()
Disables the Optional AdjacentFaces of the Edge.
Definition edge_container.h:610
uint deletedEdgeNumber() const
Returns the number of deleted Edges in the Edge container, that is edgeContainerSize() - edgeNumber()...
Definition edge_container.h:125
void disablePerEdgeColor()
Disables the Optional Color of the Edge.
Definition edge_container.h:648
auto edges(uint begin, uint end=UINT_NULL)
Returns a view object that allows to iterate over the Edges of the container in the given range:
Definition edge_container.h:456
auto edges(uint begin, uint end=UINT_NULL) const
Returns a view object that allows to iterate over the Edges of the container in the given range:
Definition edge_container.h:513
void disablePerEdgeMark()
Disables the Optional Mark of the Edge.
Definition edge_container.h:685
void disablePerEdgeAdjacentEdges()
Disables the Optional AdjacentEdges of the Edge.
Definition edge_container.h:570
ConstEdgeIterator edgeEnd() const
Returns a const iterator to the end of the container.
Definition edge_container.h:405
void addPerEdgeCustomComponent(const std::string &name)
Adds a custom component of type K to the Edge, having the given name.
Definition edge_container.h:853
uint edgeNumber() const
Returns the number of non-deleted Edges contained in the Edge container of the Mesh.
Definition edge_container.h:106
void reserveEdges(uint n)
Reserve a number of Edges in the container of Edges. This is useful when you know (or you have an ide...
Definition edge_container.h:260
void deleteEdge(const EdgeType *e)
Marks as deleted the given Edge, before asserting that the Edge belongs to this container.
Definition edge_container.h:297
EdgeIterator edgeBegin(bool jumpDeleted=true)
Returns an iterator to the beginning of the container.
Definition edge_container.h:374
bool isPerEdgeQualityEnabled() const
Checks if the Edge Optional Quality is enabled.
Definition edge_container.h:700
void enablePerEdgeAdjacentFaces()
Enable the Optional AdjacentFaces of the Edge.
Definition edge_container.h:599
bool hasPerEdgeCustomComponent(const std::string &name) const
Checks if Edges have a custom component with the given name.
Definition edge_container.h:741
bool isPerEdgeMarkEnabled() const
Checks if the Edge Optional Mark is enabled.
Definition edge_container.h:663
ConstEdgeIterator edgeBegin(bool jumpDeleted=true) const
Returns a const iterator to the beginning of the container.
Definition edge_container.h:396
uint addEdges(uint n)
Add an arbitrary number of n Edges, returning the id of the first added Edge.
Definition edge_container.h:192
void enablePerEdgeAdjacentEdges()
Enable the Optional AdjacentEdges of the Edge.
Definition edge_container.h:559
void updateEdgeIndices(const std::vector< uint > &newIndices)
Updates all the indices and pointers of the Edges of this container that are stored in any container ...
Definition edge_container.h:358
uint edgeIndexIfCompact(uint i) const
This is an utility member function that returns the index of an element if the container would be com...
Definition edge_container.h:312
bool isPerEdgeAdjacentEdgesEnabled() const
Checks if the Edge Optional AdjacentEdges is enabled.
Definition edge_container.h:546
void deleteEdge(uint i)
Marks as deleted the Edge with the given id.
Definition edge_container.h:282
EdgeContainer()=default
Empty constructor that creates an empty container of Edges.
void enablePerEdgeQuality()
Enable the Optional Quality of the Edge.
Definition edge_container.h:711
void disablePerEdgeQuality()
Disables the Optional Quality of the Edge.
Definition edge_container.h:722
EdgeType & edge(uint i)
Returns a reference of the Edge at the i-th position in the Edge Container of the Mesh,...
Definition edge_container.h:95
void deletePerEdgeCustomComponent(const std::string &name)
Deletes the custom component of the given name from the Edge Element.
Definition edge_container.h:871
void compactEdges()
Compacts the EdgeContainer, removing all the Edges marked as deleted. Edges indices will change accor...
Definition edge_container.h:268
HasEdges concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition edge_container.h:1064
Definition edge_components.h:77
Definition mesh_components.h:52
A concept that checks whether a class has (inherits from) an EdgeContainer class.
Definition edge_container.h:1024
constexpr uint UINT_NULL
The UINT_NULL value represent a null value of uint that is the maximum value that can be represented ...
Definition base.h:48