diff --git a/src/libPMacc/include/math/vector/math_functor/abs.hpp b/src/libPMacc/include/math/vector/math_functor/abs.hpp new file mode 100644 index 0000000000..d80e529315 --- /dev/null +++ b/src/libPMacc/include/math/vector/math_functor/abs.hpp @@ -0,0 +1,61 @@ +/** + * Copyright 2013, 2015 Heiko Burau, Rene Widera + * + * This file is part of libPMacc. + * + * libPMacc is free software: you can redistribute it and/or modify + * it under the terms of of either the GNU General Public License or + * the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * libPMacc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with libPMacc. + * If not, see . + */ + +#pragma once + +#include "types.h" +#include "lambda/Expression.hpp" + +namespace PMacc +{ +namespace math +{ +namespace math_functor +{ + +struct Abs +{ + template + HDINLINE + Type operator()(const Type& x) const + { + return abs(x); + } +}; + +lambda::Expression > _abs; + +} // math_vector +} // math + +namespace result_of +{ + +template +struct Functor +{ + typedef Type type; +}; + +} // result_of + +} // PMacc