ug4
attachment util

Classes

class  ug::CompareByAttachment< TElem, TAttachment >
 Instances can be used as compare operators, e.g., for std::sort. More...
 
class  ug::MultiElementAttachmentAccessor< TAttachment >
 Accesses attachements in different element types at the same time. More...
 

Functions

template<class TIterator , class TAAInt >
void ug::AssignIndices (TIterator begin, TIterator end, TAAInt &aaInt, int baseIndex=0)
 assigns indices to the elements between begin and end. More...
 
template<class TElem , class TSrcAttachment , class TDestAttachment >
bool ug::ConvertMathVectorAttachmentValues (Grid &grid, TSrcAttachment &srcAttachment, TDestAttachment &destAttachment)
 Fills the dest-attachment with values from the source-attachment. More...
 
template<class TElemIter , class TAttachment >
bool ug::CopyAttachments (Grid &grid, TElemIter elemsBegin, TElemIter elemsEnd, TAttachment &aSrc, TAttachment &aDest)
 copies attachments for the specified elements More...
 
template<class TElem , class TAttachment >
bool ug::CopyAttachments (Grid &srcGrid, TAttachment &aSrc, Grid &destGrid, TAttachment &aDest)
 copies attachments from one grid to the other More...
 
template<class TIterator , class TAttAcc >
TIterator ug::FindElementByValue (TIterator begin, TIterator end, const typename TAttAcc::ValueType &val, TAttAcc &aa)
 returns the iterator whose element has the specified attachment value. More...
 
template<class TAttachmentAccessor , class TIter , class TVal >
void ug::SetAttachmentValues (TAttachmentAccessor &aaVal, TIter elemsBegin, TIter elemsEnd, const TVal &val)
 sets attachment-values for elements between elemsBegin and elemsEnd. More...
 

Detailed Description

Several methods that ease attachment-handling are grouped here.

Function Documentation

◆ AssignIndices()

template<class TIterator , class TAAInt >
void ug::AssignIndices ( TIterator  begin,
TIterator  end,
TAAInt &  aaInt,
int  baseIndex = 0 
)

assigns indices to the elements between begin and end.

Indices are stored in the given attachment. Make sure that the given attachment-accessor operates on an attachment-pipe at which those elements are registered.

Referenced by ug::GetSelectedElementIndices(), ug::GridWriterUGX::init_grid_attachments(), ug::GridWriterVTU::new_piece(), and ug::SaveGridToNCDF().

◆ ConvertMathVectorAttachmentValues()

template<class TElem , class TSrcAttachment , class TDestAttachment >
bool ug::ConvertMathVectorAttachmentValues ( Grid grid,
TSrcAttachment &  srcAttachment,
TDestAttachment &  destAttachment 
)

Fills the dest-attachment with values from the source-attachment.

TSrcAttachment and TDestAttachment have to have ValueTypes that are compatible with ug::MathVector.

Copies values from srcAttachment to destAttachment. if destAttachment is not already attached, it will be attached automatically. The srcAttachment however has to be attached.

Valid types for TElem are: Vertex, Edge, Face, Volume

If the dimensions do not match, the algorithm behaves as follows: dim(src) > dim(dest): Only dim(dest) values are copied per element. dim(src) < dim(dest): Values in dimensions >= dim(src) are set to 0.

References ug::Grid::attach_to(), ug::Grid::get_attachment_data_container(), and ug::Grid::has_attachment().

◆ CopyAttachments() [1/2]

template<class TElemIter , class TAttachment >
bool ug::CopyAttachments ( Grid grid,
TElemIter  elemsBegin,
TElemIter  elemsEnd,
TAttachment &  aSrc,
TAttachment &  aDest 
)

copies attachments for the specified elements

If aSrc is not attached to srcGrid, false is returned. If aDest is not attached to destGrid, it is attached automatically.

References ug::Grid::attach_to(), and ug::Grid::has_attachment().

◆ CopyAttachments() [2/2]

template<class TElem , class TAttachment >
bool ug::CopyAttachments ( Grid srcGrid,
TAttachment &  aSrc,
Grid destGrid,
TAttachment &  aDest 
)

copies attachments from one grid to the other

If aSrc is not attached to srcGrid, false is returned. If aDest is not attached to destGrid, it is attached automatically.

The method iterates through the elements specified by TElem and copies the attachments.

Call like this: CopyAttachments<Vertex>(...);

References ug::Grid::attach_to(), ug::Grid::begin(), ug::Grid::end(), and ug::Grid::has_attachment().

◆ FindElementByValue()

template<class TIterator , class TAttAcc >
TIterator ug::FindElementByValue ( TIterator  begin,
TIterator  end,
const typename TAttAcc::ValueType &  val,
TAttAcc &  aa 
)

returns the iterator whose element has the specified attachment value.

If no element contains the given value, end is returned.

Make sure that the specified attachment accessor operates on the specified elements.

◆ SetAttachmentValues()