Added cmptSign

This commit is contained in:
Hrvoje Jasak 2016-03-17 11:33:54 +00:00
parent 4052d189b9
commit 86e5b360db
2 changed files with 34 additions and 0 deletions

View file

@ -297,6 +297,30 @@ tmp<Field<Type> > cmptMag(const tmp<Field<Type> >& tf)
}
template<class Type>
void cmptSign(Field<Type>& res, const UList<Type>& f)
{
TFOR_ALL_F_OP_FUNC_F(Type, res, =, cmptSign, Type, f)
}
template<class Type>
tmp<Field<Type> > cmptSign(const UList<Type>& f)
{
tmp<Field<Type> > tRes(new Field<Type>(f.size()));
cmptSign(tRes(), f);
return tRes;
}
template<class Type>
tmp<Field<Type> > cmptSign(const tmp<Field<Type> >& tf)
{
tmp<Field<Type> > tRes = reuseTmp<Type, Type>::New(tf);
cmptSign(tRes(), tf());
reuseTmp<Type, Type>::clear(tf);
return tRes;
}
#define TMP_UNARY_FUNCTION(ReturnType, Func) \
\
template<class Type> \

View file

@ -152,6 +152,16 @@ tmp<Field<Type> > cmptMag(const UList<Type>& f);
template<class Type>
tmp<Field<Type> > cmptMag(const tmp<Field<Type> >& tf);
template<class Type>
void cmptSign(Field<Type>& res, const UList<Type>& f);
template<class Type>
tmp<Field<Type> > cmptSign(const UList<Type>& f);
template<class Type>
tmp<Field<Type> > cmptSign(const tmp<Field<Type> >& tf);
#define TMP_UNARY_FUNCTION(ReturnType, Func) \
\
template<class Type> \