Commit 47c60d32 authored by Markus Holzer's avatar Markus Holzer
Browse files

Merge master into branch

parents 033ef4fb 09281516
......@@ -222,8 +222,8 @@ struct leastUnsignedInteger
};
/// \cond internal
static const uint_t UINT_BITS = static_cast< uint_t >( std::numeric_limits< uint_t >::digits );
static const uint_t UINT_BYTES = static_cast< uint_t >( std::numeric_limits< uint_t >::digits ) >> 3;
static constexpr uint_t UINT_BITS = static_cast< uint_t >( std::numeric_limits< uint_t >::digits );
static constexpr uint_t UINT_BYTES = static_cast< uint_t >( std::numeric_limits< uint_t >::digits ) >> 3;
static_assert( !(UINT_BITS & (UINT_BITS - 1)), "Type \"uint_t\" must consist of 2^x Bits!" ); // power of two
......@@ -231,18 +231,17 @@ template< int N >
struct int_ld
{
static_assert( N >= 1 && !(N & (N - 1)), "Calculating log_2(N) -> \"N\" must be a power of two!" );
static const uint_t exp = 1 + int_ld< (N >> 1) >::exp;
static constexpr uint_t exp = 1 + int_ld< (N >> 1) >::exp;
static_assert( exp > 0 );
};
template< int N > const uint_t int_ld<N>::exp;
template<>
struct int_ld<1>
{
static const uint_t exp = 0;
static constexpr uint_t exp = 0;
};
static const uint_t UINT_BITS_LD = int_ld< std::numeric_limits< uint_t >::digits >::exp;
static constexpr uint_t UINT_BITS_LD = int_ld< std::numeric_limits< uint_t >::digits >::exp;
/// \endcond
} // namespace math
......
......@@ -143,13 +143,6 @@ void sendContainer( GenericSendBuffer<T,G> & buf, const Cont & container )
}
#ifdef WALBERLA_CXX_COMPILER_IS_GNU
#if __GNUC__ == 4 && __GNUC_MINOR__ == 9 || __GNUC__ == 6
#pragma GCC push_options
#pragma GCC optimize(2)
#endif
#endif
template< typename T, // Element type of RecvBuffer
typename Cont> // Container
void recvContainer( GenericRecvBuffer<T> & buf, Cont & container )
......@@ -162,12 +155,6 @@ void recvContainer( GenericRecvBuffer<T> & buf, Cont & container )
buf >> *it;
}
#ifdef WALBERLA_CXX_COMPILER_IS_GNU
#if __GNUC__ == 4 && __GNUC_MINOR__ == 9 || __GNUC__ == 6
#pragma GCC pop_options
#endif
#endif
template< typename T, // Element type of SendBuffer
......
......@@ -318,6 +318,12 @@ namespace field {
{
#ifdef __BIGGEST_ALIGNMENT__
const uint_t alignment = __BIGGEST_ALIGNMENT__;
#elif defined(__AVX512F__)
const uint_t alignment = 64;
#elif defined(__AVX__)
const uint_t alignment = 32;
#elif defined(__SSE__) || defined(_MSC_VER)
const uint_t alignment = 16;
#else
const uint_t alignment = 64;
#endif
......
......@@ -149,7 +149,7 @@
#ifdef _OPENMP
#ifdef WALBERLA_CXX_COMPILER_IS_MSVC
#if (defined(_MSC_VER) && _MSC_VER < 1926)
#define WALBERLA_FOR_ALL_CELLS_XYZ_OMP( field, omp, CODE ) \
{ WALBERLA_ASSERT_NOT_NULLPTR_1( (field) ); \
......@@ -875,7 +875,7 @@
} \
} }
#else // == not WALBERLA_CXX_COMPILER_IS_MSVC
#else // == MSVC >= 2019 16.6 or not MSVC
#define WALBERLA_FOR_ALL_CELLS_XYZ_OMP( field, omp, CODE ) \
{ WALBERLA_ASSERT_NOT_NULLPTR_1( (field) ); \
......
......@@ -27,9 +27,7 @@
# pragma warning( disable : 4706 )
#elif ( defined WALBERLA_CXX_COMPILER_IS_GNU ) || ( defined WALBERLA_CXX_COMPILER_IS_CLANG )
# pragma GCC diagnostic push
# if !( ( __clang_major__ == 3 ) && ( __clang_minor__ <= 4 ) )
# pragma GCC diagnostic ignored "-Wpragmas"
# endif
# pragma GCC diagnostic ignored "-Wpragmas"
# pragma GCC diagnostic ignored "-Wsign-conversion"
# pragma GCC diagnostic ignored "-Wconversion"
# pragma GCC diagnostic ignored "-Wshorten-64-to-32"
......
......@@ -20,22 +20,34 @@
#pragma once
#include <core/mpi/MPIManager.h>
#include <mesa_pd/domain/IDomain.h>
namespace walberla {
namespace mesa_pd {
namespace domain {
/**
* Every process assumes the whole simulation space belongs to its subdomain.
*/
class InfiniteDomain : public IDomain
{
public:
bool isContainedInProcessSubdomain(const uint_t /*rank*/, const Vec3& /*pt*/) const override {return true;}
int findContainingProcessRank(const Vec3& /*pt*/) const override {return walberla::mpi::MPIManager::instance()->rank();}
///Everything belongs to the calling process.
bool isContainedInProcessSubdomain(const uint_t rank, const Vec3& /*pt*/) const override {return rank==rank_;}
///Everything belongs to the calling process.
int findContainingProcessRank(const Vec3& /*pt*/) const override {return static_cast<int>(rank_);}
///Nothing to do here since domain is infinite.
void periodicallyMapToDomain(Vec3& /*pt*/) const override {}
///If I own everything I do not have neighbors.
std::vector<uint_t> getNeighborProcesses() const override {return {};}
///Everything belongs to my subdomain.
bool intersectsWithProcessSubdomain(const uint_t rank, const Vec3& /*pt*/, const real_t& /*radius*/) const override
{ return int_c(rank)==walberla::mpi::MPIManager::instance()->rank() ? true : false;}
{ return rank==rank_;}
///Nothing to do here.
void correctParticlePosition(Vec3& /*pt*/) const override {}
private:
const uint_t rank_ = static_cast<uint_t>(MPIManager::instance()->rank());
};
} //namespace domain
......
......@@ -28,23 +28,6 @@
#ifdef WALBERLA_BUILD_WITH_PYTHON // macro defined in waLBerlaDefinitions.h
#ifdef _MSC_VER
#pragma warning ( push, 3 )
#pragma warning ( disable: 4244 4275 4800 4251 4267 )
#ifndef HAVE_ROUND
#define HAVE_ROUND 1
#define __CREATED_HAVE_ROUND
#endif
#endif
#include "pybind11/pybind11.h"
#ifdef _MSC_VER
#ifdef __CREATED_HAVE_ROUND
#undef HAVE_ROUND
#undef __CREATED_HAVE_ROUND
#endif
#pragma warning ( pop )
#endif
#endif
......@@ -127,7 +127,7 @@ namespace simd {
template<typename T> struct is_vector4_type { static const bool value = false; };
#if ( defined WALBERLA_CXX_COMPILER_IS_GNU ) && ( __GNUC__ >= 6 )
#ifdef WALBERLA_CXX_COMPILER_IS_GNU
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wignored-attributes"
#endif
......@@ -168,7 +168,7 @@ template<typename T> struct is_vector4_type { static const bool value = false;
#endif
#if ( defined WALBERLA_CXX_COMPILER_IS_GNU ) && ( __GNUC__ >= 6 )
#ifdef WALBERLA_CXX_COMPILER_IS_GNU
# pragma GCC diagnostic pop
#endif
......
......@@ -10,7 +10,6 @@
// core includes
#include "core/DataTypes.h"
#include "core/NonCreateable.h"
#include "core/cell/Cell.h"
#include "core/debug/Debug.h"
......
//======================================================================================================================
//
// 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
//! \author Sebastian Eibl <sebastian.eibl@fau.de>
//
//======================================================================================================================
#include "core/DataTypes.h"
#include "core/math/Angles.h"
#include "core/debug/TestSubsystem.h"
namespace walberla{
int main( int /*argc*/, char** /*argv*/ )
{
using namespace walberla::math;
debug::enterTestMode();
WALBERLA_CHECK_FLOAT_EQUAL( radToDeg(half_pi), 90_r );
WALBERLA_CHECK_FLOAT_EQUAL( half_pi, degToRad(90_r) );
return EXIT_SUCCESS;
}
} //namespace walberla
int main( int argc, char** argv )
{
return walberla::main(argc, argv);
}
......@@ -186,6 +186,9 @@ else()
endif()
waLBerla_execute_test( NAME AllHeaderTest )
waLBerla_compile_test( FILES Angles.test.cpp )
waLBerla_execute_test( NAME Angles )
waLBerla_compile_test( FILES ConcatIterator.cpp )
waLBerla_execute_test( NAME ConcatIterator )
......
......@@ -98,7 +98,7 @@ void rangeBasedTest()
auto dx = Vector3<real_t>( Grid::iterator::getUnitCellX(spacing), Grid::iterator::getUnitCellY(spacing), Grid::iterator::getUnitCellZ(spacing) );
auto lowerIt = typename Grid::iterator(domain, Vector3<real_t>(5,5,5) - dx * 30, spacing);
auto endIt = typename Grid::iterator();
for ( const auto& pt : Grid(domain, Vector3<real_t>(5,5,5) - dx * 30, spacing) )
for ( const auto pt : Grid(domain, Vector3<real_t>(5,5,5) - dx * 30, spacing) )
{
WALBERLA_CHECK( lowerIt != endIt );
WALBERLA_CHECK_FLOAT_EQUAL( *lowerIt, pt);
......
......@@ -59,7 +59,7 @@ void test( const std::string & filename, const Vector3<uint_t> & size, const std
CellInterval ci( 0, 0, 0, cell_idx_c( size[0] ) - 1, cell_idx_c( size[1] ) - 1, cell_idx_c( size[2] ) - 1 );
for (const Cell & c : ci)
for (const Cell c : ci)
{
field->get( c ) = brf.get( uint_c( c[0] ), uint_c( c[1] ), uint_c( c[2] ) );
}
......@@ -100,7 +100,7 @@ void testScaled( const std::string & filename, const Vector3<uint_t> & size, con
CellInterval ci( 0, 0, 0, cell_idx_c( scaledSize[0] ) - 1, cell_idx_c( scaledSize[1] ) - 1, cell_idx_c( scaledSize[2] ) - 1 );
for (const Cell & c : ci)
for (const Cell c : ci)
{
auto pos = blocks->getBlockLocalCellCenter( block, c );
field->get( c ) = brfi.get( pos );
......
......@@ -37,6 +37,9 @@ waLBerla_execute_test( NAME MESA_PD_COMMON_IntersectionRatio )
waLBerla_compile_test( NAME MESA_PD_ContactDetection FILES ContactDetection.cpp DEPENDS blockforest core pe)
waLBerla_execute_test( NAME MESA_PD_ContactDetection PROCESSES 8 )
waLBerla_compile_test( NAME MESA_PD_Data_ContactHistory FILES data/ContactHistory.cpp DEPENDS core )
waLBerla_execute_test( NAME MESA_PD_Data_ContactHistory )
waLBerla_compile_test( NAME MESA_PD_Data_Flags FILES data/Flags.cpp DEPENDS core )
waLBerla_execute_test( NAME MESA_PD_Data_Flags )
......@@ -66,6 +69,9 @@ waLBerla_execute_test( NAME MESA_PD_Domain_DistanceCalculation )
waLBerla_compile_test( NAME MESA_PD_Domain_DynamicRefinement FILES domain/DynamicRefinement.cpp DEPENDS blockforest core pe )
waLBerla_execute_test( NAME MESA_PD_Domain_DynamicRefinement PROCESSES 8)
waLBerla_compile_test( NAME MESA_PD_Domain_InfiniteDomain FILES domain/InfiniteDomain.cpp DEPENDS core )
waLBerla_execute_test( NAME MESA_PD_Domain_InfiniteDomain )
waLBerla_compile_test( NAME MESA_PD_Domain_SerializeDeserialize FILES domain/SerializeDeserialize.cpp DEPENDS blockforest core pe)
waLBerla_execute_test( NAME MESA_PD_Domain_SerializeDeserialize PROCESSES 8 )
......
//======================================================================================================================
//
// 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 ContactHistory.cpp
//! \author Sebastian Eibl <sebastian.eibl@fau.de>
//
//======================================================================================================================
#include <mesa_pd/data/ContactHistory.h>
#include <core/Environment.h>
#include <core/logging/Logging.h>
#include <algorithm>
#include <iostream>
namespace walberla {
using namespace walberla::mesa_pd;
void basic_test()
{
//init data structures
data::ContactHistory cs;
cs.setImpactVelocityMagnitude(1.23456_r);
cs.setIsSticking(true);
cs.setTangentialSpringDisplacement(Vec3(1.23_r,2.345_r,3.56_r));
mpi::SendBuffer sb;
sb << cs;
mpi::RecvBuffer rb(sb);
data::ContactHistory cs_recv;
rb >> cs_recv;
WALBERLA_CHECK_IDENTICAL(cs.getImpactVelocityMagnitude(), cs_recv.getImpactVelocityMagnitude());
WALBERLA_CHECK_IDENTICAL(cs.getIsSticking(), cs_recv.getIsSticking());
WALBERLA_CHECK_IDENTICAL(cs.getTangentialSpringDisplacement(), cs_recv.getTangentialSpringDisplacement());
WALBERLA_LOG_DEVEL( cs );
}
int main( int argc, char ** argv )
{
Environment env(argc, argv);
WALBERLA_UNUSED(env);
mpi::MPIManager::instance()->useWorldComm();
basic_test();
return EXIT_SUCCESS;
}
} //namespace walberla
int main( int argc, char ** argv )
{
return walberla::main(argc, argv);
}
//======================================================================================================================
//
// 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 InfiniteDomain.cpp
//! \author Sebastian Eibl <sebastian.eibl@fau.de>
//
//======================================================================================================================
#include <mesa_pd/domain/InfiniteDomain.h>
#include <core/Environment.h>
#include <core/logging/Logging.h>
#include <iostream>
namespace walberla {
using namespace walberla::mesa_pd;
void main( int argc, char ** argv )
{
Environment env(argc, argv);
WALBERLA_UNUSED(env);
mpi::MPIManager::instance()->useWorldComm();
auto rank = mpi::MPIManager::instance()->rank();
auto randomPoint = Vec3(1.23_r,2.34_r,3.45_r);
domain::InfiniteDomain domain;
WALBERLA_CHECK(domain.isContainedInProcessSubdomain(static_cast<uint_t>(rank), randomPoint));
WALBERLA_CHECK(!domain.isContainedInProcessSubdomain(static_cast<uint_t>(rank + 1), randomPoint));
WALBERLA_CHECK_EQUAL(domain.findContainingProcessRank(randomPoint), rank);
auto pt = randomPoint;
domain.periodicallyMapToDomain(pt);
WALBERLA_CHECK_IDENTICAL(pt, randomPoint);
WALBERLA_CHECK_EQUAL(domain.getNeighborProcesses().size(), 0);
WALBERLA_CHECK(domain.intersectsWithProcessSubdomain(static_cast<uint_t>(rank), randomPoint, 1_r));
WALBERLA_CHECK(!domain.intersectsWithProcessSubdomain(static_cast<uint_t>(rank + 1), randomPoint, 1_r));
domain.correctParticlePosition(pt);
WALBERLA_CHECK_IDENTICAL(pt, randomPoint);
}
}
int main( int argc, char ** argv )
{
walberla::main(argc, argv);
return EXIT_SUCCESS;
}
......@@ -8,12 +8,8 @@
# builds the test
if ( CMAKE_COMPILER_IS_GNUCXX )
if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0" )
set( MarchNativeString "" )
else()
set( MarchNativeString "-march=native" )
endif()
if ( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_CLANG )
set( MarchNativeString "-march=native" )
endif()
waLBerla_compile_test( NAME AVX2_AVX_Equivalence FILES SIMD_Equivalence.cpp )
......
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