Loading src/generators/functions/CMakeLists.txt +2 −0 Original line number Diff line number Diff line SET( headers tnlFunctionDiscretizer.h tnlExpBumpFunction.h tnlSinBumpsFunction.h tnlSinWaveFunction.h ) SET( libtnlgeneratorsfunctionsincludedir ${TNL_INCLUDE_DIR}/generators/functions ) Loading src/generators/functions/tnlExpBumpFunction.h 0 → 100644 +106 −0 Original line number Diff line number Diff line /*************************************************************************** tnlExpBumpFunction.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLEXPBUMPFUNCTION_H_ #define TNLEXPBUMPFUNCTION_H_ #include <config/tnlParameterContainer.h> #include <core/tnlTuple.h> template< typename Real > class tnlExpBumpFunctionBase { public: typedef Real RealType; bool init( const tnlParameterContainer& parameters ); void setAmplitude( const RealType& amplitude ); const RealType& getAmplitude() const; void setSigma( const RealType& sigma ); const RealType& getSigma() const; protected: RealType amplitude, sigma; }; template< int Dimensions, typename Vertex = tnlTuple< Dimensions, double >, typename Device = tnlHost > class tnlExpBumpFunction { }; template< typename Vertex, typename Device > class tnlExpBumpFunction< 1, Vertex, Device > : public tnlExpBumpFunctionBase< typename Vertex::RealType > { public: enum { Dimensions = 1 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlExpBumpFunction(); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; template< typename Vertex, typename Device > class tnlExpBumpFunction< 2, Vertex, Device > : public tnlExpBumpFunctionBase< typename Vertex::RealType > { public: enum { Dimensions = 2 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlExpBumpFunction(); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; template< typename Vertex, typename Device > class tnlExpBumpFunction< 3, Vertex, Device > : public tnlExpBumpFunctionBase< typename Vertex::RealType > { public: enum { Dimensions = 3 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlExpBumpFunction(); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; #include <implementation/generators/functions/tnlExpBumpFunction_impl.h> #endif /* TNLEXPBUMPFUNCTION_H_ */ src/generators/functions/tnlSinBumpsFunction.h 0 → 100644 +116 −0 Original line number Diff line number Diff line /*************************************************************************** tnlSinBumpsFunction.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLSINBUMPSFUNCTION_H_ #define TNLSINBUMPSFUNCTION_H_ #include <config/tnlParameterContainer.h> #include <core/tnlTuple.h> template< int Dimensions, typename Vertex = tnlTuple< Dimensions, double >, typename Device = tnlHost > class tnlSinBumpsFunctionBase { public: typedef Vertex VertexType; typedef typename VertexType::RealType RealType; void setWaveLength( const VertexType& waveLength ); const VertexType& getWaveLength() const; void setAmplitude( const RealType& amplitude ); const RealType& getAmplitude() const; void setPhase( const VertexType& phase ); const VertexType& getPhase() const; protected: RealType amplitude; VertexType waveLength, phase; }; template< int Dimensions, typename Vertex = tnlTuple< Dimensions, double >, typename Device = tnlHost > class tnlSinBumpsFunction { }; template< typename Vertex, typename Device > class tnlSinBumpsFunction< 1, Vertex, Device > : public tnlSinBumpsFunctionBase< 1, Vertex, Device > { public: enum { Dimensions = 1 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlSinBumpsFunction(); bool init( const tnlParameterContainer& parameters ); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; template< typename Vertex, typename Device > class tnlSinBumpsFunction< 2, Vertex, Device > : public tnlSinBumpsFunctionBase< 2, Vertex, Device > { public: enum { Dimensions = 2 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlSinBumpsFunction(); bool init( const tnlParameterContainer& parameters ); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; template< typename Vertex, typename Device > class tnlSinBumpsFunction< 3, Vertex, Device > : public tnlSinBumpsFunctionBase< 3, Vertex, Device > { public: enum { Dimensions = 3 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlSinBumpsFunction(); bool init( const tnlParameterContainer& parameters ); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; #include <implementation/generators/functions/tnlSinBumpsFunction_impl.h> #endif /* TNLSINBUMPSFUNCTION_H_ */ src/implementation/generators/functions/CMakeLists.txt +2 −0 Original line number Diff line number Diff line SET( headers tnlFunctionDiscretizer_impl.h tnlExpBumpFunction_impl.h tnlSinBumpsFunction_impl.h tnlSinWaveFunction_impl.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/generators/functions ) Loading src/implementation/generators/functions/tnlExpBumpFunction_impl.h 0 → 100644 +121 −0 Original line number Diff line number Diff line /*************************************************************************** tnlExpBumpFunction_impl.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLEXPBUMPFUNCTION_IMPL_H_ #define TNLEXPBUMPFUNCTION_IMPL_H_ #include <generators/functions/tnlExpBumpFunction.h> template< typename Real > bool tnlExpBumpFunctionBase< Real >::init( const tnlParameterContainer& parameters ) { this->amplitude = parameters.GetParameter< double >( "amplitude" ); this->sigma = parameters.GetParameter< double >( "sigma" ); return true; } template< typename Real > void tnlExpBumpFunctionBase< Real >::setAmplitude( const Real& amplitude ) { this->amplitude = amplitude; } template< typename Real > const Real& tnlExpBumpFunctionBase< Real >::getAmplitude() const { return this->amplitude; } template< typename Real > void tnlExpBumpFunctionBase< Real >::setSigma( const Real& sigma ) { this->sigma = sigma; } template< typename Real > const Real& tnlExpBumpFunctionBase< Real >::getSigma() const { return this->sigma; } /*** * 1D */ template< typename Vertex, typename Device > tnlExpBumpFunction< 1, Vertex, Device >::tnlExpBumpFunction() { } template< typename Vertex, typename Device > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > typename Vertex::RealType tnlExpBumpFunction< 1, Vertex, Device >::getF( const Vertex& v ) const { const RealType& x = v.x(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) return this->amplitude * sin( -x*x / ( this->sigma*this->sigma ) ); return 0.0; } /**** * 2D */ template< typename Vertex, typename Device > tnlExpBumpFunction< 2, Vertex, Device >::tnlExpBumpFunction() { } template< typename Vertex, typename Device > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > typename Vertex::RealType tnlExpBumpFunction< 2, Vertex, Device >::getF( const Vertex& v ) const { const RealType& x = v.x(); const RealType& y = v.y(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) return this->amplitude * exp( ( -x*x - y*y ) / ( this->sigma * this->sigma ) ); return 0.0; } /**** * 3D */ template< typename Vertex, typename Device > tnlExpBumpFunction< 3, Vertex, Device >::tnlExpBumpFunction() { } template< typename Vertex, typename Device > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > typename Vertex::RealType tnlExpBumpFunction< 3, Vertex, Device >::getF( const Vertex& v ) const { const RealType& x = v.x(); const RealType& y = v.y(); const RealType& z = v.z(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) return this->amplitude * exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) ); return 0.0; } #endif /* TNLEXPBUMPFUNCTION_IMPL_H_ */ Loading
src/generators/functions/CMakeLists.txt +2 −0 Original line number Diff line number Diff line SET( headers tnlFunctionDiscretizer.h tnlExpBumpFunction.h tnlSinBumpsFunction.h tnlSinWaveFunction.h ) SET( libtnlgeneratorsfunctionsincludedir ${TNL_INCLUDE_DIR}/generators/functions ) Loading
src/generators/functions/tnlExpBumpFunction.h 0 → 100644 +106 −0 Original line number Diff line number Diff line /*************************************************************************** tnlExpBumpFunction.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLEXPBUMPFUNCTION_H_ #define TNLEXPBUMPFUNCTION_H_ #include <config/tnlParameterContainer.h> #include <core/tnlTuple.h> template< typename Real > class tnlExpBumpFunctionBase { public: typedef Real RealType; bool init( const tnlParameterContainer& parameters ); void setAmplitude( const RealType& amplitude ); const RealType& getAmplitude() const; void setSigma( const RealType& sigma ); const RealType& getSigma() const; protected: RealType amplitude, sigma; }; template< int Dimensions, typename Vertex = tnlTuple< Dimensions, double >, typename Device = tnlHost > class tnlExpBumpFunction { }; template< typename Vertex, typename Device > class tnlExpBumpFunction< 1, Vertex, Device > : public tnlExpBumpFunctionBase< typename Vertex::RealType > { public: enum { Dimensions = 1 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlExpBumpFunction(); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; template< typename Vertex, typename Device > class tnlExpBumpFunction< 2, Vertex, Device > : public tnlExpBumpFunctionBase< typename Vertex::RealType > { public: enum { Dimensions = 2 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlExpBumpFunction(); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; template< typename Vertex, typename Device > class tnlExpBumpFunction< 3, Vertex, Device > : public tnlExpBumpFunctionBase< typename Vertex::RealType > { public: enum { Dimensions = 3 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlExpBumpFunction(); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; #include <implementation/generators/functions/tnlExpBumpFunction_impl.h> #endif /* TNLEXPBUMPFUNCTION_H_ */
src/generators/functions/tnlSinBumpsFunction.h 0 → 100644 +116 −0 Original line number Diff line number Diff line /*************************************************************************** tnlSinBumpsFunction.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLSINBUMPSFUNCTION_H_ #define TNLSINBUMPSFUNCTION_H_ #include <config/tnlParameterContainer.h> #include <core/tnlTuple.h> template< int Dimensions, typename Vertex = tnlTuple< Dimensions, double >, typename Device = tnlHost > class tnlSinBumpsFunctionBase { public: typedef Vertex VertexType; typedef typename VertexType::RealType RealType; void setWaveLength( const VertexType& waveLength ); const VertexType& getWaveLength() const; void setAmplitude( const RealType& amplitude ); const RealType& getAmplitude() const; void setPhase( const VertexType& phase ); const VertexType& getPhase() const; protected: RealType amplitude; VertexType waveLength, phase; }; template< int Dimensions, typename Vertex = tnlTuple< Dimensions, double >, typename Device = tnlHost > class tnlSinBumpsFunction { }; template< typename Vertex, typename Device > class tnlSinBumpsFunction< 1, Vertex, Device > : public tnlSinBumpsFunctionBase< 1, Vertex, Device > { public: enum { Dimensions = 1 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlSinBumpsFunction(); bool init( const tnlParameterContainer& parameters ); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; template< typename Vertex, typename Device > class tnlSinBumpsFunction< 2, Vertex, Device > : public tnlSinBumpsFunctionBase< 2, Vertex, Device > { public: enum { Dimensions = 2 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlSinBumpsFunction(); bool init( const tnlParameterContainer& parameters ); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; template< typename Vertex, typename Device > class tnlSinBumpsFunction< 3, Vertex, Device > : public tnlSinBumpsFunctionBase< 3, Vertex, Device > { public: enum { Dimensions = 3 }; typedef Vertex VertexType; typedef typename VertexType::RealType RealType; tnlSinBumpsFunction(); bool init( const tnlParameterContainer& parameters ); template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 > RealType getF( const VertexType& v ) const; }; #include <implementation/generators/functions/tnlSinBumpsFunction_impl.h> #endif /* TNLSINBUMPSFUNCTION_H_ */
src/implementation/generators/functions/CMakeLists.txt +2 −0 Original line number Diff line number Diff line SET( headers tnlFunctionDiscretizer_impl.h tnlExpBumpFunction_impl.h tnlSinBumpsFunction_impl.h tnlSinWaveFunction_impl.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/generators/functions ) Loading
src/implementation/generators/functions/tnlExpBumpFunction_impl.h 0 → 100644 +121 −0 Original line number Diff line number Diff line /*************************************************************************** tnlExpBumpFunction_impl.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLEXPBUMPFUNCTION_IMPL_H_ #define TNLEXPBUMPFUNCTION_IMPL_H_ #include <generators/functions/tnlExpBumpFunction.h> template< typename Real > bool tnlExpBumpFunctionBase< Real >::init( const tnlParameterContainer& parameters ) { this->amplitude = parameters.GetParameter< double >( "amplitude" ); this->sigma = parameters.GetParameter< double >( "sigma" ); return true; } template< typename Real > void tnlExpBumpFunctionBase< Real >::setAmplitude( const Real& amplitude ) { this->amplitude = amplitude; } template< typename Real > const Real& tnlExpBumpFunctionBase< Real >::getAmplitude() const { return this->amplitude; } template< typename Real > void tnlExpBumpFunctionBase< Real >::setSigma( const Real& sigma ) { this->sigma = sigma; } template< typename Real > const Real& tnlExpBumpFunctionBase< Real >::getSigma() const { return this->sigma; } /*** * 1D */ template< typename Vertex, typename Device > tnlExpBumpFunction< 1, Vertex, Device >::tnlExpBumpFunction() { } template< typename Vertex, typename Device > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > typename Vertex::RealType tnlExpBumpFunction< 1, Vertex, Device >::getF( const Vertex& v ) const { const RealType& x = v.x(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) return this->amplitude * sin( -x*x / ( this->sigma*this->sigma ) ); return 0.0; } /**** * 2D */ template< typename Vertex, typename Device > tnlExpBumpFunction< 2, Vertex, Device >::tnlExpBumpFunction() { } template< typename Vertex, typename Device > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > typename Vertex::RealType tnlExpBumpFunction< 2, Vertex, Device >::getF( const Vertex& v ) const { const RealType& x = v.x(); const RealType& y = v.y(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) return this->amplitude * exp( ( -x*x - y*y ) / ( this->sigma * this->sigma ) ); return 0.0; } /**** * 3D */ template< typename Vertex, typename Device > tnlExpBumpFunction< 3, Vertex, Device >::tnlExpBumpFunction() { } template< typename Vertex, typename Device > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > typename Vertex::RealType tnlExpBumpFunction< 3, Vertex, Device >::getF( const Vertex& v ) const { const RealType& x = v.x(); const RealType& y = v.y(); const RealType& z = v.z(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) return this->amplitude * exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) ); return 0.0; } #endif /* TNLEXPBUMPFUNCTION_IMPL_H_ */