Commit 60ff7355 authored by Dominik Thoennes's avatar Dominik Thoennes
Browse files

move tests and tutorials into walberla namespace to avoid conflicts

parent 371eafa8
Pipeline #10557 passed with stage
in 111 minutes and 46 seconds
......@@ -31,7 +31,7 @@
#include <functional>
#include <memory>
using namespace walberla;
namespace walberla {
using namespace walberla::pe;
using namespace walberla::timing;
......@@ -248,3 +248,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
} // namespace walberla
int main( int argc, char* argv[] )
{
return walberla::main( argc, argv );
}
\ No newline at end of file
......@@ -24,7 +24,7 @@
#include "gui/Gui.h"
#include "timeloop/SweepTimeloop.h"
using namespace walberla;
namespace walberla {
Field<real_t, 1>* createFields(IBlock* const block, StructuredBlockStorage * const storage) {
return new Field<real_t,1>(storage->getNumberOfXCells(*block),
......@@ -53,3 +53,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
}
int main( int argc, char ** argv )
{
return walberla::main(argc, argv);
}
\ No newline at end of file
......@@ -27,7 +27,7 @@
#include <functional>
using namespace walberla;
namespace walberla {
// some arbitrary value for our bogus algorithm
const int ARBITRARY_VALUE = 424242;
......@@ -138,3 +138,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
} // namespace walberla
int main( int argc, char* argv[] )
{
return walberla::main( argc, argv );
}
\ No newline at end of file
......@@ -37,7 +37,7 @@
#include "timeloop/SweepTimeloop.h"
using namespace walberla;
namespace walberla {
class GameOfLifeSweep
......@@ -217,3 +217,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
} // namespace walberla
int main( int argc, char* argv[] )
{
return walberla::main( argc, argv );
}
\ No newline at end of file
......@@ -31,7 +31,7 @@
using namespace walberla;
namespace walberla {
typedef lbm::D2Q9< lbm::collision_model::SRT > LatticeModel_T;
typedef LatticeModel_T::Stencil Stencil_T;
......@@ -120,3 +120,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
}
int main( int argc, char ** argv )
{
walberla::main(argc, argv);
}
\ No newline at end of file
......@@ -30,7 +30,7 @@
using namespace walberla;
namespace walberla {
typedef lbm::D2Q9< lbm::collision_model::SRT, false, lbm::force_model::SimpleConstant > LatticeModel_T;
......@@ -641,3 +641,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
}
int main( int argc, char ** argv )
{
return walberla::main(argc, argv);
}
\ No newline at end of file
......@@ -57,8 +57,7 @@
// USING //
///////////
using namespace walberla;
using walberla::uint_t;
namespace walberla {
//////////////
// TYPEDEFS //
......@@ -416,3 +415,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
}
int main( int argc, char ** argv )
{
return walberla::main(argc, argv);
}
\ No newline at end of file
......@@ -36,7 +36,7 @@
#include <vector>
using namespace walberla;
namespace walberla {
typedef GhostLayerField<real_t,1> ScalarField;
typedef stencil::D2Q5 Stencil_T;
......@@ -296,3 +296,9 @@ int main( int argc, char ** argv )
return 0;
}
}
int main( int argc, char ** argv )
{
walberla::main(argc, argv);
}
......@@ -39,7 +39,7 @@
#include <cmath>
using namespace walberla;
namespace walberla {
typedef GhostLayerField<real_t,1> ScalarField;
......@@ -250,3 +250,9 @@ int main( int argc, char ** argv )
return 0;
}
}
int main( int argc, char ** argv )
{
walberla::main(argc, argv);
}
\ No newline at end of file
......@@ -40,7 +40,7 @@
#include <cmath>
using namespace walberla;
namespace walberla {
typedef GhostLayerField<real_t,1> ScalarField;
......@@ -347,3 +347,9 @@ int main( int argc, char ** argv )
return 0;
}
} // namespace walberla
int main( int argc, char* argv[] )
{
return walberla::main( argc, argv );
}
\ No newline at end of file
......@@ -27,7 +27,7 @@
#include <core/logging/Logging.h>
//! [Includes]
using namespace walberla;
namespace walberla {
using namespace walberla::pe;
//! [BodyTypeTuple]
......@@ -161,3 +161,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
} // namespace walberla
int main( int argc, char* argv[] )
{
return walberla::main( argc, argv );
}
\ No newline at end of file
......@@ -35,7 +35,7 @@
#include <functional>
using namespace walberla;
namespace walberla {
using namespace walberla::pe;
using namespace walberla::timing;
using namespace walberla::pe::raytracing;
......@@ -294,3 +294,9 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
} // namespace walberla
int main( int argc, char* argv[] )
{
return walberla::main( argc, argv );
}
\ No newline at end of file
......@@ -24,7 +24,7 @@
#include "core/logging/Logging.h"
#include "core/mpi/Environment.h"
using namespace walberla;
namespace walberla{
void TwoBlockForestsTest()
{
......@@ -75,3 +75,9 @@ int main( int argc, char** argv )
return EXIT_SUCCESS;
}
}
int main( int argc, char** argv )
{
return walberla::main(argc,argv);
}
\ No newline at end of file
......@@ -26,7 +26,7 @@
#include "core/debug/TestSubsystem.h"
using namespace walberla;
namespace walberla {
using namespace walberla::blockforest;
void blockForestSaveLoadTest(const BlockForest::FileIOMode ioMode, const bool broadcast)
......@@ -120,3 +120,10 @@ int main( int argc, char ** argv )
return EXIT_SUCCESS;
}
}
int main( int argc, char ** argv )
{
return walberla::main(argc,argv);
}
......@@ -40,7 +40,7 @@
#include <iostream>
using namespace walberla;
namespace walberla {
namespace wlb = walberla;
typedef GhostLayerField<real_t,19> PdfField;
......@@ -269,8 +269,14 @@ int main(int argc, char **argv)
timeLoop.run();
return EXIT_SUCCESS;
}
}
int main(int argc, char **argv) {
return walberla::main(argc, argv);
}
......@@ -30,7 +30,7 @@
#include <iostream>
#include <sstream>
using namespace walberla;
namespace walberla {
int getProcToReceiveFrom()
{
......@@ -208,3 +208,9 @@ int main( int argc, char ** argv )
return 0;
}
} // namespace walberla
int main( int argc, char* argv[] )
{
return walberla::main( argc, argv );
}
\ No newline at end of file
......@@ -36,45 +36,42 @@
#include "timeloop/SweepTimeloop.h"
using namespace walberla;
void dummySweep ( IBlock * block )
void dummySweep ( walberla::IBlock * block )
{
WALBERLA_LOG_DEVEL("DummySweep on block " << block );
}
int main( int argc, char ** argv )
{
debug::enterTestMode();
walberla::debug::enterTestMode();
walberla::Environment walberlaEnv( argc, argv );
// 9 processes and 8 blocks: one process does not have a block
WALBERLA_CHECK_EQUAL( MPIManager::instance()->numProcesses(), 9 );
WALBERLA_CHECK_EQUAL( walberla::MPIManager::instance()->numProcesses(), 9 );
using namespace blockforest;
using namespace walberla::blockforest;
SetupBlockForest sforest;
sforest.addWorkloadMemorySUIDAssignmentFunction( uniformWorkloadAndMemoryAssignment );
sforest.init( AABB(0,0,0, 2,2,2), 2, 2, 2, false, false, false );
sforest.init( walberla::AABB(0,0,0, 2,2,2), 2, 2, 2, false, false, false );
// calculate process distribution
const memory_t memoryLimit = 1;
GlobalLoadBalancing::MetisConfiguration< SetupBlock > metisConfig( false, false, uniformFacesDominantCommunication );
sforest.calculateProcessDistribution_Default( uint_c( MPIManager::instance()->numProcesses() ), memoryLimit, "hilbert", 10, false, metisConfig );
MPIManager::instance()->useWorldComm();
sforest.calculateProcessDistribution_Default( walberla::uint_c( walberla::MPIManager::instance()->numProcesses() ), memoryLimit, "hilbert", 10, false, metisConfig );
walberla::MPIManager::instance()->useWorldComm();
// create StructuredBlockForest (encapsulates a newly created BlockForest)
auto bf = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sforest, true ) );
auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, 10, 10, 10 ) );
auto bf = walberla::shared_ptr< BlockForest >( new BlockForest( walberla::uint_c( walberla::MPIManager::instance()->rank() ), sforest, true ) );
auto sbf = walberla::shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, 10, 10, 10 ) );
sbf->createCellBoundingBoxes();
SweepTimeloop tl( sbf, 1 );
tl.add() << Sweep( dummySweep, "DummySweep" );
walberla::SweepTimeloop tl( sbf, 1 );
tl.add() << walberla::Sweep( dummySweep, "DummySweep" );
WcTimingPool timingPool;
walberla::WcTimingPool timingPool;
tl.run( timingPool );
timingPool.logResultOnRoot();
......
......@@ -28,7 +28,7 @@
#include <iostream>
using namespace walberla;
namespace walberla {
using std::cout;
using std::endl;
......@@ -178,17 +178,18 @@ void merging()
pool1.merge( pool2, true );
WALBERLA_CHECK_EQUAL ( pool1["test"].getCounter(), 6 );
}
}// namespace walberla
int main( int argc, char ** argv )
{
debug::enterTestMode();
MPIManager::instance()->initializeMPI( &argc, &argv );
walberla::debug::enterTestMode();
walberla::MPIManager::instance()->initializeMPI( &argc, &argv );
simpleTiming();
scopedTimer();
reduction();
merging();
walberla::simpleTiming();
walberla::scopedTimer();
walberla::reduction();
walberla::merging();
return 0;
}
......
......@@ -27,24 +27,22 @@
#include <iostream>
using namespace walberla;
void mssleep(unsigned int ms)
{
timing::StaticPolicy::addTime( ms * 1e-3);
walberla::timing::StaticPolicy::addTime( ms * 1e-3);
}
int main( int argc, char ** argv )
{
debug::enterTestMode();
walberla::debug::enterTestMode();
mpi::Environment mpiEnv(argc, argv);
walberla::mpi::Environment mpiEnv(argc, argv);
WALBERLA_UNUSED( mpiEnv );
const unsigned int rank = static_cast<unsigned int> ( MPIManager::instance()->worldRank() );
const unsigned int rank = static_cast<unsigned int> ( walberla::MPIManager::instance()->worldRank() );
timing::TimingTree<timing::StaticPolicy> tt;
timing::StaticPolicy::setTime(0);
walberla::timing::TimingTree<walberla::timing::StaticPolicy> tt;
walberla::timing::StaticPolicy::setTime(0);
tt.start("A");
mssleep(100 * rank);
......@@ -76,9 +74,9 @@ int main( int argc, char ** argv )
WALBERLA_ASSERT(!tt.timerExists("A.AA.C"));
// check copy constructor
timing::TimingTree<timing::StaticPolicy> tt2(tt);
walberla::timing::TimingTree<walberla::timing::StaticPolicy> tt2(tt);
// check assignment operator
timing::TimingTree<timing::StaticPolicy> tt3;
walberla::timing::TimingTree<walberla::timing::StaticPolicy> tt3;
tt3 = tt;
WALBERLA_ASSERT(tt2.timerExists("A"));
......@@ -97,10 +95,10 @@ int main( int argc, char ** argv )
WALBERLA_ASSERT(!tt3.timerExists("AAC"));
WALBERLA_ASSERT(!tt3.timerExists("A.AA.C"));
tt2 = tt.getReduced( timing::REDUCE_TOTAL, 0 );
tt2 = tt.getReduced( timing::REDUCE_TOTAL, 1 );
tt2 = tt.getReduced( walberla::timing::REDUCE_TOTAL, 0 );
tt2 = tt.getReduced( walberla::timing::REDUCE_TOTAL, 1 );
tt2 = tt.getReduced( timing::REDUCE_MIN, -1 );
tt2 = tt.getReduced( walberla::timing::REDUCE_MIN, -1 );
{
const auto& data = tt2.getRawData();
WALBERLA_CHECK_FLOAT_EQUAL( data.tree_.at("A").timer_.total(), (1.8) );
......@@ -109,7 +107,7 @@ int main( int argc, char ** argv )
WALBERLA_CHECK_FLOAT_EQUAL( tt["A.AB.ABB"].total(), (0.100 * rank), "total time: " << tt["A.AB.ABB"].total() );
}
tt2 = tt.getReduced( timing::REDUCE_MAX, -1 );
tt2 = tt.getReduced( walberla::timing::REDUCE_MAX, -1 );
{
const auto& data = tt2.getRawData();
WALBERLA_CHECK_FLOAT_EQUAL( data.tree_.at("A").timer_.total(), (1.8) );
......@@ -118,7 +116,7 @@ int main( int argc, char ** argv )
WALBERLA_CHECK_FLOAT_EQUAL( tt["A.AB.ABB"].total(), (0.100 * rank), "total time: " << tt["A.AB.ABB"].total() );
}
tt2 = tt.getReduced( timing::REDUCE_AVG, -1 );
tt2 = tt.getReduced( walberla::timing::REDUCE_AVG, -1 );
{
const auto& data = tt2.getRawData();
WALBERLA_CHECK_FLOAT_EQUAL( data.tree_.at("A").timer_.total(), (1.8) );
......@@ -127,7 +125,7 @@ int main( int argc, char ** argv )
WALBERLA_CHECK_FLOAT_EQUAL( tt["A.AB.ABB"].total(), (0.100 * rank), "total time: " << tt["A.AB.ABB"].total() );
}
tt2 = tt.getReduced( timing::REDUCE_TOTAL, -1 );
tt2 = tt.getReduced( walberla::timing::REDUCE_TOTAL, -1 );
{
const auto& data = tt2.getRawData();
WALBERLA_CHECK_FLOAT_EQUAL( data.tree_.at("A").timer_.total(), (1.8) );
......
......@@ -31,7 +31,7 @@
#include "stencil/D3Q27.h"
using namespace walberla;
namespace walberla {
bool periodicCheck( StructuredBlockForest& forest, const math::AABB& box1, const math::AABB& box2)
{
......@@ -194,3 +194,9 @@ int main( int argc, char** argv )
return EXIT_SUCCESS;
}
} // namespace walberla
int main( int argc, char* argv[] )
{
return walberla::main( argc, argv );
}
\ No newline at end of file
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