33 #ifndef __H__LIB_GRID__ATTACHMENT_UTIL_IMPL__
34 #define __H__LIB_GRID__ATTACHMENT_UTIL_IMPL__
43 template <
class TAttachmentAccessor,
class TIter,
class TVal>
45 TIter elemsBegin, TIter elemsEnd,
48 while(elemsBegin != elemsEnd)
50 aaVal[*elemsBegin] = val;
57 template<
class TElem,
class TSrcAttachment,
class TDestAttachment>
59 TSrcAttachment& srcAttachment,
60 TDestAttachment& destAttachment)
62 typedef TSrcAttachment ASrc;
63 typedef TDestAttachment ADest;
73 typename ASrc::ContainerType& cSrc
75 typename ADest::ContainerType& cDest
78 int srcDim = ASrc::ValueType::Size;
79 int destDim = ADest::ValueType::Size;
85 for(
uint i = 0; i < cSrc.size(); ++i)
87 typename ASrc::ValueType& vSrc = cSrc[i];
88 typename ADest::ValueType& vDest = cDest[i];
90 for(
int j = 0; j < destDim; ++j)
97 for(
uint i = 0; i < cSrc.size(); ++i)
99 typename ASrc::ValueType& vSrc = cSrc[i];
100 typename ADest::ValueType& vDest = cDest[i];
102 for(
int j = 0; j < srcDim; ++j)
105 for(
int j = srcDim; j < destDim; ++j)
114 template <
class TElem,
class TAttachment>
116 Grid& destGrid, TAttachment& aDest)
133 while((iterSrc != srcGrid.
end<TElem>())
134 &&(iterDest != destGrid.
end<TElem>()))
136 aaDest[*iterDest] = aaSrc[*iterSrc];
146 template <
class TElemIter,
class TAttachment>
148 TAttachment& aSrc, TAttachment& aDest)
165 TElemIter iter = elemsBegin;
166 while(iter != elemsEnd)
168 aaDest[*iter] = aaSrc[*iter];
177 template <
class TIterator,
class TAAInt>
179 TAAInt& aaInt,
int baseIndex)
181 for(TIterator iter = begin; iter != end; ++iter)
182 aaInt[*iter] = baseIndex++;
186 template <
class TIterator,
class TAttAcc>
188 const typename TAttAcc::ValueType& val,
191 TIterator iter = begin;
the generic attachment-accessor for access to grids attachment pipes.
Definition: grid.h:182
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
void attach_to(IAttachment &attachment, bool passOnValues)
attach with custom pass-on-behaviour and unspecified default value.
Definition: grid_impl.hpp:296
bool has_attachment(IAttachment &attachment)
Definition: grid.h:796
geometry_traits< TGeomObj >::iterator begin()
Definition: grid_impl.hpp:164
geometry_traits< TGeomObj >::iterator end()
Definition: grid_impl.hpp:175
TAttachment::ContainerType * get_attachment_data_container(TAttachment &attachment)
Definition: grid_impl.hpp:399
Definition: grid_base_object_traits.h:68
bool ConvertMathVectorAttachmentValues(Grid &grid, TSrcAttachment &srcAttachment, TDestAttachment &destAttachment)
Fills the dest-attachment with values from the source-attachment.
Definition: attachment_util_impl.hpp:58
TIterator FindElementByValue(TIterator begin, TIterator end, const typename TAttAcc::ValueType &val, TAttAcc &aa)
returns the iterator whose element has the specified attachment value.
Definition: attachment_util_impl.hpp:187
bool CopyAttachments(Grid &srcGrid, TAttachment &aSrc, Grid &destGrid, TAttachment &aDest)
copies attachments from one grid to the other
Definition: attachment_util_impl.hpp:115
void AssignIndices(TIterator begin, TIterator end, TAAInt &aaInt, int baseIndex=0)
assigns indices to the elements between begin and end.
Definition: attachment_util_impl.hpp:178
void SetAttachmentValues(TAttachmentAccessor &aaVal, TIter elemsBegin, TIter elemsEnd, const TVal &val)
sets attachment-values for elements between elemsBegin and elemsEnd.
Definition: attachment_util_impl.hpp:44
IMaterialLaw< TDomain > base_type
unsigned int uint
Definition: types.h:114
T value_type
Definition: sparsematrix_interface.h:2
Definition: grid_base_objects.h:1011