Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for math::tan #374

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 45 additions & 26 deletions src/libPMacc/include/algorithms/math/defines/trigo.hpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* Copyright 2013-2014 Heiko Burau, Rene Widera, Richard Pausch
* Copyright 2013-2014 Heiko Burau, Rene Widera, Richard Pausch, Axel Huebl
*
* 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 <http://www.gnu.org/licenses/>.
*/

* 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 <http://www.gnu.org/licenses/>.
*/

#pragma once

Expand All @@ -36,6 +36,9 @@ struct Sin;
template<typename Type>
struct Cos;

template<typename Type>
struct Tan;

template<typename ArgType, typename SinType, typename CosType>
struct SinCos;

Expand All @@ -44,29 +47,45 @@ struct Sinc;


template<typename T1>
HDINLINE static typename Sin< T1 >::result sin(const T1& value)
HDINLINE static
typename Sin< T1 >::result
sin(const T1& value)
{
return Sin< T1 > ()(value);
}

template<typename T1>
HDINLINE static typename Cos<T1>::result cos(const T1& value)
HDINLINE static
typename Cos<T1>::result
cos(const T1& value)
{
return Cos< T1 > ()(value);
}

template<typename T1>
HDINLINE static
typename Tan<T1>::result
tan(const T1& value)
{
return Tan< T1 > ()(value);
}

template<typename ArgType, typename SinType, typename CosType>
HDINLINE static typename SinCos< ArgType, SinType, CosType >::result sincos(ArgType arg, SinType& sinValue, CosType& cosValue)
HDINLINE static
typename SinCos< ArgType, SinType, CosType >::result
sincos(ArgType arg, SinType& sinValue, CosType& cosValue)
{
return SinCos< ArgType, SinType, CosType > ()(arg, sinValue, cosValue);
}

template<typename T1>
HDINLINE static typename Sinc<T1>::result sinc(const T1& value)
HDINLINE static
typename Sinc<T1>::result
sinc(const T1& value)
{
return Sinc< T1 > ()(value);
}

} //namespace math
} //namespace algorithms
}//namespace PMacc
} /* namespace math */
} /* namespace algorithms */
} /* namespace PMacc */
49 changes: 30 additions & 19 deletions src/libPMacc/include/algorithms/math/doubleMath/trigo.tpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* Copyright 2013-2014 Heiko Burau, Rene Widera, Richard Pausch
* Copyright 2013-2014 Heiko Burau, Rene Widera, Richard Pausch, Axel Huebl
*
* 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 <http://www.gnu.org/licenses/>.
*/

* 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 <http://www.gnu.org/licenses/>.
*/

#pragma once

Expand Down Expand Up @@ -54,6 +54,17 @@ struct Cos<double>
}
};

template<>
struct Tan<double>
{
typedef double result;

HDINLINE double operator( )(const double& value )
{
return ::tan( value );
}
};

template<>
struct SinCos<double, double, double>
{
Expand Down
50 changes: 31 additions & 19 deletions src/libPMacc/include/algorithms/math/floatMath/trigo.tpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
/**
* Copyright 2013-2014 Heiko Burau, Rene Widera, Richard Pausch
* Copyright 2013-2014 Heiko Burau, Rene Widera, Richard Pausch, Axel Huebl
*
* 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 <http://www.gnu.org/licenses/>.
*/

* 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 <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "types.h"
Expand Down Expand Up @@ -53,6 +54,17 @@ struct Cos<float>
}
};

template<>
struct Tan<float>
{
typedef float result;

HDINLINE float operator( )(const float& value )
{
return ::tanf( value );
}
};

template<>
struct SinCos<float, float, float>
{
Expand Down