Commit 7638eceb authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Merge branch 'hamilton-jacobi' into 'develop'

Hamilton jacobi

See merge request !12
parents a13675de e7217db4
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
set( tnl_narrow_band_SOURCES
#     MainBuildConfig.h
#     tnlNarrowBand2D_impl.h
#     tnlNarrowBand.h
#     narrowBandConfig.h 
     main.cpp)


IF(  BUILD_CUDA ) 
	CUDA_ADD_EXECUTABLE(narrow-band main.cu)
ELSE(  BUILD_CUDA )                
	ADD_EXECUTABLE(narrow-band main.cpp)
ENDIF( BUILD_CUDA )
target_link_libraries (narrow-band tnl )


INSTALL( TARGETS narrow-band
         RUNTIME DESTINATION bin
         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
        
#INSTALL( FILES ${tnl_narrow_band_SOURCES}
#         DESTINATION ${TNL_TARGET_DATA_DIRECTORY}/examples/narrow-band )
+0 −64
Original line number Diff line number Diff line
/***************************************************************************
                          MainBuildConfig.h  -  description
                             -------------------
    begin                : Jul 7, 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 MAINBUILDCONFIG_H_
#define MAINBUILDCONFIG_H_

#include <solvers/tnlBuildConfigTags.h>

class MainBuildConfig
{
   public:

      static void print() {std::cerr << "MainBuildConfig" <<std::endl; }
};

/****
 * Turn off support for float and long double.
 */
template<> struct tnlConfigTagReal< MainBuildConfig, float > { enum { enabled = false }; };
template<> struct tnlConfigTagReal< MainBuildConfig, long double > { enum { enabled = false }; };

/****
 * Turn off support for short int and long int indexing.
 */
template<> struct tnlConfigTagIndex< MainBuildConfig, short int >{ enum { enabled = false }; };
template<> struct tnlConfigTagIndex< MainBuildConfig, long int >{ enum { enabled = false }; };

/****
 * Use of tnlGrid is enabled for allowed dimensions and Real, Device and Index types.
 */
template< int Dimensions, typename Real, typename Device, typename Index >
   struct tnlConfigTagMesh< MainBuildConfig, tnlGrid< Dimensions, Real, Device, Index > >
      { enum { enabled = tnlConfigTagDimensions< MainBuildConfig, Dimensions >::enabled  &&
                         tnlConfigTagReal< MainBuildConfig, Real >::enabled &&
                         tnlConfigTagDevice< MainBuildConfig, Device >::enabled &&
                         tnlConfigTagIndex< MainBuildConfig, Index >::enabled }; };

/****
 * Please, chose your preferred time discretisation  here.
 */
template<> struct tnlConfigTagTimeDiscretisation< MainBuildConfig, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; };
template<> struct tnlConfigTagTimeDiscretisation< MainBuildConfig, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = false}; };
template<> struct tnlConfigTagTimeDiscretisation< MainBuildConfig, tnlImplicitTimeDiscretisationTag >{ enum { enabled = false }; };

/****
 * Only the Runge-Kutta-Merson solver is enabled by default.
 */
template<> struct tnlConfigTagExplicitSolver< MainBuildConfig, tnlExplicitEulerSolverTag >{ enum { enabled = false }; };

#endif /* MAINBUILDCONFIG_H_ */

src/Examples/narrow-band/main.cpp

deleted100644 → 0
+0 −17
Original line number Diff line number Diff line
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : Oct 15 , 2015
    copyright            : (C) 2015 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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "main.h"

src/Examples/narrow-band/main.cu

deleted100644 → 0
+0 −17
Original line number Diff line number Diff line
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : Oct 15 , 2015
    copyright            : (C) 2015 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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "main.h"

src/Examples/narrow-band/main.h

deleted100644 → 0
+0 −88
Original line number Diff line number Diff line
/***************************************************************************
                          main.h  -  description
                             -------------------
    begin                : Oct 15 , 2015
    copyright            : (C) 2015 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.                                   *
 *                                                                         *
 ***************************************************************************/


#include "MainBuildConfig.h"
	//for HOST versions:
//#include "tnlNarrowBand.h"
	//for DEVICE versions:
#include "tnlNarrowBand_CUDA.h"
#include "narrowBandConfig.h"
#include <solvers/tnlBuildConfigTags.h>

#include <mesh/tnlGrid.h>
#include <core/tnlDevice.h>
#include <time.h>
#include <ctime>

typedef MainBuildConfig BuildConfig;

int main( int argc, char* argv[] )
{
	time_t start;
	time_t stop;
	time(&start);
	std::clock_t start2= std::clock();
   Config::ParameterContainer parameters;
   tnlConfigDescription configDescription;
   narrowBandConfig< BuildConfig >::configSetup( configDescription );

   if( ! parseCommandLine( argc, argv, configDescription, parameters ) )
      return false;

   const int& dim = parameters.getParameter< int >( "dim" );

   if(dim == 2)
   {
		tnlNarrowBand<tnlGrid<2,double,TNL::Devices::Host, int>, double, int> solver;
		if(!solver.init(parameters))
	   {
			cerr << "Solver failed to initialize." <<std::endl;
			return EXIT_FAILURE;
	   }
		TNL_CHECK_CUDA_DEVICE;
	  std::cout << "-------------------------------------------------------------" <<std::endl;
	  std::cout << "Starting solver..." <<std::endl;
	   solver.run();
   }
//   else if(dim == 3)
//   {
//		tnlNarrowBand<tnlGrid<3,double,TNL::Devices::Host, int>, double, int> solver;
//		if(!solver.init(parameters))
//	   {
//			cerr << "Solver failed to initialize." <<std::endl;
//			return EXIT_FAILURE;
//	   }
//		TNL_CHECK_CUDA_DEVICE;
//	  std::cout << "-------------------------------------------------------------" <<std::endl;
//	  std::cout << "Starting solver..." <<std::endl;
//	   solver.run();
//   }
   else
   {
	  std::cerr << "Unsupported number of dimensions: " << dim << "!" <<std::endl;
	   return EXIT_FAILURE;
   }


   time(&stop);
  std::cout << "Solver stopped..." <<std::endl;
  std::cout <<std::endl;
  std::cout << "Running time was: " << difftime(stop,start) << " .... " << (std::clock() - start2) / (double)(CLOCKS_PER_SEC) <<std::endl;
   return EXIT_SUCCESS;
}

Loading