diff --git a/examples/CMakeLists.txt~ b/examples/CMakeLists.txt~ deleted file mode 100755 index b509b17e52aa8679097f9efef417f43b8a4b8638..0000000000000000000000000000000000000000 --- a/examples/CMakeLists.txt~ +++ /dev/null @@ -1,6 +0,0 @@ -add_subdirectory( heat-equation ) -add_subdirectory( navier-stokes ) -#add_subdirectory( mean-curvature-flow ) -#add_subdirectory( hamilton-jacobi ) -#add_subdirectory( hamilton-jacobi-parallel ) -add_subdirectory( fast-sweeping ) diff --git a/examples/hamilton-jacobi-parallel-map/Makefile~ b/examples/hamilton-jacobi-parallel-map/Makefile~ deleted file mode 100644 index d996b5c90703680cd0e9cf334eb70d311caaa8f3..0000000000000000000000000000000000000000 --- a/examples/hamilton-jacobi-parallel-map/Makefile~ +++ /dev/null @@ -1,41 +0,0 @@ -TNL_VERSION=0.1 -TNL_INSTALL_DIR=${HOME}/local/lib -TNL_INCLUDE_DIR=${HOME}/local/include/tnl-${TNL_VERSION} - -TARGET = hamiltonJacobiParallelSolver -#CONFIG_FILE = $(TARGET).cfg.desc -INSTALL_DIR = ${HOME}/local -CXX = g++ -CUDA_CXX = nvcc -OMP_FLAGS = -DHAVE_OPENMP -fopenmp -CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) -O3 $(OMP_FLAGS) -DDEBUG -LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 -lgomp - -SOURCES = main.cpp -HEADERS = -OBJECTS = main.o -DIST = $(SOURCES) Makefile - -all: $(TARGET) -clean: - rm -f $(OBJECTS) - rm -f $(TARGET)-conf.h - -dist: $(DIST) - tar zcvf $(TARGET).tgz $(DIST) - -install: $(TARGET) - cp $(TARGET) $(INSTALL_DIR)/bin - cp $(CONFIG_FILE) $(INSTALL_DIR)/share - -uninstall: $(TARGET) - rm -f $(INSTALL_DIR)/bin/$(TARGET) - rm -f $(CONFIG_FILE) $(INSTALL_DIR)/share - -$(TARGET): $(OBJECTS) - $(CUDA_CXX) -o $(TARGET) $(OBJECTS) $(LD_FLAGS) - -%.o: %.cpp $(HEADERS) - $(CXX) -c -o $@ $(CXX_FLAGS) $< - - diff --git a/examples/hamilton-jacobi-parallel-map/run~ b/examples/hamilton-jacobi-parallel-map/run~ deleted file mode 100755 index 236669a39749dd09b5870242d965df65295bb6fc..0000000000000000000000000000000000000000 --- a/examples/hamilton-jacobi-parallel-map/run~ +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -#GRID_SIZES="0897" -#GRID_SIZES="0449" -GRID_SIZES="1793" - -dimensions=2 - -size=2 - -time=3 - -for grid_size in $GRID_SIZES; - -do - - rm -r grid-${grid_size} - mkdir grid-${grid_size} - cd grid-${grid_size} - - tnl-grid-setup --dimensions $dimensions \ - --origin-x -1.0 \ - --origin-y -1.0 \ - --origin-z -1.0 \ - --proportions-x $size \ - --proportions-y $size \ - --proportions-z $size \ - --size-x ${grid_size} \ - --size-y ${grid_size} \ - --size-z ${grid_size} - - tnl-init --test-function sdf-para \ - --offset 0.25 \ - --output-file init.tnl \ - --final-time 0.0 \ - --snapshot-period 0.1 \ - - - tnl-init --test-function sdf-para-sdf \ - --offset 0.25 \ - --output-file sdf.tnl \ - --final-time 0.0 \ - --snapshot-period 0.1 - - hamilton-jacobi-parallel --initial-condition init.tnl \ - --cfl-condition 1.0e-1 \ - --mesh mesh.tnl \ - --initial-tau 1.0e-3 \ - --epsilon 1.0 \ - --delta 0.0 \ - --stop-time $time \ - --scheme godunov \ - --subgrid-size 8 - - tnl-diff --mesh mesh.tnl --mode sequence --input-files sdf.tnl u-00001.tnl --write-difference yes --output-file ../${grid_size}.diff - - cd .. - -done - - -./tnl-err2eoc-2.py --format txt --size $size *.diff - - diff --git a/examples/hamilton-jacobi-parallel/Makefile~ b/examples/hamilton-jacobi-parallel/Makefile~ deleted file mode 100644 index d996b5c90703680cd0e9cf334eb70d311caaa8f3..0000000000000000000000000000000000000000 --- a/examples/hamilton-jacobi-parallel/Makefile~ +++ /dev/null @@ -1,41 +0,0 @@ -TNL_VERSION=0.1 -TNL_INSTALL_DIR=${HOME}/local/lib -TNL_INCLUDE_DIR=${HOME}/local/include/tnl-${TNL_VERSION} - -TARGET = hamiltonJacobiParallelSolver -#CONFIG_FILE = $(TARGET).cfg.desc -INSTALL_DIR = ${HOME}/local -CXX = g++ -CUDA_CXX = nvcc -OMP_FLAGS = -DHAVE_OPENMP -fopenmp -CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) -O3 $(OMP_FLAGS) -DDEBUG -LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 -lgomp - -SOURCES = main.cpp -HEADERS = -OBJECTS = main.o -DIST = $(SOURCES) Makefile - -all: $(TARGET) -clean: - rm -f $(OBJECTS) - rm -f $(TARGET)-conf.h - -dist: $(DIST) - tar zcvf $(TARGET).tgz $(DIST) - -install: $(TARGET) - cp $(TARGET) $(INSTALL_DIR)/bin - cp $(CONFIG_FILE) $(INSTALL_DIR)/share - -uninstall: $(TARGET) - rm -f $(INSTALL_DIR)/bin/$(TARGET) - rm -f $(CONFIG_FILE) $(INSTALL_DIR)/share - -$(TARGET): $(OBJECTS) - $(CUDA_CXX) -o $(TARGET) $(OBJECTS) $(LD_FLAGS) - -%.o: %.cpp $(HEADERS) - $(CXX) -c -o $@ $(CXX_FLAGS) $< - - diff --git a/examples/hamilton-jacobi-parallel/run~ b/examples/hamilton-jacobi-parallel/run~ deleted file mode 100755 index 236669a39749dd09b5870242d965df65295bb6fc..0000000000000000000000000000000000000000 --- a/examples/hamilton-jacobi-parallel/run~ +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -#GRID_SIZES="0897" -#GRID_SIZES="0449" -GRID_SIZES="1793" - -dimensions=2 - -size=2 - -time=3 - -for grid_size in $GRID_SIZES; - -do - - rm -r grid-${grid_size} - mkdir grid-${grid_size} - cd grid-${grid_size} - - tnl-grid-setup --dimensions $dimensions \ - --origin-x -1.0 \ - --origin-y -1.0 \ - --origin-z -1.0 \ - --proportions-x $size \ - --proportions-y $size \ - --proportions-z $size \ - --size-x ${grid_size} \ - --size-y ${grid_size} \ - --size-z ${grid_size} - - tnl-init --test-function sdf-para \ - --offset 0.25 \ - --output-file init.tnl \ - --final-time 0.0 \ - --snapshot-period 0.1 \ - - - tnl-init --test-function sdf-para-sdf \ - --offset 0.25 \ - --output-file sdf.tnl \ - --final-time 0.0 \ - --snapshot-period 0.1 - - hamilton-jacobi-parallel --initial-condition init.tnl \ - --cfl-condition 1.0e-1 \ - --mesh mesh.tnl \ - --initial-tau 1.0e-3 \ - --epsilon 1.0 \ - --delta 0.0 \ - --stop-time $time \ - --scheme godunov \ - --subgrid-size 8 - - tnl-diff --mesh mesh.tnl --mode sequence --input-files sdf.tnl u-00001.tnl --write-difference yes --output-file ../${grid_size}.diff - - cd .. - -done - - -./tnl-err2eoc-2.py --format txt --size $size *.diff - - diff --git a/examples/hamilton-jacobi/CMakeLists.txt~ b/examples/hamilton-jacobi/CMakeLists.txt~ deleted file mode 100755 index 339e3040040212c34850f3e219fac8cb961335c9..0000000000000000000000000000000000000000 --- a/examples/hamilton-jacobi/CMakeLists.txt~ +++ /dev/null @@ -1,18 +0,0 @@ -set( tnl_hamilton_jacobi_SOURCES - hamiltonJacobiProblemSetter.h - hamiltonJacobiProblemSetter_impl.h - hamiltonJacobiProblemSolver.h - hamiltonJacobiProblemSolver_impl.cpp - main.cpp - hamiltonJacobiProblemConfig.h ) - -ADD_EXECUTABLE(hamilton-jacobi${debugExt} main.cpp) -target_link_libraries (hamilton-jacobi${debugExt} tnl${debugExt}-${tnlVersion} ) - -INSTALL( TARGETS hamilton-jacobi${debugExt} - RUNTIME DESTINATION bin - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) - -INSTALL( FILES ${tnl_hamilton_jacobi_SOURCES} - Makefile - DESTINATION share/tnl-${tnlVersion}/examples/hamilton-jacobi ) diff --git a/src/functions/CMakeLists.txt b/src/functions/CMakeLists.txt index 78364547322a6a51153cd0c24b6661a5c744227b..064cd2a686d9cecef75b2ed5f67dd95333822ad3 100755 --- a/src/functions/CMakeLists.txt +++ b/src/functions/CMakeLists.txt @@ -25,21 +25,19 @@ SET( headers tnlConstantFunction.h tnlSinWaveFunction_impl.h tnlTestFunction.h tnlTestFunction_impl.h - tnlSDFSinBumpsFunction.h - tnlSDFSinBumpsFunctionSDF.h + tnlSinBumpsFunctionSDF.h tnlSDFSinWaveFunction.h tnlSDFSinWaveFunctionSDF.h - tnlSDFParaboloid.h - tnlSDFParaboloidSDF.h + tnlParaboloid.h + tnlParaboloidSDF.h tnlSDFSchemeTest.h tnlSDFSign.h tnlSDFGridValue.h - tnlSDFSinBumpsFunction_impl.h - tnlSDFSinBumpsFunctionSDF_impl.h + tnlSinBumpsFunctionSDF_impl.h tnlSDFSinWaveFunction_impl.h tnlSDFSinWaveFunctionSDF_impl.h - tnlSDFParaboloid_impl.h - tnlSDFParaboloidSDF_impl.h + tnlParaboloid_impl.h + tnlParaboloidSDF_impl.h tnlSDFSchemeTest_impl.h tnlSDFSign_impl.h tnlSDFGridValue_impl.h ) diff --git a/src/functions/CMakeLists.txt~ b/src/functions/CMakeLists.txt~ deleted file mode 100755 index f809c63dcebaafefd1263c0a1750c334f4d0a2ea..0000000000000000000000000000000000000000 --- a/src/functions/CMakeLists.txt~ +++ /dev/null @@ -1,44 +0,0 @@ -ADD_SUBDIRECTORY( initial_conditions ) - -SET( headers tnlConstantFunction.h - tnlConstantFunction_impl.h - tnlDomain.h - tnlExactOperatorFunction.h - tnlExpBumpFunction.h - tnlExpBumpFunction_impl.h - tnlFunctionAdapter.h - tnlFunctionEvaluator.h - tnlFunctionEvaluator_impl.h - tnlMeshFunction.h - tnlMeshFunction_impl.h - tnlMeshFunctionEvaluator.h - tnlMeshFunctionEvaluator_impl.h - tnlMeshFunctionGnuplotWriter.h - tnlMeshFunctionGnuplotWriter_impl.h - tnlMeshFunctionNormGetter.h - tnlMeshFunctionVTKWriter.h - tnlMeshFunctionVTKWriter_impl.h - tnlOperatorFunction.h - tnlSinBumpsFunction.h - tnlSinBumpsFunction_impl.h - tnlSinWaveFunction.h - tnlSinWaveFunction_impl.h - tnlTestFunction.h - tnlTestFunction_impl.h ) - -SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/functions ) -set( common_SOURCES - ${CURRENT_DIR}/tnlTestFunction_impl.cpp ) - -IF( BUILD_CUDA ) - set( tnl_functions_CUDA__SOURCES - ${common_SOURCES} - ${CURRENT_DIR}/tnlTestFunction_impl.cu - PARENT_SCOPE ) -ENDIF() - -set( tnl_functions_SOURCES - ${common_SOURCES} - PARENT_SCOPE ) - -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/functions ) diff --git a/src/functions/initial_conditions/CMakeLists.txt~ b/src/functions/initial_conditions/CMakeLists.txt~ deleted file mode 100755 index fcfe293ea4d8d756d7bb371b56a6088166554123..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/CMakeLists.txt~ +++ /dev/null @@ -1,5 +0,0 @@ -SET( headers tnlCylinderFunction.h - tnlCylinderFunction_impl.h - ) - -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/problems ) diff --git a/src/functions/initial_conditions/level_set_functions/CMakeLists.txt~ b/src/functions/initial_conditions/level_set_functions/CMakeLists.txt~ deleted file mode 100755 index aaac57306c17920568010efc120817e452c73af3..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/level_set_functions/CMakeLists.txt~ +++ /dev/null @@ -1,11 +0,0 @@ -ADD_SUBDIRECTORY( level_set_conditions ) - -SET( headers tnlCylinderFunction.h - tnlCylinderFunction_impl.h - tnlFlowerpotFunction.h - tnlFlowerpotFunction_impl.h - tnlTwinsFunction.h - tnlTwinsFunction_impl.h - ) - -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/functions/initial_conditions ) diff --git a/src/functions/initial_conditions/level_set_functions/tnlBlobFunction.h~ b/src/functions/initial_conditions/level_set_functions/tnlBlobFunction.h~ deleted file mode 100644 index c085289494fb4d25b5e0abe78e707d266f833be2..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/level_set_functions/tnlBlobFunction.h~ +++ /dev/null @@ -1,160 +0,0 @@ -/*************************************************************************** - 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 TNLBLOBFUNCTION_H_ -#define TNLBLOBFUNCTION_H_ - -#include <config/tnlParameterContainer.h> -#include <core/vectors/tnlStaticVector.h> -#include <functors/tnlFunctionType.h> - -template< typename Real > -class tnlBlobFunctionBase -{ - public: - - typedef Real RealType; - - bool setup( const tnlParameterContainer& parameters, - const tnlString& prefix = "" ); - - protected: - - RealType height; -}; - -template< int Dimensions, - typename Real > -class tnlBlobFunction -{ -}; - -template< typename Real > -class tnlBlobFunction< 1, Real > : public tnlBlobFunctionBase< Real > -{ - public: - - enum { Dimensions = 1 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlBlobFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlBlobFunction< 2, Real > : public tnlBlobFunctionBase< Real > -{ - public: - - enum { Dimensions = 2 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlBlobFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlBlobFunction< 3, Real > : public tnlBlobFunctionBase< Real > -{ - public: - - enum { Dimensions = 3 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlBlobFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< int Dimensions, - typename Real > -ostream& operator << ( ostream& str, const tnlBlobFunction< Dimensions, Real >& f ) -{ - str << "Level-set pseudo square function."; - return str; -} - -template< int FunctionDimensions, - typename Real > -class tnlFunctionType< tnlBlobFunction< FunctionDimensions, Real > > -{ - public: - - enum { Type = tnlAnalyticFunction }; -}; - - -#include <functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h> - - -#endif /* TNLBLOBFUNCTION_H_ */ diff --git a/src/functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h~ b/src/functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h~ deleted file mode 100644 index 6e05320396a2f903146eb82e44730ca8c2a349b7..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/level_set_functions/tnlBlobFunction_impl.h~ +++ /dev/null @@ -1,147 +0,0 @@ -/*************************************************************************** - 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 TNLBLOBFUNCTION_IMPL_H_ -#define TNLBLOBFUNCTION_IMPL_H_ - -#include <functions/initial_conditions/level_set_functions/tnlBlobFunction.h> - -template< typename Real > -bool -tnlBlobFunctionBase< Real >:: -setup( const tnlParameterContainer& parameters, - const tnlString& prefix ) -{ - this->height = parameters.getParameter< double >( prefix + "height" ); - - return true; -} - - -/*** - * 1D - */ - -template< typename Real > -tnlString -tnlBlobFunction< 1, Real >::getType() -{ - return "tnlBlobFunction< 1, " + ::getType< Real >() + tnlString( " >" ); -} - -template< typename Real > -tnlBlobFunction< 1, Real >::tnlBlobFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlBlobFunction< 1, Real >::getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - if( YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 ) - return 0.0; - return 0.0; -} - -/**** - * 2D - */ - -template< typename Real > -tnlString -tnlBlobFunction< 2, Real >::getType() -{ - return tnlString( "tnlBlobFunction< 2, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlBlobFunction< 2, Real >::tnlBlobFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlBlobFunction< 2, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - if( ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 && YDiffOrder == 0 ) - return x * x + y * y - this->height - sin( cos ( 2 * x + y ) * sin ( 2 * x + y ) ); - return 0.0; -} - -/**** - * 3D - */ - -template< typename Real > -tnlString -tnlBlobFunction< 3, Real >::getType() -{ - return tnlString( "tnlBlobFunction< 3, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlBlobFunction< 3, Real >::tnlBlobFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlBlobFunction< 3, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - const RealType& z = v.z(); - if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) - return 0.0; - return 0.0; -} - - -#endif /* TNLBLOBFUNCTION_IMPL_H_ */ diff --git a/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h~ b/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h~ deleted file mode 100644 index 5c2350e9bbbbd2cd01834d99ffc4589b85b21913..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h~ +++ /dev/null @@ -1,160 +0,0 @@ -/*************************************************************************** - 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 TNLPSEUDOSQUAREFUNCTION_H_ -#define TNLPSEUDOSQUAREFUNCTION_H_ - -#include <config/tnlParameterContainer.h> -#include <core/vectors/tnlStaticVector.h> -#include <functors/tnlFunctionType.h> - -template< typename Real > -class tnlPseudoSquareFunctionBase -{ - public: - - typedef Real RealType; - - bool setup( const tnlParameterContainer& parameters, - const tnlString& prefix = "" ); - - protected: - - RealType height; -}; - -template< int Dimensions, - typename Real > -class tnlPseudoSquareFunction -{ -}; - -template< typename Real > -class tnlPseudoSquareFunction< 1, Real > : public tnlPseudoSquareFunctionBase< Real > -{ - public: - - enum { Dimensions = 1 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlPseudoSquareFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlPseudoSquareFunction< 2, Real > : public tnlPseudoSquareFunctionBase< Real > -{ - public: - - enum { Dimensions = 2 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlPseudoSquareFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlPseudoSquareFunction< 3, Real > : public tnlPseudoSquareFunctionBase< Real > -{ - public: - - enum { Dimensions = 3 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlPseudoSquareFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< int Dimensions, - typename Real > -ostream& operator << ( ostream& str, const tnlPseudoSquareFunction< Dimensions, Real >& f ) -{ - str << "Level-set pseudo square function."; - return str; -} - -template< int FunctionDimensions, - typename Real > -class tnlFunctionType< tnlPseudoSquareFunction< FunctionDimensions, Real > > -{ - public: - - enum { Type = tnlAnalyticFunction }; -}; - - -#include <functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h> - - -#endif /* TNLPSEUDOSQUAREFUNCTION_H_ */ diff --git a/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h~ b/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h~ deleted file mode 100644 index 7fb79c33ca0d36b38daf76c49cfbda89a9878b42..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction_impl.h~ +++ /dev/null @@ -1,147 +0,0 @@ -/*************************************************************************** - 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 TNLPSEUDOSQUAREFUNCTION_IMPL_H_ -#define TNLPSEUDOSQUAREFUNCTION_IMPL_H_ - -#include <functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h> - -template< typename Real > -bool -tnlPseudoSquareFunctionBase< Real >:: -setup( const tnlParameterContainer& parameters, - const tnlString& prefix ) -{ - this->height = parameters.getParameter< double >( prefix + "height" ); - - return true; -} - - -/*** - * 1D - */ - -template< typename Real > -tnlString -tnlPseudoSquareFunction< 1, Real >::getType() -{ - return "tnlPseudoSquareFunction< 1, " + ::getType< Real >() + tnlString( " >" ); -} - -template< typename Real > -tnlPseudoSquareFunction< 1, Real >::tnlPseudoSquareFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlPseudoSquareFunction< 1, Real >::getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - if( YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 ) - return 0.0; - return 0.0; -} - -/**** - * 2D - */ - -template< typename Real > -tnlString -tnlPseudoSquareFunction< 2, Real >::getType() -{ - return tnlString( "tnlPseudoSquareFunction< 2, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlPseudoSquareFunction< 2, Real >::tnlPseudoSquareFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlPseudoSquareFunction< 2, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - if( ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 && YDiffOrder == 0 ) - return x * x + y * y - this->height - cos( 2 * x * y ) * cos( 2 * x * y ); - return 0.0; -} - -/**** - * 3D - */ - -template< typename Real > -tnlString -tnlPseudoSquareFunction< 3, Real >::getType() -{ - return tnlString( "tnlPseudoSquareFunction< 3, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlPseudoSquareFunction< 3, Real >::tnlPseudoSquareFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlPseudoSquareFunction< 3, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - const RealType& z = v.z(); - if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) - return 0.0; - return 0.0; -} - - -#endif /* TNLPSEUDOSQUAREFUNCTION_IMPL_H_ */ diff --git a/src/functions/initial_conditions/tnlCylinderFunction.h~ b/src/functions/initial_conditions/tnlCylinderFunction.h~ deleted file mode 100644 index ce90d3f447ebc63929ca07dbdd0c03193d159a8d..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/tnlCylinderFunction.h~ +++ /dev/null @@ -1,164 +0,0 @@ -/*************************************************************************** - 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 TNLCYLINDERFUNCTION_H_ -#define TNLCYLINDERFUNCTION_H_ - -#include <config/tnlParameterContainer.h> -#include <core/vectors/tnlStaticVector.h> -#include <functors/tnlFunctionType.h> - -template< typename Real > -class tnlCylinderFunctionBase -{ - public: - - typedef Real RealType; - - bool setup( const tnlParameterContainer& parameters, - const tnlString& prefix = "" ); - - void setDiameter( const RealType& sigma ); - - const RealType& getDiameter() const; - - protected: - - RealType diameter; -}; - -template< int Dimensions, - typename Real > -class tnlCylinderFunction -{ -}; - -template< typename Real > -class tnlCylinderFunction< 1, Real > : public tnlCylinderFunctionBase< Real > -{ - public: - - enum { Dimensions = 1 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlCylinderFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlCylinderFunction< 2, Real > : public tnlCylinderFunctionBase< Real > -{ - public: - - enum { Dimensions = 2 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlCylinderFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlCylinderFunction< 3, Real > : public tnlCylinderFunctionBase< Real > -{ - public: - - enum { Dimensions = 3 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlCylinderFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< int Dimensions, - typename Real > -ostream& operator << ( ostream& str, const tnlCylinderFunction< Dimensions, Real >& f ) -{ - str << "Cylinder function."; - return str; -} - -template< int FunctionDimensions, - typename Real > -class tnlFunctionType< tnlCylinderFunction< FunctionDimensions, Real > > -{ - public: - - enum { Type = tnlAnalyticFunction }; -}; - - -#include <functions/initial_conditions/tnlCylinderFunction_impl.h> - - -#endif /* TNLEXPBUMPFUNCTION_H_ */ diff --git a/src/functions/initial_conditions/tnlCylinderFunction_impl.h~ b/src/functions/initial_conditions/tnlCylinderFunction_impl.h~ deleted file mode 100644 index 90c250ad33356cabe14f004e60aeb771256c1612..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/tnlCylinderFunction_impl.h~ +++ /dev/null @@ -1,157 +0,0 @@ -/*************************************************************************** - 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 TNLCYLINDERFUNCTION_IMPL_H_ -#define TNLCYLINDERFUNCTION_IMPL_H_ - -#include <functions/initial_conditions/tnlCylinderFunction.h> - -template< typename Real > -bool -tnlCylinderFunctionBase< Real >:: -setup( const tnlParameterContainer& parameters, - const tnlString& prefix ) -{ - this->diameter = parameters.getParameter< double >( prefix + "diameter" ); - return true; -} - -template< typename Real > -void tnlCylinderFunctionBase< Real >::setDiameter( const Real& sigma ) -{ - this->diameter = diameter; -} - -template< typename Real > -const Real& tnlCylinderFunctionBase< Real >::getDiameter() const -{ - return this->diameter; -} - -/*** - * 1D - */ - -template< typename Real > -tnlString -tnlCylinderFunction< 1, Real >::getType() -{ - return "tnlCylinderFunction< 1, " + ::getType< Real >() + tnlString( " >" ); -} - -template< typename Real > -tnlCylinderFunction< 1, Real >::tnlCylinderFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlCylinderFunction< 1, Real >::getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - if( YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 ) - return ( ( x*x - this->diameter ) < 0 ) - ( ( x*x - this->diameter ) > 0 ) + 1; - return 0.0; -} - -/**** - * 2D - */ - -template< typename Real > -tnlString -tnlCylinderFunction< 2, Real >::getType() -{ - return tnlString( "tnlCylinderFunction< 2, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlCylinderFunction< 2, Real >::tnlCylinderFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlCylinderFunction< 2, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - if( ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 && YDiffOrder == 0 ) - return ( ( x*x + y*y - this->diameter ) < 0 ) - ( ( x*x + y*y - this->diameter ) > 0 ) + 1; - return 0.0; -} - -/**** - * 3D - */ - -template< typename Real > -tnlString -tnlCylinderFunction< 3, Real >::getType() -{ - return tnlString( "tnlCylinderFunction< 3, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlCylinderFunction< 3, Real >::tnlCylinderFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlCylinderFunction< 3, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - const RealType& z = v.z(); - if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) - return ( ( x*x + y*y + z*z - this->diameter ) < 0 ) - ( ( x*x + y*y + z*z - this->diameter ) > 0 ) + 1; - return 0.0; -} - - -#endif /* TNLCYLINDERFUNCTION_IMPL_H_ */ diff --git a/src/functions/initial_conditions/tnlFlowerpotFunction.h~ b/src/functions/initial_conditions/tnlFlowerpotFunction.h~ deleted file mode 100644 index 04fc344a6d61112bb15b6b807edc90ed60871de6..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/tnlFlowerpotFunction.h~ +++ /dev/null @@ -1,164 +0,0 @@ -/*************************************************************************** - 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 TNLFLOWERPOTFUNCTION_H_ -#define TNLFLOWERPOTFUNCTION_H_ - -#include <config/tnlParameterContainer.h> -#include <core/vectors/tnlStaticVector.h> -#include <functors/tnlFunctionType.h> - -template< typename Real > -class tnlFlowerpotFunctionBase -{ - public: - - typedef Real RealType; - - bool setup( const tnlParameterContainer& parameters, - const tnlString& prefix = "" ); - - void setDiameter( const RealType& sigma ); - - const RealType& getDiameter() const; - - protected: - - RealType diameter; -}; - -template< int Dimensions, - typename Real > -class tnlFlowerpotFunction -{ -}; - -template< typename Real > -class tnlFlowerpotFunction< 1, Real > : public tnlFlowerpotFunctionBase< Real > -{ - public: - - enum { Dimensions = 1 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlFlowerpotFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlFlowerpotFunction< 2, Real > : public tnlFlowerpotFunctionBase< Real > -{ - public: - - enum { Dimensions = 2 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlFlowerpotFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlFlowerpotFunction< 3, Real > : public tnlFlowerpotFunctionBase< Real > -{ - public: - - enum { Dimensions = 3 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlFlowerpotFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< int Dimensions, - typename Real > -ostream& operator << ( ostream& str, const tnlFlowerpotFunction< Dimensions, Real >& f ) -{ - str << "Flowerpot function."; - return str; -} - -template< int FunctionDimensions, - typename Real > -class tnlFunctionType< tnlFlowerpotFunction< FunctionDimensions, Real > > -{ - public: - - enum { Type = tnlAnalyticFunction }; -}; - - -#include <functions/initial_conditions/tnlFlowerpotFunction_impl.h> - - -#endif /* TNLFLOWERPOTFUNCTION_H_ */ diff --git a/src/functions/initial_conditions/tnlFlowerpotFunction_impl.h~ b/src/functions/initial_conditions/tnlFlowerpotFunction_impl.h~ deleted file mode 100644 index 9cf6f58945596a4246186da0ea6364fc91bf41bc..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/tnlFlowerpotFunction_impl.h~ +++ /dev/null @@ -1,157 +0,0 @@ -/*************************************************************************** - 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 TNLFLOWERPOTFUNCTION_IMPL_H_ -#define TNLFLOWERPOTFUNCTION_IMPL_H_ - -#include <functions/initial_conditions/tnlFlowerpotFunction.h> - -template< typename Real > -bool -tnlFlowerpotFunctionBase< Real >:: -setup( const tnlParameterContainer& parameters, - const tnlString& prefix ) -{ - this->diameter = parameters.getParameter< double >( prefix + "diameter" ); - return true; -} - -template< typename Real > -void tnlFlowerpotFunctionBase< Real >::setDiameter( const Real& sigma ) -{ - this->diameter = diameter; -} - -template< typename Real > -const Real& tnlFlowerpotFunctionBase< Real >::getDiameter() const -{ - return this->diameter; -} - -/*** - * 1D - */ - -template< typename Real > -tnlString -tnlFlowerpotFunction< 1, Real >::getType() -{ - return "tnlFlowerpotFunction< 1, " + ::getType< Real >() + tnlString( " >" ); -} - -template< typename Real > -tnlFlowerpotFunction< 1, Real >::tnlFlowerpotFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlFlowerpotFunction< 1, Real >::getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - if( YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 ) - return sin( M_PI * tanh( 5 * ( x * x - this->diameter ) ) ); - return 0.0; -} - -/**** - * 2D - */ - -template< typename Real > -tnlString -tnlFlowerpotFunction< 2, Real >::getType() -{ - return tnlString( "tnlFlowerpotFunction< 2, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlFlowerpotFunction< 2, Real >::tnlFlowerpotFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlFlowerpotFunction< 2, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - if( ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 && YDiffOrder == 0 ) - return sin( M_PI * tanh( 5 * ( x * x + y * y - this->diameter ) ) ); - return 0.0; -} - -/**** - * 3D - */ - -template< typename Real > -tnlString -tnlFlowerpotFunction< 3, Real >::getType() -{ - return tnlString( "tnlFlowerpotFunction< 3, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlFlowerpotFunction< 3, Real >::tnlFlowerpotFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlFlowerpotFunction< 3, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - const RealType& z = v.z(); - if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) - return sin( M_PI * tanh( 5 * ( x * x + y * y + z * z - 0.25 ) ) ); - return 0.0; -} - - -#endif /* TNLFLOWERPOTFUNCTION_IMPL_H_ */ diff --git a/src/functions/initial_conditions/tnlTwinsFunction.h~ b/src/functions/initial_conditions/tnlTwinsFunction.h~ deleted file mode 100644 index e91c1f0e998689a657417f96d7907cb50d7c9716..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/tnlTwinsFunction.h~ +++ /dev/null @@ -1,156 +0,0 @@ -/*************************************************************************** - 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 TNLTWINSFUNCTION_H_ -#define TNLTWINSFUNCTION_H_ - -#include <config/tnlParameterContainer.h> -#include <core/vectors/tnlStaticVector.h> -#include <functors/tnlFunctionType.h> - -template< typename Real > -class tnlTwinsFunctionBase -{ - public: - - typedef Real RealType; - - bool setup( const tnlParameterContainer& parameters, - const tnlString& prefix = "" ); -}; - -template< int Dimensions, - typename Real > -class tnlTwinsFunction -{ -}; - -template< typename Real > -class tnlTwinsFunction< 1, Real > : public tnlTwinsFunctionBase< Real > -{ - public: - - enum { Dimensions = 1 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlTwinsFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlTwinsFunction< 2, Real > : public tnlTwinsFunctionBase< Real > -{ - public: - - enum { Dimensions = 2 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlTwinsFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< typename Real > -class tnlTwinsFunction< 3, Real > : public tnlTwinsFunctionBase< Real > -{ - public: - - enum { Dimensions = 3 }; - typedef Real RealType; - typedef tnlStaticVector< Dimensions, Real > VertexType; - - static tnlString getType(); - - tnlTwinsFunction(); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > -#endif -#ifdef HAVE_CUDA - __device__ __host__ -#endif - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -}; - -template< int Dimensions, - typename Real > -ostream& operator << ( ostream& str, const tnlTwinsFunction< Dimensions, Real >& f ) -{ - str << "Twins function."; - return str; -} - -template< int FunctionDimensions, - typename Real > -class tnlFunctionType< tnlTwinsFunction< FunctionDimensions, Real > > -{ - public: - - enum { Type = tnlAnalyticFunction }; -}; - - -#include <functions/initial_conditions/tnlTwinsFunction_impl.h> - - -#endif /* TNLTWINSFUNCTION_H_ */ diff --git a/src/functions/initial_conditions/tnlTwinsFunction_impl.h~ b/src/functions/initial_conditions/tnlTwinsFunction_impl.h~ deleted file mode 100644 index a89dd007fe5ec0fc6665c69a9f2ef2521f1c8dea..0000000000000000000000000000000000000000 --- a/src/functions/initial_conditions/tnlTwinsFunction_impl.h~ +++ /dev/null @@ -1,145 +0,0 @@ -/*************************************************************************** - 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 TNLTWINSFUNCTION_IMPL_H_ -#define TNLTWINSFUNCTION_IMPL_H_ - -#include <functions/initial_conditions/tnlTwinsFunction.h> - -template< typename Real > -bool -tnlTwinsFunctionBase< Real >:: -setup( const tnlParameterContainer& parameters, - const tnlString& prefix ) -{ - return true; -} - - -/*** - * 1D - */ - -template< typename Real > -tnlString -tnlTwinsFunction< 1, Real >::getType() -{ - return "tnlTwinsFunction< 1, " + ::getType< Real >() + tnlString( " >" ); -} - -template< typename Real > -tnlTwinsFunction< 1, Real >::tnlTwinsFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlTwinsFunction< 1, Real >::getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - if( YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 ) - return 0.0; - return 0.0; -} - -/**** - * 2D - */ - -template< typename Real > -tnlString -tnlTwinsFunction< 2, Real >::getType() -{ - return tnlString( "tnlTwinsFunction< 2, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlTwinsFunction< 2, Real >::tnlTwinsFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlTwinsFunction< 2, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - if( ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 && YDiffOrder == 0 ) - return -0.5 * sin( M_PI * x) * sin( M_PI * x) * ( 1 - ( y - 2 ) * ( y - 2 ) ) * ( 1 - tanh ( 10 * ( sqrt( x * x + y * y ) - 0.6 ) ) ); - return 0.0; -} - -/**** - * 3D - */ - -template< typename Real > -tnlString -tnlTwinsFunction< 3, Real >::getType() -{ - return tnlString( "tnlTwinsFunction< 3, " ) + ::getType< Real >() + " >"; -} - -template< typename Real > -tnlTwinsFunction< 3, Real >::tnlTwinsFunction() -{ -} - -template< typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -#ifdef HAVE_CUDA - __device__ __host__ -#endif -Real -tnlTwinsFunction< 3, Real >:: -getValue( const Vertex& v, - const Real& time ) const -{ - const RealType& x = v.x(); - const RealType& y = v.y(); - const RealType& z = v.z(); - if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) - return 0.0; - return 0.0; -} - - -#endif /* TNLTWINSFUNCTION_IMPL_H_ */ diff --git a/src/functions/tnlSDFParaboloid.h b/src/functions/tnlParaboloid.h similarity index 86% rename from src/functions/tnlSDFParaboloid.h rename to src/functions/tnlParaboloid.h index c39a770308ef4eba88deaebf6023a2c7e22c7244..c29648f65d613b2691fd89235bf3e3bb4aeaee8e 100644 --- a/src/functions/tnlSDFParaboloid.h +++ b/src/functions/tnlParaboloid.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlSDFParaboloid.h - description + tnlParaboloid.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik @@ -15,8 +15,7 @@ * * ***************************************************************************/ -#ifndef TNLSDFPARABOLOID_H_ -#define TNLSDFPARABOLOID_H_ +#pragma once #include <config/tnlParameterContainer.h> #include <core/vectors/tnlStaticVector.h> @@ -24,11 +23,11 @@ template< int dimensions, typename Real = double > -class tnlSDFParaboloidBase : public tnlDomain< dimensions, SpaceDomain > +class tnlParaboloidBase : public tnlDomain< dimensions, SpaceDomain > { public: - tnlSDFParaboloidBase(); + tnlParaboloidBase(); bool setup( const tnlParameterContainer& parameters, const tnlString& prefix = "" ); @@ -59,12 +58,12 @@ class tnlSDFParaboloidBase : public tnlDomain< dimensions, SpaceDomain > }; template< int Dimensions, typename Real > -class tnlSDFParaboloid +class tnlParaboloid { }; template< typename Real > -class tnlSDFParaboloid< 1, Real > : public tnlSDFParaboloidBase< 1, Real > +class tnlParaboloid< 1, Real > : public tnlParaboloidBase< 1, Real > { public: @@ -91,7 +90,7 @@ class tnlSDFParaboloid< 1, Real > : public tnlSDFParaboloidBase< 1, Real > }; template< typename Real > -class tnlSDFParaboloid< 2, Real > : public tnlSDFParaboloidBase< 2, Real > +class tnlParaboloid< 2, Real > : public tnlParaboloidBase< 2, Real > { public: @@ -118,7 +117,7 @@ class tnlSDFParaboloid< 2, Real > : public tnlSDFParaboloidBase< 2, Real > }; template< typename Real > -class tnlSDFParaboloid< 3, Real > : public tnlSDFParaboloidBase< 3, Real > +class tnlParaboloid< 3, Real > : public tnlParaboloidBase< 3, Real > { public: @@ -148,14 +147,12 @@ class tnlSDFParaboloid< 3, Real > : public tnlSDFParaboloidBase< 3, Real > template< int Dimensions, typename Real > -ostream& operator << ( ostream& str, const tnlSDFParaboloid< Dimensions, Real >& f ) +ostream& operator << ( ostream& str, const tnlParaboloid< Dimensions, Real >& f ) { str << "SDF Paraboloid function: amplitude = " << f.getCoefficient() << " offset = " << f.getOffset(); return str; } -#include <functions/tnlSDFParaboloid_impl.h> - -#endif /* TNLSDFPARABOLOID_H_ */ +#include <functions/tnlParaboloid_impl.h> diff --git a/src/functions/tnlSDFParaboloidSDF.h b/src/functions/tnlParaboloidSDF.h similarity index 85% rename from src/functions/tnlSDFParaboloidSDF.h rename to src/functions/tnlParaboloidSDF.h index 37b0411077d7214fd6d4d46638b0443a5cf80279..f9984486347b20f07498bded02f367a55d7cbcc5 100644 --- a/src/functions/tnlSDFParaboloidSDF.h +++ b/src/functions/tnlParaboloidSDF.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlSDFParaboloidSDFSDF.h - description + tnlParaboloidSDF.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik @@ -15,8 +15,7 @@ * * ***************************************************************************/ -#ifndef TNLSDFPARABOLOIDSDF_H_ -#define TNLSDFPARABOLOIDSDF_H_ +#pragma once #include <config/tnlParameterContainer.h> #include <core/vectors/tnlStaticVector.h> @@ -24,11 +23,11 @@ template< int dimensions, typename Real = double > -class tnlSDFParaboloidSDFBase : public tnlDomain< dimensions, SpaceDomain > +class tnlParaboloidSDFBase : public tnlDomain< dimensions, SpaceDomain > { public: - tnlSDFParaboloidSDFBase(); + tnlParaboloidSDFBase(); bool setup( const tnlParameterContainer& parameters, const tnlString& prefix = "" ); @@ -59,12 +58,12 @@ class tnlSDFParaboloidSDFBase : public tnlDomain< dimensions, SpaceDomain > }; template< int Dimensions, typename Real > -class tnlSDFParaboloidSDF +class tnlParaboloidSDF { }; template< typename Real > -class tnlSDFParaboloidSDF< 1, Real > : public tnlSDFParaboloidSDFBase< 1, Real > +class tnlParaboloidSDF< 1, Real > : public tnlParaboloidSDFBase< 1, Real > { public: @@ -91,7 +90,7 @@ class tnlSDFParaboloidSDF< 1, Real > : public tnlSDFParaboloidSDFBase< 1, Real > }; template< typename Real > -class tnlSDFParaboloidSDF< 2, Real > : public tnlSDFParaboloidSDFBase< 2, Real > +class tnlParaboloidSDF< 2, Real > : public tnlParaboloidSDFBase< 2, Real > { public: @@ -118,7 +117,7 @@ class tnlSDFParaboloidSDF< 2, Real > : public tnlSDFParaboloidSDFBase< 2, Real > }; template< typename Real > -class tnlSDFParaboloidSDF< 3, Real > : public tnlSDFParaboloidSDFBase< 3, Real > +class tnlParaboloidSDF< 3, Real > : public tnlParaboloidSDFBase< 3, Real > { public: @@ -148,15 +147,12 @@ class tnlSDFParaboloidSDF< 3, Real > : public tnlSDFParaboloidSDFBase< 3, Real > template< int Dimensions, typename Real > -ostream& operator << ( ostream& str, const tnlSDFParaboloidSDF< Dimensions, Real >& f ) +ostream& operator << ( ostream& str, const tnlParaboloidSDF< Dimensions, Real >& f ) { str << "SDF Paraboloid SDF function: amplitude = " << f.getCoefficient() << " offset = " << f.getOffset(); return str; } -#include <functions/tnlSDFParaboloidSDF_impl.h> - - -#endif /* TNLSDFPARABOLOIDSDF_H_ */ +#include <functions/tnlParaboloidSDF_impl.h> diff --git a/src/functions/tnlSDFParaboloidSDF_impl.h b/src/functions/tnlParaboloidSDF_impl.h similarity index 75% rename from src/functions/tnlSDFParaboloidSDF_impl.h rename to src/functions/tnlParaboloidSDF_impl.h index c7572ed5127df55c9294289ab7b203b022e3d649..63ebc4386bd591ae50a18fe8d376d3f74f935db1 100644 --- a/src/functions/tnlSDFParaboloidSDF_impl.h +++ b/src/functions/tnlParaboloidSDF_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlSDFParaboloidSDFSDF_impl.h - description + tnlParaboloidSDFSDF_impl.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik @@ -15,20 +15,19 @@ * * ***************************************************************************/ -#ifndef TNLSDFPARABOLOIDSDF_IMPL_H_ -#define TNLSDFPARABOLOIDSDF_IMPL_H_ +#pragma once -#include <functions/tnlSDFParaboloidSDF.h> +#include <functions/tnlParaboloidSDF.h> template< int dimensions, typename Real > -tnlSDFParaboloidSDFBase< dimensions, Real >::tnlSDFParaboloidSDFBase() +tnlParaboloidSDFBase< dimensions, Real >::tnlParaboloidSDFBase() : xCentre( 0 ), yCentre( 0 ), zCentre( 0 ), coefficient( 1 ), offset ( 0 ) { } template< int dimensions, typename Real > -bool tnlSDFParaboloidSDFBase< dimensions, Real >::setup( const tnlParameterContainer& parameters, +bool tnlParaboloidSDFBase< dimensions, Real >::setup( const tnlParameterContainer& parameters, const tnlString& prefix) { this->xCentre = parameters.getParameter< double >( "x-centre" ); @@ -41,60 +40,60 @@ bool tnlSDFParaboloidSDFBase< dimensions, Real >::setup( const tnlParameterConta } template< int dimensions, typename Real > -void tnlSDFParaboloidSDFBase< dimensions, Real >::setXCentre( const Real& xCentre ) +void tnlParaboloidSDFBase< dimensions, Real >::setXCentre( const Real& xCentre ) { this->xCentre = xCentre; } template< int dimensions, typename Real > -Real tnlSDFParaboloidSDFBase< dimensions, Real >::getXCentre() const +Real tnlParaboloidSDFBase< dimensions, Real >::getXCentre() const { return this->xCentre; } template< int dimensions, typename Real > -void tnlSDFParaboloidSDFBase< dimensions, Real >::setYCentre( const Real& yCentre ) +void tnlParaboloidSDFBase< dimensions, Real >::setYCentre( const Real& yCentre ) { this->yCentre = yCentre; } template< int dimensions, typename Real > -Real tnlSDFParaboloidSDFBase< dimensions, Real >::getYCentre() const +Real tnlParaboloidSDFBase< dimensions, Real >::getYCentre() const { return this->yCentre; } template< int dimensions, typename Real > -void tnlSDFParaboloidSDFBase< dimensions, Real >::setZCentre( const Real& zCentre ) +void tnlParaboloidSDFBase< dimensions, Real >::setZCentre( const Real& zCentre ) { this->zCentre = zCentre; } template< int dimensions, typename Real > -Real tnlSDFParaboloidSDFBase< dimensions, Real >::getZCentre() const +Real tnlParaboloidSDFBase< dimensions, Real >::getZCentre() const { return this->zCentre; } template< int dimensions, typename Real > -void tnlSDFParaboloidSDFBase< dimensions, Real >::setCoefficient( const Real& amplitude ) +void tnlParaboloidSDFBase< dimensions, Real >::setCoefficient( const Real& amplitude ) { this->coefficient = coefficient; } template< int dimensions, typename Real > -Real tnlSDFParaboloidSDFBase< dimensions, Real >::getCoefficient() const +Real tnlParaboloidSDFBase< dimensions, Real >::getCoefficient() const { return this->coefficient; } template< int dimensions, typename Real > -void tnlSDFParaboloidSDFBase< dimensions, Real >::setOffset( const Real& offset ) +void tnlParaboloidSDFBase< dimensions, Real >::setOffset( const Real& offset ) { this->offset = offset; } template< int dimensions, typename Real > -Real tnlSDFParaboloidSDFBase< dimensions, Real >::getOffset() const +Real tnlParaboloidSDFBase< dimensions, Real >::getOffset() const { return this->offset; } @@ -105,7 +104,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSDFParaboloidSDF< 1, Real >:: +tnlParaboloidSDF< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -126,7 +125,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSDFParaboloidSDF< 2, Real >:: +tnlParaboloidSDF< 2, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -146,7 +145,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSDFParaboloidSDF< 3, Real >:: +tnlParaboloidSDF< 3, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -161,5 +160,3 @@ getPartialDerivative( const VertexType& v, } return 0.0; } - -#endif /* TNLSDFPARABOLOIDSDF_IMPL_H_ */ diff --git a/src/functions/tnlSDFParaboloid_impl.h b/src/functions/tnlParaboloid_impl.h similarity index 80% rename from src/functions/tnlSDFParaboloid_impl.h rename to src/functions/tnlParaboloid_impl.h index 3a4a59b5bc37b4f5ba1b95fea9c083ab07088053..ae4debbaff5ba572e65f2e89a64e7aec5bc2e69b 100644 --- a/src/functions/tnlSDFParaboloid_impl.h +++ b/src/functions/tnlParaboloid_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlSDFParaboloid_impl.h - description + tnlParaboloid_impl.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik @@ -15,20 +15,19 @@ * * ***************************************************************************/ -#ifndef TNLSDFPARABOLOID_IMPL_H_ -#define TNLSDFPARABOLOID_IMPL_H_ +#pragma once -#include <functions/tnlSDFParaboloid.h> +#include <functions/tnlParaboloid.h> template< int dimensions, typename Real > -tnlSDFParaboloidBase< dimensions, Real >::tnlSDFParaboloidBase() +tnlParaboloidBase< dimensions, Real >::tnlParaboloidBase() : xCentre( 0 ), yCentre( 0 ), zCentre( 0 ), coefficient( 1 ), offset ( 0 ) { } template< int dimensions, typename Real > -bool tnlSDFParaboloidBase< dimensions, Real >::setup( const tnlParameterContainer& parameters, +bool tnlParaboloidBase< dimensions, Real >::setup( const tnlParameterContainer& parameters, const tnlString& prefix) { this->xCentre = parameters.getParameter< double >( "x-centre" ); @@ -41,60 +40,60 @@ bool tnlSDFParaboloidBase< dimensions, Real >::setup( const tnlParameterContaine } template< int dimensions, typename Real > -void tnlSDFParaboloidBase< dimensions, Real >::setXCentre( const Real& xCentre ) +void tnlParaboloidBase< dimensions, Real >::setXCentre( const Real& xCentre ) { this->xCentre = xCentre; } template< int dimensions, typename Real > -Real tnlSDFParaboloidBase< dimensions, Real >::getXCentre() const +Real tnlParaboloidBase< dimensions, Real >::getXCentre() const { return this->xCentre; } template< int dimensions, typename Real > -void tnlSDFParaboloidBase< dimensions, Real >::setYCentre( const Real& yCentre ) +void tnlParaboloidBase< dimensions, Real >::setYCentre( const Real& yCentre ) { this->yCentre = yCentre; } template< int dimensions, typename Real > -Real tnlSDFParaboloidBase< dimensions, Real >::getYCentre() const +Real tnlParaboloidBase< dimensions, Real >::getYCentre() const { return this->yCentre; } template< int dimensions, typename Real > -void tnlSDFParaboloidBase< dimensions, Real >::setZCentre( const Real& zCentre ) +void tnlParaboloidBase< dimensions, Real >::setZCentre( const Real& zCentre ) { this->zCentre = zCentre; } template< int dimensions, typename Real > -Real tnlSDFParaboloidBase< dimensions, Real >::getZCentre() const +Real tnlParaboloidBase< dimensions, Real >::getZCentre() const { return this->zCentre; } template< int dimensions, typename Real > -void tnlSDFParaboloidBase< dimensions, Real >::setCoefficient( const Real& amplitude ) +void tnlParaboloidBase< dimensions, Real >::setCoefficient( const Real& amplitude ) { this->coefficient = coefficient; } template< int dimensions, typename Real > -Real tnlSDFParaboloidBase< dimensions, Real >::getCoefficient() const +Real tnlParaboloidBase< dimensions, Real >::getCoefficient() const { return this->coefficient; } template< int dimensions, typename Real > -void tnlSDFParaboloidBase< dimensions, Real >::setOffset( const Real& offset ) +void tnlParaboloidBase< dimensions, Real >::setOffset( const Real& offset ) { this->offset = offset; } template< int dimensions, typename Real > -Real tnlSDFParaboloidBase< dimensions, Real >::getOffset() const +Real tnlParaboloidBase< dimensions, Real >::getOffset() const { return this->offset; } @@ -105,7 +104,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSDFParaboloid< 1, Real >:: +tnlParaboloid< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -126,7 +125,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSDFParaboloid< 2, Real >:: +tnlParaboloid< 2, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -156,7 +155,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSDFParaboloid< 3, Real >:: +tnlParaboloid< 3, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -183,5 +182,3 @@ getPartialDerivative( const VertexType& v, return 2.0 * this->coefficient; return 0.0; } - -#endif /* TNLSDFPARABOLOID_IMPL_H_ */ diff --git a/src/functions/tnlSinBumpsFunction.h b/src/functions/tnlSinBumpsFunction.h index 68878e10cd8d83eeeb4e1e9a1723595f1a971d56..19c8137033b6ca446df73f7dd1107597ac5c05ae 100644 --- a/src/functions/tnlSinBumpsFunction.h +++ b/src/functions/tnlSinBumpsFunction.h @@ -15,8 +15,11 @@ * * ***************************************************************************/ -#ifndef TNLSINBUMPSFUNCTION_H_ -#define TNLSINBUMPSFUNCTION_H_ +/**** + * Tomas Sobotik + */ + +#pragma once #include <config/tnlParameterContainer.h> #include <core/vectors/tnlStaticVector.h> @@ -26,7 +29,7 @@ template< typename Vertex > class tnlSinBumpsFunctionBase : public tnlDomain< Vertex::size, SpaceDomain > { public: - + typedef Vertex VertexType; typedef typename Vertex::RealType RealType; enum { Dimensions = VertexType::size }; @@ -43,11 +46,15 @@ class tnlSinBumpsFunctionBase : public tnlDomain< Vertex::size, SpaceDomain > const VertexType& getPhase() const; + void setWavesNumber( const VertexType& wavesNumber ); + + const VertexType& getWavesNumber() const; + protected: RealType amplitude; - VertexType waveLength, phase; + VertexType waveLength, phase, wavesNumber; }; template< int Dimensions, typename Real > @@ -59,10 +66,9 @@ template< typename Real > class tnlSinBumpsFunction< 1, Real > : public tnlSinBumpsFunctionBase< tnlStaticVector< 1, Real > > { public: - - typedef Real RealType; - typedef tnlStaticVector< 1, RealType > VertexType; + typedef Real RealType; + typedef tnlStaticVector< 1, RealType > VertexType; tnlSinBumpsFunction(); @@ -81,11 +87,10 @@ class tnlSinBumpsFunction< 1, Real > : public tnlSinBumpsFunctionBase< tnlStati __cuda_callable__ RealType getPartialDerivative( const VertexType& v, const Real& time = 0.0 ) const; - - __cuda_callable__ - RealType operator()( const VertexType& v, - const Real& time = 0.0 ) const; - + + __cuda_callable__ + RealType operator()( const VertexType& v, + const Real& time = 0.0 ) const; }; template< typename Real > @@ -95,7 +100,6 @@ class tnlSinBumpsFunction< 2, Real > : public tnlSinBumpsFunctionBase< tnlStatic typedef Real RealType; typedef tnlStaticVector< 2, RealType > VertexType; - tnlSinBumpsFunction(); @@ -164,6 +168,3 @@ ostream& operator << ( ostream& str, const tnlSinBumpsFunction< Dimensions, Real } #include <functions/tnlSinBumpsFunction_impl.h> - - -#endif /* TNLSINBUMPSFUNCTION_H_ */ diff --git a/src/functions/tnlSDFSinBumpsFunctionSDF.h b/src/functions/tnlSinBumpsFunctionSDF.h similarity index 82% rename from src/functions/tnlSDFSinBumpsFunctionSDF.h rename to src/functions/tnlSinBumpsFunctionSDF.h index de9421889503feb09c1b97aec92a13839c096663..b30771cd722ab8856065645ce1b17f5291d369a0 100644 --- a/src/functions/tnlSDFSinBumpsFunctionSDF.h +++ b/src/functions/tnlSinBumpsFunctionSDF.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlSDFSinBumpsFunctionSDFSDF.h - description + tnlSinBumpsFunctionSDFSDF.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik @@ -15,15 +15,14 @@ * * ***************************************************************************/ -#ifndef TNLSDFSINBUMPSFUNCTIONSDF_H_ -#define TNLSDFSINBUMPSFUNCTIONSDF_H_ +#pragma once #include <config/tnlParameterContainer.h> #include <core/vectors/tnlStaticVector.h> #include <functions/tnlDomain.h> template< typename Vertex > -class tnlSDFSinBumpsFunctionSDFBase : public tnlDomain< Vertex::size, SpaceDomain > +class tnlSinBumpsFunctionSDFBase : public tnlDomain< Vertex::size, SpaceDomain > { public: @@ -55,12 +54,12 @@ class tnlSDFSinBumpsFunctionSDFBase : public tnlDomain< Vertex::size, SpaceDomai }; template< int Dimensions, typename Real > -class tnlSDFSinBumpsFunctionSDF +class tnlSinBumpsFunctionSDF { }; template< typename Real > -class tnlSDFSinBumpsFunctionSDF< 1, Real > : public tnlSDFSinBumpsFunctionSDFBase< tnlStaticVector< 1, Real > > +class tnlSinBumpsFunctionSDF< 1, Real > : public tnlSinBumpsFunctionSDFBase< tnlStaticVector< 1, Real > > { public: @@ -68,7 +67,7 @@ class tnlSDFSinBumpsFunctionSDF< 1, Real > : public tnlSDFSinBumpsFunctionSDFBa typedef tnlStaticVector< 1, RealType > VertexType; - tnlSDFSinBumpsFunctionSDF(); + tnlSinBumpsFunctionSDF(); bool setup( const tnlParameterContainer& parameters, const tnlString& prefix = "" ); @@ -93,7 +92,7 @@ class tnlSDFSinBumpsFunctionSDF< 1, Real > : public tnlSDFSinBumpsFunctionSDFBa }; template< typename Real > -class tnlSDFSinBumpsFunctionSDF< 2, Real > : public tnlSDFSinBumpsFunctionSDFBase< tnlStaticVector< 2, Real > > +class tnlSinBumpsFunctionSDF< 2, Real > : public tnlSinBumpsFunctionSDFBase< tnlStaticVector< 2, Real > > { public: @@ -101,7 +100,7 @@ class tnlSDFSinBumpsFunctionSDF< 2, Real > : public tnlSDFSinBumpsFunctionSDFBas typedef tnlStaticVector< 2, RealType > VertexType; - tnlSDFSinBumpsFunctionSDF(); + tnlSinBumpsFunctionSDF(); bool setup( const tnlParameterContainer& parameters, const tnlString& prefix = "" ); @@ -126,14 +125,14 @@ class tnlSDFSinBumpsFunctionSDF< 2, Real > : public tnlSDFSinBumpsFunctionSDFBas }; template< typename Real > -class tnlSDFSinBumpsFunctionSDF< 3, Real > : public tnlSDFSinBumpsFunctionSDFBase< tnlStaticVector< 3, Real > > +class tnlSinBumpsFunctionSDF< 3, Real > : public tnlSinBumpsFunctionSDFBase< tnlStaticVector< 3, Real > > { public: typedef Real RealType; typedef tnlStaticVector< 3, RealType > VertexType; - tnlSDFSinBumpsFunctionSDF(); + tnlSinBumpsFunctionSDF(); bool setup( const tnlParameterContainer& parameters, const tnlString& prefix = "" ); @@ -159,7 +158,7 @@ class tnlSDFSinBumpsFunctionSDF< 3, Real > : public tnlSDFSinBumpsFunctionSDFBas template< int Dimensions, typename Real > -ostream& operator << ( ostream& str, const tnlSDFSinBumpsFunctionSDF< Dimensions, Real >& f ) +ostream& operator << ( ostream& str, const tnlSinBumpsFunctionSDF< Dimensions, Real >& f ) { str << "SDF Sin Bumps SDF. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength() @@ -167,6 +166,4 @@ ostream& operator << ( ostream& str, const tnlSDFSinBumpsFunctionSDF< Dimensions return str; } -#include <functions/tnlSDFSinBumpsFunctionSDF_impl.h> - -#endif /* TNLSDFSINBUMPSFUNCTIONSDF_H_ */ +#include <functions/tnlSinBumpsFunctionSDF_impl.h> diff --git a/src/functions/tnlSDFSinBumpsFunctionSDF_impl.h b/src/functions/tnlSinBumpsFunctionSDF_impl.h similarity index 74% rename from src/functions/tnlSDFSinBumpsFunctionSDF_impl.h rename to src/functions/tnlSinBumpsFunctionSDF_impl.h index f246ac4a95b6958554907e90e8f038ce78a1bc96..1d689f98b1ff6fab8f3242bcf1347bfc4fcb6ee2 100644 --- a/src/functions/tnlSDFSinBumpsFunctionSDF_impl.h +++ b/src/functions/tnlSinBumpsFunctionSDF_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - tnlSDFSinBumpsFunctionSDFSDF_impl.h - description + tnlSinBumpsFunctionSDFSDF_impl.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik @@ -15,43 +15,42 @@ * * ***************************************************************************/ -#ifndef TNLSDFSINBUMPSFUNCTIONSDF_IMPL_H_ -#define TNLSDFSINBUMPSFUNCTIONSDF_IMPL_H_ +#pragma once -#include <functions/tnlSDFSinBumpsFunctionSDF.h> +#include <functions/tnlSinBumpsFunctionSDF.h> template< typename Vertex > -void tnlSDFSinBumpsFunctionSDFBase< Vertex >::setWaveLength( const Vertex& waveLength ) +void tnlSinBumpsFunctionSDFBase< Vertex >::setWaveLength( const Vertex& waveLength ) { this->waveLength = waveLength; } template< typename Vertex > -const Vertex& tnlSDFSinBumpsFunctionSDFBase< Vertex >::getWaveLength() const +const Vertex& tnlSinBumpsFunctionSDFBase< Vertex >::getWaveLength() const { return this->waveLength; } template< typename Vertex > -void tnlSDFSinBumpsFunctionSDFBase< Vertex >::setAmplitude( const typename Vertex::RealType& amplitude ) +void tnlSinBumpsFunctionSDFBase< Vertex >::setAmplitude( const typename Vertex::RealType& amplitude ) { this->amplitude = amplitude; } template< typename Vertex > -const typename Vertex::RealType& tnlSDFSinBumpsFunctionSDFBase< Vertex >::getAmplitude() const +const typename Vertex::RealType& tnlSinBumpsFunctionSDFBase< Vertex >::getAmplitude() const { return this->amplitude; } template< typename Vertex > -void tnlSDFSinBumpsFunctionSDFBase< Vertex >::setPhase( const Vertex& phase ) +void tnlSinBumpsFunctionSDFBase< Vertex >::setPhase( const Vertex& phase ) { this->phase = phase; } template< typename Vertex > -const Vertex& tnlSDFSinBumpsFunctionSDFBase< Vertex >::getPhase() const +const Vertex& tnlSinBumpsFunctionSDFBase< Vertex >::getPhase() const { return this->phase; } @@ -61,12 +60,12 @@ const Vertex& tnlSDFSinBumpsFunctionSDFBase< Vertex >::getPhase() const */ template< typename Real > -tnlSDFSinBumpsFunctionSDF< 1, Real >::tnlSDFSinBumpsFunctionSDF() +tnlSinBumpsFunctionSDF< 1, Real >::tnlSinBumpsFunctionSDF() { } template< typename Real > -bool tnlSDFSinBumpsFunctionSDF< 1, Real >::setup( const tnlParameterContainer& parameters, +bool tnlSinBumpsFunctionSDF< 1, Real >::setup( const tnlParameterContainer& parameters, const tnlString& prefix) { this->amplitude = parameters.getParameter< double >( prefix+"amplitude" ); @@ -85,23 +84,23 @@ template< typename Real > int ZDiffOrder > __cuda_callable__ Real -tnlSDFSinBumpsFunctionSDF< 1, Real >:: +tnlSinBumpsFunctionSDF< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { - const RealType& x = v.x(); - RealType xp = sqrt(x*x) + Sign(x)*(this->phase.x())*(this->waveLength.x())/(2.0*M_PI); - if (xp > this->wavesNumber.x()*this->waveLength.x() && this->wavesNumber.x() != 0.0 ) - return 0.0; - if( YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - if( XDiffOrder == 0 ) - return Sign(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) - *(xp- round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) - *Sign(sin(this-> phase.x() + 2.0 * M_PI * x / this->waveLength.x())); - if( XDiffOrder == 1 ) - return 1.0; - return 0.0; + const RealType& x = v.x(); + RealType xp = fabs( x ) + Sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0*M_PI ); + if( this->wavesNumber.x() != 0.0 && xp > this->wavesNumber.x() * this->waveLength.x() ) + return 0.0; + if( YDiffOrder != 0 || ZDiffOrder != 0 ) + return 0.0; + if( XDiffOrder == 0 ) + return Sign( xp - round( (2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 ) + * ( xp- round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) + * Sign(sin(this-> phase.x() + 2.0 * M_PI * x / this->waveLength.x())); + if( XDiffOrder == 1 ) + return 1.0; + return 0.0; } /**** @@ -109,12 +108,12 @@ getPartialDerivative( const VertexType& v, */ template< typename Real > -tnlSDFSinBumpsFunctionSDF< 2, Real >::tnlSDFSinBumpsFunctionSDF() +tnlSinBumpsFunctionSDF< 2, Real >::tnlSinBumpsFunctionSDF() { } template< typename Real > -bool tnlSDFSinBumpsFunctionSDF< 2, Real >::setup( const tnlParameterContainer& parameters, +bool tnlSinBumpsFunctionSDF< 2, Real >::setup( const tnlParameterContainer& parameters, const tnlString& prefix ) { this->amplitude = parameters.getParameter< double >( prefix+"amplitude" ); @@ -138,16 +137,16 @@ template< typename Real > int ZDiffOrder > __cuda_callable__ Real -tnlSDFSinBumpsFunctionSDF< 2, Real >:: +tnlSinBumpsFunctionSDF< 2, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { const RealType& x = v.x(); const RealType& y = v.y(); - RealType xp = sqrt(x*x) + Sign(x)*(this->phase.x())*(this->waveLength.x())/(2.0*M_PI); - RealType yp = sqrt(y*y) + Sign(y)*(this->phase.y())*(this->waveLength.y())/(2.0*M_PI); - if ( (xp > this->wavesNumber.x()*this->waveLength.x() && this->wavesNumber.x() != 0.0 ) || - (yp > this->wavesNumber.y()*this->waveLength.y() && this->wavesNumber.y() != 0.0 ) ) + RealType xp = sqrt(x*x) + Sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); + RealType yp = sqrt(y*y) + Sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); + if( ( xp > this->wavesNumber.x()*this->waveLength.x() && this->wavesNumber.x() != 0.0 ) || + ( yp > this->wavesNumber.y()*this->waveLength.y() && this->wavesNumber.y() != 0.0 ) ) return 0.0; const RealType sx = Sign(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) *(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0); @@ -171,12 +170,12 @@ getPartialDerivative( const VertexType& v, */ template< typename Real > -tnlSDFSinBumpsFunctionSDF< 3, Real >::tnlSDFSinBumpsFunctionSDF() +tnlSinBumpsFunctionSDF< 3, Real >::tnlSinBumpsFunctionSDF() { } template< typename Real > -bool tnlSDFSinBumpsFunctionSDF< 3, Real >::setup( const tnlParameterContainer& parameters, +bool tnlSinBumpsFunctionSDF< 3, Real >::setup( const tnlParameterContainer& parameters, const tnlString& prefix ) { this->amplitude = parameters.getParameter< double >( prefix+"amplitude" ); @@ -205,7 +204,7 @@ template< typename Real > int ZDiffOrder > __cuda_callable__ Real -tnlSDFSinBumpsFunctionSDF< 3, Real >:: +tnlSinBumpsFunctionSDF< 3, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -235,10 +234,8 @@ getPartialDerivative( const VertexType& v, if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) { return sxyz * Sign( sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) - * sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) + * sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() ) ); } return 0.0; } - -#endif /* TNLSDFSINBUMPSFUNCTIONSDF_IMPL_H_ */ diff --git a/src/functions/tnlSinBumpsFunction_impl.h b/src/functions/tnlSinBumpsFunction_impl.h index 34497733472727517d5a6a2aea8900727d3253d8..6fad9b633c73ce3524766aa50b3854644d56127b 100644 --- a/src/functions/tnlSinBumpsFunction_impl.h +++ b/src/functions/tnlSinBumpsFunction_impl.h @@ -15,8 +15,11 @@ * * ***************************************************************************/ -#ifndef TNLSINBUMPSFUNCTION_IMPL_H_ -#define TNLSINBUMPSFUNCTION_IMPL_H_ +/**** + * Tomas Sobotik + */ + +#pragma once #include <functions/tnlSinBumpsFunction.h> @@ -56,10 +59,21 @@ const Vertex& tnlSinBumpsFunctionBase< Vertex >::getPhase() const return this->phase; } +template< typename Vertex > +void tnlSinBumpsFunctionBase< Vertex >::setWavesNumber( const Vertex& wavesNumber ) +{ + this->wavesNumber = wavesNumber; +} + +template< typename Vertex > +const Vertex& tnlSinBumpsFunctionBase< Vertex >::getWavesNumber() const +{ + return this->wavesNumber; +} + /*** * 1D */ - template< typename Real > tnlSinBumpsFunction< 1, Real >::tnlSinBumpsFunction() { @@ -72,6 +86,7 @@ bool tnlSinBumpsFunction< 1, Real >::setup( const tnlParameterContainer& paramet this->amplitude = parameters.getParameter< double >( prefix + "amplitude" ); this->waveLength.x() = parameters.getParameter< double >( prefix + "wave-length-x" ); this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" ); + this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) ); return true; } @@ -86,9 +101,14 @@ tnlSinBumpsFunction< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { - const RealType& x = v.x(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; + + const RealType& x = v.x(); + const RealType xp = fabs( x ) + Sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); + if( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() ) + return 0.0; + if( XDiffOrder == 0 ) return this->amplitude * sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ); if( XDiffOrder == 1 ) @@ -112,7 +132,6 @@ operator()( const VertexType& v, /**** * 2D */ - template< typename Real > tnlSinBumpsFunction< 2, Real >::tnlSinBumpsFunction() { @@ -127,10 +146,11 @@ bool tnlSinBumpsFunction< 2, Real >::setup( const tnlParameterContainer& paramet this->waveLength.y() = parameters.getParameter< double >( prefix + "wave-length-y" ); this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" ); this->phase.y() = parameters.getParameter< double >( prefix + "phase-y" ); + this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) ); + this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix+"waves-number-y" ) ); return true; } - template< typename Real > template< int XDiffOrder, int YDiffOrder, @@ -141,10 +161,18 @@ tnlSinBumpsFunction< 2, Real>:: getPartialDerivative( const VertexType& v, const Real& time ) const { + if( ZDiffOrder != 0 ) + return 0.0; + const RealType& x = v.x(); const RealType& y = v.y(); - if( ZDiffOrder != 0 ) + const RealType xp = fabs( x ) + Sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); + const RealType yp = fabs( y ) + Sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); + //std::cerr << "this->wavesNumber.x() = " << this->wavesNumber.x() << "fabs( x ) = " << fabs( x ) << " 2.0*M_PI * this->waveLength.x() * this->wavesNumber.x() = " << 2.0*M_PI * this->waveLength.x() * this->wavesNumber.x() << std::endl; + if( ( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() ) || + ( this->wavesNumber.y() != 0.0 && yp > this->waveLength.y() * this->wavesNumber.y() ) ) return 0.0; + if( XDiffOrder == 0 && YDiffOrder == 0 ) return this->amplitude * sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * @@ -175,7 +203,6 @@ operator()( const VertexType& v, /**** * 3D */ - template< typename Real > tnlSinBumpsFunction< 3, Real >::tnlSinBumpsFunction() { @@ -192,10 +219,12 @@ bool tnlSinBumpsFunction< 3, Real >::setup( const tnlParameterContainer& paramet this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" ); this->phase.y() = parameters.getParameter< double >( prefix + "phase-y" ); this->phase.z() = parameters.getParameter< double >( prefix + "phase-z" ); + this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) ); + this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix+"waves-number-y" ) ); + this->wavesNumber.z() = ceil( parameters.getParameter< double >( prefix+"waves-number-z" ) ); return true; } - template< typename Real > template< int XDiffOrder, int YDiffOrder, @@ -209,6 +238,16 @@ getPartialDerivative( const VertexType& v, const RealType& x = v.x(); const RealType& y = v.y(); const RealType& z = v.z(); + + const RealType xp = fabs( x ) + Sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); + const RealType yp = fabs( y ) + Sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); + const RealType zp = fabs( z ) + Sign( z ) * this->phase.z() * this->waveLength.z() / (2.0*M_PI); + + if( ( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() ) || + ( this->wavesNumber.y() != 0.0 && yp > this->waveLength.y() * this->wavesNumber.y() ) || + ( this->wavesNumber.z() != 0.0 && zp > this->waveLength.z() * this->wavesNumber.z() ) ) + return 0.0; + if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0) return this->amplitude * sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * @@ -243,7 +282,4 @@ operator()( const VertexType& v, const Real& time ) const { return this->template getPartialDerivative< 0, 0, 0 >( v, time ); -} - - -#endif /* TNLSINBUMPSFUNCTION_IMPL_H_ */ +} \ No newline at end of file diff --git a/src/functions/tnlSinWaveFunction.h b/src/functions/tnlSinWaveFunction.h index a1ea37ea3b557dee3c91e10eccf032160e6021bc..3e118001eb1e0fbab98bd0136212de9df8eb381a 100644 --- a/src/functions/tnlSinWaveFunction.h +++ b/src/functions/tnlSinWaveFunction.h @@ -15,8 +15,11 @@ * * ***************************************************************************/ -#ifndef TNLSINWAVEFUNCTION_H_ -#define TNLSINWAVEFUNCTION_H_ +/**** + * Tomas Sobotik + */ + +#pragma once #include <config/tnlParameterContainer.h> #include <core/vectors/tnlStaticVector.h> @@ -28,26 +31,32 @@ class tnlSinWaveFunctionBase : public tnlDomain< dimensions, SpaceDomain > { public: - tnlSinWaveFunctionBase(); + tnlSinWaveFunctionBase(); + + bool setup( const tnlParameterContainer& parameters, + const tnlString& prefix = "" ); - bool setup( const tnlParameterContainer& parameters, - const tnlString& prefix = "" ); + void setWaveLength( const Real& waveLength ); - void setWaveLength( const Real& waveLength ); + Real getWaveLength() const; - Real getWaveLength() const; + void setAmplitude( const Real& amplitude ); - void setAmplitude( const Real& amplitude ); + Real getAmplitude() const; - Real getAmplitude() const; + void setPhase( const Real& phase ); - void setPhase( const Real& phase ); + Real getPhase() const; - Real getPhase() const; + void setWavesNumber( const Real& wavesNumber ); + + Real getWavesNumber() const; protected: + + bool isInsideWaves( const Real& distance ) const; - Real waveLength, amplitude, phase, wavesNumber; + Real waveLength, amplitude, phase, wavesNumber; }; template< int Dimensions, typename Real > @@ -144,10 +153,10 @@ ostream& operator << ( ostream& str, const tnlSinWaveFunction< Dimensions, Real { str << "Sin Wave. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength() - << " phase = " << f.getPhase(); + << " phase = " << f.getPhase() + << " waves number = " << f.getWavesNumber(); return str; } #include <functions/tnlSinWaveFunction_impl.h> -#endif /* TNLSINWAVEFUNCTION_H_ */ diff --git a/src/functions/tnlSinWaveFunction_impl.h b/src/functions/tnlSinWaveFunction_impl.h index e03d31e95ffe90d9afd8b7029743151ad5d9e918..035f79053b9a86260faa3fb73021381276d56d94 100644 --- a/src/functions/tnlSinWaveFunction_impl.h +++ b/src/functions/tnlSinWaveFunction_impl.h @@ -15,8 +15,7 @@ * * ***************************************************************************/ -#ifndef TNLSINWAVEFUNCTION_IMPL_H_ -#define TNLSINWAVEFUNCTION_IMPL_H_ +#pragma once #include <functions/tnlSinWaveFunction.h> @@ -36,7 +35,7 @@ bool tnlSinWaveFunctionBase< dimensions, Real >::setup( const tnlParameterContai this->waveLength = parameters.getParameter< double >( prefix + "wave-length" ); this->amplitude = parameters.getParameter< double >( prefix + "amplitude" ); this->phase = parameters.getParameter< double >( prefix + "phase" ); - parameters.getParameter< double >( prefix + "waves-number" ); + this->wavesNumber = parameters.getParameter< double >( prefix + "waves-number" ); return true; } @@ -76,7 +75,27 @@ Real tnlSinWaveFunctionBase< dimensions, Real >::getPhase() const return this->phase; } +template< int dimensions, typename Real > +void tnlSinWaveFunctionBase< dimensions, Real >::setWavesNumber( const Real& wavesNumber ) +{ + this->wavesNumber = wavesNumber; +} +template< int dimensions, typename Real > +Real tnlSinWaveFunctionBase< dimensions, Real >::getWavesNumber() const +{ + return this->wavesNumber; +} + +template< int dimensions, typename Real > +bool tnlSinWaveFunctionBase< dimensions, Real >::isInsideWaves( const Real& distance ) const +{ + if( this->wavesNumber == 0.0 || + distance + ( this->phase ) * ( this->waveLength ) / ( 2.0*M_PI ) < ( this->wavesNumber ) * (this->waveLength) ) + return true; + return false; + +} template< typename Real > template< int XDiffOrder, @@ -88,24 +107,43 @@ tnlSinWaveFunction< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { - const RealType& x = v.x(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; + + const RealType& x = v.x(); + const RealType distance = sqrt( x * x ); + if( XDiffOrder == 0 ) { - RealType arg = 2.0 * M_PI * x / this->waveLength; + if( this->isInsideWaves( distance ) ) + return this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ); + else + return distance + this->phase * this->waveLength / ( 2.0*M_PI ) - this->wavesNumber * this->waveLength; + + /*RealType arg = 2.0 * M_PI * x / this->waveLength; if( this->wavesNumber ) { if( tnlAbs( arg ) > this->wavesNumber ) arg = Sign( x ) * this->wavesNumber; } //cout << "arg = " << arg << " amplitude = " << this->amplitude << " -> " << this->amplitude * sin( this->phase + arg ) << endl; - return this->amplitude * sin( this->phase + arg ); + return this->amplitude * sin( this->phase + arg );*/ } if( XDiffOrder == 1 ) - return 2.0 * M_PI / this->waveLength * this->amplitude * cos( this->phase + 2.0 * M_PI * x / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI / this->waveLength * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt(x*x) / this->waveLength ); + else return x / distance; + } if( XDiffOrder == 2 ) - return -4.0 * M_PI * M_PI / ( this->waveLength * this->waveLength ) * this->amplitude * sin( this->phase + 2.0 * M_PI * x / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return -4.0 * M_PI * M_PI / ( this->waveLength * this->waveLength ) * this->amplitude * sin( this->phase + 2.0 * M_PI * x / this->waveLength ); + else + { + tnlAssert( false, ); + } + } return 0.0; } @@ -131,25 +169,64 @@ tnlSinWaveFunction< 2, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { - const RealType& x = v.x(); - const RealType& y = v.y(); if ( ZDiffOrder != 0 ) return 0.0; + + const RealType& x = v.x(); + const RealType& y = v.y(); + const RealType distance = sqrt( x * x + y * y); + if( XDiffOrder == 0 && YDiffOrder == 0) { - return this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ); + if( this->isInsideWaves( distance ) ) + return this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ); + else + return distance + this->phase * this->waveLength / ( 2.0*M_PI ) - this->wavesNumber * this->waveLength; } + + if( XDiffOrder == 1 && YDiffOrder == 0 ) + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI / this->waveLength * this->amplitude * cos( this->phase * 2.0 * M_PI * distance / this->waveLength ) * x / distance; + return x / distance; + } + if( XDiffOrder == 0 && YDiffOrder == 1 ) + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI / this->waveLength * this->amplitude * cos( this->phase * 2.0 * M_PI * distance / this->waveLength ) * y / distance; + return y / distance; + } if( XDiffOrder == 1 && YDiffOrder == 0 ) - return 2.0 * M_PI * x / ( this->waveLength * sqrt( x * x + y * y ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * x / ( this->waveLength * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 2 && YDiffOrder == 0 ) - return 2.0 * M_PI * x * x / ( this->waveLength * sqrt( x * x + y * y ) * sqrt( x * x + y * y ) * sqrt( x * x + y * y ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ) - 4.0 * M_PI * M_PI * x * x / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * x * x / ( this->waveLength * distance * distance * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) - 4.0 * M_PI * M_PI * x * x / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 0 && YDiffOrder == 1 ) - return 2.0 * M_PI * y / ( this->waveLength * sqrt( x * x + y * y ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * y / ( this->waveLength * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 0 && YDiffOrder == 2 ) - return 2.0 * M_PI * y * y / ( this->waveLength * sqrt( x * x + y * y ) * sqrt( x * x + y * y ) * sqrt( x * x + y * y ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ) - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * y * y / ( this->waveLength * distance * distance * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 1 && YDiffOrder == 1 ) - return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ) - - 2.0 * M_PI * this->amplitude * x * y * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y ) / this->waveLength ) / ( this->waveLength * sqrt( (x * x + y * y ) * (x * x + y * y ) * (x * x + y * y ) ) ); + { + if( this->isInsideWaves( distance ) ) + return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ) + - 2.0 * M_PI * this->amplitude * x * y * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) / ( this->waveLength * sqrt( (x * x + y * y ) * (x * x + y * y ) * (x * x + y * y ) ) ); + tnlAssert( false, "TODO: implement this" ); + } return 0.0; } @@ -177,31 +254,69 @@ getPartialDerivative( const VertexType& v, const RealType& x = v.x(); const RealType& y = v.y(); const RealType& z = v.z(); + const RealType distance = sqrt( x * x + y * y + z * z ); if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) { - return this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ); + if( this->isInsideWaves( distance ) ) + return this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ); } if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 0 ) - return 2.0 * M_PI * x / ( this->waveLength * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * x / ( this->waveLength * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ); + return x / distance; + } if( XDiffOrder == 2 && YDiffOrder == 0 && ZDiffOrder == 0 ) - return 2.0 * M_PI * ( y * y + z * z ) / ( this->waveLength * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) - 4.0 * M_PI * M_PI * x * x / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * ( y * y + z * z ) / ( this->waveLength * distance * distance * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) - 4.0 * M_PI * M_PI * x * x / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 0 ) - return 2.0 * M_PI * y / ( this->waveLength * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * y / ( this->waveLength * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ); + return y / distance; + } if( XDiffOrder == 0 && YDiffOrder == 2 && ZDiffOrder == 0 ) - return 2.0 * M_PI * ( x * x + z * z ) / ( this->waveLength * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * ( x * x + z * z ) / ( this->waveLength * distance * distance * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 1 ) - return 2.0 * M_PI * z / ( this->waveLength * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * z / ( this->waveLength * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ); + return z / distance; + } if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 2 ) - return 2.0 * M_PI * ( x * x + y * y ) / ( this->waveLength * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) * sqrt( x * x + y * y + z * z ) ) * this->amplitude * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) - 4.0 * M_PI * M_PI * z * z / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ); + { + if( this->isInsideWaves( distance ) ) + return 2.0 * M_PI * ( x * x + y * y ) / ( this->waveLength * distance * distance * distance ) * this->amplitude * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) - 4.0 * M_PI * M_PI * z * z / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 1 && YDiffOrder == 1 && ZDiffOrder == 0 ) - return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) - - 2.0 * M_PI * this->amplitude * x * y * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength * sqrt( (x * x + y * y + z * z ) * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) ); + { + if( this->isInsideWaves( distance ) ) + return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ) + - 2.0 * M_PI * this->amplitude * x * y * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) / ( this->waveLength * sqrt( (x * x + y * y + z * z ) * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 1 ) - return -4.0 * M_PI * M_PI * x * z / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) - - 2.0 * M_PI * this->amplitude * x * z * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength * sqrt( (x * x + y * y + z * z ) * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) ); + { + if( this->isInsideWaves( distance ) ) + return -4.0 * M_PI * M_PI * x * z / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ) + - 2.0 * M_PI * this->amplitude * x * z * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) / ( this->waveLength * sqrt( (x * x + y * y + z * z ) * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) ); + tnlAssert( false, "TODO: implement this" ); + } if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 1 ) - return -4.0 * M_PI * M_PI * z * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) - - 2.0 * M_PI * this->amplitude * z * y * cos( this->phase + 2.0 * M_PI * sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength * sqrt( (x * x + y * y + z * z ) * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) ); + { + if( this->isInsideWaves( distance ) ) + return -4.0 * M_PI * M_PI * z * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * sin( this->phase + 2.0 * M_PI * distance / this->waveLength ) + - 2.0 * M_PI * this->amplitude * z * y * cos( this->phase + 2.0 * M_PI * distance / this->waveLength ) / ( this->waveLength * sqrt( (x * x + y * y + z * z ) * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) ); + tnlAssert( false, "TODO: implement this" ); + } return 0.0; } @@ -215,5 +330,3 @@ operator()( const VertexType& v, return this->template getPartialDerivative< 0, 0, 0 >( v, time ); } - -#endif /* TNLSINWAVEFUNCTION_IMPL_H_ */ diff --git a/src/functions/tnlTestFunction.h b/src/functions/tnlTestFunction.h index e5a50dfe57288e00f444e1e4ca1da1e62abe5a96..6d8707436f8cf9160d918995ea8d5b4ea3029cd0 100644 --- a/src/functions/tnlTestFunction.h +++ b/src/functions/tnlTestFunction.h @@ -32,6 +32,7 @@ class tnlTestFunction : public tnlDomain< FunctionDimensions, SpaceDomain > protected: enum TestFunctions{ constant, + paraboloid, expBump, sinBumps, sinWave, @@ -40,12 +41,9 @@ class tnlTestFunction : public tnlDomain< FunctionDimensions, SpaceDomain > twins, pseudoSquare, blob, - sdfParaboloid, - sdfSinWave, - sdfSinBumps, - sdfParaboloidSDF, - sdfSinWaveSDF, - sdfSinBumpsSDF }; + paraboloidSDF, + sinWaveSDF, + sinBumpsSDF }; enum TimeDependence { none, linear, diff --git a/src/functions/tnlTestFunction_impl.h b/src/functions/tnlTestFunction_impl.h index 612fd06d188b4d72d77dd0f8d28933a44ef8ac4f..5db093fdd033b31ebf73f4cfa4e7017314a712c5 100644 --- a/src/functions/tnlTestFunction_impl.h +++ b/src/functions/tnlTestFunction_impl.h @@ -20,11 +20,7 @@ #include <core/tnlCuda.h> #include <functions/tnlConstantFunction.h> -#include <functions/tnlExpBumpFunction.h> -#include <functions/tnlSinBumpsFunction.h> -#include <functions/tnlSinWaveFunction.h> - -#include <functions/tnlConstantFunction.h> +#include <functions/tnlParaboloid.h> #include <functions/tnlExpBumpFunction.h> #include <functions/tnlSinBumpsFunction.h> #include <functions/tnlSinWaveFunction.h> @@ -34,6 +30,13 @@ #include <functions/initial_conditions/level_set_functions/tnlBlobFunction.h> #include <functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h> +/**** + * The signed distance test functions + */ +#include <functions/tnlSinBumpsFunctionSDF.h> +#include <functions/tnlSDFSinWaveFunction.h> +#include <functions/tnlParaboloidSDF.h> + template< int FunctionDimensions, typename Real, typename Device > @@ -55,6 +58,7 @@ configSetup( tnlConfigDescription& config, { config.addRequiredEntry< tnlString >( prefix + "test-function", "Testing function." ); config.addEntryEnum( "constant" ); + config.addEntryEnum( "paraboloid" ); config.addEntryEnum( "exp-bump" ); config.addEntryEnum( "sin-wave" ); config.addEntryEnum( "sin-bumps" ); @@ -63,6 +67,10 @@ configSetup( tnlConfigDescription& config, config.addEntryEnum( "twins" ); config.addEntryEnum( "pseudoSquare" ); config.addEntryEnum( "blob" ); + config.addEntryEnum( "paraboloid-sdf" ); + config.addEntryEnum( "sin-wave-sdf" ); + config.addEntryEnum( "sin-bumps-sdf" ); + config.addEntry < double >( prefix + "constant", "Value of the constant function.", 0.0 ); config.addEntry < double >( prefix + "wave-length", "Wave length of the sine based test functions.", 1.0 ); config.addEntry < double >( prefix + "wave-length-x", "Wave length of the sine based test functions.", 1.0 ); @@ -78,8 +86,13 @@ configSetup( tnlConfigDescription& config, config.addEntry < double >( prefix + "waves-number-y", "Cut-off for the sine based test functions.", 0.0 ); config.addEntry < double >( prefix + "waves-number-z", "Cut-off for the sine based test functions.", 0.0 ); config.addEntry < double >( prefix + "sigma", "Sigma for the exp based test functions.", 1.0 ); + config.addEntry < double >( prefix + "offset", "Offset for paraboloids.", 1.0 ); + config.addEntry < double >( prefix + "coefficient", "Coefficient for paraboloids.", 1.0 ); + config.addEntry < double >( prefix + "x-centre", "x-centre for paraboloids.", 0.0 ); + config.addEntry < double >( prefix + "y-centre", "y-centre for paraboloids.", 0.0 ); + config.addEntry < double >( prefix + "z-centre", "z-centre for paraboloids.", 0.0 ); config.addEntry < double >( prefix + "diameter", "Diameter for the cylinder, flowerpot test functions.", 1.0 ); - config.addEntry < double >( prefix + "height", "Height of zero-level-set function for the blob, pseudosquare test functions.", 1.0 ); + config.addEntry < double >( prefix + "height", "Height of zero-level-set function for the blob, pseudosquare test functions.", 1.0 ); config.addEntry < tnlString >( prefix + "time-dependence", "Time dependence of the test function.", "none" ); config.addEntryEnum( "none" ); config.addEntryEnum( "linear" ); @@ -105,11 +118,11 @@ setupFunction( const tnlParameterContainer& parameters, return false; } - if( Device::DeviceType == ( int ) tnlHostDevice ) + if( std::is_same< Device, tnlHost >::value ) { this->function = auxFunction; } - if( Device::DeviceType == ( int ) tnlCudaDevice ) + if( std::is_same< Device, tnlCuda >::value ) { this->function = tnlCuda::passToDevice( *auxFunction ); delete auxFunction; @@ -152,6 +165,12 @@ setup( const tnlParameterContainer& parameters, functionType = constant; return setupFunction< FunctionType >( parameters ); } + if( testFunction == "paraboloid" ) + { + typedef tnlParaboloid< Dimensions, Real > FunctionType; + functionType = paraboloid; + return setupFunction< FunctionType >( parameters ); + } if( testFunction == "exp-bump" ) { typedef tnlExpBumpFunction< Dimensions, Real > FunctionType; @@ -200,6 +219,30 @@ setup( const tnlParameterContainer& parameters, functionType = blob; return setupFunction< FunctionType >( parameters ); } + + /**** + * Signed distance function of some test functions + */ + if( testFunction == "paraboloid-sdf" ) + { + typedef tnlParaboloidSDF< Dimensions, Real > FunctionType; + functionType = paraboloidSDF; + return setupFunction< FunctionType >( parameters ); + } + + if( testFunction == "sin-bumps-sdf" ) + { + typedef tnlSinBumpsFunctionSDF< Dimensions, Real > FunctionType; + functionType = sinBumpsSDF; + return setupFunction< FunctionType >( parameters ); + } + if( testFunction == "sin-wave-sdf" ) + { + typedef tnlSDFSinWaveFunction< Dimensions, Real > FunctionType; + functionType = sinWaveSDF; + return setupFunction< FunctionType >( parameters ); + } + cerr << "Unknown function " << testFunction << endl; return false; } @@ -250,11 +293,20 @@ operator = ( const tnlTestFunction& function ) case blob: this->copyFunction< tnlBlobFunction< FunctionDimensions, Real > >( function.function ); break; + + case paraboloidSDF: + this->copyFunction< tnlParaboloid< FunctionDimensions, Real > >( function.function ); + break; + case sinBumpsSDF: + this->copyFunction< tnlSinBumpsFunctionSDF< FunctionDimensions, Real > >( function.function ); + break; + case sinWaveSDF: + this->copyFunction< tnlSDFSinWaveFunction< FunctionDimensions, Real > >( function.function ); + break; default: tnlAssert( false, ); break; } - } template< int FunctionDimensions, @@ -290,31 +342,44 @@ getPartialDerivative( const VertexType& vertex, { case constant: return scale * ( ( tnlConstantFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + case paraboloid: + return scale * ( ( tnlParaboloid< Dimensions, Real >* ) function )-> + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case expBump: return scale * ( ( tnlExpBumpFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case sinBumps: return scale * ( ( tnlSinBumpsFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case sinWave: return scale * ( ( tnlSinWaveFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case cylinder: return scale * ( ( tnlCylinderFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case flowerpot: return scale * ( ( tnlFlowerpotFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case twins: return scale * ( ( tnlTwinsFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case pseudoSquare: return scale * ( ( tnlPseudoSquareFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case blob: return scale * ( ( tnlBlobFunction< Dimensions, Real >* ) function )-> - template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + + case sinBumpsSDF: + return scale * ( ( tnlSinBumpsFunctionSDF< Dimensions, Real >* ) function )-> + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + case sinWaveSDF: + return scale * ( ( tnlSDFSinWaveFunction< Dimensions, Real >* ) function )-> + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + case paraboloidSDF: + return scale * ( ( tnlParaboloidSDF< Dimensions, Real >* ) function )-> + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); default: return 0.0; } @@ -352,6 +417,9 @@ getTimeDerivative( const VertexType& vertex, case constant: return scale * ( ( tnlConstantFunction< Dimensions, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + case paraboloid: + return scale * ( ( tnlParaboloid< Dimensions, Real >* ) function )-> + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case expBump: return scale * ( ( tnlExpBumpFunction< Dimensions, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); @@ -382,6 +450,17 @@ getTimeDerivative( const VertexType& vertex, return scale * ( ( tnlBlobFunction< Dimensions, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); break; + + + case paraboloidSDF: + return scale * ( ( tnlParaboloidSDF< Dimensions, Real >* ) function )-> + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + case sinBumpsSDF: + return scale * ( ( tnlSinBumpsFunctionSDF< Dimensions, Real >* ) function )-> + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); + case sinWaveSDF: + return scale * ( ( tnlSDFSinWaveFunction< Dimensions, Real >* ) function )-> + getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); default: return 0.0; } @@ -419,6 +498,9 @@ deleteFunctions() case constant: deleteFunction< tnlConstantFunction< Dimensions, Real> >(); break; + case paraboloid: + deleteFunction< tnlParaboloid< Dimensions, Real> >(); + break; case expBump: deleteFunction< tnlExpBumpFunction< Dimensions, Real> >(); break; @@ -443,6 +525,16 @@ deleteFunctions() case blob: deleteFunction< tnlBlobFunction< Dimensions, Real> >(); break; + + case paraboloidSDF: + deleteFunction< tnlParaboloidSDF< Dimensions, Real> >(); + break; + case sinBumpsSDF: + deleteFunction< tnlSinBumpsFunctionSDF< Dimensions, Real> >(); + break; + case sinWaveSDF: + deleteFunction< tnlSDFSinWaveFunction< Dimensions, Real> >(); + break; } } @@ -475,17 +567,17 @@ tnlTestFunction< FunctionDimensions, Real, Device >:: printFunction( ostream& str ) const { FunctionType* f = ( FunctionType* ) this->function; - if( std::is_same< Device, tnlHost >::value ) - { - str << *f; - return str; - } - if( std::is_same< Device, tnlCuda >::value ) + switch( Device::DeviceType ) { - tnlCuda::print( f, str ); - return str; + case tnlHostDevice: + str << *f; + return str; + case tnlCudaDevice: + tnlCuda::print( f, str ); + return str; + default: + return str; } - return str; } template< int FunctionDimensions, @@ -502,6 +594,8 @@ print( ostream& str ) const { case constant: return printFunction< tnlConstantFunction< Dimensions, Real> >( str ); + case paraboloid: + return printFunction< tnlParaboloid< Dimensions, Real> >( str ); case expBump: return printFunction< tnlExpBumpFunction< Dimensions, Real> >( str ); case sinBumps: @@ -518,6 +612,13 @@ print( ostream& str ) const return printFunction< tnlPseudoSquareFunction< Dimensions, Real> >( str ); case blob: return printFunction< tnlBlobFunction< Dimensions, Real> >( str ); + + case paraboloidSDF: + return printFunction< tnlParaboloidSDF< Dimensions, Real> >( str ); + case sinBumpsSDF: + return printFunction< tnlSinBumpsFunctionSDF< Dimensions, Real> >( str ); + case sinWaveSDF: + return printFunction< tnlSDFSinWaveFunction< Dimensions, Real> >( str ); } return str; } diff --git a/src/functions/tnlTestFunction_impl.h~ b/src/functions/tnlTestFunction_impl.h~ deleted file mode 100644 index 9417563c9a6acc7c5258efe79854cfefde20c4c0..0000000000000000000000000000000000000000 --- a/src/functions/tnlTestFunction_impl.h~ +++ /dev/null @@ -1,697 +0,0 @@ -/*************************************************************************** - tnlTestFunction_impl.h - description - ------------------- - begin : Aug 3, 2014 - copyright : (C) 2014 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 TNLTESTFUNCTION_IMPL_H_ -#define TNLTESTFUNCTION_IMPL_H_ - -#include <core/tnlCuda.h> -#include <functions/tnlConstantFunction.h> -#include <functions/tnlExpBumpFunction.h> -#include <functions/tnlSinBumpsFunction.h> -#include <functions/tnlSinWaveFunction.h> - -// This is from origin/mean-curvature -#include <functions/tnlConstantFunction.h> -#include <functions/tnlExpBumpFunction.h> -#include <functions/tnlSinBumpsFunction.h> -#include <functions/tnlSinWaveFunction.h> -#include <functions/initial_conditions/tnlCylinderFunction.h> -#include <functions/initial_conditions/tnlFlowerpotFunction.h> -#include <functions/initial_conditions/tnlTwinsFunction.h> -#include <functions/initial_conditions/level_set_functions/tnlBlobFunction.h> -#include <functions/initial_conditions/level_set_functions/tnlPseudoSquareFunction.h> - -// For hmailton-jacobi -#include <functions/tnlSDFParaboloid.h> -#include <functions/tnlSDFSinBumpsFunction.h> -#include <functions/tnlSDFSinWaveFunction.h> -#include <functions/tnlSDFParaboloidSDF.h> -#include <functions/tnlSDFSinBumpsFunctionSDF.h> -#include <functions/tnlSDFSinWaveFunctionSDF.h> - -template< int FunctionDimensions, - typename Real, - typename Device > -tnlTestFunction< FunctionDimensions, Real, Device >:: -tnlTestFunction() -: function( 0 ), - timeDependence( none ), - timeScale( 1.0 ) -{ -} - -template< int FunctionDimensions, - typename Real, - typename Device > -void -tnlTestFunction< FunctionDimensions, Real, Device >:: -configSetup( tnlConfigDescription& config, - const tnlString& prefix ) -{ - config.addRequiredEntry< tnlString >( prefix + "test-function", "Testing function." ); - config.addEntryEnum( "constant" ); - config.addEntryEnum( "exp-bump" ); - config.addEntryEnum( "sin-wave" ); - config.addEntryEnum( "sin-bumps" ); - config.addEntryEnum( "cylinder" ); - config.addEntryEnum( "flowerpot" ); - config.addEntryEnum( "twins" ); - config.addEntryEnum( "pseudoSquare" ); - config.addEntryEnum( "blob" ); - config.addEntry < double >( prefix + "constant", "Value of the constant function.", 0.0 ); - config.addEntry < double >( prefix + "wave-length", "Wave length of the sine based test functions.", 1.0 ); - config.addEntry < double >( prefix + "wave-length-x", "Wave length of the sine based test functions.", 1.0 ); - config.addEntry < double >( prefix + "wave-length-y", "Wave length of the sine based test functions.", 1.0 ); - config.addEntry < double >( prefix + "wave-length-z", "Wave length of the sine based test functions.", 1.0 ); - config.addEntry < double >( prefix + "phase", "Phase of the sine based test functions.", 0.0 ); - config.addEntry < double >( prefix + "phase-x", "Phase of the sine based test functions.", 0.0 ); - config.addEntry < double >( prefix + "phase-y", "Phase of the sine based test functions.", 0.0 ); - config.addEntry < double >( prefix + "phase-z", "Phase of the sine based test functions.", 0.0 ); - config.addEntry < double >( prefix + "amplitude", "Amplitude length of the sine based test functions.", 1.0 ); - config.addEntry < double >( prefix + "waves-number", "Cut-off for the sine based test functions.", 0.0 ); - config.addEntry < double >( prefix + "waves-number-x", "Cut-off for the sine based test functions.", 0.0 ); - config.addEntry < double >( prefix + "waves-number-y", "Cut-off for the sine based test functions.", 0.0 ); - config.addEntry < double >( prefix + "waves-number-z", "Cut-off for the sine based test functions.", 0.0 ); - config.addEntry < double >( prefix + "sigma", "Sigma for the exp based test functions.", 1.0 ); - config.addEntry < double >( prefix + "offset", "Offset for paraboloids.", 1.0 ); - config.addEntry < double >( prefix + "coefficient", "Coefficient for paraboloids.", 1.0 ); - config.addEntry < double >( prefix + "x-centre", "x-centre for paraboloids.", 0.0 ); - config.addEntry < double >( prefix + "y-centre", "y-centre for paraboloids.", 0.0 ); - config.addEntry < double >( prefix + "z-centre", "z-centre for paraboloids.", 0.0 ); - config.addEntry < double >( prefix + "diameter", "Diameter for the cylinder, flowerpot test functions.", 1.0 ); - config.addEntry < double >( prefix + "height", "Height of zero-level-set function for the blob, pseudosquare test functions.", 1.0 ); - config.addEntry < tnlString >( prefix + "time-dependence", "Time dependence of the test function.", "none" ); - config.addEntryEnum( "none" ); - config.addEntryEnum( "linear" ); - config.addEntryEnum( "quadratic" ); - config.addEntryEnum( "cosine" ); - config.addEntry < double >( prefix + "time-scale", "Time scaling for the time dependency of the test function.", 1.0 ); - -} - -template< int FunctionDimensions, - typename Real, - typename Device > - template< typename FunctionType > -bool -tnlTestFunction< FunctionDimensions, Real, Device >:: -setupFunction( const tnlParameterContainer& parameters, - const tnlString& prefix ) -{ - FunctionType* auxFunction = new FunctionType; - if( ! auxFunction->setup( parameters, prefix ) ) - { - delete auxFunction; - return false; - } - - if( Device::DeviceType == ( int ) tnlHostDevice ) - { - this->function = auxFunction; - } - if( Device::DeviceType == ( int ) tnlCudaDevice ) - { - this->function = tnlCuda::passToDevice( *auxFunction ); - delete auxFunction; - if( ! checkCudaDevice ) - return false; - } - return true; -} - -template< int FunctionDimensions, - typename Real, - typename Device > -bool -tnlTestFunction< FunctionDimensions, Real, Device >:: -setup( const tnlParameterContainer& parameters, - const tnlString& prefix ) -{ - cout << "Test function setup ... " << endl; - const tnlString& timeDependence = - parameters.getParameter< tnlString >( - prefix + - "time-dependence" ); - cout << "Time dependence ... " << timeDependence << endl; - if( timeDependence == "none" ) - this->timeDependence = none; - if( timeDependence == "linear" ) - this->timeDependence = linear; - if( timeDependence == "quadratic" ) - this->timeDependence = quadratic; - if( timeDependence == "cosine" ) - this->timeDependence = cosine; - - this->timeScale = parameters.getParameter< double >( prefix + "time-scale" ); - - const tnlString& testFunction = parameters.getParameter< tnlString >( prefix + "test-function" ); - cout << "Test function ... " << testFunction << endl; - if( testFunction == "constant" ) - { - typedef tnlConstantFunction< Dimensions, Real > FunctionType; - functionType = constant; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "exp-bump" ) - { - typedef tnlExpBumpFunction< Dimensions, Real > FunctionType; - functionType = expBump; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "sin-bumps" ) - { - typedef tnlSinBumpsFunction< Dimensions, Real > FunctionType; - functionType = sinBumps; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "sin-wave" ) - { - typedef tnlSinWaveFunction< Dimensions, Real > FunctionType; - functionType = sinWave; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "cylinder" ) - { - typedef tnlCylinderFunction< Dimensions, Real > FunctionType; - functionType = cylinder; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "flowerpot" ) - { - typedef tnlFlowerpotFunction< Dimensions, Real > FunctionType; - functionType = flowerpot; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "twins" ) - { - typedef tnlTwinsFunction< Dimensions, Real > FunctionType; - functionType = twins; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "pseudoSquare" ) - { - typedef tnlPseudoSquareFunction< Dimensions, Real > FunctionType; - functionType = pseudoSquare; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "blob" ) - { - typedef tnlBlobFunction< Dimensions, Real > FunctionType; - functionType = blob; - return setupFunction< FunctionType >( parameters ); - } - - if( testFunction == "sdf-para" ) - { - typedef tnlSDFParaboloid< Dimensions, Real > FunctionType; - functionType = sdfParaboloid; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "sdf-sin-bumps" ) - { - typedef tnlSDFSinBumpsFunction< Dimensions, Real > FunctionType; - functionType = sdfSinBumps; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "sdf-sin-wave" ) - { - typedef tnlSDFSinWaveFunction< Dimensions, Real > FunctionType; - functionType = sdfSinWave; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "sdf-para-sdf" ) - { - typedef tnlSDFParaboloidSDF< Dimensions, Real > FunctionType; - functionType = sdfParaboloidSDF; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "sdf-sin-bumps-sdf" ) - { - typedef tnlSDFSinBumpsFunctionSDF< Dimensions, Real > FunctionType; - functionType = sdfSinBumpsSDF; - return setupFunction< FunctionType >( parameters ); - } - if( testFunction == "sdf-sin-wave-sdf" ) - { - typedef tnlSDFSinWaveFunctionSDF< Dimensions, Real > FunctionType; - functionType = sdfSinWaveSDF; - return setupFunction< FunctionType >( parameters ); - } - - - cerr << "Unknown function " << testFunction << endl; - return false; -} - -template< int FunctionDimensions, - typename Real, - typename Device > -const tnlTestFunction< FunctionDimensions, Real, Device >& -tnlTestFunction< FunctionDimensions, Real, Device >:: -operator = ( const tnlTestFunction& function ) -{ - /***** - * TODO: if the function is on the device we cannot do the following - */ - abort(); - this->functionType = function.functionType; - this->timeDependence = function.timeDependence; - this->timeScale = function.timeScale; - - this->deleteFunctions(); - - switch( this->functionType ) - { - case constant: - this->copyFunction< tnlConstantFunction< FunctionDimensions, Real > >( function.function ); - break; - case expBump: - this->copyFunction< tnlExpBumpFunction< FunctionDimensions, Real > >( function.function ); - break; - case sinBumps: - this->copyFunction< tnlSinBumpsFunction< FunctionDimensions, Real > >( function.function ); - break; - case sinWave: - this->copyFunction< tnlSinWaveFunction< FunctionDimensions, Real > >( function.function ); - break; - case cylinder: - this->copyFunction< tnlCylinderFunction< FunctionDimensions, Real > >( function.function ); - break; - case flowerpot: - this->copyFunction< tnlFlowerpotFunction< FunctionDimensions, Real > >( function.function ); - break; - case twins: - this->copyFunction< tnlTwinsFunction< FunctionDimensions, Real > >( function.function ); - break; - case pseudoSquare: - this->copyFunction< tnlPseudoSquareFunction< FunctionDimensions, Real > >( function.function ); - break; - case blob: - this->copyFunction< tnlBlobFunction< FunctionDimensions, Real > >( function.function ); - break; - - case sdfParaboloid: - this->copyFunction< tnlSDFParaboloid< FunctionDimensions, Real > >( function.function ); - break; - case sdfSinBumps: - this->copyFunction< tnlSDFSinBumpsFunction< FunctionDimensions, Real > >( function.function ); - break; - case sdfSinWave: - this->copyFunction< tnlSDFSinWaveFunction< FunctionDimensions, Real > >( function.function ); - break; - case sdfParaboloidSDF: - this->copyFunction< tnlSDFParaboloidSDF< FunctionDimensions, Real > >( function.function ); - break; - case sdfSinBumpsSDF: - this->copyFunction< tnlSDFSinBumpsFunctionSDF< FunctionDimensions, Real > >( function.function ); - break; - case sdfSinWaveSDF: - this->copyFunction< tnlSDFSinWaveFunctionSDF< FunctionDimensions, Real > >( function.function ); - break; - default: - tnlAssert( false, ); - break; - } - -} - -template< int FunctionDimensions, - typename Real, - typename Device > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder > -__cuda_callable__ -Real -tnlTestFunction< FunctionDimensions, Real, Device >:: -getPartialDerivative( const VertexType& vertex, - const Real& time ) const -{ - Real scale( 1.0 ); - switch( this->timeDependence ) - { - case none: - break; - case linear: - scale = 1.0 - this->timeScale * time; - break; - case quadratic: - scale = this->timeScale * time; - scale *= scale; - scale = 1.0 - scale; - break; - case cosine: - scale = cos( this->timeScale * time ); - break; - } - switch( functionType ) - { - case constant: - return scale * ( ( tnlConstantFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case expBump: - return scale * ( ( tnlExpBumpFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case sinBumps: - return scale * ( ( tnlSinBumpsFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case sinWave: - return scale * ( ( tnlSinWaveFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case cylinder: - return scale * ( ( tnlCylinderFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case flowerpot: - return scale * ( ( tnlFlowerpotFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case twins: - return scale * ( ( tnlTwinsFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case pseudoSquare: - return scale * ( ( tnlPseudoSquareFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case blob: - return scale * ( ( tnlBlobFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - - case sdfParaboloid: - return scale * ( ( tnlSDFParaboloid< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfSinBumps: - return scale * ( ( tnlSDFSinBumpsFunction< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfSinWave: - return scale * ( ( tnlSDFSinWaveFunction< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfParaboloidSDF: - return scale * ( ( tnlSDFParaboloidSDF< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfSinBumpsSDF: - return scale * ( ( tnlSDFSinBumpsFunctionSDF< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfSinWaveSDF: - return scale * ( ( tnlSDFSinWaveFunctionSDF< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - default: - return 0.0; - } -} - -template< int FunctionDimensions, - typename Real, - typename Device > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder > -__cuda_callable__ -Real -tnlTestFunction< FunctionDimensions, Real, Device >:: -getTimeDerivative( const VertexType& vertex, - const Real& time ) const -{ - Real scale( 0.0 ); - switch( timeDependence ) - { - case none: - break; - case linear: - scale = -this->timeScale; - break; - case quadratic: - scale = -2.0 * this->timeScale * this->timeScale * time; - break; - case cosine: - scale = -this->timeScale * sin( this->timeScale * time ); - break; - } - switch( functionType ) - { - case constant: - return scale * ( ( tnlConstantFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case expBump: - return scale * ( ( tnlExpBumpFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case sinBumps: - return scale * ( ( tnlSinBumpsFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - case sinWave: - return scale * ( ( tnlSinWaveFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - break; - case cylinder: - return scale * ( ( tnlCylinderFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - break; - case flowerpot: - return scale * ( ( tnlFlowerpotFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - break; - case twins: - return scale * ( ( tnlTwinsFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - break; - case pseudoSquare: - return scale * ( ( tnlPseudoSquareFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - break; - case blob: - return scale * ( ( tnlBlobFunction< Dimensions, Real >* ) function )-> - getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); - break; - - - case sdfParaboloid: - return scale * ( ( tnlSDFParaboloid< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfSinBumps: - return scale * ( ( tnlSDFSinBumpsFunction< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfSinWave: - return scale * ( ( tnlSDFSinWaveFunction< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfParaboloidSDF: - return scale * ( ( tnlSDFParaboloidSDF< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfSinBumpsSDF: - return scale * ( ( tnlSDFSinBumpsFunctionSDF< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - case sdfSinWaveSDF: - return scale * ( ( tnlSDFSinWaveFunctionSDF< Dimensions, Real >* ) function )-> - getValue< XDiffOrder, YDiffOrder, ZDiffOrder, Vertex >( vertex, time ); - break; - default: - return 0.0; - } -} - -template< int FunctionDimensions, - typename Real, - typename Device > - template< typename FunctionType > -void -tnlTestFunction< FunctionDimensions, Real, Device >:: -deleteFunction() -{ - if( Device::DeviceType == ( int ) tnlHostDevice ) - { - if( function ) - delete ( FunctionType * ) function; - } - if( Device::DeviceType == ( int ) tnlCudaDevice ) - { - if( function ) - tnlCuda::freeFromDevice( ( FunctionType * ) function ); - } -} - -template< int FunctionDimensions, - typename Real, - typename Device > -void -tnlTestFunction< FunctionDimensions, Real, Device >:: -deleteFunctions() -{ - switch( functionType ) - { - case constant: - deleteFunction< tnlConstantFunction< Dimensions, Real> >(); - break; - case expBump: - deleteFunction< tnlExpBumpFunction< Dimensions, Real> >(); - break; - case sinBumps: - deleteFunction< tnlSinBumpsFunction< Dimensions, Real> >(); - break; - case sinWave: - deleteFunction< tnlSinWaveFunction< Dimensions, Real> >(); - break; - case cylinder: - deleteFunction< tnlCylinderFunction< Dimensions, Real> >(); - break; - case flowerpot: - deleteFunction< tnlFlowerpotFunction< Dimensions, Real> >(); - break; - case twins: - deleteFunction< tnlTwinsFunction< Dimensions, Real> >(); - break; - case pseudoSquare: - deleteFunction< tnlPseudoSquareFunction< Dimensions, Real> >(); - break; - case blob: - deleteFunction< tnlBlobFunction< Dimensions, Real> >(); - break; - } -} - -template< int FunctionDimensions, - typename Real, - typename Device > - template< typename FunctionType > -void -tnlTestFunction< FunctionDimensions, Real, Device >:: -copyFunction( const void* function ) -{ - if( Device::DeviceType == ( int ) tnlHostDevice ) - { - FunctionType* f = new FunctionType; - *f = * ( FunctionType* )function; - } - if( Device::DeviceType == ( int ) tnlCudaDevice ) - { - tnlAssert( false, ); - abort(); - } -} - -template< int FunctionDimensions, - typename Real, - typename Device > - template< typename FunctionType > -ostream& -tnlTestFunction< FunctionDimensions, Real, Device >:: -printFunction( ostream& str ) const -{ - FunctionType* f = ( FunctionType* ) this->function; - switch( Device::DeviceType ) - { - case tnlHostDevice: - str << *f; - return str; - case tnlCudaDevice: - tnlCuda::print( f, str ); - return str; - default: - return str; - } -} - -template< int FunctionDimensions, - typename Real, - typename Device > -ostream& -tnlTestFunction< FunctionDimensions, Real, Device >:: -print( ostream& str ) const -{ - str << " timeDependence = " << this->timeDependence; - str << " functionType = " << this->functionType; - str << " function = " << this->function << "; "; - switch( functionType ) - { - case constant: - return printFunction< tnlConstantFunction< Dimensions, Real> >( str ); - case expBump: - return printFunction< tnlExpBumpFunction< Dimensions, Real> >( str ); - case sinBumps: - return printFunction< tnlSinBumpsFunction< Dimensions, Real> >( str ); - case sinWave: - return printFunction< tnlSinWaveFunction< Dimensions, Real> >( str ); - case cylinder: - return printFunction< tnlCylinderFunction< Dimensions, Real> >( str ); - case flowerpot: - return printFunction< tnlFlowerpotFunction< Dimensions, Real> >( str ); - case twins: - return printFunction< tnlTwinsFunction< Dimensions, Real> >( str ); - case pseudoSquare: - return printFunction< tnlPseudoSquareFunction< Dimensions, Real> >( str ); - case blob: - return printFunction< tnlBlobFunction< Dimensions, Real> >( str ); - } - return str; -} - -template< int FunctionDimensions, - typename Real, - typename Device > -tnlTestFunction< FunctionDimensions, Real, Device >:: -~tnlTestFunction() -{ - deleteFunctions(); -} - - -#ifdef TEMPLATE_EXPLICIT_INSTANTIATION - -#ifdef INSTANTIATE_FLOAT -extern template class tnlTestFunction< 1, float, tnlHost >; -extern template class tnlTestFunction< 2, float, tnlHost >; -extern template class tnlTestFunction< 3, float, tnlHost >; -#endif - -extern template class tnlTestFunction< 1, double, tnlHost >; -extern template class tnlTestFunction< 2, double, tnlHost >; -extern template class tnlTestFunction< 3, double, tnlHost >; - -#ifdef INSTANTIATE_LONG_DOUBLE -extern template class tnlTestFunction< 1, long double, tnlHost >; -extern template class tnlTestFunction< 2, long double, tnlHost >; -extern template class tnlTestFunction< 3, long double, tnlHost >; -#endif - -#ifdef HAVE_CUDA -#ifdef INSTANTIATE_FLOAT -extern template class tnlTestFunction< 1, float, tnlCuda>; -extern template class tnlTestFunction< 2, float, tnlCuda >; -extern template class tnlTestFunction< 3, float, tnlCuda >; -#endif - -extern template class tnlTestFunction< 1, double, tnlCuda >; -extern template class tnlTestFunction< 2, double, tnlCuda >; -extern template class tnlTestFunction< 3, double, tnlCuda >; - -#ifdef INSTANTIATE_LONG_DOUBLE -extern template class tnlTestFunction< 1, long double, tnlCuda >; -extern template class tnlTestFunction< 2, long double, tnlCuda >; -extern template class tnlTestFunction< 3, long double, tnlCuda >; -#endif -#endif - -#endif - - -#endif /* TNLTESTFUNCTION_IMPL_H_ */ diff --git a/src/operators/CMakeLists.txt~ b/src/operators/CMakeLists.txt~ deleted file mode 100755 index 7749f7b0f84bf9ab568e32b589215cb028326e49..0000000000000000000000000000000000000000 --- a/src/operators/CMakeLists.txt~ +++ /dev/null @@ -1,54 +0,0 @@ -ADD_SUBDIRECTORY( diffusion ) -ADD_SUBDIRECTORY( euler ) -ADD_SUBDIRECTORY( interpolants ) -ADD_SUBDIRECTORY( operator-Q ) -ADD_SUBDIRECTORY( operator-curvature ) -#ADD_SUBDIRECTORY( godunov ) -#ADD_SUBDIRECTORY( upwind ) -ADD_SUBDIRECTORY( godunov-eikonal ) -#ADD_SUBDIRECTORY( upwind-eikonal ) - -SET( headers tnlDirichletBoundaryConditions.h - tnlDirichletBoundaryConditions_impl.h - tnlExactFunctionInverseOperator.h - tnlExactIdentityOperator.h - tnlExactOperatorComposition.h - tnlFiniteDifferences.h - tnlFiniteDifferences_impl.h - tnlFunctionInverseOperator.h - tnlIdentityOperator.h - tnlNeumannBoundaryConditions.h - tnlNeumannBoundaryConditions_impl.h - tnlOperatorComposition.h - tnlOperator.h - tnlNeumannReflectionBoundaryConditions.h - tnlNeumannReflectionBoundaryConditions_impl.h )) - -SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/operators ) - -if( BUILD_CUDA) - set( tnl_operators_CUDA__SOURCES - ${tnl_operators_diffusion_CUDA__SOURCES} - ${tnl_operators_gradient_CUDA__SOURCES} - ${tnl_operators_euler_CUDA__SOURCES} -# ${tnl_operators_godunov_CUDA__SOURCES} - ${tnl_operators_godunov-eikonal_CUDA__SOURCES} -# ${tnl_operators_upwind_CUDA__SOURCES} -# ${tnl_operators_upwind-eikonal_CUDA__SOURCES} - ${common_SOURCES} - ${common_SOURCES} - PARENT_SCOPE ) -endif() - -set( tnl_operators_SOURCES - ${tnl_operators_diffusion_SOURCES} - ${tnl_operators_gradient_SOURCES} - ${tnl_operators_euler_SOURCES} -# ${tnl_operators_godunov_SOURCES} - ${tnl_operators_godunov-eikonal_SOURCES} -# ${tnl_operators_upwind_SOURCES} -# ${tnl_operators_upwind-eikonal_SOURCES} - ${common_SOURCES} - PARENT_SCOPE ) - -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/operators ) diff --git a/src/operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator.h~ b/src/operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator.h~ deleted file mode 100644 index 041307fa9a7e284a398ef402020bc02efb0a5e9e..0000000000000000000000000000000000000000 --- a/src/operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator.h~ +++ /dev/null @@ -1,194 +0,0 @@ -#ifndef TNLONESIDEDIFFNONLINEAROPERATOR_H -#define TNLONESIDEDIFFNONLINEAROPERATOR_H - -#include <core/vectors/tnlVector.h> -#include "tnlForwardFiniteDifference.h" -#include "tnlBackwardFiniteDifference.h" -#include <mesh/tnlGrid.h> - -template< typename Mesh, - typename NonlinearDiffusionOperator, - typename OperatorQ, - typename Real = typename Mesh::RealType, - typename Index = typename Mesh::IndexType > -class tnlOneSideDiffNonlinearOperator -{ - -}; - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename OperatorQ > -class tnlOneSideDiffNonlinearOperator< tnlGrid< 1,MeshReal, Device, MeshIndex >, OperatorQ, Real, Index > -{ - public: - - typedef tnlGrid< 1, MeshReal, Device, MeshIndex > MeshType; - typedef typename MeshType::CoordinatesType CoordinatesType; - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef OperatorQ OperatorQType; - - static tnlString getType(); - - template< typename Vector > -#ifdef HAVE_CUDA - __device__ __host__ -#endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time) const; - -#ifdef HAVE_CUDA - __device__ __host__ -#endif - Index getLinearSystemRowLength( const MeshType& mesh, - const IndexType& index, - const CoordinatesType& coordinates ) const - {} - - template< typename Vector, typename MatrixRow > -#ifdef HAVE_CUDA - __device__ __host__ -#endif - void updateLinearSystem( const RealType& time, - const RealType& tau, - const MeshType& mesh, - const IndexType& index, - const CoordinatesType& coordinates, - Vector& u, - Vector& b, - MatrixRow& matrixRow ) const - {} - - - private: - - OperatorQ operatorQ; -}; - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename OperatorQ > -class tnlOneSideDiffNonlinearOperator< tnlGrid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index > -{ - public: - - typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType; - typedef typename MeshType::CoordinatesType CoordinatesType; - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedej OperatorQ OperatorQType: - - - static tnlString getType(); - - template< typename Vector > -#ifdef HAVE_CUDA - __device__ __host__ -#endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time) const; - -#ifdef HAVE_CUDA - __device__ __host__ -#endif - Index getLinearSystemRowLength( const MeshType& mesh, - const IndexType& index, - const CoordinatesType& coordinates ) const - {} - - template< typename Vector, typename MatrixRow > -#ifdef HAVE_CUDA - __device__ __host__ -#endif - void updateLinearSystem( const RealType& time, - const RealType& tau, - const MeshType& mesh, - const IndexType& index, - const CoordinatesType& coordinates, - Vector& u, - Vector& b, - MatrixRow& matrixRow ) const - {} - - private: - - OperatorQ operatorQ; -}; - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename OperatorQ > -class tnlOneSideDiffNonlinearOperator< tnlGrid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index > -{ - public: - - typedef tnlGrid< 3, MeshReal, Device, MeshIndex > MeshType; - typedef typename MeshType::CoordinatesType CoordinatesType; - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedej OperatorQ OperatorQType; - - static tnlString getType(); - - template< typename Vector > -#ifdef HAVE_CUDA - __device__ __host__ -#endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time) const - {} - -#ifdef HAVE_CUDA - __device__ __host__ -#endif - Index getLinearSystemRowLength( const MeshType& mesh, - const IndexType& index, - const CoordinatesType& coordinates ) const - {} - - template< typename Vector, typename MatrixRow > -#ifdef HAVE_CUDA - __device__ __host__ -#endif - void updateLinearSystem( const RealType& time, - const RealType& tau, - const MeshType& mesh, - const IndexType& index, - const CoordinatesType& coordinates, - Vector& u, - Vector& b, - MatrixRow& matrixRow ) const - {} - -}; - - -#include "tnlOneSideDiffNonlinearOperator_impl.h" - - -#endif /* TNLONESIDEDIFFNONLINEAROPERATOR_H */ diff --git a/src/operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator_impl.h~ b/src/operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator_impl.h~ deleted file mode 100644 index 1bbd523ee06371fe7537b096d8c93217a2deae55..0000000000000000000000000000000000000000 --- a/src/operators/diffusion/nonlinear-diffusion-operators/tnlOneSideDiffNonlinearOperator_impl.h~ +++ /dev/null @@ -1,84 +0,0 @@ - -#ifndef TNLONESIDEDIFFNONLINEAROPERATOR_IMPL_H -#define TNLONESIDEDIFFNONLINEAROPERATOR_IMPL_H - -#include "tnlOneSideDiffNonlinearOperator.h" - -#include <mesh/tnlGrid.h> - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename OperatorQ > -tnlString -tnlOneSideDiffNonlinearOperator< tnlGrid< 1, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >:: -getType() -{ - return tnlString( "tnlOneSideDiffNonlinearOperator< " ) + - MeshType::getType() + ", " + - ::getType< Real >() + ", " + - ::getType< Index >() + ", " + - OperatorQ::getType() + " >"; -} - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename OperatorQ > -tnlString -tnlNonlinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >:: -getType() -{ - return tnlString( "tnlOneSideDiffNonlinearOperator< " ) + - MeshType::getType() + ", " + - ::getType< Real >() + ", " + - ::getType< Index >() + ", " + - OperatorQ::getType() + " >"; -} - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename OperatorQ > -template< typename Vector > -#ifdef HAVE_CUDA -__device__ __host__ -#endif -Real -tnlNonlinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >:: -getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const Real& time ) const -{ - return operatorQ.getValueStriped(mesh,cellIndex,u)*((fDifference.getValueX(mesh,cellIndex,u)/operatorQ.getValue(mesh,cellIndex,u) - -bDifference.getValueX(mesh,cellIndex,u)/operatorQ.getValue(mesh,mesh.template getCellNextToCell<-1,0>(cellIndex),u)) - *mesh.getHxInverse()+(fDifference.getValueY(mesh,cellIndex,u)/operatorQ.getValue(mesh,cellIndex,u) - -bDifference.getValueY(mesh,cellIndex,u)/operatorQ.getValue(mesh,mesh.template getCellNextToCell<0,-1>(cellIndex),u))*mesh.getHyInverse()); -} - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename OperatorQ > -tnlString -tnlNonlinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >:: -getType() -{ - return tnlString( "tnlOneSideDiffNonlinearOperator< " ) + - MeshType::getType() + ", " + - ::getType< Real >() + ", " + - ::getType< Index >() + ", " + - OperatorQ::getType() + " >"; -} - -#endif /* TNLONESIDEDIFFNONLINEAROPERATOR_IMPL_H */ diff --git a/src/operators/hamilton-jacobi/godunov-eikonal/CMakeLists.txt~ b/src/operators/hamilton-jacobi/godunov-eikonal/CMakeLists.txt~ deleted file mode 100755 index 6e0c100777d3f531c3b93c13c1eea6c9fda78ec7..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/godunov-eikonal/CMakeLists.txt~ +++ /dev/null @@ -1,20 +0,0 @@ -set( headers godunovEikonal1D_impl.h - godunovEikonal2D_impl.h - godunovEikonal3D_impl.h - parallelGodunovEikonal1D_impl.h - parallelGodunovEikonal2D_impl.h - parallelGodunovEikonal3D_impl.h) - -SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/operators/godunov-eikonal ) - -if( BUILD_CUDA) - set( tnl_implementation_operators_godunov-eikonal_CUDA__SOURCES - ${common_SOURCES} - PARENT_SCOPE ) -endif() - -set( tnl_implementation_operators_godunov-eikonal_SOURCES - ${common_SOURCES} - PARENT_SCOPE ) - -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/operators/godunov-eikonal ) diff --git a/src/operators/hamilton-jacobi/godunov-eikonal/godunovEikonal.h~ b/src/operators/hamilton-jacobi/godunov-eikonal/godunovEikonal.h~ deleted file mode 100644 index 486c7aeeb34520fbe70d926aa0278a696445fca0..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/godunov-eikonal/godunovEikonal.h~ +++ /dev/null @@ -1,209 +0,0 @@ -/*************************************************************************** - godunov.h - description - ------------------- - begin : Jul 8 , 2014 - copyright : (C) 2014 by Tomas Sobotik - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 GODUNOVEIKONAL_H_ -#define GODUNOVEIKONAL_H_ - -#include <matrices/tnlCSRMatrix.h> -#include <solvers/preconditioners/tnlDummyPreconditioner.h> -#include <solvers/tnlSolverMonitor.h> -#include <core/tnlLogger.h> -#include <core/vectors/tnlVector.h> -#include <core/vectors/tnlSharedVector.h> -#include <core/mfilename.h> -#include <mesh/tnlGrid.h> - - -template< typename Mesh, - typename Real, - typename Index > -class godunovEikonalScheme -{ -}; - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class godunovEikonalScheme< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 1, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const RealType eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType h; - - RealType epsilon; - - -}; - - - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class godunovEikonalScheme< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 2, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - - RealType epsilon; - - -}; - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class godunovEikonalScheme< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 3, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - RealType hz; - - RealType epsilon; - - -}; - - - -#include <implementation/operators/godunov-eikonal/godunovEikonal1D_impl.h> -#include <implementation/operators/godunov-eikonal/godunovEikonal2D_impl.h> -#include <implementation/operators/godunov-eikonal/godunovEikonal3D_impl.h> - - -#endif /* GODUNOVEIKONAL_H_ */ diff --git a/src/operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal.h~ b/src/operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal.h~ deleted file mode 100644 index 0834e22080dfd88279e403945db8eeb4b7be8c37..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal.h~ +++ /dev/null @@ -1,212 +0,0 @@ -/*************************************************************************** - godunov.h - description - ------------------- - begin : Dec 1 , 2014 - copyright : (C) 2014 by Tomas Sobotik - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 GODUNOVEIKONAL_H_ -#define GODUNOVEIKONAL_H_ - -#include <matrices/tnlCSRMatrix.h> -#include <solvers/preconditioners/tnlDummyPreconditioner.h> -#include <solvers/tnlSolverMonitor.h> -#include <core/tnlLogger.h> -#include <core/vectors/tnlVector.h> -#include <core/vectors/tnlSharedVector.h> -#include <core/mfilename.h> -#include <mesh/tnlGrid.h> - - -template< typename Mesh, - typename Real, - typename Index > -class parallelGodunovEikonalScheme -{ -}; - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class parallelGodunovEikonalScheme< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 1, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const RealType eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time, - const IndexType boundaryCondition) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType h; - - RealType epsilon; - - -}; - - - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class parallelGodunovEikonalScheme< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 2, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time, - const IndexType boundaryCondition ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - - RealType epsilon; - - -}; - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class parallelGodunovEikonalScheme< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 3, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time, - const IndexType boundaryCondition ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - RealType hz; - - RealType epsilon; - - -}; - - - -#include <implementation/operators/godunov-eikonal/parallelGodunovEikonal1D_impl.h> -#include <implementation/operators/godunov-eikonal/parallelGodunovEikonal2D_impl.h> -#include <implementation/operators/godunov-eikonal/parallelGodunovEikonal3D_impl.h> - - -#endif /* GODUNOVEIKONAL_H_ */ diff --git a/src/operators/hamilton-jacobi/godunov/CMakeLists.txt~ b/src/operators/hamilton-jacobi/godunov/CMakeLists.txt~ deleted file mode 100755 index 74f7510d72329f60305bb366604e72b7201a3ea0..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/godunov/CMakeLists.txt~ +++ /dev/null @@ -1,17 +0,0 @@ -set( headers godunov1D_impl.h - godunov2D_impl.h - godunov3D_impl.h) - -SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/operators/godunov ) - -if( BUILD_CUDA) - set( tnl_implementation_operators_godunov_CUDA__SOURCES - ${common_SOURCES} - PARENT_SCOPE ) -endif() - -set( tnl_implementation_operators_godunov_SOURCES - ${common_SOURCES} - PARENT_SCOPE ) - -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/operators/godunov ) diff --git a/src/operators/hamilton-jacobi/godunov/godunov.h~ b/src/operators/hamilton-jacobi/godunov/godunov.h~ deleted file mode 100644 index 1b890b66a2fc25452d306c44ea01b1ea2c59598b..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/godunov/godunov.h~ +++ /dev/null @@ -1,221 +0,0 @@ -/*************************************************************************** - godunov.h - description - ------------------- - begin : Jul 8 , 2014 - copyright : (C) 2014 by Tomas Sobotik - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 GODUNOV_H_ -#define GODUNOV_H_ - -#include <matrices/tnlCSRMatrix.h> -#include <solvers/preconditioners/tnlDummyPreconditioner.h> -#include <solvers/tnlSolverMonitor.h> -#include <core/tnlLogger.h> -#include <core/vectors/tnlVector.h> -#include <core/vectors/tnlSharedVector.h> -#include <core/mfilename.h> -#include <mesh/tnlGrid.h> - - -template< typename Mesh, - typename Real, - typename Index, - typename Function > -class godunovScheme -{ -}; - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename Function > -class godunovScheme< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index, Function > -{ -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 1, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const RealType eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - Function f; - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType h; - - RealType epsilon; - - -}; - - - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename Function > -class godunovScheme< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index, Function > -{ -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 2, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - Function f; - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - - RealType epsilon; - - -}; - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename Function > -class godunovScheme< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index, Function > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 3, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - Function f; - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - RealType hz; - - RealType epsilon; - -}; - - - -#include <implementation/operators/godunov/godunov1D_impl.h> -#include <implementation/operators/godunov/godunov2D_impl.h> -#include <implementation/operators/godunov/godunov3D_impl.h> - - -#endif /* GODUNOV_H_ */ diff --git a/src/operators/hamilton-jacobi/upwind-eikonal/CMakeLists.txt~ b/src/operators/hamilton-jacobi/upwind-eikonal/CMakeLists.txt~ deleted file mode 100755 index 5e0db4a050a07a5ef147744817fc2c12930f3906..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/upwind-eikonal/CMakeLists.txt~ +++ /dev/null @@ -1,18 +0,0 @@ -set( headers upwindEikonal.h - upwindEikonal1D_impl.h - upwindEikonal2D_impl.h - upwindEikonal3D_impl.h) - -SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/operators/upwind-eikonal ) - -if( BUILD_CUDA) - set( tnl_implementation_operators_upwind_eikonal_CUDA__SOURCES - ${common_SOURCES} - PARENT_SCOPE ) -endif() - -set( tnl_implementation_operators_upwind_eikonal_SOURCES - ${common_SOURCES} - PARENT_SCOPE ) - -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/operators/upwind-eikonal ) diff --git a/src/operators/hamilton-jacobi/upwind-eikonal/upwindEikonal.h~ b/src/operators/hamilton-jacobi/upwind-eikonal/upwindEikonal.h~ deleted file mode 100644 index af1cebda234f84d8f90f33d6cc796f3c43627ca1..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/upwind-eikonal/upwindEikonal.h~ +++ /dev/null @@ -1,207 +0,0 @@ -/*************************************************************************** - upwindEikonal.h - description - ------------------- - begin : Jul 8 , 2014 - copyright : (C) 2014 by Tomas Sobotik - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 UPWINDEIKONAL_H_ -#define UPWINDEIKONAL_H_ - -#include <matrices/tnlCSRMatrix.h> -#include <solvers/preconditioners/tnlDummyPreconditioner.h> -#include <solvers/tnlSolverMonitor.h> -#include <core/tnlLogger.h> -#include <core/vectors/tnlVector.h> -#include <core/vectors/tnlSharedVector.h> -#include <core/mfilename.h> -#include <mesh/tnlGrid.h> - - -template< typename Mesh, - typename Real, - typename Index > -class upwindEikonalScheme -{ -}; - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class upwindEikonalScheme< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 1, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const RealType eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType h; - - RealType epsilon; - - -}; - - - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class upwindEikonalScheme< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 2, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - - RealType epsilon; - - -}; - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index > -class upwindEikonalScheme< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 3, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - RealType hz; - - RealType epsilon; - -}; - - - -#include <implementation/operators/upwind-eikonal/upwindEikonal1D_impl.h> -#include <implementation/operators/upwind-eikonal/upwindEikonal2D_impl.h> -#include <implementation/operators/upwind-eikonal/upwindEikonal3D_impl.h> - - -#endif /* UPWINDEIKONAL_H_ */ diff --git a/src/operators/hamilton-jacobi/upwind/CMakeLists.txt~ b/src/operators/hamilton-jacobi/upwind/CMakeLists.txt~ deleted file mode 100755 index 489bea97449765ac5b324beb258d515b17dbeac9..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/upwind/CMakeLists.txt~ +++ /dev/null @@ -1,17 +0,0 @@ -set( headers upwind1D_impl.h - upwind2D_impl.h - upwind3D_impl.h) - -SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/operators/upwind ) - -if( BUILD_CUDA) - set( tnl_implementation_operators_upwind_CUDA__SOURCES - ${common_SOURCES} - PARENT_SCOPE ) -endif() - -set( tnl_implementation_operators_upwind_SOURCES - ${common_SOURCES} - PARENT_SCOPE ) - -INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/operators/upwind ) diff --git a/src/operators/hamilton-jacobi/upwind/upwind.h~ b/src/operators/hamilton-jacobi/upwind/upwind.h~ deleted file mode 100644 index 93190235ee30a2e246c7b055604464f18e580fe1..0000000000000000000000000000000000000000 --- a/src/operators/hamilton-jacobi/upwind/upwind.h~ +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************************** - upwind.h - description - ------------------- - begin : Jul 8 , 2014 - copyright : (C) 2014 by Tomas Sobotik - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 UPWIND_H_ -#define UPWIND_H_ - -#include <matrices/tnlCSRMatrix.h> -#include <solvers/preconditioners/tnlDummyPreconditioner.h> -#include <solvers/tnlSolverMonitor.h> -#include <core/tnlLogger.h> -#include <core/vectors/tnlVector.h> -#include <core/vectors/tnlSharedVector.h> -#include <core/mfilename.h> -#include <mesh/tnlGrid.h> - - -template< typename Mesh, - typename Real, - typename Index, - typename Function > -class upwindScheme -{ -}; - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename Function > -class upwindScheme< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index, Function > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 1, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const RealType eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - Function f; - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType h; - - RealType epsilon; - - -}; - - - - - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename Function > -class upwindScheme< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index, Function > -{ - -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 2, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - Function f; - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - - RealType epsilon; - - -}; - - -template< typename MeshReal, - typename Device, - typename MeshIndex, - typename Real, - typename Index, - typename Function > -class upwindScheme< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index, Function > -{ -public: - typedef Real RealType; - typedef Device DeviceType; - typedef Index IndexType; - typedef tnlGrid< 3, Real, Device, Index > MeshType; - typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType; - typedef typename MeshType::CoordinatesType CoordinatesType; - - - - static tnlString getType(); - - RealType positivePart(const RealType arg) const; - - RealType negativePart(const RealType arg) const; - - RealType sign(const RealType x, const Real eps) const; - - template< typename Vector > - #ifdef HAVE_CUDA - __device__ __host__ - #endif - Real getValue( const MeshType& mesh, - const IndexType cellIndex, - const CoordinatesType& coordinates, - const Vector& u, - const RealType& time ) const; - - - bool init( const tnlParameterContainer& parameters ); - - -protected: - - Function f; - - MeshType originalMesh; - - DofVectorType dofVector; - - RealType hx; - RealType hy; - RealType hz; - - RealType epsilon; - - -}; - - - -#include <implementation/operators/upwind/upwind1D_impl.h> -#include <implementation/operators/upwind/upwind2D_impl.h> -#include <implementation/operators/upwind/upwind3D_impl.h> - - -#endif /* UPWIND_H_ */ diff --git a/tools/src/tnl-view.cpp b/tools/src/tnl-view.cpp index f697f74fb1334240c9526a4ea652c49d0ccc3208..9073a593d595a51d22b8a47962d3f09ab9ae8822 100644 --- a/tools/src/tnl-view.cpp +++ b/tools/src/tnl-view.cpp @@ -38,7 +38,7 @@ void setupConfig( tnlConfigDescription& config ) config.addEntry < int > ( "output-y-size", "Y size of the output." ); config.addEntry < int > ( "output-z-size", "Z size of the output." ); config.addEntry < double > ( "scale", "Multiply the function by given number.", 1.0 ); - config.addEntry < tnlString > ( "output-format", "Output file format.", "gnuplot" ); + config.addEntry < tnlString > ( "output-format", "Output file format.", "vtk" ); config.addEntryEnum < tnlString > ( "gnuplot" ); config.addEntryEnum < tnlString > ( "vtk" ); config.addEntry < int > ( "verbose", "Set the verbosity of the program.", 1 );