Commit 1e90c598 authored by Martin Bauer's avatar Martin Bauer
Browse files

Initial commit

parents
CMAKE_MINIMUM_REQUIRED (VERSION 3.0)
PROJECT ( your_project_name )
enable_testing()
include_directories( src )
include_directories ( ${your_project_name_BINARY_DIR}/src )
# Extends cmake module path - so that FindwaLBerla.cmake in the current directory is found
set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${your_project_name_SOURCE_DIR} )
find_package( waLBerla )
add_subdirectory( src )
add_subdirectory( apps )
add_subdirectory( tests )
set( WALBERLA_DIR WALBERLA_DIR-NOTFOUND CACHE PATH "waLBerla path" )
if ( WALBERLA_DIR )
# WALBERLA_DIR has to point to the waLBerla source directory
# this command builds waLBerla (again) in the current build directory in the subfolder "walberla" (second argument)
add_subdirectory( ${WALBERLA_DIR} walberla )
waLBerla_import()
# Adds the 'src' and 'tests' directory of current app
list( APPEND WALBERLA_MODULE_DIRS "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/tests" )
list( REMOVE_DUPLICATES WALBERLA_MODULE_DIRS )
set ( WALBERLA_MODULE_DIRS ${WALBERLA_MODULE_DIRS} CACHE INTERNAL "All folders that contain modules or tests" )
else()
message( FATAL_ERROR "waLBerla not found - Use 'cmake -DWALBERLA_DIR=path_to_waLBerla_sources pathToApplicationSources' " )
endif()
waLBerla example application
============================
CMake Template on how to use waLBerla in your app
How to build
=============
mkdir build
cd build
cmake .. -DWALBERLA_DIR=path/to/walberla/sources
add_subdirectory( example_app )
waLBerla_link_files_to_builddir( *.prm *.py)
waLBerla_add_executable ( NAME ExampleApp
FILES ExampleApp.cpp
DEPENDS blockforest core field lbm geometry timeloop gui )
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla 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 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file 01_BlocksAndFields.cpp
//! \author Martin Bauer <martin.bauer@fau.de>
//
//======================================================================================================================
#include "blockforest/Initialization.h"
#include "core/Environment.h"
#include "field/Field.h"
#include "gui/Gui.h"
#include "timeloop/SweepTimeloop.h"
namespace walberla {
Field<real_t, 1>* createFields(IBlock* const block, StructuredBlockStorage * const storage) {
return new Field<real_t,1>(storage->getNumberOfXCells(*block),
storage->getNumberOfYCells(*block),
storage->getNumberOfZCells(*block),
real_c(0));
}
int main( int argc, char ** argv )
{
walberla::Environment env( argc, argv );
shared_ptr<StructuredBlockForest> blocks = blockforest::createUniformBlockGrid(
uint_c(3), uint_c(2), uint_c(4),
uint_c(10), uint_c(8), uint_c(12),
real_c(0.5),
false,
false, false, false);
blocks->addStructuredBlockData< Field<real_t,1> >( &createFields, "My Field" );
SweepTimeloop timeloop( blocks, uint_c(1) );
GUI gui( timeloop, blocks, argc, argv );
gui.run();
return EXIT_SUCCESS;
}
}
int main( int argc, char ** argv )
{
return walberla::main(argc, argv);
}
#add_subdirectory( name_of_your_module_subfolder )
#add_subdirectory( name_of_your_module_subfolder )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment