diff --git a/src/pe/cr/HCSITS.h b/src/pe/cr/HCSITS.h index 0af5c6fa9591d4a514addac2dc62c37fb5ab9138..d5fc5075f72016fac8f9131fd702b9d0bf7cdc1a 100644 --- a/src/pe/cr/HCSITS.h +++ b/src/pe/cr/HCSITS.h @@ -135,6 +135,10 @@ public: virtual inline size_t getNumberOfContactsTreated() const WALBERLA_OVERRIDE; inline const std::map<IBlockID::IDType, ContactCache> getContactCache() const { return blockToContactCache_; } inline real_t getSpeedLimitFactor() const; + inline size_t getMaxIterations() const { return maxIterations_; } + inline real_t getRelaxationParameter() const { return relaxationParam_; } + inline real_t getErrorReductionParameter() const { return erp_; } + inline RelaxationModel getRelaxationModel() const { return relaxationModel_; } //@} //********************************************************************************************** diff --git a/tests/pe/CMakeLists.txt b/tests/pe/CMakeLists.txt index feb9e032e06183838899087bd2721f0fcf4be27c..1427603f3758a076ba0f79507e38bf56e1a339b1 100644 --- a/tests/pe/CMakeLists.txt +++ b/tests/pe/CMakeLists.txt @@ -42,6 +42,9 @@ waLBerla_execute_test( NAME PE_HASHGRIDS_DBG COMMAND $<TARGET_FILE:PE_HASHGRID waLBerla_compile_test( NAME PE_HCSITS FILES HCSITS.cpp DEPENDS core blockforest ) waLBerla_execute_test( NAME PE_HCSITS ) +waLBerla_compile_test( NAME PE_LOADFROMCONFIG FILES LoadFromConfig.cpp DEPENDS core blockforest ) +waLBerla_execute_test( NAME PE_LOADFROMCONFIG COMMAND $<TARGET_FILE:PE_LOADFROMCONFIG> ${CMAKE_CURRENT_SOURCE_DIR}/LoadFromConfig.cfg ) + waLBerla_compile_test( NAME PE_MARSHALLING FILES Marshalling.cpp DEPENDS core ) waLBerla_execute_test( NAME PE_MARSHALLING ) diff --git a/tests/pe/LoadFromConfig.cfg b/tests/pe/LoadFromConfig.cfg new file mode 100644 index 0000000000000000000000000000000000000000..d6e28430bab28de26b292ce2f459f3cae50d3c60 --- /dev/null +++ b/tests/pe/LoadFromConfig.cfg @@ -0,0 +1,18 @@ + +LoadFromConfig +{ + setupRun 0; + path .; + + simulationCorner < -15, -15, 0 >; + simulationDomain < 12, 23, 34 >; + blocks < 3, 4, 5 >; + isPeriodic < 0, 1, 0 >; + + HCSITSmaxIterations 123; + HCSITSRelaxationParameter 0.123; + HCSITSErrorReductionParameter 0.123; + HCSITSRelaxationModelStr ApproximateInelasticCoulombContactByDecoupling; + globalLinearAcceleration < 1, -2, 3 >; + +} diff --git a/tests/pe/LoadFromConfig.cpp b/tests/pe/LoadFromConfig.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7b8fdae29a7d2e02158b51e7899b99e5607b3af1 --- /dev/null +++ b/tests/pe/LoadFromConfig.cpp @@ -0,0 +1,66 @@ +//====================================================================================================================== +// +// 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 LoadFromConfig.cpp +//! \author Sebastian Eibl <sebastian.eibl@fau.de> +// +//====================================================================================================================== + + +#include "blockforest/all.h" +#include "core/all.h" +#include "domain_decomposition/all.h" + +#include "pe/basic.h" +#include "pe/utility/CreateWorld.h" + +#include "core/debug/TestSubsystem.h" + +#include <boost/tuple/tuple.hpp> + +using namespace walberla; +using namespace walberla::pe; + +int main( int argc, char ** argv ) +{ + walberla::debug::enterTestMode(); + + Environment env(argc, argv); + const Config::BlockHandle configBlock = env.config()->getBlock( "LoadFromConfig" ); + + shared_ptr<BodyStorage> globalBodyStorage = make_shared<BodyStorage>(); + + // create blocks + shared_ptr<BlockForest> forest = createBlockForestFromConfig( configBlock ); + WALBERLA_CHECK_EQUAL( forest->getXSize(), 3 ); + WALBERLA_CHECK_EQUAL( forest->getYSize(), 4 ); + WALBERLA_CHECK_EQUAL( forest->getZSize(), 5 ); + WALBERLA_CHECK( !forest->isXPeriodic() ); + WALBERLA_CHECK( forest->isYPeriodic() ); + WALBERLA_CHECK( !forest->isZPeriodic() ); + WALBERLA_CHECK_FLOAT_EQUAL( forest->getDomain().minCorner(), Vec3(-15, -15, 0) ); + WALBERLA_CHECK_FLOAT_EQUAL( forest->getDomain().maxCorner(), Vec3(-3, 8, 34) ); + + BlockDataID blockDataID; + cr::HCSITS hcsits( globalBodyStorage, forest, blockDataID, blockDataID, blockDataID); + configure(configBlock, hcsits); + WALBERLA_CHECK_EQUAL( hcsits.getRelaxationModel(), cr::HCSITS::RelaxationModel::ApproximateInelasticCoulombContactByDecoupling ); + WALBERLA_CHECK_EQUAL( hcsits.getMaxIterations(), 123 ); + WALBERLA_CHECK_FLOAT_EQUAL( hcsits.getRelaxationParameter(), real_t(0.123) ); + WALBERLA_CHECK_FLOAT_EQUAL( hcsits.getErrorReductionParameter(), real_t(0.123) ); + WALBERLA_CHECK_FLOAT_EQUAL( hcsits.getGlobalLinearAcceleration(), Vec3(1,-2,3) ); + + return EXIT_SUCCESS; +}