Loading examples/heat-equation/CMakeLists.txt +15 −15 Original line number Diff line number Diff line Loading @@ -2,27 +2,27 @@ set( tnl_heat_equation_SOURCES tnlHeatEquationEocRhs.h tnlRightHandSide_impl.h tnlRightHandSide.h tnlAnalyticSolution_impl.h tnlAnalyticSolution.h tnl-heat-equation.cpp tnl-heat-equation-eoc.cpp heatEquationSolver_impl.h heatEquationSolver.h heatEquationSetter_impl.h heatEquationSetter.h heatEquationEocRhs.h ) heatEquationScheme_impl.h heatEquationScheme.h tnlHeatEquationEocRhs.h ) #ADD_EXECUTABLE(tnl-heat-equation${debugExt} tnl-heat-equation.cpp) #target_link_libraries (tnl-heat-equation${debugExt} tnl${debugExt}-${tnlVersion} ) ADD_EXECUTABLE(tnl-heat-equation${debugExt} tnl-heat-equation.cpp) target_link_libraries (tnl-heat-equation${debugExt} tnl${debugExt}-${tnlVersion} ) ADD_EXECUTABLE(tnl-heat-equation-eoc-test${debugExt} tnl-heat-equation-eoc.cpp) target_link_libraries (tnl-heat-equation-eoc-test${debugExt} tnl${debugExt}-${tnlVersion} ) INSTALL( TARGETS #tnl-heat-equation${debugExt} INSTALL( TARGETS tnl-heat-equation${debugExt} tnl-heat-equation-eoc-test${debugExt} RUNTIME DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) INSTALL( FILES tnl-run-heat-equation-eoc-test INSTALL( FILES ${tnl_heat_equation_SOURCES} Makefile tnl-run-heat-equation-eoc-test tnl-run-heat-equation DESTINATION share/tnl-${tnlVersion}/examples/heat-equation ) examples/heat-equation/Makefile +5 −7 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ TNL_VERSION=0.1 TNL_INSTALL_DIR=${HOME}/local/lib TNL_INCLUDE_DIR=${HOME}/local/include/tnl-${TNL_VERSION} TARGET = heat-equation TARGET = tnl-heat-equation CONFIG_FILE = $(TARGET).cfg.desc INSTALL_DIR = ${HOME}/local CXX = g++ Loading @@ -11,9 +11,10 @@ OMP_FLAGS = -DHAVE_OPENMP -fopenmp CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) -O3 $(OMP_FLAGS) LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 -lgomp SOURCES = main.cpp SOURCES = tnl-heat-equation.cpp CUDA_SOURCES = tnl-heat-equation.cu HEADERS = OBJECTS = main.o OBJECTS = tnl-heat-equation.o DIST = $(SOURCES) Makefile all: $(TARGET) Loading @@ -32,12 +33,9 @@ uninstall: $(TARGET) rm -f $(INSTALL_DIR)/bin/$(TARGET) rm -f $(CONFIG_FILE) $(INSTALL_DIR)/share/tnl-0.1/examples/heat-equation $(TARGET): $(TARGET)-conf.h $(OBJECTS) $(TARGET): $(OBJECTS) $(CXX) -o $(TARGET) $(OBJECTS) $(LD_FLAGS) %.o: %.cpp $(HEADERS) $(CXX) -c -o $@ $(CXX_FLAGS) $< $(TARGET)-conf.h: echo "#define CONFIG_FILE \"${INSTALL_DIR}/share/tnl-0.1/examples/heat-equation/${CONFIG_FILE}\" " > $(TARGET)-conf.h examples/heat-equation/heatEquationSetter.hdeleted 100644 → 0 +0 −67 Original line number Diff line number Diff line /*************************************************************************** simpleProblemSetter.h - description ------------------- begin : Feb 23, 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 SIMPLEPROBLEMTYPESSETTER_H_ #define SIMPLEPROBLEMTYPESSETTER_H_ #include <config/tnlParameterContainer.h> #include <mesh/tnlGrid.h> #include "heatEquationSolver.h" #include <functions/tnlSinWaveFunction.h> #include <functions/tnlExpBumpFunction.h> #include <functions/tnlSinBumpsFunction.h> #include "tnlTimeFunction.h" #include <operators/tnlDirichletBoundaryConditions.h> #include <operators/diffusion/tnlLinearDiffusion.h> #include <operators/tnlNeumannBoundaryConditions.h> #include "tnlZeroRightHandSide.h" #include "tnlRightHandSide.h" template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class heatEquationSetter { public: typedef TimeFunction< MeshType, TimeFunctionBase::TimeIndependent, Real, Index > TimeIndependent; typedef TimeFunction< MeshType, TimeFunctionBase::Linear, Real, Index > Linear; typedef TimeFunction< MeshType, TimeFunctionBase::Quadratic, Real, Index > Quadratic; typedef TimeFunction< MeshType, TimeFunctionBase::Cosinus, Real, Index > Cosinus; //typedef typename MeshType::RealType RealType; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; typedef tnlStaticVector< MeshType::Dimensions, Real > Vertex; template< typename TimeFunction > static bool setAnalyticSpaceFunction (const tnlParameterContainer& parameters); static bool setTimeFunction (const tnlParameterContainer& parameters); static bool run( const tnlParameterContainer& parameters ); }; #include "heatEquationSetter_impl.h" #endif /* HEATEQUATIONSETTER_H_ */ examples/heat-equation/heatEquationSetter_impl.hdeleted 100644 → 0 +0 −83 Original line number Diff line number Diff line /*************************************************************************** simpleProblemSetter_impl.h - description ------------------- begin : Mar 10, 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 HEATEQUATIONSETTER_IMPL_H_ #define HEATEQUATIONSETTER_IMPL_H_ #include "heatEquationSetter.h" #include "heatEquationSolver.h" #include <functions/tnlTestFunction.h> #include <operators/diffusion/tnlLinearDiffusion.h> #include <operators/tnlDirichletBoundaryConditions.h> #include "tnlRightHandSide.h" template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > template< typename TimeFunction > bool heatEquationSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter > ::setAnalyticSpaceFunction (const tnlParameterContainer& parameters) { typedef tnlLinearDiffusion< MeshType, Real, Index > Diffusion; typedef tnlTestFunction< MeshType::Dimensions, Real, Device > RightHandSide; typedef tnlStaticVector < MeshType::Dimensions, Real > Vertex; typedef tnlConstantFunction< MeshType::Dimensions, Real > BCFunction; typedef tnlDirichletBoundaryConditions< MeshType, BCFunction, Real, Index > BoundaryConditions; typedef heatEquationSolver< MeshType, Diffusion, BoundaryConditions, RightHandSide > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); } template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > bool heatEquationSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter > ::setTimeFunction (const tnlParameterContainer& parameters) { const tnlString& timeFunctionParameter = parameters.GetParameter<tnlString>("test-function-time-dependence"); if (timeFunctionParameter == "none") return setAnalyticSpaceFunction< TimeIndependent >(parameters); if (timeFunctionParameter == "linear") return setAnalyticSpaceFunction< Linear >(parameters); if (timeFunctionParameter == "quadratic") return setAnalyticSpaceFunction< Quadratic >(parameters); if (timeFunctionParameter == "cosine") return setAnalyticSpaceFunction< Cosinus >(parameters); cerr<<"Unknown time-function parameter: "<<timeFunctionParameter<<". "; return 0; } template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > bool heatEquationSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter >::run( const tnlParameterContainer& parameters ) { return setTimeFunction(parameters); } #endif /* HEATEQUATIONSETTER_IMPL_H_ */ examples/heat-equation/tnl-heat-equation.cpp +33 −1 Original line number Diff line number Diff line Loading @@ -15,10 +15,13 @@ * * ***************************************************************************/ #include "heatEquationSetter.h" #include <solvers/tnlSolver.h> #include <solvers/tnlFastBuildConfig.h> #include <solvers/tnlConfigTags.h> #include <operators/diffusion/tnlLinearDiffusion.h> #include <operators/tnlDirichletBoundaryConditions.h> #include <functions/tnlConstantFunction.h> #include "heatEquationSolver.h" //typedef tnlDefaultConfigTag BuildConfig; typedef tnlFastBuildConfig BuildConfig; Loading @@ -34,6 +37,35 @@ class heatEquationConfig } }; template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class heatEquationSetter { public: typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; typedef tnlStaticVector< MeshType::Dimensions, Real > Vertex; static bool run( const tnlParameterContainer& parameters ) { enum { Dimensions = MeshType::Dimensions }; typedef tnlLinearDiffusion< MeshType, Real, Index > ApproximateOperator; typedef tnlConstantFunction< Dimensions, Real > RightHandSide; typedef tnlStaticVector < MeshType::Dimensions, Real > Vertex; typedef tnlDirichletBoundaryConditions< MeshType, RightHandSide, Real, Index > BoundaryConditions; typedef heatEquationSolver< MeshType, ApproximateOperator, BoundaryConditions, RightHandSide > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); }; }; int main( int argc, char* argv[] ) { tnlSolver< heatEquationSetter, heatEquationConfig, BuildConfig > solver; Loading Loading
examples/heat-equation/CMakeLists.txt +15 −15 Original line number Diff line number Diff line Loading @@ -2,27 +2,27 @@ set( tnl_heat_equation_SOURCES tnlHeatEquationEocRhs.h tnlRightHandSide_impl.h tnlRightHandSide.h tnlAnalyticSolution_impl.h tnlAnalyticSolution.h tnl-heat-equation.cpp tnl-heat-equation-eoc.cpp heatEquationSolver_impl.h heatEquationSolver.h heatEquationSetter_impl.h heatEquationSetter.h heatEquationEocRhs.h ) heatEquationScheme_impl.h heatEquationScheme.h tnlHeatEquationEocRhs.h ) #ADD_EXECUTABLE(tnl-heat-equation${debugExt} tnl-heat-equation.cpp) #target_link_libraries (tnl-heat-equation${debugExt} tnl${debugExt}-${tnlVersion} ) ADD_EXECUTABLE(tnl-heat-equation${debugExt} tnl-heat-equation.cpp) target_link_libraries (tnl-heat-equation${debugExt} tnl${debugExt}-${tnlVersion} ) ADD_EXECUTABLE(tnl-heat-equation-eoc-test${debugExt} tnl-heat-equation-eoc.cpp) target_link_libraries (tnl-heat-equation-eoc-test${debugExt} tnl${debugExt}-${tnlVersion} ) INSTALL( TARGETS #tnl-heat-equation${debugExt} INSTALL( TARGETS tnl-heat-equation${debugExt} tnl-heat-equation-eoc-test${debugExt} RUNTIME DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) INSTALL( FILES tnl-run-heat-equation-eoc-test INSTALL( FILES ${tnl_heat_equation_SOURCES} Makefile tnl-run-heat-equation-eoc-test tnl-run-heat-equation DESTINATION share/tnl-${tnlVersion}/examples/heat-equation )
examples/heat-equation/Makefile +5 −7 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ TNL_VERSION=0.1 TNL_INSTALL_DIR=${HOME}/local/lib TNL_INCLUDE_DIR=${HOME}/local/include/tnl-${TNL_VERSION} TARGET = heat-equation TARGET = tnl-heat-equation CONFIG_FILE = $(TARGET).cfg.desc INSTALL_DIR = ${HOME}/local CXX = g++ Loading @@ -11,9 +11,10 @@ OMP_FLAGS = -DHAVE_OPENMP -fopenmp CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) -O3 $(OMP_FLAGS) LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 -lgomp SOURCES = main.cpp SOURCES = tnl-heat-equation.cpp CUDA_SOURCES = tnl-heat-equation.cu HEADERS = OBJECTS = main.o OBJECTS = tnl-heat-equation.o DIST = $(SOURCES) Makefile all: $(TARGET) Loading @@ -32,12 +33,9 @@ uninstall: $(TARGET) rm -f $(INSTALL_DIR)/bin/$(TARGET) rm -f $(CONFIG_FILE) $(INSTALL_DIR)/share/tnl-0.1/examples/heat-equation $(TARGET): $(TARGET)-conf.h $(OBJECTS) $(TARGET): $(OBJECTS) $(CXX) -o $(TARGET) $(OBJECTS) $(LD_FLAGS) %.o: %.cpp $(HEADERS) $(CXX) -c -o $@ $(CXX_FLAGS) $< $(TARGET)-conf.h: echo "#define CONFIG_FILE \"${INSTALL_DIR}/share/tnl-0.1/examples/heat-equation/${CONFIG_FILE}\" " > $(TARGET)-conf.h
examples/heat-equation/heatEquationSetter.hdeleted 100644 → 0 +0 −67 Original line number Diff line number Diff line /*************************************************************************** simpleProblemSetter.h - description ------------------- begin : Feb 23, 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 SIMPLEPROBLEMTYPESSETTER_H_ #define SIMPLEPROBLEMTYPESSETTER_H_ #include <config/tnlParameterContainer.h> #include <mesh/tnlGrid.h> #include "heatEquationSolver.h" #include <functions/tnlSinWaveFunction.h> #include <functions/tnlExpBumpFunction.h> #include <functions/tnlSinBumpsFunction.h> #include "tnlTimeFunction.h" #include <operators/tnlDirichletBoundaryConditions.h> #include <operators/diffusion/tnlLinearDiffusion.h> #include <operators/tnlNeumannBoundaryConditions.h> #include "tnlZeroRightHandSide.h" #include "tnlRightHandSide.h" template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class heatEquationSetter { public: typedef TimeFunction< MeshType, TimeFunctionBase::TimeIndependent, Real, Index > TimeIndependent; typedef TimeFunction< MeshType, TimeFunctionBase::Linear, Real, Index > Linear; typedef TimeFunction< MeshType, TimeFunctionBase::Quadratic, Real, Index > Quadratic; typedef TimeFunction< MeshType, TimeFunctionBase::Cosinus, Real, Index > Cosinus; //typedef typename MeshType::RealType RealType; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; typedef tnlStaticVector< MeshType::Dimensions, Real > Vertex; template< typename TimeFunction > static bool setAnalyticSpaceFunction (const tnlParameterContainer& parameters); static bool setTimeFunction (const tnlParameterContainer& parameters); static bool run( const tnlParameterContainer& parameters ); }; #include "heatEquationSetter_impl.h" #endif /* HEATEQUATIONSETTER_H_ */
examples/heat-equation/heatEquationSetter_impl.hdeleted 100644 → 0 +0 −83 Original line number Diff line number Diff line /*************************************************************************** simpleProblemSetter_impl.h - description ------------------- begin : Mar 10, 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 HEATEQUATIONSETTER_IMPL_H_ #define HEATEQUATIONSETTER_IMPL_H_ #include "heatEquationSetter.h" #include "heatEquationSolver.h" #include <functions/tnlTestFunction.h> #include <operators/diffusion/tnlLinearDiffusion.h> #include <operators/tnlDirichletBoundaryConditions.h> #include "tnlRightHandSide.h" template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > template< typename TimeFunction > bool heatEquationSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter > ::setAnalyticSpaceFunction (const tnlParameterContainer& parameters) { typedef tnlLinearDiffusion< MeshType, Real, Index > Diffusion; typedef tnlTestFunction< MeshType::Dimensions, Real, Device > RightHandSide; typedef tnlStaticVector < MeshType::Dimensions, Real > Vertex; typedef tnlConstantFunction< MeshType::Dimensions, Real > BCFunction; typedef tnlDirichletBoundaryConditions< MeshType, BCFunction, Real, Index > BoundaryConditions; typedef heatEquationSolver< MeshType, Diffusion, BoundaryConditions, RightHandSide > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); } template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > bool heatEquationSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter > ::setTimeFunction (const tnlParameterContainer& parameters) { const tnlString& timeFunctionParameter = parameters.GetParameter<tnlString>("test-function-time-dependence"); if (timeFunctionParameter == "none") return setAnalyticSpaceFunction< TimeIndependent >(parameters); if (timeFunctionParameter == "linear") return setAnalyticSpaceFunction< Linear >(parameters); if (timeFunctionParameter == "quadratic") return setAnalyticSpaceFunction< Quadratic >(parameters); if (timeFunctionParameter == "cosine") return setAnalyticSpaceFunction< Cosinus >(parameters); cerr<<"Unknown time-function parameter: "<<timeFunctionParameter<<". "; return 0; } template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > bool heatEquationSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter >::run( const tnlParameterContainer& parameters ) { return setTimeFunction(parameters); } #endif /* HEATEQUATIONSETTER_IMPL_H_ */
examples/heat-equation/tnl-heat-equation.cpp +33 −1 Original line number Diff line number Diff line Loading @@ -15,10 +15,13 @@ * * ***************************************************************************/ #include "heatEquationSetter.h" #include <solvers/tnlSolver.h> #include <solvers/tnlFastBuildConfig.h> #include <solvers/tnlConfigTags.h> #include <operators/diffusion/tnlLinearDiffusion.h> #include <operators/tnlDirichletBoundaryConditions.h> #include <functions/tnlConstantFunction.h> #include "heatEquationSolver.h" //typedef tnlDefaultConfigTag BuildConfig; typedef tnlFastBuildConfig BuildConfig; Loading @@ -34,6 +37,35 @@ class heatEquationConfig } }; template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class heatEquationSetter { public: typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; typedef tnlStaticVector< MeshType::Dimensions, Real > Vertex; static bool run( const tnlParameterContainer& parameters ) { enum { Dimensions = MeshType::Dimensions }; typedef tnlLinearDiffusion< MeshType, Real, Index > ApproximateOperator; typedef tnlConstantFunction< Dimensions, Real > RightHandSide; typedef tnlStaticVector < MeshType::Dimensions, Real > Vertex; typedef tnlDirichletBoundaryConditions< MeshType, RightHandSide, Real, Index > BoundaryConditions; typedef heatEquationSolver< MeshType, ApproximateOperator, BoundaryConditions, RightHandSide > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); }; }; int main( int argc, char* argv[] ) { tnlSolver< heatEquationSetter, heatEquationConfig, BuildConfig > solver; Loading